16#include <Octree_Double.h>
18template <
typename _SIZE_>
33template <
typename _SIZE_>
38 int ix = 0, iy = 0, iz = 0;
42 return ok ?
octree_int_.search_elements(ix, iy, iz, index) : 0;
55template <
typename _SIZE_>
66 Cerr <<
"Internal error in Octree_Double_32_64<_SIZE_>::build_nodes: negative epsilon" << finl;
69 bool have_epsilon = (epsilon != 0.);
71 elements_boxes.
resize(nb_som, have_epsilon ? (dim*2) : dim, RESIZE_OPTIONS::NOCOPY_NOINIT);
73 for (
int_t i = 0; i < nb_som; i++)
74 for (
int j = 0; j < dim; j++)
77 const double x0 = coords(i, j);
78 double x = x0 - epsilon;
81 Cerr <<
"Fatal error in octree : integer position outside octree" << finl;
84 elements_boxes(i, j) = pos1;
88 double xbis = x0 + epsilon;
91 Cerr <<
"Fatal error in octree : integer position outside octree" << finl;
94 elements_boxes(i, dim+j) = pos1;
103template <
typename _SIZE_>
105 double xmax,
double ymax,
double zmax,
108 const int dim =
dim_;
114 int x0 = 0, x1 = 0, y0 = 0, y1 = 0, z0 = 0, z1 = 0;
116 if ((ok) && (dim >= 1))
119 if ((ok) && (dim >= 2))
123 octree_int_.search_elements_box(x0, y0, z0, x1, y1, z1, elements);
136template <
typename _SIZE_>
142 double x = center[0];
143 double y = (dim>=2) ? center[1] : 0.;
144 double z = (dim>2) ? center[2] : 0.;
146 x+radius, y+radius, z+radius,
158template <
typename _SIZE_>
164 double eps2 = epsilon * epsilon;
169 for (
int_t i = 0; i < n; i++)
171 const int_t som = node_list[i];
172 double dx = x - coords(som, 0);
173 double dy = (dim >= 2) ? y - coords(som, 1) : 0.;
174 double dz = (dim >= 3) ? z - coords(som, 2) : 0.;
175 double d2 = dx * dx + dy * dy + dz * dz;
178 node_list[count] = som;
194template <
typename _SIZE_>
201 double y = (dim>=2) ? point[1] : 0.;
202 double z = (dim>2) ? point[2] : 0.;
: An octree allowing to search in space for elements or points described by real-valued coordinates.
bool integer_position(double x, int direction, int &ix) const
Converts a real coordinate to an integer coordinate for the octree_int.
DoubleTab_T< _SIZE_ > DoubleTab_t
void compute_origin_factors(const _TAB_TYPE_ &coords, const double epsilon, const int include_virtual)
Helper method for build_nodes and build_elements: computes the conversion factors from real to intege...
static int_t search_nodes_close_to(double x, double y, double z, const DoubleTab_t &coords, ArrOfInt_t &node_list, double epsilon)
Non-member method. Searches among the vertices in node_list for those within a distance.
ArrOfInt_T< _SIZE_ > ArrOfInt_t
bool integer_position_clip(double xmin, double xmax, int &x0, int &x1, int direction) const
void build_nodes(const DoubleTab_t &coords, const bool include_virtual, const double epsilon=0.)
builds an octree containing the points with coordinates coords.
Octree_Int_32_64< _SIZE_ > octree_int_
int_t search_elements(double x, double y, double z, int_t &index) const
searches for the elements or points contained in the octree_floor that contains the point (x,...
int_t search_elements_box(double xmin, double ymin, double zmin, double xmax, double ymax, double zmax, ArrOfInt_t &elements) const
searches for all elements or points potentially having a non-empty intersection with the given box.
IntTab_T< _SIZE_ > IntTab_t
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
_SIZE_ size_array() const
void resize_array(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
int dimension_int(int d) const
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension_tot(int) const override
_SIZE_ dimension(int d) const