#include <Phalanx_Allocator_Contiguous.hpp>
Public Member Functions | |
ContiguousAllocator () | |
~ContiguousAllocator () | |
void | reset () |
void | addRequiredChunk (std::size_t size_of_data_type, std::size_t num_elements) |
data_type_size is the size of a single element of the data type and num_elements is the number of elements of the data type that need to be allocated. | |
void | setup () |
Called after all byte requirements are registered. Allocates the contiguous array. | |
template<class DataT > | |
Teuchos::ArrayRCP< DataT > | allocate (std::size_t num_elements) |
int | getTotalBytes () const |
Private Attributes | |
bool | setup_called_ |
long int | total_bytes_ |
int | offset_ |
Teuchos::ArrayRCP< char > | chunk_ |
This class will allocate all fields for all data types in one contiguous chunk of memory. It is templated on AlignmentT which is the size that all variables should be aligned on.
PHX::ContiguousAllocator< AlignmentT >::ContiguousAllocator | ( | ) | [inline] |
References PHX::ContiguousAllocator< AlignmentT >::reset().
PHX::ContiguousAllocator< AlignmentT >::~ContiguousAllocator | ( | ) | [inline] |
void PHX::ContiguousAllocator< AlignmentT >::addRequiredChunk | ( | std::size_t | size_of_data_type, | |
std::size_t | num_elements | |||
) | [inline] |
data_type_size is the size of a single element of the data type and num_elements is the number of elements of the data type that need to be allocated.
References PHX::ContiguousAllocator< AlignmentT >::setup_called_, and PHX::ContiguousAllocator< AlignmentT >::total_bytes_.
Teuchos::ArrayRCP<DataT> PHX::ContiguousAllocator< AlignmentT >::allocate | ( | std::size_t | num_elements | ) | [inline] |
int PHX::ContiguousAllocator< AlignmentT >::getTotalBytes | ( | ) | const [inline] |
void PHX::ContiguousAllocator< AlignmentT >::reset | ( | ) | [inline] |
References PHX::ContiguousAllocator< AlignmentT >::chunk_, PHX::ContiguousAllocator< AlignmentT >::offset_, PHX::ContiguousAllocator< AlignmentT >::setup_called_, and PHX::ContiguousAllocator< AlignmentT >::total_bytes_.
Referenced by PHX::ContiguousAllocator< AlignmentT >::ContiguousAllocator().
void PHX::ContiguousAllocator< AlignmentT >::setup | ( | ) | [inline] |
Called after all byte requirements are registered. Allocates the contiguous array.
References PHX::ContiguousAllocator< AlignmentT >::chunk_, PHX::ContiguousAllocator< AlignmentT >::setup_called_, and PHX::ContiguousAllocator< AlignmentT >::total_bytes_.
Teuchos::ArrayRCP<char> PHX::ContiguousAllocator< AlignmentT >::chunk_ [private] |
int PHX::ContiguousAllocator< AlignmentT >::offset_ [private] |
bool PHX::ContiguousAllocator< AlignmentT >::setup_called_ [private] |
long int PHX::ContiguousAllocator< AlignmentT >::total_bytes_ [private] |