Schnek
schnek::SingleArrayInstantAllocation< T, rank > Class Template Reference

Allocate a single array for multidimensional grids in C ordering. More...

#include <single-array-allocation.hpp>

Collaboration diagram for schnek::SingleArrayInstantAllocation< T, rank >:

Classes

struct  SizeInfo
 

Public Types

typedef Array< int, rank > IndexType
 The grid index type.
 
typedef Range< int, rank > RangeType
 The grid range type.
 

Public Member Functions

 SingleArrayInstantAllocation ()
 Default constructor.
 
 SingleArrayInstantAllocation (const SingleArrayInstantAllocation< T, rank > &)
 Copy constructor.
 
SingleArrayInstantAllocation< T, rank > & operator= (const SingleArrayInstantAllocation< T, rank > &)
 Assignment operator.
 
 ~SingleArrayInstantAllocation ()
 destructor
 

Protected Types

typedef std::function< void()> UpdaterType
 

Protected Member Functions

void resizeImpl (const IndexType &lo, const IndexType &hi)
 resizes to grid with lower indices lo[0],...,lo[rank-1] and upper indices hi[0],...,hi[rank-1]
 
void onUpdate (const UpdaterType &updater)
 Add an updater to the data. More...
 

Protected Attributes

std::shared_ptr< internal::SingleArrayAllocationData< T, SizeInfo > > data
 The pointer to the data.
 
size_t size
 The length of the allocated array.
 
RangeType range
 The lowest and highest coordinates in the grid (inclusive)
 
IndexType dims
 The dimensions of the grid dims = high - low + 1
 

Detailed Description

template<typename T, size_t rank>
class schnek::SingleArrayInstantAllocation< T, rank >

Allocate a single array for multidimensional grids in C ordering.

Deallocation and allocation is performed on every resize.

Template Parameters
TThe type of data stored in the grid
rankThe rank of the grid

Member Function Documentation

◆ onUpdate()

template<typename T , size_t rank>
void schnek::SingleArrayInstantAllocation< T, rank >::onUpdate ( const UpdaterType &  updater)
protected

Add an updater to the data.

The updater is called when the data is resized.


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