DOLFIN-X
DOLFIN-X C++ interface
Classes | Functions | Variables
dolfinx::geometry Namespace Reference

Geometry data structures and algorithms. More...

Classes

class  BoundingBoxTree
 Axis-Aligned bounding box binary tree. It is used to find entities in a collection (often a mesh::Mesh). More...
 
class  CollisionPredicates
 This class implements algorithms for detecting pairwise collisions between mesh entities of varying dimensions. More...
 
class  GeometryPredicates
 This class implements geometric predicates, i.e. function that return either true or false. More...
 
class  PredicateInitialization
 Class used for automatic initialization of tolerances at startup. A global instance is defined inside predicates.cpp to ensure that the constructor and thus exactinit() is called. More...
 

Functions

void exactinit ()
 Initialize tolerances for exact arithmetic.
 
double orient1d (double a, double b, double x)
 Compute relative orientation of point x wrt segment [a, b].
 
double orient2d (const Eigen::Vector3d &a, const Eigen::Vector3d &b, const Eigen::Vector3d &c)
 Convenience function using Eigen.
 
double orient3d (const Eigen::Vector3d &a, const Eigen::Vector3d &b, const Eigen::Vector3d &c, const Eigen::Vector3d &d)
 Convenience function using Eigen.
 
BoundingBoxTree create_midpoint_tree (const mesh::Mesh &mesh)
 Create a boundary box tree for cell midpoints. More...
 
std::pair< std::vector< int >, std::vector< int > > compute_collisions (const BoundingBoxTree &tree0, const BoundingBoxTree &tree1)
 Compute all collisions between bounding boxes and BoundingBoxTree.
 
std::pair< std::vector< int >, std::vector< int > > compute_entity_collisions (const BoundingBoxTree &tree0, const BoundingBoxTree &tree1, const mesh::Mesh &mesh0, const mesh::Mesh &mesh1)
 Compute all collisions between entities and BoundingBoxTree.
 
std::vector< int > compute_collisions (const BoundingBoxTree &tree, const Eigen::Vector3d &p)
 Compute all collisions between bounding boxes and point. More...
 
std::vector< int > compute_entity_collisions (const BoundingBoxTree &tree, const Eigen::Vector3d &p, const mesh::Mesh &mesh)
 Compute all collisions between mesh entities and point. More...
 
int compute_first_collision (const BoundingBoxTree &tree, const Eigen::Vector3d &p)
 Compute first collision between bounding boxes and point. More...
 
int compute_first_entity_collision (const BoundingBoxTree &tree, const Eigen::Vector3d &p, const mesh::Mesh &mesh)
 Compute first collision between entities and point. More...
 
std::vector< int > compute_process_collisions (const BoundingBoxTree &tree, const Eigen::Vector3d &p)
 Compute all collisions between processes and Point returning a list of process ranks.
 
bool bbox_in_bbox (const Eigen::Array< double, 2, 3, Eigen::RowMajor > &a, const Eigen::Array< double, 2, 3, Eigen::RowMajor > &b, double rtol=1e-14)
 Check whether bounding box a collides with bounding box (b)
 
std::pair< int, double > compute_closest_entity (const BoundingBoxTree &tree, const BoundingBoxTree &tree_midpoint, const Eigen::Vector3d &p, const mesh::Mesh &mesh)
 Compute closest mesh entity and distance to the point. The tree must have been initialised with topological co-dimension 0.
 
std::pair< int, double > compute_closest_point (const BoundingBoxTree &tree, const Eigen::Vector3d &p)
 Compute closest point and distance to a given point. More...
 
bool point_in_bbox (const Eigen::Array< double, 2, 3, Eigen::RowMajor > &b, const Eigen::Vector3d &x, double rtol=1e-14)
 Check whether point (x) is in bounding box. More...
 
double compute_squared_distance_bbox (const Eigen::Array< double, 2, 3, Eigen::RowMajor > &b, const Eigen::Vector3d &x)
 Compute squared distance between point and bounding box wih index "node". Returns zero if point is inside box.
 
double squared_distance (const mesh::MeshEntity &entity, const Eigen::Vector3d &p)
 Compute squared distance from a given point to the nearest point on a cell (only simplex cells are supported at this stage)
 
double squared_distance_triangle (const Eigen::Vector3d &point, const Eigen::Vector3d &a, const Eigen::Vector3d &b, const Eigen::Vector3d &c)
 Compute squared distance to given point. This version takes the three vertex coordinates as 3D points. This makes it possible to reuse this function for computing the (squared) distance to a tetrahedron.
 
double squared_distance_interval (const Eigen::Vector3d &point, const Eigen::Vector3d &a, const Eigen::Vector3d &b)
 Compute squared distance to given point. This version takes the two vertex coordinates as 3D points. This makes it possible to reuse this function for computing the (squared) distance to a triangle.
 

Variables

PredicateInitialization predicate_initialization
 Initialize the predicate.
 

Detailed Description

Geometry data structures and algorithms.

Tools for geometric data structures and operations, e.g. searching.

Function Documentation

◆ compute_closest_point()

std::pair< int, double > dolfinx::geometry::compute_closest_point ( const BoundingBoxTree tree,
const Eigen::Vector3d &  p 
)

Compute closest point and distance to a given point.

Parameters
[in]treeThe bounding box tree. It must have been initialised with topological dimension 0.
[in]pThe point to compute the distance from
Returns
(point index, distance)

◆ compute_collisions()

std::vector< int > dolfinx::geometry::compute_collisions ( const BoundingBoxTree tree,
const Eigen::Vector3d &  p 
)

Compute all collisions between bounding boxes and point.

Parameters
[in]treeThe bounding box tree
[in]pThe point
Returns
Bounding box leaves that contain the point

◆ compute_entity_collisions()

std::vector< int > dolfinx::geometry::compute_entity_collisions ( const BoundingBoxTree tree,
const Eigen::Vector3d &  p,
const mesh::Mesh mesh 
)

Compute all collisions between mesh entities and point.

Parameters
[in]treeThe bounding box tree
[in]pThe point
[in]meshThe mesh
Returns
Mesh entities that contain the point

◆ compute_first_collision()

int dolfinx::geometry::compute_first_collision ( const BoundingBoxTree tree,
const Eigen::Vector3d &  p 
)

Compute first collision between bounding boxes and point.

Parameters
[in]treeThe bounding box tree
[in]pThe point
Returns
Index of the first found box that contains the point

◆ compute_first_entity_collision()

int dolfinx::geometry::compute_first_entity_collision ( const BoundingBoxTree tree,
const Eigen::Vector3d &  p,
const mesh::Mesh mesh 
)

Compute first collision between entities and point.

Parameters
[in]treeThe bounding box tree
[in]pThe point
[in]meshThe mesh
Returns
Index of the first found mesh entity that contains the point

◆ create_midpoint_tree()

geometry::BoundingBoxTree dolfinx::geometry::create_midpoint_tree ( const mesh::Mesh mesh)

Create a boundary box tree for cell midpoints.

Parameters
[in]meshThe mesh build tree of cell midpoints from
Returns
Bounding box tree for mesh cell midpoints

◆ point_in_bbox()

bool dolfinx::geometry::point_in_bbox ( const Eigen::Array< double, 2, 3, Eigen::RowMajor > &  b,
const Eigen::Vector3d &  x,
double  rtol = 1e-14 
)

Check whether point (x) is in bounding box.

Parameters
[in]bThe bounding box
[in]xThe point to check
[in]rtolRelative tolerance for checking if x is inside the bounding box
Returns
(point index, distance)