DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
dftfe::utils::MemoryStorage< ValueType, memorySpace > Class Template Reference

#include <MemoryStorage.h>

Public Types

typedef ValueType value_type
 A class template to provide an interface that can act similar to STL vectors but with different MemorySpace— HOST (cpu) , DEVICE (gpu), etc,.
 
typedef ValueType * pointer
 
typedef ValueType & reference
 
typedef const ValueType & const_reference
 
typedef ValueType * iterator
 
typedef const ValueType * const_iterator
 

Public Member Functions

 MemoryStorage ()=default
 
 MemoryStorage (const MemoryStorage &u)
 Copy constructor for a MemoryStorage.
 
 MemoryStorage (MemoryStorage &&u) noexcept
 Move constructor for a Vector.
 
 MemoryStorage (std::size_t size, ValueType initVal=0)
 Constructor for Vector with size and initial value arguments.
 
 ~MemoryStorage ()
 Destructor.
 
void clear ()
 clear and set to d_data to nullptr
 
void setValue (const ValueType val)
 Set all the entries to a given value.
 
iterator begin ()
 Return iterator pointing to the beginning of point data.
 
const_iterator begin () const
 Return iterator pointing to the beginning of Vector data.
 
iterator end ()
 Return iterator pointing to the end of Vector data.
 
const_iterator end () const
 Return iterator pointing to the end of Vector data.
 
MemoryStorageoperator= (const MemoryStorage &rhs)
 Copy assignment operator.
 
MemoryStorageoperator= (MemoryStorage &&rhs) noexcept
 Move assignment constructor.
 
reference operator[] (std::size_t i)
 Operator to get a reference to a element of the Vector.
 
const_reference operator[] (std::size_t i) const
 Operator to get a const reference to a element of the Vector.
 
void swap (MemoryStorage &rhs)
 
void resize (std::size_t size, ValueType initVal=ValueType())
 Deallocates and then resizes Vector with new size and initial value arguments.
 
std::size_t size () const
 Returns the dimension of the Vector.
 
ValueType * data () noexcept
 Return the raw pointer to the Vector.
 
const ValueType * data () const noexcept
 Return the raw pointer to the Vector without modifying the values.
 
template<dftfe::utils::MemorySpace memorySpaceDst>
void copyTo (MemoryStorage< ValueType, memorySpaceDst > &dstMemoryStorage) const
 Copies the data to a MemoryStorage object in a different memory space. This provides a seamless interface to copy back and forth between memory spaces , including between the same memory spaces.
 
template<dftfe::utils::MemorySpace memorySpaceDst>
void copyTo (MemoryStorage< ValueType, memorySpaceDst > &dstMemoryStorage, const std::size_t N, const std::size_t srcOffset, const std::size_t dstOffset) const
 Copies the data to a MemoryStorage object in a different memory space. This provides a seamless interface to copy back and forth between memory spaces , including between the same memory spaces. This is a more granular version of the above copyTo function as it provides transfer from a specific portion of the source MemoryStorage to a specific portion of the destination MemoryStorage.
 
template<dftfe::utils::MemorySpace memorySpaceSrc>
void copyFrom (const MemoryStorage< ValueType, memorySpaceSrc > &srcMemoryStorage)
 Copies data from a MemoryStorage object in a different memory space. This provides a seamless interface to copy back and forth between memory spaces, including between the same memory spaces.
 
template<dftfe::utils::MemorySpace memorySpaceSrc>
void copyFrom (const MemoryStorage< ValueType, memorySpaceSrc > &srcMemoryStorage, const std::size_t N, const std::size_t srcOffset, const std::size_t dstOffset)
 Copies data from a MemoryStorage object in a different memory space. This provides a seamless interface to copy back and forth between memory spaces, including between the same memory spaces. This is a more granular version of the above copyFrom function as it provides transfer from a specific portion of the source MemoryStorage to a specific portion of the destination MemoryStorage.
 
template<dftfe::utils::MemorySpace memorySpaceDst>
void copyTo (ValueType *dst) const
 Copies the data to a memory pointed by a raw pointer This provides a seamless interface to copy back and forth between memory spaces, including between the same memory spaces.
 
template<dftfe::utils::MemorySpace memorySpaceDst>
void copyTo (ValueType *dst, const std::size_t N, const std::size_t srcOffset, const std::size_t dstOffset) const
 Copies the data to a memory pointer by a raw pointer. This provides a seamless interface to copy back and forth between memory spaces , including between the same memory spaces. This is a more granular version of the above copyTo function as it provides transfer from a specific portion of the source MemoryStorage to a specific portion of the destination pointer.
 
template<dftfe::utils::MemorySpace memorySpaceSrc>
void copyFrom (const ValueType *src)
 Copies data from a memory pointed by a raw pointer into the MemoryStorage object. This provides a seamless interface to copy back and forth between memory spaces, including between the same memory spaces.
 
template<dftfe::utils::MemorySpace memorySpaceSrc>
void copyFrom (const ValueType *src, const std::size_t N, const std::size_t srcOffset, const std::size_t dstOffset)
 Copies data from a memory pointer by a raw pointer into the MemoryStorage object. This provides a seamless interface to copy back and forth between memory spaces, including between the same memory spaces. This is a more granular version of the above copyFrom function as it provides transfer from a specific portion of the source memory to a specific portion of the destination MemoryStorage.
 
void copyTo (std::vector< ValueType > &dst) const
 Copies the data to a C++ STL vector, which always resides in the CPU. This provides a seamless interface to copy from any memory space to a C++ STL vector, including the case where source memory space is HOST (i.e., it resides on the CPU)
 
void copyTo (std::vector< ValueType > &dst, const std::size_t N, const std::size_t srcOffset, const std::size_t dstOffset) const
 Copies the data to a C++ STL vector, which always resides in the CPU. This provides a seamless interface to copy from any memory space to a C++ STL vector, including the case where source memory space is HOST (i.e., it resides on the CPU). This is a more granular version of the above copyToSTL function as it provides transfer from a specific portion of the MemoryStorage to a specific portion of the destination STL vector.
 
void copyFrom (const std::vector< ValueType > &src)
 Copies data from a C++ STL vector to the MemoryStorage object, which always resides on a CPU. This provides a seamless interface to copy from any memory space, including the case where the same memory spaces is HOST(i.e., the MemoryStorage is on CPU).
 
void copyFrom (const std::vector< ValueType > &src, const std::size_t N, const std::size_t srcOffset, const std::size_t dstOffset)
 Copies data from a C++ STL vector to the MemoryStorage object, which always resides on a CPU. This provides a seamless interface to copy from any memory space, including the case where the same memory spaces is HOST(i.e., the MemoryStorage is on CPU). This is a more granular version of the above copyFromSTL function as it provides transfer from a specific portion of the source STL vector to to a specific portion of the destination MemoryStorage.
 

Private Attributes

ValueType * d_data = nullptr
 
std::size_t d_size = 0
 

Member Typedef Documentation

◆ const_iterator

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
typedef const ValueType* dftfe::utils::MemoryStorage< ValueType, memorySpace >::const_iterator

◆ const_reference

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
typedef const ValueType& dftfe::utils::MemoryStorage< ValueType, memorySpace >::const_reference

◆ iterator

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
typedef ValueType* dftfe::utils::MemoryStorage< ValueType, memorySpace >::iterator

◆ pointer

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
typedef ValueType* dftfe::utils::MemoryStorage< ValueType, memorySpace >::pointer

◆ reference

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
typedef ValueType& dftfe::utils::MemoryStorage< ValueType, memorySpace >::reference

◆ value_type

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
typedef ValueType dftfe::utils::MemoryStorage< ValueType, memorySpace >::value_type

A class template to provide an interface that can act similar to STL vectors but with different MemorySpace— HOST (cpu) , DEVICE (gpu), etc,.

Template Parameters
ValueTypeThe underlying value type for the MemoryStorage (e.g., int, double, complex<double>, etc.)
memorySpaceThe memory space in which the MemoryStorage needs to reside

Constructor & Destructor Documentation

◆ MemoryStorage() [1/4]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
dftfe::utils::MemoryStorage< ValueType, memorySpace >::MemoryStorage ( )
default

◆ MemoryStorage() [2/4]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
dftfe::utils::MemoryStorage< ValueType, memorySpace >::MemoryStorage ( const MemoryStorage< ValueType, memorySpace > & u)

Copy constructor for a MemoryStorage.

Parameters
[in]uMemoryStorage object to copy from

◆ MemoryStorage() [3/4]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
dftfe::utils::MemoryStorage< ValueType, memorySpace >::MemoryStorage ( MemoryStorage< ValueType, memorySpace > && u)
noexcept

Move constructor for a Vector.

Parameters
[in]uVector object to move from

◆ MemoryStorage() [4/4]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
dftfe::utils::MemoryStorage< ValueType, memorySpace >::MemoryStorage ( std::size_t size,
ValueType initVal = 0 )
explicit

Constructor for Vector with size and initial value arguments.

Parameters
[in]sizesize of the Vector
[in]initValinitial value of elements of the Vector

◆ ~MemoryStorage()

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
dftfe::utils::MemoryStorage< ValueType, memorySpace >::~MemoryStorage ( )

Destructor.

Member Function Documentation

◆ begin() [1/2]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
MemoryStorage< ValueType, memorySpace >::iterator dftfe::utils::MemoryStorage< ValueType, memorySpace >::begin ( )

Return iterator pointing to the beginning of point data.

Returns
Iterator pointing to the beginning of Vector.

◆ begin() [2/2]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
MemoryStorage< ValueType, memorySpace >::const_iterator dftfe::utils::MemoryStorage< ValueType, memorySpace >::begin ( ) const

Return iterator pointing to the beginning of Vector data.

Returns
Constant iterator pointing to the beginning of Vector.

◆ clear()

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::clear ( )

clear and set to d_data to nullptr

◆ copyFrom() [1/6]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
template<dftfe::utils::MemorySpace memorySpaceSrc>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::copyFrom ( const MemoryStorage< ValueType, memorySpaceSrc > & srcMemoryStorage)

Copies data from a MemoryStorage object in a different memory space. This provides a seamless interface to copy back and forth between memory spaces, including between the same memory spaces.

Note
The MemoryStorage must be pre-allocated appropriately
Template Parameters
memorySpaceSrcmemory space of the source MemoryStorage from which to copy
Parameters
[in]srcMemoryStoragereference to the source MemoryStorage
Exceptions
utils::LengthErrorexception if the size of underlying MemoryStorage is less than size of srcMemoryStorage

◆ copyFrom() [2/6]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
template<dftfe::utils::MemorySpace memorySpaceSrc>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::copyFrom ( const MemoryStorage< ValueType, memorySpaceSrc > & srcMemoryStorage,
const std::size_t N,
const std::size_t srcOffset,
const std::size_t dstOffset )

Copies data from a MemoryStorage object in a different memory space. This provides a seamless interface to copy back and forth between memory spaces, including between the same memory spaces. This is a more granular version of the above copyFrom function as it provides transfer from a specific portion of the source MemoryStorage to a specific portion of the destination MemoryStorage.

Note
The MemoryStorage must be pre-allocated appropriately
Template Parameters
memorySpaceSrcmemory space of the source MemoryStorage from which to copy
Parameters
[in]srcMemoryStoragereference to the source MemoryStorage
[in]Nnumber of entries of the source MemoryStorage that needs to be copied to the destination MemoryStorage
[in]srcOffsetoffset relative to the start of the source MemoryStorage from which we need to copy data
[in]dstOffsetoffset relative to the start of the destination MemoryStorage to which we need to copy data
Exceptions
utils::LengthErrorexception if the size of srcMemoryStorage is less than N + srcOffset
utils::LengthErrorexception if the size of underlying MemoryStorage is less than N + dstOffset

◆ copyFrom() [3/6]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::copyFrom ( const std::vector< ValueType > & src)

Copies data from a C++ STL vector to the MemoryStorage object, which always resides on a CPU. This provides a seamless interface to copy from any memory space, including the case where the same memory spaces is HOST(i.e., the MemoryStorage is on CPU).

Parameters
[in]srcconst reference to the source C++ STL vector from which the data needs to be copied.
Exceptions
utils::LengthErrorexception if the size of the MemoryStorage is less than the size of the src

◆ copyFrom() [4/6]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::copyFrom ( const std::vector< ValueType > & src,
const std::size_t N,
const std::size_t srcOffset,
const std::size_t dstOffset )

Copies data from a C++ STL vector to the MemoryStorage object, which always resides on a CPU. This provides a seamless interface to copy from any memory space, including the case where the same memory spaces is HOST(i.e., the MemoryStorage is on CPU). This is a more granular version of the above copyFromSTL function as it provides transfer from a specific portion of the source STL vector to to a specific portion of the destination MemoryStorage.

Parameters
[in]srcconst reference to the source C++ STL vector from which the data needs to be copied.
[in]Nnumber of entries of the source pointer that needs to be copied to the destination MemoryStorage
[in]srcOffsetoffset relative to the start of the source STL vector from which we need to copy data
[in]dstOffsetoffset relative to the start of the destination MemoryStorage to which we need to copy data
Exceptions
utils::LengthErrorexception if the size of src is less than N + srcOffset
utils::LengthErrorexception if the size of the MemoryStorage is less thant N + dstOffset

◆ copyFrom() [5/6]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
template<dftfe::utils::MemorySpace memorySpaceSrc>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::copyFrom ( const ValueType * src)

Copies data from a memory pointed by a raw pointer into the MemoryStorage object. This provides a seamless interface to copy back and forth between memory spaces, including between the same memory spaces.

Note
The src pointer must point to a memory chunk that is at least the size of the MemoryStorage
Template Parameters
memorySpaceSrcmemory space of the source pointer from which to copy
Parameters
[in]srcpointer to the source memory

◆ copyFrom() [6/6]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
template<dftfe::utils::MemorySpace memorySpaceSrc>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::copyFrom ( const ValueType * src,
const std::size_t N,
const std::size_t srcOffset,
const std::size_t dstOffset )

Copies data from a memory pointer by a raw pointer into the MemoryStorage object. This provides a seamless interface to copy back and forth between memory spaces, including between the same memory spaces. This is a more granular version of the above copyFrom function as it provides transfer from a specific portion of the source memory to a specific portion of the destination MemoryStorage.

Note
The src pointer must point to a memory chunk that is at least the size of N + srcOffset
Template Parameters
memorySpaceSrcmemory space of the source pointer from which to copy
Parameters
[in]srcpointer to the source memory
[in]Nnumber of entries of the source pointer that needs to be copied to the destination MemoryStorage
[in]srcOffsetoffset relative to the start of the source pointer from which we need to copy data
[in]dstOffsetoffset relative to the start of the destination MemoryStorage to which we need to copy data
Exceptions
utils::LengthErrorexception if the size of the MemoryStorage is less than N + dstOffset

◆ copyTo() [1/6]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
template<dftfe::utils::MemorySpace memorySpaceDst>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::copyTo ( MemoryStorage< ValueType, memorySpaceDst > & dstMemoryStorage) const

Copies the data to a MemoryStorage object in a different memory space. This provides a seamless interface to copy back and forth between memory spaces , including between the same memory spaces.

Note
The destination MemoryStorage must be pre-allocated appropriately
Template Parameters
memorySpaceDstmemory space of the destination MemoryStorage
Parameters
[in]dstMemoryStoragereference to the destination MemoryStorage. It must be pre-allocated appropriately
[out]dstMemoryStoragereference to the destination MemoryStorage with the data copied into it
Exceptions
utils::LengthErrorexception if the size of dstMemoryStorage is less than underlying MemoryStorage

◆ copyTo() [2/6]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
template<dftfe::utils::MemorySpace memorySpaceDst>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::copyTo ( MemoryStorage< ValueType, memorySpaceDst > & dstMemoryStorage,
const std::size_t N,
const std::size_t srcOffset,
const std::size_t dstOffset ) const

Copies the data to a MemoryStorage object in a different memory space. This provides a seamless interface to copy back and forth between memory spaces , including between the same memory spaces. This is a more granular version of the above copyTo function as it provides transfer from a specific portion of the source MemoryStorage to a specific portion of the destination MemoryStorage.

Note
The destination MemoryStorage must be pre-allocated appropriately
Template Parameters
memorySpaceDstmemory space of the destination MemoryStorage
Parameters
[in]dstMemoryStoragereference to the destination MemoryStorage. It must be pre-allocated appropriately
[in]Nnumber of entries of the source MemoryStorage that needs to be copied to the destination MemoryStorage
[in]srcOffsetoffset relative to the start of the source MemoryStorage from which we need to copy data
[in]dstOffsetoffset relative to the start of the destination MemoryStorage to which we need to copy data
[out]dstMemoryStoragereference to the destination MemoryStorage with the data copied into it
Exceptions
utils::LengthErrorexception if the size of dstMemoryStorage is less than N + dstOffset
utils::LengthErrorexception if the size of underlying MemoryStorage is less than N + srcOffset

◆ copyTo() [3/6]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::copyTo ( std::vector< ValueType > & dst) const

Copies the data to a C++ STL vector, which always resides in the CPU. This provides a seamless interface to copy from any memory space to a C++ STL vector, including the case where source memory space is HOST (i.e., it resides on the CPU)

Parameters
[in]dstreference to the destination C++ STL vector to which the data needs to be copied.
[out]dstreference to the destination C++ STL vector with the data copied into it
Note
If the size of the dst vector is less than the the size of the underlying MemoryStorage, it will be resized. Thus, for performance reasons, it is recommened that the dst STL vector be pre-allocated appropriately.

◆ copyTo() [4/6]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::copyTo ( std::vector< ValueType > & dst,
const std::size_t N,
const std::size_t srcOffset,
const std::size_t dstOffset ) const

Copies the data to a C++ STL vector, which always resides in the CPU. This provides a seamless interface to copy from any memory space to a C++ STL vector, including the case where source memory space is HOST (i.e., it resides on the CPU). This is a more granular version of the above copyToSTL function as it provides transfer from a specific portion of the MemoryStorage to a specific portion of the destination STL vector.

Parameters
[in]dstreference to the destination C++ STL vector to which the data needs to be copied.
Note
If the size of the dst vector is less than the the size of the underlying memory storage, it will be resized. Thus, for performance reasons it is recommened to should be allocated appropriately.
Parameters
[in]Nnumber of entries of the source MemoryStorage that needs to be copied to the destination pointer
[in]srcOffsetoffset relative to the start of the source MemoryStorage from which we need to copy data
[in]dstOffsetoffset relative to the start of the STL vector to which we need to copy data
[out]dstreference to the destination C++ STL vector with the data copied into it
Exceptions
utils::LengthErrorexception if the size of the MemoryStorage is less than N + srcOffset
Note
If the size of the dst vector is less N + srcOffset, it will be resized. Thus, for performance reasons, it is recommened that the dst STL vector be allocated appropriately.

◆ copyTo() [5/6]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
template<dftfe::utils::MemorySpace memorySpaceDst>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::copyTo ( ValueType * dst) const

Copies the data to a memory pointed by a raw pointer This provides a seamless interface to copy back and forth between memory spaces, including between the same memory spaces.

Note
The destination pointer must be pre-allocated to be at least of the size of the MemoryStorage
Template Parameters
memorySpaceDstmemory space of the destination pointer
Parameters
[in]dstpointer to the destination. It must be pre-allocated appropriately
[out]dstpointer to the destination with the data copied into it

◆ copyTo() [6/6]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
template<dftfe::utils::MemorySpace memorySpaceDst>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::copyTo ( ValueType * dst,
const std::size_t N,
const std::size_t srcOffset,
const std::size_t dstOffset ) const

Copies the data to a memory pointer by a raw pointer. This provides a seamless interface to copy back and forth between memory spaces , including between the same memory spaces. This is a more granular version of the above copyTo function as it provides transfer from a specific portion of the source MemoryStorage to a specific portion of the destination pointer.

Note
The destination pointer must be pre-allocated to be at least of the size N + dstOffset
Template Parameters
memorySpaceDstmemory space of the destination pointer
Parameters
[in]dstpointer to the destination. It must be pre-allocated appropriately
[in]Nnumber of entries of the source MemoryStorage that needs to be copied to the destination pointer
[in]srcOffsetoffset relative to the start of the source MemoryStorage from which we need to copy data
[in]dstOffsetoffset relative to the start of the destination pointer to which we need to copy data
[out]dstpointer to the destination with the data copied into it
Exceptions
utils::LengthErrorexception if the size of the MemoryStorage is less than N + srcOffset

◆ data() [1/2]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
const ValueType * dftfe::utils::MemoryStorage< ValueType, memorySpace >::data ( ) const
noexcept

Return the raw pointer to the Vector without modifying the values.

Returns
pointer to const data

◆ data() [2/2]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
ValueType * dftfe::utils::MemoryStorage< ValueType, memorySpace >::data ( )
noexcept

Return the raw pointer to the Vector.

Returns
pointer to data

◆ end() [1/2]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
MemoryStorage< ValueType, memorySpace >::iterator dftfe::utils::MemoryStorage< ValueType, memorySpace >::end ( )

Return iterator pointing to the end of Vector data.

Returns
Iterator pointing to the end of Vector.

◆ end() [2/2]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
MemoryStorage< ValueType, memorySpace >::const_iterator dftfe::utils::MemoryStorage< ValueType, memorySpace >::end ( ) const

Return iterator pointing to the end of Vector data.

Returns
Constant iterator pointing to the end of Vector.

◆ operator=() [1/2]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
MemoryStorage< ValueType, memorySpace > & dftfe::utils::MemoryStorage< ValueType, memorySpace >::operator= ( const MemoryStorage< ValueType, memorySpace > & rhs)

Copy assignment operator.

Parameters
[in]rhsthe rhs Vector from which to copy
Returns
reference to the lhs Vector

◆ operator=() [2/2]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
MemoryStorage< ValueType, memorySpace > & dftfe::utils::MemoryStorage< ValueType, memorySpace >::operator= ( MemoryStorage< ValueType, memorySpace > && rhs)
noexcept

Move assignment constructor.

Parameters
[in]rhsthe rhs Vector from which to move
Returns
reference to the lhs Vector

◆ operator[]() [1/2]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
MemoryStorage< ValueType, memorySpace >::reference dftfe::utils::MemoryStorage< ValueType, memorySpace >::operator[] ( std::size_t i)

Operator to get a reference to a element of the Vector.

Parameters
[in]iis the index to the element of the Vector
Returns
reference to the element of the Vector
Exceptions
exceptionif i >= size of the Vector

◆ operator[]() [2/2]

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
MemoryStorage< ValueType, memorySpace >::const_reference dftfe::utils::MemoryStorage< ValueType, memorySpace >::operator[] ( std::size_t i) const

Operator to get a const reference to a element of the Vector.

Parameters
[in]iis the index to the element of the Vector
Returns
const reference to the element of the Vector
Exceptions
exceptionif i >= size of the Vector

◆ resize()

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::resize ( std::size_t size,
ValueType initVal = ValueType() )

Deallocates and then resizes Vector with new size and initial value arguments.

Parameters
[in]sizesize of the Vector
[in]initValinitial value of elements of the Vector

◆ setValue()

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::setValue ( const ValueType val)

Set all the entries to a given value.

Parameters
[in]valThe value to which the entries are to be set

◆ size()

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
std::size_t dftfe::utils::MemoryStorage< ValueType, memorySpace >::size ( ) const

Returns the dimension of the Vector.

Returns
size of the Vector

◆ swap()

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
void dftfe::utils::MemoryStorage< ValueType, memorySpace >::swap ( MemoryStorage< ValueType, memorySpace > & rhs)

Member Data Documentation

◆ d_data

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
ValueType* dftfe::utils::MemoryStorage< ValueType, memorySpace >::d_data = nullptr
private

◆ d_size

template<typename ValueType, dftfe::utils::MemorySpace memorySpace>
std::size_t dftfe::utils::MemoryStorage< ValueType, memorySpace >::d_size = 0
private

The documentation for this class was generated from the following files: