waLBerla 7.3
Loading...
Searching...
No Matches
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 >:

Public Member Functions

void setInnerGhostLayerSize (uint_t innerGhostLayerSize) override
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.
T * allocate (uint_t allocSize)
 Allocate memory of the given size.
void incrementReferenceCount (T *mem)
 Increments the reference count for the given pointer.
bool decrementReferenceCount (T *mem)
 Decrements the reference count for the given pointer.
uint_t referenceCount (T *mem) const

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.
T * allocateMemory (uint_t size) override
 Same as allocated, without handling of reference counter.
void deallocate (T *&values) override
 Deallocates memory that has been allocated using allocate().

Private Attributes

uint_t offset_

Static Private Attributes

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

Additional Inherited Members

Public Types inherited from walberla::field::FieldAllocator< T >
using BaseType = std::conditional_t<VectorTrait<T>::F_SIZE!=0, typename VectorTrait<T>::OutputType, T>

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)
inlineoverridevirtual

Member Data Documentation

◆ nrOfElements_

template<typename T, uint_t alignment>
std::map<T*, uint_t> walberla::field::AllocateAligned< T, alignment >::nrOfElements_
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:
  • /builds/administration/walberla-website/walberla/src/field/allocation/FieldAllocator.h