walberla::field::AllocateAligned< T, alignment > Class Template Reference

Detailed Description

template<typename T, uint_t alignment>
class walberla::field::AllocateAligned< T, alignment >

Aligned Allocation strategy for Fields.

Template parameters:

  • T type that is stored in field
  • alignment the beginning of each row of the field is placed such that the memory address 'a' of each row fulfills: a % alignment == 0 alignment has to be a power of 2

#include <FieldAllocator.h>

+ Inheritance diagram for walberla::field::AllocateAligned< T, alignment >:

Protected Member Functions

T * allocateMemory (uint_t size0, uint_t size1, uint_t size2, uint_t size3, uint_t &allocSize1, uint_t &allocSize2, uint_t &allocSize3) override
 Same as allocated, without handling of reference counter. More...
 
T * allocateMemory (uint_t size) override
 Same as allocated, without handling of reference counter. More...
 
void setInnerGhostLayerSize (uint_t innerGhostLayerSize) override
 
void deallocate (T *&values) override
 Deallocates memory that has been allocated using allocate() More...
 

Private Attributes

uint_t offset_
 

Static Private Attributes

static std::map< T *, uint_tnrOfElements_ = std::map<T*,uint_t>()
 Nr of elements per allocated pointer has to be stored to call the destructor on each element. More...
 

Additional Inherited Members

- Public Types inherited from walberla::field::FieldAllocator< T >
using BaseType = typename std::conditional< VectorTrait< T >::F_SIZE!=0, typename VectorTrait< T >::OutputType, T >::type
 
- Public Member Functions inherited from walberla::field::FieldAllocator< T >
virtual ~FieldAllocator ()=default
 
T * allocate (uint_t size0, uint_t size1, uint_t size2, uint_t size3, uint_t &allocSize1, uint_t &allocSize2, uint_t &allocSize3)
 Allocate memory for a field of given sizes and initializes reference counter with one. More...
 
T * allocate (uint_t allocSize)
 Allocate memory of the given size. More...
 
void incrementReferenceCount (T *mem)
 Increments the reference count for the given pointer. More...
 
bool decrementReferenceCount (T *mem)
 Decrements the reference count for the given pointer. More...
 
uint_t referenceCount (T *mem) const
 

Member Function Documentation

◆ allocateMemory() [1/2]

template<typename T , uint_t alignment>
T* walberla::field::AllocateAligned< T, alignment >::allocateMemory ( uint_t  size)
inlineoverrideprotectedvirtual

Same as allocated, without handling of reference counter.

Implements walberla::field::FieldAllocator< T >.

◆ allocateMemory() [2/2]

template<typename T , uint_t alignment>
T* walberla::field::AllocateAligned< T, alignment >::allocateMemory ( uint_t  size0,
uint_t  size1,
uint_t  size2,
uint_t  size3,
uint_t allocSize1,
uint_t allocSize2,
uint_t allocSize3 
)
inlineoverrideprotectedvirtual

Same as allocated, without handling of reference counter.

Implements walberla::field::FieldAllocator< T >.

◆ deallocate()

template<typename T , uint_t alignment>
void walberla::field::AllocateAligned< T, alignment >::deallocate ( T *&  values)
inlineoverrideprotectedvirtual

Deallocates memory that has been allocated using allocate()

Parameters
valuesReturn value of allocate function()

Implements walberla::field::FieldAllocator< T >.

◆ setInnerGhostLayerSize()

template<typename T , uint_t alignment>
void walberla::field::AllocateAligned< T, alignment >::setInnerGhostLayerSize ( uint_t  innerGhostLayerSize)
inlineoverrideprotectedvirtual

Member Data Documentation

◆ nrOfElements_

template<typename T , uint_t alignment>
std::map< T *, uint_t > walberla::field::AllocateAligned< T, alignment >::nrOfElements_ = std::map<T*,uint_t>()
staticprivate

Nr of elements per allocated pointer has to be stored to call the destructor on each element.

◆ offset_

template<typename T , uint_t alignment>
uint_t walberla::field::AllocateAligned< T, alignment >::offset_
private

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