DOLFIN
DOLFIN C++ interface
Public Member Functions | List of all members
dolfin::BoundingBoxTree Class Reference

#include <BoundingBoxTree.h>

Public Member Functions

 BoundingBoxTree ()
 Create empty bounding box tree.
 
 ~BoundingBoxTree ()
 Destructor.
 
void build (const Mesh &mesh)
 
void build (const Mesh &mesh, std::size_t tdim)
 
void build (const std::vector< Point > &points, std::size_t gdim)
 
std::vector< unsigned int > compute_collisions (const Point &point) const
 
std::pair< std::vector< unsigned int >, std::vector< unsigned int > > compute_collisions (const BoundingBoxTree &tree) const
 
std::vector< unsigned int > compute_entity_collisions (const Point &point) const
 
std::vector< unsigned int > compute_process_collisions (const Point &point) const
 
std::pair< std::vector< unsigned int >, std::vector< unsigned int > > compute_entity_collisions (const BoundingBoxTree &tree) const
 
unsigned int compute_first_collision (const Point &point) const
 
unsigned int compute_first_entity_collision (const Point &point) const
 
std::pair< unsigned int, double > compute_closest_entity (const Point &point) const
 
std::pair< unsigned int, double > compute_closest_point (const Point &point) const
 
bool collides (const Point &point) const
 
bool collides_entity (const Point &point) const
 

Detailed Description

This class implements a (distributed) axis aligned bounding box tree (AABB tree). Bounding box trees can be created from meshes and [other data structures, to be filled in].

Member Function Documentation

◆ build() [1/3]

void BoundingBoxTree::build ( const Mesh mesh)

Build bounding box tree for cells of mesh.

Arguments mesh (Mesh) The mesh for which to compute the bounding box tree.

◆ build() [2/3]

void BoundingBoxTree::build ( const Mesh mesh,
std::size_t  tdim 
)

Build bounding box tree for mesh entities of given dimension.

Arguments mesh (Mesh) The mesh for which to compute the bounding box tree. dimension (std::size_t) The entity dimension (topological dimension) for which to compute the bounding box tree.

◆ build() [3/3]

void BoundingBoxTree::build ( const std::vector< Point > &  points,
std::size_t  gdim 
)

Build bounding box tree for point cloud.

Arguments points (std::vector<Point>) The list of points. gdim (std::size_t) The geometric dimension.

◆ collides()

bool BoundingBoxTree::collides ( const Point point) const

Check whether given point collides with the bounding box tree. This is equivalent to calling compute_first_collision and checking whether any collision was detected.

Returns bool True iff the point is inside the tree.

◆ collides_entity()

bool BoundingBoxTree::collides_entity ( const Point point) const

Check whether given point collides with any entity contained in the bounding box tree. This is equivalent to calling compute_first_entity_collision and checking whether any collision was detected.

Returns bool True iff the point is inside the tree.

◆ compute_closest_entity()

std::pair< unsigned int, double > BoundingBoxTree::compute_closest_entity ( const Point point) const

Compute closest entity to Point.

Returns unsigned int The local index for the entity that is closest to the point. If more than one entity is at the same distance (or point contained in entity), then the first entity is returned. double The distance to the closest entity.

Arguments point (Point) The point.

◆ compute_closest_point()

std::pair< unsigned int, double > BoundingBoxTree::compute_closest_point ( const Point point) const

Compute closest point to Point. This function assumes that the tree has been built for a point cloud.

Developer note: This function should not be confused with computing the closest point in all entities of a mesh. That function could be added with relative ease since we actually compute the closest points to get the distance in the above function (compute_closest_entity) inside the specialized implementations in TetrahedronCell.cpp etc.

Returns unsigned int The local index for the point that is closest to the point. If more than one point is at the same distance (or point contained in entity), then the first point is returned. double The distance to the closest point.

Arguments point (Point) The point.

◆ compute_collisions() [1/2]

std::vector< unsigned int > BoundingBoxTree::compute_collisions ( const Point point) const

Compute all collisions between bounding boxes and Point.

Returns std::vector<unsigned int> A list of local indices for entities contained in (leaf) bounding boxes that collide with (intersect) the given point.

Arguments point (Point) The point.

◆ compute_collisions() [2/2]

std::pair< std::vector< unsigned int >, std::vector< unsigned int > > BoundingBoxTree::compute_collisions ( const BoundingBoxTree tree) const

Compute all collisions between bounding boxes and BoundingBoxTree.

Returns std::vector<unsigned int> A list of local indices for entities in this tree that collide with (intersect) entities in other tree. std::vector<unsigned int> A list of local indices for entities in other tree that collide with (intersect) entities in this tree.

The two lists have equal length and contain matching entities, such that entity i in the first list collides with entity i in the second list.

Note that this means that the entity lists may contain duplicate entities since a single entity may collide with several different entities.

Arguments tree (BoundingBoxTree) The bounding box tree.

Note that this function only checks collisions between bounding boxes of entities. It does not check that the entities themselves actually collide. To compute entity collisions, use the function compute_entity_collisions.

◆ compute_entity_collisions() [1/2]

std::vector< unsigned int > BoundingBoxTree::compute_entity_collisions ( const Point point) const

Compute all collisions between entities and Point.

Returns std::vector<unsigned int> A list of local indices for entities that collide with (intersect) the given point.

Arguments point (Point) The point.

◆ compute_entity_collisions() [2/2]

std::pair< std::vector< unsigned int >, std::vector< unsigned int > > BoundingBoxTree::compute_entity_collisions ( const BoundingBoxTree tree) const

Compute all collisions between entities and BoundingBoxTree.

Returns std::vector<unsigned int> A list of local indices for entities in this tree that collide with (intersect) entities in other tree. std::vector<unsigned int> A list of local indices for entities in other tree that collide with (intersect) entities in this tree.

The two lists have equal length and contain matching entities, such that entity i in the first list collides with entity i in the second list.

Note that this means that the entity lists may contain duplicate entities since a single entity may collide with several different entities.

Arguments tree (BoundingBoxTree) The bounding box tree.

◆ compute_first_collision()

unsigned int BoundingBoxTree::compute_first_collision ( const Point point) const

Compute first collision between bounding boxes and Point.

Returns unsigned int The local index for the first found entity contained in a (leaf) bounding box that collides with (intersects) the given point. If not found, std::numeric_limits<unsigned int>::max() is returned.

Arguments point (Point) The point.

◆ compute_first_entity_collision()

unsigned int BoundingBoxTree::compute_first_entity_collision ( const Point point) const

Compute first collision between entities and Point.

Returns unsigned int The local index for the first found entity that collides with (intersects) the given point. If not found, std::numeric_limits<unsigned int>::max() is returned.

Arguments point (Point) The point.

◆ compute_process_collisions()

std::vector< unsigned int > BoundingBoxTree::compute_process_collisions ( const Point point) const

Compute all collisions between process bounding boxes and Point. Effectively a list of processes which may contain the Point.

Returns std::vector<unsigned int> A list of process numbers where the Mesh may collide with (intersect) the given point.

Arguments point (Point) The point.


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