TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Octree_Double_32_64< _SIZE_ > Class Template Reference

: An octree allowing to search in space for elements or points described by real-valued coordinates. More...

#include <Octree_Double.h>

Collaboration diagram for Octree_Double_32_64< _SIZE_ >:
[legend]

Public Types

using int_t = _SIZE_
using ArrOfInt_t = ArrOfInt_T<_SIZE_>
using IntTab_t = IntTab_T<_SIZE_>
using ArrOfDouble_t = ArrOfDouble_T<_SIZE_>
using DoubleTab_t = DoubleTab_T<_SIZE_>

Public Member Functions

void reset ()
template<class _TAB_TYPE_>
void build_elements (const _TAB_TYPE_ &coords, const IntTab_t &elements, const double epsilon, const bool include_virtual)
 Builds an octree from volumetric elements described by sets of vertices.
void build_nodes (const DoubleTab_t &coords, const bool include_virtual, const double epsilon=0.)
 builds an octree containing the points with coordinates coords.
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,y,z).
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.
int_t search_elements_box (const ArrOfDouble &center, const double radius, ArrOfInt_t &elements) const
 Searches for all elements or points potentially having a non-empty intersection with the given box (center +/- radius in each direction).
int dimension () const
const ArrOfInt_tfloor_elements () const

Static Public Member Functions

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.
static int_t search_nodes_close_to (const ArrOfDouble &point, const DoubleTab_t &coords, ArrOfInt_t &node_list, double epsilon)
 Same as search_nodes_close_to(double x, double y, double z, ...).

Protected Member Functions

bool integer_position (double x, int direction, int &ix) const
 Converts a real coordinate to an integer coordinate for the octree_int.
bool integer_position_clip (double xmin, double xmax, int &x0, int &x1, int direction) const
template<class _TAB_TYPE_>
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 integer coordinates for Octree_Int.

Protected Attributes

Octree_Int_32_64< _SIZE_ > octree_int_
ArrOfDouble origin_
ArrOfDouble factor_
int dim_ = 0

Detailed Description

template<typename _SIZE_>
class Octree_Double_32_64< _SIZE_ >

: An octree allowing to search in space for elements or points described by real-valued coordinates.

This object is based on Octree_Int. Tips: To search for points up to epsilon tolerance one can do: 1) build_nodes(coord, include_virt, 0.) followed by search_elements_box(center, epsilon, elements);

2) build_nodes(coord, include_virt, epsilon) followed by search_elements(x,y,z,...) The first solution takes more time to build the octree but the search is faster. The second is the reverse... and one can choose epsilon for each point.

Definition at line 39 of file Octree_Double.h.

Member Typedef Documentation

◆ ArrOfDouble_t

template<typename _SIZE_>
using Octree_Double_32_64< _SIZE_ >::ArrOfDouble_t = ArrOfDouble_T<_SIZE_>

Definition at line 45 of file Octree_Double.h.

◆ ArrOfInt_t

template<typename _SIZE_>
using Octree_Double_32_64< _SIZE_ >::ArrOfInt_t = ArrOfInt_T<_SIZE_>

Definition at line 43 of file Octree_Double.h.

◆ DoubleTab_t

template<typename _SIZE_>
using Octree_Double_32_64< _SIZE_ >::DoubleTab_t = DoubleTab_T<_SIZE_>

Definition at line 46 of file Octree_Double.h.

◆ int_t

template<typename _SIZE_>
using Octree_Double_32_64< _SIZE_ >::int_t = _SIZE_

Definition at line 42 of file Octree_Double.h.

◆ IntTab_t

template<typename _SIZE_>
using Octree_Double_32_64< _SIZE_ >::IntTab_t = IntTab_T<_SIZE_>

Definition at line 44 of file Octree_Double.h.

Member Function Documentation

◆ build_elements()

template<typename _SIZE_>
template<class _TAB_TYPE_>
void Octree_Double_32_64< _SIZE_ >::build_elements ( const _TAB_TYPE_ & coords,
const IntTab_t & elements,
const double epsilon,
const bool include_virtual )

Builds an octree from volumetric elements described by sets of vertices.

Stores in the octree the bounding parallelepipeds of each element (containing all vertices of the element) plus a margin of epsilon. If include_virtual=1, stores elements.dimension_tot(0) elements, otherwise stores elements.dimension(0).

Templated because the float version is needed for lata tools.

Definition at line 31 of file Octree_Double.tpp.

◆ build_nodes()

template<typename _SIZE_>
void Octree_Double_32_64< _SIZE_ >::build_nodes ( const DoubleTab_t & coords,
const bool include_virtual,
const double epsilon = 0. )

builds an octree containing the points with coordinates coords.

If include_virtual=1, stores coords.dimension_tot(0) elements, otherwise stores coords.dimension(0) elements. If epsilon = 0, builds an octree of zero-size points (each point is in a single octree_floor). Otherwise, builds an octree of cubic elements centered on the coords, with half-width epsilon. A point can then be found in several octree_floors.

Definition at line 56 of file Octree_Double.cpp.

◆ compute_origin_factors()

template<typename _SIZE_>
template<class _TAB_TYPE_>
void Octree_Double_32_64< _SIZE_ >::compute_origin_factors ( const _TAB_TYPE_ & coords,
const double epsilon,
const int include_virtual )
protected

Helper method for build_nodes and build_elements: computes the conversion factors from real to integer coordinates for Octree_Int.

epsilon is added to the min and max coordinates for the octree bounding box.

Templated because the float version is needed for lata tools.

Definition at line 77 of file Octree_Double.tpp.

◆ dimension()

template<typename _SIZE_>
int Octree_Double_32_64< _SIZE_ >::dimension ( ) const
inline

Definition at line 59 of file Octree_Double.h.

◆ floor_elements()

template<typename _SIZE_>
const ArrOfInt_t & Octree_Double_32_64< _SIZE_ >::floor_elements ( ) const
inline

Definition at line 64 of file Octree_Double.h.

◆ integer_position()

template<typename _SIZE_>
bool Octree_Double_32_64< _SIZE_ >::integer_position ( double x,
int direction,
int & ix ) const
inlineprotected

Converts a real coordinate to an integer coordinate for the octree_int.

Return value: 1 if ok, 0 if coordinate is outside the octree

Definition at line 86 of file Octree_Double.h.

◆ integer_position_clip()

template<typename _SIZE_>
bool Octree_Double_32_64< _SIZE_ >::integer_position_clip ( double xmin,
double xmax,
int & x0,
int & x1,
int direction ) const
inlineprotected

Definition at line 103 of file Octree_Double.h.

◆ reset()

template<typename _SIZE_>
void Octree_Double_32_64< _SIZE_ >::reset ( )

Definition at line 19 of file Octree_Double.cpp.

◆ search_elements()

template<typename _SIZE_>
Octree_Double_32_64< _SIZE_ >::int_t Octree_Double_32_64< _SIZE_ >::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,y,z).

Returns the number n of these elements. The indices of the elements are in floor_elements()[index+i] for 0 <= i < n

Definition at line 34 of file Octree_Double.cpp.

◆ search_elements_box() [1/2]

template<typename _SIZE_>
Octree_Double_32_64< _SIZE_ >::int_t Octree_Double_32_64< _SIZE_ >::search_elements_box ( const ArrOfDouble & center,
const double radius,
ArrOfInt_t & elements ) const

Searches for all elements or points potentially having a non-empty intersection with the given box (center +/- radius in each direction).

Parameters
centerCenter of the box.
radiusHalf-width of the box in each direction.
elementsArray filled with the indices of the matching elements.
Returns
Number of elements found.

Definition at line 138 of file Octree_Double.cpp.

◆ search_elements_box() [2/2]

template<typename _SIZE_>
Octree_Double_32_64< _SIZE_ >::int_t Octree_Double_32_64< _SIZE_ >::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.

Definition at line 104 of file Octree_Double.cpp.

◆ search_nodes_close_to() [1/2]

template<typename _SIZE_>
Octree_Double_32_64< _SIZE_ >::int_t Octree_Double_32_64< _SIZE_ >::search_nodes_close_to ( const ArrOfDouble & point,
const DoubleTab_t & coords,
ArrOfInt_t & node_list,
double epsilon )
static

Same as search_nodes_close_to(double x, double y, double z, ...).

Definition at line 195 of file Octree_Double.cpp.

◆ search_nodes_close_to() [2/2]

template<typename _SIZE_>
Octree_Double_32_64< _SIZE_ >::int_t Octree_Double_32_64< _SIZE_ >::search_nodes_close_to ( double x,
double y,
double z,
const DoubleTab_t & coords,
ArrOfInt_t & node_list,
double epsilon )
static

Non-member method. Searches among the vertices in node_list for those within a distance.

less than epsilon from the point (x,y,z). node_list contains indices of vertices in the coords array. The list of nodes satisfying the criterion is placed in node_list. Returns the index in the coords array of the nearest vertex.

Definition at line 159 of file Octree_Double.cpp.

Member Data Documentation

◆ dim_

template<typename _SIZE_>
int Octree_Double_32_64< _SIZE_ >::dim_ = 0
protected

Definition at line 76 of file Octree_Double.h.

◆ factor_

template<typename _SIZE_>
ArrOfDouble Octree_Double_32_64< _SIZE_ >::factor_
protected

Definition at line 75 of file Octree_Double.h.

◆ octree_int_

template<typename _SIZE_>
Octree_Int_32_64<_SIZE_> Octree_Double_32_64< _SIZE_ >::octree_int_
protected

Definition at line 73 of file Octree_Double.h.

◆ origin_

template<typename _SIZE_>
ArrOfDouble Octree_Double_32_64< _SIZE_ >::origin_
protected

Definition at line 75 of file Octree_Double.h.


The documentation for this class was generated from the following files: