35 #ifndef CHUNK_HASH_GRID_HPP 36 #define CHUNK_HASH_GRID_HPP 44 #include <unordered_map> 58 return mesh->getFloatChannel(
"vertices");
63 return points->getFloatChannel(
"points");
70 using val_type = boost::variant<MeshBufferPtr, PointBufferPtr>;
79 explicit ChunkHashGrid(std::string hdf5Path,
size_t cacheSize,
float chunkSize = 10.0f);
105 template <
typename T>
106 void setGeometryChunk(std::string layer,
int x,
int y,
int z, T data);
122 template <
typename T>
123 void setChunk(std::string layer,
int x,
int y,
int z, T data);
140 template <
typename T>
141 boost::optional<T> getChunk(std::string layer,
int x,
int y,
int z);
151 bool isChunkLoaded(std::string layer,
size_t hashValue);
163 bool isChunkLoaded(std::string layer,
int x,
int y,
int z);
176 return (i + m_chunkIndexOffset.x) * m_chunkAmount.y * m_chunkAmount.z
177 + (j + m_chunkIndexOffset.y) * m_chunkAmount.z + k + m_chunkIndexOffset.z;
182 return m_boundingBox;
192 return m_chunkAmount;
200 BaseVector<int> offset(m_chunkIndexOffset.x, m_chunkIndexOffset.y, m_chunkIndexOffset.z);
210 m_chunkAmount.y - m_chunkIndexOffset.y,
211 m_chunkAmount.z - m_chunkIndexOffset.z);
212 return maxChunkIndex;
232 void expandBoundingBox(
const val_type& data);
245 template <
typename T>
246 bool loadChunk(std::string layer,
int x,
int y,
int z);
261 void loadChunk(std::string layer,
int x,
int y,
int z,
const val_type& data);
270 m_chunkSize = chunkSize;
271 m_io.saveChunkSize(m_chunkSize);
296 std::list<std::pair<std::string, size_t>>
m_items;
299 std::unordered_map<std::string, std::unordered_map<size_t, val_type>>
m_hashGrid;
313 #include "ChunkHashGrid.tcc" 315 #endif // CHUNK_HASH_GRID_HPP BaseVector< int > getChunkMaxChunkIndex() const
returns the maximum chunk ids
const BoundingBox< BaseVector< float > > & getBoundingBox() const
float getChunkSize() const
std::shared_ptr< MeshBuffer > MeshBufferPtr
FloatChannelOptional operator()(const PointBufferPtr points) const
FloatChannelOptional operator()(const MeshBufferPtr mesh) const
std::size_t hashValue(int i, int j, int k) const
Calculates the hash value for the given index triple.
const BaseVector< std::size_t > & getChunkAmount() const
visitor that returns the channel that holds geometic information (like vertices-channel for meshes) ...
BaseVector< std::size_t > m_chunkIndexOffset
std::shared_ptr< PointBuffer > PointBufferPtr
A dynamic bounding box class.
typename Hdf5Construct< Feature >::type Hdf5Build
BaseVector< int > getChunkMinChunkIndex() const
returns the minimum chunk ids
boost::variant< MeshBufferPtr, PointBufferPtr > val_type
FloatChannel::Optional FloatChannelOptional
void setChunkSize(float chunkSize)
sets chunk size in this container and in persistent storage
Hdf5Build< hdf5features::ChunkIO > io
BoundingBox< BaseVector< float > > m_boundingBox
std::list< std::pair< std::string, size_t > > m_items
std::unordered_map< std::string, std::unordered_map< size_t, val_type > > m_hashGrid
BaseVector< std::size_t > m_chunkAmount