Go to the documentation of this file.
40 : m_cacheSize(cacheSize)
59 : m_cacheSize(cacheSize)
71 auto chunkIt = layerIt->second.find(
hashValue);
72 if (chunkIt != layerIt->second.end())
88 std::unordered_map<std::string, std::unordered_map<std::size_t, val_type>> tmpCache;
89 for (std::pair<std::string, std::size_t>& elem :
m_items)
92 int k = elem.second % oldChunkAmount.
z - oldChunkIndexOffset.
z;
93 int j = (elem.second / oldChunkAmount.
z) % oldChunkAmount.
y - oldChunkIndexOffset.
y;
94 int i = elem.second / (oldChunkAmount.
y * oldChunkAmount.
z) - oldChunkIndexOffset.
x;
98 auto layerIt = tmpCache.find(elem.first);
99 if (layerIt != tmpCache.end())
101 auto chunkIt = tmpCache[elem.first].find(elem.second);
102 if (chunkIt != tmpCache[elem.first].end())
104 chunk = tmpCache[elem.first][elem.second];
116 std::size_t newHash =
hashValue(i, j, k);
118 auto chunkIt =
m_hashGrid[elem.first].find(newHash);
121 tmpCache[elem.first][newHash] =
m_hashGrid[elem.first][newHash];
126 elem.second = newHash;
136 for (
unsigned int i = 0; i < geometryChannel.get().numElements(); i++)
147 std::size_t chunkHash =
hashValue(x, y, z);
153 m_items.remove({layer, chunkHash});
157 m_items.push_front({layer, chunkHash});
void rehashCache(const BaseVector< std::size_t > &oldChunkAmount, const BaseVector< std::size_t > &oldChunkIndexOffset)
regenerates cache hash grid
void expandBoundingBox(const val_type &data)
void setBoundingBox(const BoundingBox< BaseVector< float >> boundingBox)
sets the bounding box in this container and in persistend storage
const BoundingBox< BaseVector< float > > & getBoundingBox() const
BaseVecT getMax() const
Returns the upper right coordinates.
std::unordered_map< std::string, std::unordered_map< size_t, val_type > > m_hashGrid
ChunkHashGrid(std::string hdf5Path, size_t cacheSize, float chunkSize=10.0f)
class to load chunks from an HDF5 file
std::size_t hashValue(int i, int j, int k) const
Calculates the hash value for the given index triple.
FloatChannel::Optional FloatChannelOptional
boost::variant< MeshBufferPtr, PointBufferPtr > val_type
bool loadChunk(std::string layer, int x, int y, int z)
loads a chunk from persistent storage into cache
visitor that returns the channel that holds geometic information (like vertices-channel for meshes)
float getChunkSize() const
BaseVector< std::size_t > m_chunkAmount
BoundingBox< BaseVector< float > > m_boundingBox
std::list< std::pair< std::string, size_t > > m_items
A dynamic bounding box class.
void expand(T v)
Expands the bounding box if the given Vector v} is outside the current volume.
bool isChunkLoaded(std::string layer, size_t hashValue)
indicates if wether or not a chunk is currently loaded in the local cache
void setChunkAmountAndOffset(const BaseVector< std::size_t > &chunkAmount, const BaseVector< std::size_t > &chunkIndexOffset)
sets the amount of chunks in x y and z direction in this container and in persistent storage
void setChunkSize(float chunkSize)
sets chunk size in this container and in persistent storage
BaseVector< std::size_t > m_chunkIndexOffset
BaseVecT getMin() const
Returns the lower left coordinates.
lvr2
Author(s): Thomas Wiemann
, Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:23