mimmo::skdTreeUtils Namespace Reference

Utilities employing SkdTree. More...

Functions

bool checkPointBelongsToCell (const std::array< double, 3 > &point, const bitpit::SurfUnstructured *surface_mesh, long cellId)
 
double computePseudoNormal (const std::array< double, 3 > &point, const bitpit::SurfUnstructured *surface_mesh, long id, std::array< double, 3 > &pseudo_normal)
 
double distance (const std::array< double, 3 > *point, const bitpit::PatchSkdTree *tree, long &id, double r)
 
void distance (int nP, const std::array< double, 3 > *points, const bitpit::PatchSkdTree *tree, long *ids, double *distances, double *r)
 
void distance (int nP, const std::array< double, 3 > *points, const bitpit::PatchSkdTree *tree, long *ids, double *distances, double r)
 
void extractTarget (bitpit::PatchSkdTree *target, const std::vector< const bitpit::SkdNode * > &leafSelection, std::vector< long > &extracted, double tol)
 
long findPointClosestCell (const std::array< double, 3 > &point, const bitpit::PatchSkdTree *tree, bool interiorOnly, long *id, double *distance)
 
long findPointClosestCell (const std::array< double, 3 > &point, const bitpit::PatchSkdTree *tree, double maxDistance, bool interiorOnly, long *id, double *distance)
 
long locatePointOnPatch (const std::array< double, 3 > &point, const bitpit::PatchSkdTree *tree)
 
darray3E projectPoint (const std::array< double, 3 > *point, const bitpit::PatchSkdTree *skdtree, double r)
 
void projectPoint (int nP, const std::array< double, 3 > *points, const bitpit::PatchSkdTree *tree, std::array< double, 3 > *projected_points, long *ids, double *r)
 
void projectPoint (int nP, const std::array< double, 3 > *points, const bitpit::PatchSkdTree *tree, std::array< double, 3 > *projected_points, long *ids, double r)
 
std::vector< long > selectByPatch (bitpit::PatchSkdTree *selection, bitpit::PatchSkdTree *target, double tol)
 
double signedDistance (const std::array< double, 3 > *point, const bitpit::PatchSkdTree *tree, long &id, std::array< double, 3 > &normal, double r)
 
void signedDistance (int nP, const std::array< double, 3 > *points, const bitpit::PatchSkdTree *tree, long *ids, double *distances, std::array< double, 3 > *normals, double *r)
 
void signedDistance (int nP, const std::array< double, 3 > *points, const bitpit::PatchSkdTree *tree, long *ids, double *distances, std::array< double, 3 > *normals, double r)
 

Detailed Description

Utilities employing SkdTree.

Function Documentation

◆ checkPointBelongsToCell()

bool mimmo::skdTreeUtils::checkPointBelongsToCell ( const std::array< double, 3 > &  point,
const bitpit::SurfUnstructured *  surface_mesh,
long  cellId 
)

It check if a point belongs to an input cell. If the point is located on the plane of the cell and inside it, it returns true, false otherwise.

Parameters
[in]pointpoint coordinates
[in]surface_meshpointer to surface mesh
[in]cellIdcell id belong to the input surface mesh to be checked
Returns
true if the point belongs to the input cell

Definition at line 592 of file SkdTreeUtils.cpp.

◆ computePseudoNormal()

double mimmo::skdTreeUtils::computePseudoNormal ( const std::array< double, 3 > &  point,
const bitpit::SurfUnstructured *  surface_mesh,
long  id,
std::array< double, 3 > &  pseudo_normal 
)

It computes the pseudo-normal of a cell of a surface mesh from an input point, i.e. the unit vector with direction (P-xP), where P is the input point and xP is the projection on the cell.

Parameters
[in]pointcoordinates of the point
[in]surface_meshpointer to surface mesh
[in]idcell id belong to the input surface mesh
[out]pseudo_normal3-components array representing the pseudo-normal.
Returns
+/- 1.0 to identify if the pseudo normal is pointing in the same direction of the local surface normal or in the opposite side.

Definition at line 517 of file SkdTreeUtils.cpp.

◆ distance() [1/3]

double mimmo::skdTreeUtils::distance ( const std::array< double, 3 > *  point,
const bitpit::PatchSkdTree *  tree,
long &  id,
double  r 
)

It computes the unsigned distance of a point to a geometry linked in a SkdTree object. The geometry has to be a surface mesh, in particular an object of type bitpit::SurfUnstructured (a static cast is hardly coded in the method). It searches the element with minimum distance in a box of length 2*r, if none is found return a default value of distance equal to std::numeric_limits<double>::max().

Parameters
[in]pointPointer to coordinates of input point.
[in]treePointer to Boundary Volume Hierarchy tree that stores the geometry.
[out]idLabel of the element found as minimum distance element in the skd-tree.
[in]rLength of the side of the box or radius of the sphere used to search. (The algorithm checks every element encountered inside the box/sphere).
Returns
Unsigned distance of the input point from the patch in the skd-tree.

Definition at line 49 of file SkdTreeUtils.cpp.

◆ distance() [2/3]

void mimmo::skdTreeUtils::distance ( int  nP,
const std::array< double, 3 > *  points,
const bitpit::PatchSkdTree *  tree,
long *  ids,
double *  distances,
double *  r 
)

It computes the unsigned distance of a set of points to a geometry linked in a SkdTree object. The geometry has to be a surface mesh, in particular an object of type bitpit::SurfUnstructured (a static cast is hardly coded in the method). It searches the element with minimum distance in a box of length 2*r, if none is found return a default value of distance equal to std::numeric_limits<double>::max() in the position of the distances array related to the input point.

Parameters
[in]nPNumber of input points.
[in]pointsPointer to coordinates of input points.
[in]treePointer to Boundary Volume Hierarchy tree that stores the geometry.
[out]distancesUnsigned distance of the input points from the patch in the skd-tree.
[out]idsLabel of the elements found as minimum distance elements in the skd-tree.
[in]rLength of the side of the box or radius of the sphere used to search for each input point. (The algorithm checks every element encountered inside the box/sphere).

Definition at line 140 of file SkdTreeUtils.cpp.

◆ distance() [3/3]

void mimmo::skdTreeUtils::distance ( int  nP,
const std::array< double, 3 > *  points,
const bitpit::PatchSkdTree *  tree,
long *  ids,
double *  distances,
double  r 
)

It computes the unsigned distance of a set of points to a geometry linked in a SkdTree object. The geometry has to be a surface mesh, in particular an object of type bitpit::SurfUnstructured (a static cast is hardly coded in the method). It searches the element with minimum distance in a box of length 2*r, if none is found return a default value of distance equal to std::numeric_limits<double>::max() in the position of the distances array related to the input point.

Parameters
[in]nPNumber of input points.
[in]pointsPointer to coordinates of input points.
[in]treePointer to Boundary Volume Hierarchy tree that stores the geometry.
[out]distancesUnsigned distance of the input points from the patch in the skd-tree.
[out]idsLabel of the elements found as minimum distance elements in the skd-tree.
[in]rLength of the side of the box or radius of the sphere used to search. (The algorithm checks every element encountered inside the box/sphere).

Definition at line 119 of file SkdTreeUtils.cpp.

◆ extractTarget()

void mimmo::skdTreeUtils::extractTarget ( bitpit::PatchSkdTree *  target,
const std::vector< const bitpit::SkdNode * > &  leafSelection,
std::vector< long > &  extracted,
double  tol 
)

It extracts the elements of a leaf node of geometry stored in a skd-tree by a distance criterion in respect to an other geometry stored in a different skd-tree. It is a method used in selectByPatch method.

Parameters
[in]targetPointer to skd-tree that store the target geometry.
[in,out]leafSelectionVector of pointers to the leaf nodes currently interesting for the selection procedure.
[in,out]extractedof the label of all the elements of the target skd-tree, currently found placed at a distance <= tol from the bounding boxes of the leaf nodes in leafSelection.
[in]tolDistance threshold used to select the elements of target. the next-th node is not a leaf node the method is recursively called.

Definition at line 296 of file SkdTreeUtils.cpp.

◆ findPointClosestCell() [1/2]

long mimmo::skdTreeUtils::findPointClosestCell ( const std::array< double, 3 > &  point,
const bitpit::PatchSkdTree *  tree,
bool  interiorOnly,
long *  id,
double *  distance 
)

Given the specified point find the closest cell contained in a skd-tree and evaluates the distance between that cell and the given point.

Parameters
[in]pointis the point
[in]treepointer to SkdTree relative to the target volume geometry.
[in]interiorOnlyif set to true, only interior cells will be considered, it will be possible to consider non-interior cells only if the tree has been instantiated with non-interior cells support enabled
[out]idon output it will contain the id of the cell closest to the point, if the distance between the point and the surface is greater than the specified maximum distance, the id parameter will be set to the null id
[in,out]distanceon output it will contain the distance between the point and closest cell. If all cells contained in the tree are farther than the maximum distance, the function will return the maximum representable distance.

Definition at line 1538 of file SkdTreeUtils.cpp.

◆ findPointClosestCell() [2/2]

long mimmo::skdTreeUtils::findPointClosestCell ( const std::array< double, 3 > &  point,
const bitpit::PatchSkdTree *  tree,
double  maxDistance,
bool  interiorOnly,
long *  id,
double *  distance 
)

Given the specified point find the closest cell contained in a skd-tree and evaluates the distance between that cell and the given point.

Parameters
[in]pointis the point
[in]treepointer to SkdTree relative to the target volume geometry.
[in]maxDistanceall cells whose distance is greater than this parameters will not be considered for the evaluation of the distance
[in]interiorOnlyif set to true, only interior cells will be considered, it will be possible to consider non-interior cells only if the tree has been instantiated with non-interior cells support enabled
[out]idon output it will contain the id of the closest cell. If all cells contained in the tree are farther than the maximum distance, the argument will be set to the null id
[out]distanceon output it will contain the distance between the point and closest cell. If all cells contained in the tree are farther than the maximum distance, the argument will be set to the maximum representable distance

Definition at line 1564 of file SkdTreeUtils.cpp.

◆ locatePointOnPatch()

long mimmo::skdTreeUtils::locatePointOnPatch ( const std::array< double, 3 > &  point,
const bitpit::PatchSkdTree *  tree 
)

Given the specified point find the cell of a surface patch it is into. The method works only with trees generated with bitpit::SurfUnstructured mesh.

Parameters
[in]pointis the point
[in]treereference to SkdTree relative to the target surface geometry.
Returns
id of the geometry cell the point is into. Return bitpit::Cell::NULL_ID if no cell is found.

Definition at line 456 of file SkdTreeUtils.cpp.

◆ projectPoint() [1/3]

std::array< double, 3 > mimmo::skdTreeUtils::projectPoint ( const std::array< double, 3 > *  point,
const bitpit::PatchSkdTree *  skdtree,
double  r 
)

It computes the projection of a point on a geometry linked in a skd-tree object. The geometry must be a surface mesh, in particular an object of type bitpit::SurfUnstructured (a static cast is hardly coded in the method). It searches the elements of the geometry with minimum distance recursively in a sphere of radius r, by increasing the size r at each step until at least one element is found.

Parameters
[in]pointPointer to coordinates of input point.
[in]skdtreePointer to Boundary Volume Hierarchy tree that stores the geometry.
[in]rInitial length of the sphere radius used to search. (The algorithm checks every element encountered inside the sphere).
Returns
Coordinates of the projected point.

Definition at line 375 of file SkdTreeUtils.cpp.

◆ projectPoint() [2/3]

void mimmo::skdTreeUtils::projectPoint ( int  nP,
const std::array< double, 3 > *  points,
const bitpit::PatchSkdTree *  tree,
std::array< double, 3 > *  projected_points,
long *  ids,
double *  r 
)

It computes the projection of a set of points on a geometry linked in a skd-tree object. The geometry must be a surface mesh, in particular an object of type bitpit::SurfUnstructured (a static cast is hardly coded in the method). It searches the elements of the geometry with minimum distance recursively in a sphere of radius r, by increasing the size r at each step until at least one element is found.

Parameters
[in]nPNumber of input points.
[in]pointsPointer to coordinates of input points.
[in]treePointer to Boundary Volume Hierarchy tree that stores the geometry.
[out]projected_pointsCoordinates of the projected points.
[out]idsLabels of the elements found as minimum distance element into the points are projected.
[in]rpointer to a list of initial search sphere radii. (The algorithm checks for every point i every element encountered inside the sphere of i-th radius).

Definition at line 419 of file SkdTreeUtils.cpp.

◆ projectPoint() [3/3]

void mimmo::skdTreeUtils::projectPoint ( int  nP,
const std::array< double, 3 > *  points,
const bitpit::PatchSkdTree *  tree,
std::array< double, 3 > *  projected_points,
long *  ids,
double  r 
)

It computes the projection of a set of points on a geometry linked in a skd-tree object. The geometry must be a surface mesh, in particular an object of type bitpit::SurfUnstructured (a static cast is hardly coded in the method). It searches the elements of the geometry with minimum distance recursively in a sphere of radius r, by increasing the size r at each step until at least one element is found.

Parameters
[in]nPNumber of input points.
[in]pointsPointer to coordinates of input points.
[in]treePointer to geometry Skdtree.
[out]projected_pointsCoordinates of projected points.
[out]idsLabels of cells found as minimum distance element support for projected points.
[in]rInitial length of the sphere radius used to search. (The algorithm checks every element encountered inside the sphere).

Definition at line 398 of file SkdTreeUtils.cpp.

◆ selectByPatch()

std::vector< long > mimmo::skdTreeUtils::selectByPatch ( bitpit::PatchSkdTree *  selection,
bitpit::PatchSkdTree *  target,
double  tol 
)

It selects the elements of a geometry stored in a skd-tree by a distance criterion in respect to an other geometry stored in a different skd-tree.

Parameters
[in]selectionPointer to skd-tree used as selection patch.
[in]targetPointer to skd-tree that store the target geometry.
[in]tolDistance threshold used to select the elements of target.
Returns
Vector of the label of all the elements of the target skd-tree placed at a distance <= tol from the bounding boxes of the leaf nodes of the skd-tree selection.

Definition at line 251 of file SkdTreeUtils.cpp.

◆ signedDistance() [1/3]

double mimmo::skdTreeUtils::signedDistance ( const std::array< double, 3 > *  point,
const bitpit::PatchSkdTree *  tree,
long &  id,
std::array< double, 3 > &  normal,
double  r 
)

It computes the signed distance of a point to a geometry linked in a SkdTree object. The geometry must be a surface mesh, in particular an object of type bitpit::SurfUnstructured (a static cast is hardly coded in the method). The sign of the distance is provided by the normal to the geometry locally computed. A positive distance means that the point is located, in respect to the surface mesh, on the same side of the outer normal vector. It searches the element with minimum distance in a box of length 2*r, if none is found return a default value of distance equal to std::numeric_limits<double>::max().

Parameters
[in]pointPointer to coordinates of input point.
[in]treePointer to Boundary Volume Hierarchy tree that stores the geometry.
[out]idLabel of the element found as minimum distance element in the skd-tree.
[out]normalPseudo-normal of the element (i.e. unit vector with direction (P-xP), where P is the input point and xP the nearest point on the element (simplex) to the projection of P on the plane of the simplex.
[in]rLength of the side of the box or radius of the sphere used to search. (The algorithm checks every element encountered inside the box/sphere).
Returns
Signed distance of the input point from the patch in the skd-tree.

Definition at line 84 of file SkdTreeUtils.cpp.

◆ signedDistance() [2/3]

void mimmo::skdTreeUtils::signedDistance ( int  nP,
const std::array< double, 3 > *  points,
const bitpit::PatchSkdTree *  tree,
long *  ids,
double *  distances,
std::array< double, 3 > *  normals,
double *  r 
)

It computes the signed distance of a set of points to a geometry linked in a SkdTree object. The geometry must be a surface mesh, in particular an object of type bitpit::SurfUnstructured (a static cast is hardly coded in the method). The sign of the distance is provided by the normal to the geometry locally computed. A positive distance means that the point is located, in respect to the surface mesh, on the same side of the outer normal vector. It searches the element with minimum distance in a box of length 2*r, if none is found return a default value of distance equal to std::numeric_limits<double>::max() in the position of the distances array related to the input point.

Parameters
[in]nPNumber of input points.
[in]pointsPointer to coordinates of input points.
[in]treePointer to Boundary Volume Hierarchy tree that stores the geometry.
[out]distancesSigned distance of the input points from the patch in the skd-tree.
[out]idsLabel of the elements found as minimum distance elements in the skd-tree.
[out]normalsPseudo-normal of the elements (i.e. unit vector with direction (P-xP), where P is the input point and xP the nearest point on the element (simplex) to the projection of P on the plane of the simplex.
[in]rLength of the side of the box or radius of the sphere used to search for each input point. (The algorithm checks every element encountered inside the box/sphere).

Definition at line 213 of file SkdTreeUtils.cpp.

◆ signedDistance() [3/3]

void mimmo::skdTreeUtils::signedDistance ( int  nP,
const std::array< double, 3 > *  points,
const bitpit::PatchSkdTree *  tree,
long *  ids,
double *  distances,
std::array< double, 3 > *  normals,
double  r 
)

It computes the signed distance of a set of points to a geometry linked in a SkdTree object. The geometry must be a surface mesh, in particular an object of type bitpit::SurfUnstructured (a static cast is hardly coded in the method). The sign of the distance is provided by the normal to the geometry locally computed. A positive distance means that the point is located, in respect to the surface mesh, on the same side of the outer normal vector. It searches the element with minimum distance in a box of length 2*r, if none is found return a default value of distance equal to std::numeric_limits<double>::max() in the position of the distances array related to the input point.

Parameters
[in]nPNumber of input points.
[in]pointsPointer to coordinates of input points.
[in]treePointer to Boundary Volume Hierarchy tree that stores the geometry.
[out]distancesSigned distance of the input points from the patch in the skd-tree.
[out]idsLabel of the elements found as minimum distance elements in the skd-tree.
[out]normalsPseudo-normal of the elements (i.e. unit vector with direction (P-xP), where P is the input point and xP the nearest point on the element (simplex) to the projection of P on the plane of the simplex.
[in]rLength of the side of the box or radius of the sphere used to search. (The algorithm checks every element encountered inside the box/sphere).

Definition at line 186 of file SkdTreeUtils.cpp.