38 #ifndef GRID_LEVEL_CACHE_H
39 #define GRID_LEVEL_CACHE_H
56 template<
class Type,
class Allocator>
73 :
Blocked<Type>(comm, numa, type),
92 unsigned int cacheSize,
94 grid::ValuePosition valuePos)
97 blockSize, timeDimension, valuePos);
102 err = this->
numa().template allocate<Allocator>(
120 void getAt(T* buf,
const double* pos)
125 size_t index[MAX_DIMENSIONS];
131 unsigned long cacheOffset;
135 if (static_cast<long>(globalBlockId) != oldGlobalBlockId)
145 this->
type().convert(&data[this->
typeSize() * offset], buf);
157 void loadBlock(
const size_t *index,
unsigned char* data)
161 size_t index2[MAX_DIMENSIONS];
164 for (
unsigned char i = 0; i < this->
dimensions(); i++)
165 index2[i] = index[i] - (index[i] % this->
blockSize(i));
void loadBlock(const size_t *index, unsigned char *data)
unsigned long blockByCoords(const size_t *index) const
Base class for all grid levels that work on blocks.
void incCounter(perf::Counter::CounterType type)
asagi::Grid::Error open(const char *filename, const char *varname, const int *blockSize, int timeDimension, unsigned int cacheSize, int cacheHandSpread, grid::ValuePosition valuePos)
void init(unsigned char *cache, unsigned long blocks, unsigned long blockSize, long handDiff=-1)
unsigned int dimensions() const
unsigned int typeSize() const
unsigned int numaDomainId() const
const size_t * blockSize() const
cache::CacheManager m_cacheManager
void getAt(T *buf, const double *pos)
unsigned long totalBlockSize() const
cache::CacheManager & cacheManager()
unsigned long calcOffsetInBlock(const size_t *index)
void pos2index(const double *pos, size_t *index)
Cache(mpi::MPIComm &comm, const numa::Numa &numa, Type &type)
const Type & type() const
long get(unsigned long blockId, unsigned long &cacheOffset, unsigned char *&data)
asagi::Grid::Error open(const char *filename, const char *varname, const int *blockSize, int timeDimension, grid::ValuePosition valuePos)
io::NetCdfReader & inputFile() const
void unlock(unsigned long cacheOffset)