SpatialOps
SpatialOps::Pool< T > Class Template Reference

Static Public Member Functions

static T * get (const short int deviceLocation, const size_t n)
 Obtain a pointer to a block of memory with the requested size. If the requested size is zero, this returns a NULL pointer. More...
 
static void put (const short int deviceLocation, T *t)
 Return the requested block of memory to the pool. This should only be done for memory requested from the pool to begin with! More...
 
static size_t active ()
 
static size_t total ()
 
static size_t flush_unused (const size_t n)
 remove fields that have not been used for more than n calls to the pool More...
 

Detailed Description

template<typename T>
class SpatialOps::Pool< T >

Definition at line 58 of file FieldInfo.h.

Member Function Documentation

◆ active()

template<typename T >
size_t SpatialOps::Pool< T >::active ( )
static
Returns
the number of active fields in the pool on CPU

Definition at line 256 of file MemoryPool.cpp.

◆ flush_unused()

template<typename T >
size_t SpatialOps::Pool< T >::flush_unused ( const size_t  n)
static

remove fields that have not been used for more than n calls to the pool

Returns
the number of removed fields

Definition at line 275 of file MemoryPool.cpp.

◆ get()

template<typename T >
T * SpatialOps::Pool< T >::get ( const short int  deviceLocation,
const size_t  n 
)
static

Obtain a pointer to a block of memory with the requested size. If the requested size is zero, this returns a NULL pointer.

Parameters
deviceLocationthe location where the memory is requested
nthe size of the block of memory

Example: return a pointer to a block of memory for 5 doubles

double* my5Doubles = Pool<double>::get( CPU_INDEX, 5 );

Definition at line 116 of file MemoryPool.cpp.

Referenced by SpatialOps::BitField::begin().

Here is the caller graph for this function:

◆ put()

template<typename T >
void SpatialOps::Pool< T >::put ( const short int  deviceLocation,
T *  t 
)
static

Return the requested block of memory to the pool. This should only be done for memory requested from the pool to begin with!

Parameters
deviceLocationthe location to return it to
tthe pointer to the block of memory.

Definition at line 217 of file MemoryPool.cpp.

Referenced by SpatialOps::BitField::BitField(), SpatialOps::FieldInfo< T >::~FieldInfo(), and SpatialOps::PoolAutoPtr< T >::~PoolAutoPtr().

Here is the caller graph for this function:

◆ total()

template<typename T >
size_t SpatialOps::Pool< T >::total ( )
static
Returns
the maximum number of active fields in the pool on CPU

Definition at line 268 of file MemoryPool.cpp.


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