Blue Brain BioExplorer
VectorOctree.h
Go to the documentation of this file.
1 /*
2  *
3  * The Blue Brain BioExplorer is a tool for scientists to extract and analyse
4  * scientific data from visualization
5  *
6  * This file is part of Blue Brain BioExplorer <https://github.com/BlueBrain/BioExplorer>
7  *
8  * Copyright 2020-2024 Blue BrainProject / EPFL
9  *
10  * This program is free software: you can redistribute it and/or modify it under
11  * the terms of the GNU General Public License as published by the Free Software
12  * Foundation, either version 3 of the License, or (at your option) any later
13  * version.
14  *
15  * This program is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License along with
21  * this program. If not, see <https://www.gnu.org/licenses/>.
22  */
23 
24 #pragma once
25 
27 
28 #include "VectorOctreeNode.h"
29 
30 namespace core
31 {
38 {
39 public:
49  VectorOctree(const OctreeVectors &vectors, double voxelSize, const Vector3d &minAABB, const Vector3d &maxAABB);
50 
55  ~VectorOctree();
56 
62  const core::Vector3ui &getVolumeDimensions() const { return _volumeDimensions; }
63 
69  uint32_t getVolumeSize() const { return _volumeSize; }
70 
76  uint32_t getOctreeSize() const { return _octreeSize; }
77 
83  uint32_t getOctreeDepth() const { return _depth; }
84 
90  const uint32_ts &getFlatIndices() const { return _flatIndices; }
91 
97  const floats &getFlatData() const { return _flatData; }
98 
99 private:
100  void _flattenChildren(VectorOctreeNode *node, uint32_t level);
101 
102  inline uint32_t _pow2roundup(uint32_t x)
103  {
104  --x;
105  x |= x >> 1;
106  x |= x >> 2;
107  x |= x >> 4;
108  x |= x >> 8;
109  x |= x >> 16;
110  return x + 1;
111  }
112 
113  Vector3ui _volumeDimensions;
114  uint32_t _volumeSize;
115  uint32_t _octreeSize;
116  uint32_t _depth;
117 
118  uint32_ts _offsetPerLevel;
119 
120  uint32_ts _flatIndices;
121  floats _flatData;
122 };
123 } // namespace core
The VectorOctreeNode class implement a spherical node of the Octree acceleration structure used by th...
The VectorOctree class implements the VectorOctree acceleration structure used by the FieldsRenderer ...
Definition: VectorOctree.h:38
VectorOctree(const OctreeVectors &vectors, double voxelSize, const Vector3d &minAABB, const Vector3d &maxAABB)
Construct a new VectorOctree object.
const core::Vector3ui & getVolumeDimensions() const
Get the volume dimensions defined by the scene and the voxel sizes.
Definition: VectorOctree.h:62
const uint32_ts & getFlatIndices() const
Get a flattened representation of the VectorOctree indices.
Definition: VectorOctree.h:90
uint32_t getVolumeSize() const
Get the size of the volume.
Definition: VectorOctree.h:69
~VectorOctree()
Destroy the VectorOctree object.
const floats & getFlatData() const
Get a flattened representation of the VectorOctree data (node values)
Definition: VectorOctree.h:97
uint32_t getOctreeDepth() const
Get the depth of the VectorOctree.
Definition: VectorOctree.h:83
uint32_t getOctreeSize() const
Get the size of the VectorOctree.
Definition: VectorOctree.h:76
glm::vec< 3, uint32_t > Vector3ui
Definition: MathTypes.h:134
glm::vec< 3, double > Vector3d
Definition: MathTypes.h:143
std::vector< OctreeVector > OctreeVectors
Definition: Types.h:425
std::vector< uint32_t > uint32_ts
Definition: Types.h:53
std::vector< float > floats
Definition: Types.h:45