19 #include "unibn_octree.h"
24 unibn::Octree<Real3, AgentContainer>*
octree_ =
nullptr;
28 impl_ = std::unique_ptr<OctreeEnvironment::UnibnImpl>(
30 impl_->octree_ =
new unibn::Octree<Real3, AgentContainer>();
35 delete impl_->octree_;
48 std::array<real_t, 6> tmp_dim = {{inf, -inf, inf, -inf, inf, -inf}};
53 unibn::OctreeParams params;
54 params.bucketSize = param->unibn_bucketsize;
61 bool uninitialized =
impl_->octree_ ==
nullptr;
62 if (uninitialized && param->bound_space) {
67 int min = param->min_bound;
68 int max = param->max_bound;
72 }
else if (!uninitialized) {
80 "You tried to initialize an empty simulation without bound space. "
81 "Therefore we cannot determine the size of the simulation space. "
82 "Please add simulation objects, or set Param::bound_space_, "
83 "Param::min_bound_, and Param::max_bound_.");
95 const Real3& query_position,
97 const Agent* query_agent) {
98 std::vector<uint32_t> neighbors;
99 std::vector<double> distances;
102 impl_->octree_->radiusNeighbors<unibn::L2Distance<Real3>>(
103 query_position,
static_cast<double>(std::sqrt(squared_radius)), neighbors,
108 for (
auto& n : neighbors) {
110 if (nb_so != query_agent) {
111 lambda(nb_so,
static_cast<real_t>(distances[i]));
118 const Agent& query,
void* criteria) {
119 Log::Fatal(
"OctreeEnvironment::ForEachNeighbor",
120 "You tried to call a specific ForEachNeighbor in an "
121 "environment that does not yet support it.");
133 Log::Fatal(
"OctreeEnvironment::GetLoadBalanceInfo",
134 "You tried to call GetLoadBalanceInfo in an environment that does "
145 int32_t inf = std::numeric_limits<int32_t>::max();
151 const std::array<real_t, 6>& grid_dimensions) {