supereight
allocator.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2016-2019 Emanuele Vespa
3  * SPDX-FileCopyrightText: 2020-2023 Smart Robotics Lab, Imperial College London, Technical University of Munich
4  * SPDX-FileCopyrightText: 2020-2023 Nils Funk
5  * SPDX-FileCopyrightText: 2021-2023 Sotiris Papatheodorou
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef SE_ALLOCATOR_HPP
10 #define SE_ALLOCATOR_HPP
11 
12 #include <Eigen/StdVector>
13 #include <set>
14 
15 #include "octree.hpp"
17 
22 namespace se {
23 namespace allocator {
24 
35 template<typename OctreeT>
36 inline se::OctantBase*
37 block(const Eigen::Vector3i& voxel_coord, OctreeT& octree, se::OctantBase* base_parent_ptr);
38 
39 template<typename OctreeT>
40 inline se::OctantBase*
41 block(const se::key_t voxel_key, OctreeT& octree, se::OctantBase* base_parent_ptr);
42 
56 template<typename OctreeT>
57 std::vector<se::OctantBase*>
58 blocks(const std::vector<Eigen::Vector3i, Eigen::aligned_allocator<Eigen::Vector3i>>& voxel_coords,
59  OctreeT& octree,
60  se::OctantBase* base_parent_ptr,
61  const bool only_allocated = false);
62 
76 template<typename OctreeT>
77 std::vector<se::OctantBase*> blocks(std::vector<se::key_t>& voxel_keys,
78  OctreeT& octree,
79  se::OctantBase* base_parent_ptr,
80  const bool only_allocated = false);
81 
82 namespace detail {
83 
84 
99 template<typename OctreeT>
100 inline bool allocate_key(const se::key_t key,
101  OctreeT& octree,
102  se::OctantBase* base_parent_ptr,
103  se::OctantBase*& allocated_octant);
104 
105 
106 
107 } // namespace detail
108 } // namespace allocator
109 } // namespace se
110 
111 #include "impl/allocator_impl.hpp"
112 
113 #endif // SE_ALLOCATOR_HPP
std::vector< se::OctantBase * > blocks(const std::vector< Eigen::Vector3i, Eigen::aligned_allocator< Eigen::Vector3i >> &voxel_coords, OctreeT &octree, se::OctantBase *base_parent_ptr, const bool only_allocated=false)
Allocate Blocks at the provided voxel coordinates.
uint64_t key_t
key = 1 bit buffer + 57 bits of morton code + 6 bits of scale information The maxium scale is limited...
Definition: type_util.hpp:44
se::OctantBase * block(const Eigen::Vector3i &voxel_coord, OctreeT &octree, se::OctantBase *base_parent_ptr)
Allocate a block at the provided voxel coordinates.
bool allocate_key(const se::key_t key, OctreeT &octree, se::OctantBase *base_parent_ptr, se::OctantBase *&allocated_octant)
Allocate a given key in the octree.
This class only helps to dynamic cast the octant to the right type and builds the base of nodes and b...
Definition: octant.hpp:24
Helper wrapper to allocate and de-allocate octants in the octree.
Definition: colour_utils.hpp:17