#include <ChunkHashGrid.hpp>
Public Types | |
using | io = Hdf5Build< hdf5features::ChunkIO > |
using | val_type = boost::variant< MeshBufferPtr, PointBufferPtr > |
Public Member Functions | |
ChunkHashGrid (std::string hdf5Path, size_t cacheSize, float chunkSize=10.0f) | |
class to load chunks from an HDF5 file More... | |
ChunkHashGrid (std::string hdf5Path, size_t cacheSize, BoundingBox< BaseVector< float >> boundingBox, float chunkSize) | |
class to load chunks from an HDF5 file More... | |
const BoundingBox< BaseVector< float > > & | getBoundingBox () const |
template<typename T > | |
boost::optional< T > | getChunk (std::string layer, int x, int y, int z) |
delivers the content of a chunk More... | |
const BaseVector< std::size_t > & | getChunkAmount () const |
BaseVector< int > | getChunkMaxChunkIndex () const |
returns the maximum chunk ids More... | |
BaseVector< int > | getChunkMinChunkIndex () const |
returns the minimum chunk ids More... | |
float | getChunkSize () const |
std::size_t | hashValue (int i, int j, int k) const |
Calculates the hash value for the given index triple. More... | |
bool | isChunkLoaded (std::string layer, size_t hashValue) |
indicates if wether or not a chunk is currently loaded in the local cache More... | |
bool | isChunkLoaded (std::string layer, int x, int y, int z) |
indicates if wether or not a chunk is currently loaded in the local cache More... | |
void | setBoundingBox (const BoundingBox< BaseVector< float >> boundingBox) |
sets the bounding box in this container and in persistend storage More... | |
template<typename T > | |
void | setChunk (std::string layer, int x, int y, int z, T data) |
sets a chunk of a given layer in hashgrid More... | |
template<typename T > | |
void | setGeometryChunk (std::string layer, int x, int y, int z, T data) |
sets a chunk of a given layer in hashgrid More... | |
Protected Member Functions | |
void | expandBoundingBox (const val_type &data) |
template<typename T > | |
bool | loadChunk (std::string layer, int x, int y, int z) |
loads a chunk from persistent storage into cache More... | |
void | loadChunk (std::string layer, int x, int y, int z, const val_type &data) |
loads given chunk data into cache More... | |
void | rehashCache (const BaseVector< std::size_t > &oldChunkAmount, const BaseVector< std::size_t > &oldChunkIndexOffset) |
regenerates cache hash grid More... | |
void | setChunkSize (float chunkSize) |
sets chunk size in this container and in persistent storage More... | |
Protected Attributes | |
BoundingBox< BaseVector< float > > | m_boundingBox |
Private Member Functions | |
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 More... | |
Private Attributes | |
size_t | m_cacheSize |
BaseVector< std::size_t > | m_chunkAmount |
BaseVector< std::size_t > | m_chunkIndexOffset |
float | m_chunkSize |
std::unordered_map< std::string, std::unordered_map< size_t, val_type > > | m_hashGrid |
io | m_io |
std::list< std::pair< std::string, size_t > > | m_items |
Definition at line 67 of file ChunkHashGrid.hpp.
Definition at line 72 of file ChunkHashGrid.hpp.
using lvr2::ChunkHashGrid::val_type = boost::variant<MeshBufferPtr, PointBufferPtr> |
Definition at line 70 of file ChunkHashGrid.hpp.
|
explicit |
class to load chunks from an HDF5 file
hdf5Path | path to the HDF5 file |
Definition at line 39 of file ChunkHashGrid.cpp.
lvr2::ChunkHashGrid::ChunkHashGrid | ( | std::string | hdf5Path, |
size_t | cacheSize, | ||
BoundingBox< BaseVector< float >> | boundingBox, | ||
float | chunkSize | ||
) |
class to load chunks from an HDF5 file
hdf5Path | path to the HDF5 file |
Definition at line 55 of file ChunkHashGrid.cpp.
|
protected |
Definition at line 130 of file ChunkHashGrid.cpp.
|
inline |
Definition at line 180 of file ChunkHashGrid.hpp.
boost::optional<T> lvr2::ChunkHashGrid::getChunk | ( | std::string | layer, |
int | x, | ||
int | y, | ||
int | z | ||
) |
delivers the content of a chunk
Returns a the content of a chunk from the local cache. If the requested chunk is not cached, the chunk will be loaded from the persistent storage and returned after being added to the cache.
T | type of requested chunk |
layer | layer of requested chunk |
x | x coordinate of chunk in chunk coordinates |
y | y coordinate of chunk in chunk coordinates |
z | z coordinate of chunk in chunk coordinates |
|
inline |
Definition at line 190 of file ChunkHashGrid.hpp.
|
inline |
returns the maximum chunk ids
Definition at line 207 of file ChunkHashGrid.hpp.
|
inline |
returns the minimum chunk ids
Definition at line 198 of file ChunkHashGrid.hpp.
|
inline |
Definition at line 185 of file ChunkHashGrid.hpp.
|
inline |
Calculates the hash value for the given index triple.
i | index of x-axis |
j | index of y-axis |
k | index of z-axis |
Definition at line 174 of file ChunkHashGrid.hpp.
bool lvr2::ChunkHashGrid::isChunkLoaded | ( | std::string | layer, |
size_t | hashValue | ||
) |
indicates if wether or not a chunk is currently loaded in the local cache
layer | layer of chunk |
hashValue | hashValue hash of the chunk coordinate |
bool lvr2::ChunkHashGrid::isChunkLoaded | ( | std::string | layer, |
int | x, | ||
int | y, | ||
int | z | ||
) |
indicates if wether or not a chunk is currently loaded in the local cache
layer | layer of chunk |
x | x coordinate of chunk in chunk coordinates |
y | y coordinate of chunk in chunk coordinates |
z | z coordinate of chunk in chunk coordinates |
Definition at line 80 of file ChunkHashGrid.cpp.
|
protected |
loads a chunk from persistent storage into cache
T | Type of chunk data |
layer | layer of chunk |
x | x coordinate of chunk in chunk coordinates |
y | y coordinate of chunk in chunk coordinates |
z | z coordinate of chunk in chunk coordinates |
|
protected |
loads given chunk data into cache
Loads given chunk data into cache and handles cache overflows. If the cache is full after adding the chunk, the least recent used chunk will be removed from cache.
layer | layer of chunk |
x | x coordinate of chunk in chunk coordinates |
y | y coordinate of chunk in chunk coordinates |
z | z coordinate of chunk in chunk coordinates |
data | content of chunk to load |
Definition at line 145 of file ChunkHashGrid.cpp.
|
protected |
regenerates cache hash grid
oldChunkAmount | previous amount of chunks |
oldChunkIndexOffset | previous offset for chunk indices |
Definition at line 85 of file ChunkHashGrid.cpp.
void lvr2::ChunkHashGrid::setBoundingBox | ( | const BoundingBox< BaseVector< float >> | boundingBox | ) |
sets the bounding box in this container and in persistend storage
boundingBox | new bounding box |
Definition at line 172 of file ChunkHashGrid.cpp.
void lvr2::ChunkHashGrid::setChunk | ( | std::string | layer, |
int | x, | ||
int | y, | ||
int | z, | ||
T | data | ||
) |
sets a chunk of a given layer in hashgrid
Adds a chunk for a given layer and coordinate in chunk coordinates to local cache and stores it permanently using io module. if the given chunk coordinate does not exist, the boudnig box will be expanded to fit the new chunk
T | type of chunk |
layer | layer of chunk |
x | x coordinate of chunk in chunk coordinates |
y | y coordinate of chunk in chunk coordinates |
z | z coordinate of chunk in chunk coordinates |
data | content of chunk to be added |
|
private |
sets the amount of chunks in x y and z direction in this container and in persistent storage
chunkAmount | new amounts of chunks |
Definition at line 202 of file ChunkHashGrid.cpp.
|
inlineprotected |
sets chunk size in this container and in persistent storage
chunkSize | new size of chunks |
Definition at line 268 of file ChunkHashGrid.hpp.
void lvr2::ChunkHashGrid::setGeometryChunk | ( | std::string | layer, |
int | x, | ||
int | y, | ||
int | z, | ||
T | data | ||
) |
sets a chunk of a given layer in hashgrid
Adds a chunk for a given layer and coordinate in chunk coordinates to local cache and stores it permanently using io module. Uses the geometrical data of the chunk data (if exists) to expand boundingbox
T | type of chunk |
layer | layer of chunk |
x | x coordinate of chunk in chunk coordinates |
y | y coordinate of chunk in chunk coordinates |
z | z coordinate of chunk in chunk coordinates |
data | content of chunk to be added |
|
protected |
Definition at line 276 of file ChunkHashGrid.hpp.
|
private |
Definition at line 293 of file ChunkHashGrid.hpp.
|
private |
Definition at line 305 of file ChunkHashGrid.hpp.
|
private |
Definition at line 308 of file ChunkHashGrid.hpp.
|
private |
Definition at line 302 of file ChunkHashGrid.hpp.
|
private |
Definition at line 299 of file ChunkHashGrid.hpp.
|
private |
Definition at line 290 of file ChunkHashGrid.hpp.
|
private |
Definition at line 296 of file ChunkHashGrid.hpp.