23#ifndef VELOCITY_MESH_CPU_H
24#define VELOCITY_MESH_CPU_H
31#include <unordered_map>
39#if defined(DEBUG_VLASIATOR) || defined(DEBUG_SPATIAL_CELL)
56 void clear(
bool shrink=
false);
72 std::vector<vmesh::GlobalID>*
getGrid();
88 bool push_back(
const std::vector<vmesh::GlobalID>& blocks);
90 bool setGrid(
const std::vector<vmesh::GlobalID>& globalIDs);
94 size_t size(
bool dummy=0)
const;
109 meshID = std::numeric_limits<size_t>::max();
154 for (
size_t b=0; b<
size(); ++b) {
160 std::cerr <<
"VMO ERROR: localToGlobalMap[" << b <<
"] = " << globalID <<
" but ";
161 std::cerr <<
"globalToLocalMap[" << globalID <<
"] = " << localID << std::endl;
188 if (sourceLID !=
size()-1) {
189 printf(
"Warning! Moving velocity mesh entry from position which is not last LID!\n");
241 getIndices(globalID,indices[0],indices[1],indices[2]);
303 std::cerr <<
"ERROR invalid local id" << std::endl; exit(1);
440 if (position.second ==
true) {
444 return position.second;
449 std::cerr <<
"vmesh: too many blocks, current size is " <<
size();
450 std::cerr <<
", adding " << blocks.size() <<
" blocks";
455 for (
size_t b=0; b<blocks.size(); ++b) {
void setNewCapacity(const vmesh::LocalID &newCapacity)
vmesh::GlobalID getGlobalIndexOffset()
const vmesh::LocalID * getGridLength() const
bool push_back(const vmesh::GlobalID &globalID)
const VelocityMesh & operator=(const VelocityMesh &other)
OpenBucketHashtable< vmesh::GlobalID, vmesh::LocalID > globalToLocalMap
static vmesh::LocalID invalidBlockIndex()
ARCH_HOSTDEV size_t size() const
bool getBlockCoordinates(const vmesh::GlobalID &globalID, Real coords[3]) const
std::vector< vmesh::GlobalID > * getGrid()
void clearMap(const vmesh::LocalID &newSize)
static vmesh::LocalID invalidLocalID()
const Real * getMeshMaxLimits() const
bool move(const vmesh::LocalID &sourceLocalID, const vmesh::LocalID &targetLocalID)
const Real * getBlockSize() const
bool setMesh(const size_t &meshID)
void setNewSize(const vmesh::LocalID &newSize)
size_t count(const vmesh::GlobalID &globalID) const
const Real * getMeshMinLimits() const
vmesh::LocalID getLocalID(const vmesh::GlobalID &globalID) const
void clear(bool shrink=false)
vmesh::GlobalID findBlock(vmesh::GlobalID cellIndices[3]) const
size_t sizeInBytes() const
const Real * getCellSize() const
bool isInitialized() const
std::vector< vmesh::GlobalID > localToGlobalMap
vmesh::GlobalID getGlobalID(const vmesh::LocalID &localID) const
vmesh::GlobalID getMaxVelocityBlocks() const
static vmesh::GlobalID invalidGlobalID()
size_t size(bool dummy=0) const
bool initialize(const size_t &meshID)
void getIndices(const vmesh::GlobalID &globalID, vmesh::LocalID &i, vmesh::LocalID &j, vmesh::LocalID &k) const
size_t capacityInBytes() const
void getBlockInfo(const vmesh::GlobalID &globalID, Real *array) const
static const LocalID INVALID_LOCALID
static const GlobalID INVALID_GLOBALID
ARCH_HOSTDEV MeshWrapper * getMeshWrapper()
static const LocalID INVALID_VEL_BLOCK_INDEX
std::array< vmesh::MeshParameters, MAX_VMESH_PARAMETERS_COUNT > * velocityMeshes
static ARCH_HOSTDEV VecSimple< T > floor(VecSimple< T > const &a)