AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::quest::Delaunay< DIM > Class Template Reference

A class for incremental generation of a 2D or 3D Delaunay triangulation. More...

#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/latest/src/axom/quest/Delaunay.hpp>

Inheritance diagram for axom::quest::Delaunay< DIM >:

Public Types

using DataType = double
 
using PointType = primal::Point< DataType, DIM >
 
using ElementType = typename std::conditional< DIM==2, primal::Triangle< DataType, 2 >, primal::Tetrahedron< DataType, 3 > >::type
 
using BaryCoordType = primal::Point< DataType, DIM+1 >
 
using BoundingBox = primal::BoundingBox< DataType, DIM >
 
using IAMeshType = slam::IAMesh< DIM, DIM, PointType >
 
using IndexType = typename IAMeshType::IndexType
 
using IndexArray = typename IAMeshType::IndexArray
 
using IndexPairType = std::pair< IndexType, IndexType >
 

Public Member Functions

 AXOM_STATIC_ASSERT_MSG (DIM==2||DIM==3, "The template parameter DIM can only be 2 or 3. ")
 
 Delaunay ()
 Default constructor. More...
 
void initializeBoundary (const BoundingBox &bb)
 Defines the boundary of the triangulation. More...
 
void insertPoint (const PointType &new_pt)
 Adds a new point and locally re-triangulates the mesh to ensure that it stays Delaunay. More...
 
template<int TDIM = DIM>
std::enable_if< TDIM==2, ElementType >::type getElement (int element_index) const
 
template<int TDIM = DIM>
std::enable_if< TDIM==3, ElementType >::type getElement (int element_index) const
 
void printMesh ()
 Prints out mesh details, for debugging purpose. More...
 
void writeToVTKFile (const std::string &filename)
 Write the m_mesh to a legacy VTK file. More...
 
void removeBoundary ()
 Removes the vertices that defines the boundary of the mesh, and the elements attached to them. More...
 
const IAMeshTypegetMeshData () const
 Get the IA mesh data pointer. More...
 
bool isValid (bool verboseOutput=false) const
 Checks that the underlying mesh is a valid Delaunay triangulation of the point set. More...
 
IndexType findContainingElement (const PointType &query_pt, bool warnOnInvalid=true) const
 Find the index of the element that contains the query point, or the element closest to the point. More...
 
BaryCoordType getBaryCoords (IndexType element_idx, const PointType &q_pt) const
 helper function to retrieve the barycentric coordinate of the query point in the element More...
 
Delaunay< 2 >::BaryCoordType getBaryCoords (IndexType element_idx, const PointType &query_pt) const
 
Delaunay< 3 >::BaryCoordType getBaryCoords (IndexType element_idx, const PointType &query_pt) const
 

Static Public Attributes

static constexpr int VERT_PER_ELEMENT = DIM + 1
 
static constexpr IndexType INVALID_INDEX = -1
 

Detailed Description

template<int DIM = 2>
class axom::quest::Delaunay< DIM >

A class for incremental generation of a 2D or 3D Delaunay triangulation.

Construct a Delaunay triangulation incrementally by inserting points one by one. A bounding box of the points needs to be defined first via initializeBoundary(...)

Member Typedef Documentation

◆ DataType

template<int DIM = 2>
using axom::quest::Delaunay< DIM >::DataType = double

◆ PointType

template<int DIM = 2>
using axom::quest::Delaunay< DIM >::PointType = primal::Point<DataType, DIM>

◆ ElementType

template<int DIM = 2>
using axom::quest::Delaunay< DIM >::ElementType = typename std::conditional<DIM == 2, primal::Triangle<DataType, 2>, primal::Tetrahedron<DataType, 3> >::type

◆ BaryCoordType

template<int DIM = 2>
using axom::quest::Delaunay< DIM >::BaryCoordType = primal::Point<DataType, DIM + 1>

◆ BoundingBox

template<int DIM = 2>
using axom::quest::Delaunay< DIM >::BoundingBox = primal::BoundingBox<DataType, DIM>

◆ IAMeshType

template<int DIM = 2>
using axom::quest::Delaunay< DIM >::IAMeshType = slam::IAMesh<DIM, DIM, PointType>

◆ IndexType

template<int DIM = 2>
using axom::quest::Delaunay< DIM >::IndexType = typename IAMeshType::IndexType

◆ IndexArray

template<int DIM = 2>
using axom::quest::Delaunay< DIM >::IndexArray = typename IAMeshType::IndexArray

◆ IndexPairType

template<int DIM = 2>
using axom::quest::Delaunay< DIM >::IndexPairType = std::pair<IndexType, IndexType>

Constructor & Destructor Documentation

◆ Delaunay()

template<int DIM = 2>
axom::quest::Delaunay< DIM >::Delaunay ( )
inline

Default constructor.

Note
User must call initializeBoundary(BoundingBox) before adding points.

Member Function Documentation

◆ AXOM_STATIC_ASSERT_MSG()

template<int DIM = 2>
axom::quest::Delaunay< DIM >::AXOM_STATIC_ASSERT_MSG ( DIM  = =2||DIM==3,
"The template parameter DIM can only be 2 or 3. "   
)

◆ initializeBoundary()

template<int DIM = 2>
void axom::quest::Delaunay< DIM >::initializeBoundary ( const BoundingBox bb)
inline

Defines the boundary of the triangulation.

subsequent points added to the triangulation must not be outside of this boundary.

◆ insertPoint()

template<int DIM = 2>
void axom::quest::Delaunay< DIM >::insertPoint ( const PointType new_pt)
inline

Adds a new point and locally re-triangulates the mesh to ensure that it stays Delaunay.

This function will traverse the mesh to find the element that contains this point, creates the Delaunay cavity, which takes out all the elements that contains the point in its sphere, and fill it with a Delaunay ball.

Precondition
The current mesh must already be Delaunay.

References axom::primal::BoundingBox< T, NDIMS >::contains(), axom::quest::Delaunay< DIM >::findContainingElement(), axom::quest::Delaunay< DIM >::INVALID_INDEX, SLIC_ASSERT_MSG, and SLIC_WARNING.

◆ getElement() [1/2]

template<int DIM = 2>
template<int TDIM = DIM>
std::enable_if<TDIM == 2, ElementType>::type axom::quest::Delaunay< DIM >::getElement ( int  element_index) const
inline

◆ getElement() [2/2]

template<int DIM = 2>
template<int TDIM = DIM>
std::enable_if<TDIM == 3, ElementType>::type axom::quest::Delaunay< DIM >::getElement ( int  element_index) const
inline

◆ printMesh()

template<int DIM = 2>
void axom::quest::Delaunay< DIM >::printMesh ( )
inline

Prints out mesh details, for debugging purpose.

◆ writeToVTKFile()

template<int DIM = 2>
void axom::quest::Delaunay< DIM >::writeToVTKFile ( const std::string &  filename)
inline

Write the m_mesh to a legacy VTK file.

Parameters
filenameThe name of the file to write to,
Note
The suffix ".vtk" will be appended to the provided filename

This function uses mint to write the m_mesh to VTK format.

References axom::mint::UnstructuredMesh< TOPO >::appendCell(), axom::mint::UnstructuredMesh< TOPO >::appendNodes(), axom::mint::TET, axom::mint::TRIANGLE, and axom::mint::write_vtk().

◆ removeBoundary()

template<int DIM = 2>
void axom::quest::Delaunay< DIM >::removeBoundary ( )
inline

Removes the vertices that defines the boundary of the mesh, and the elements attached to them.

After this function is called, no more points can be added to the m_mesh.

◆ getMeshData()

template<int DIM = 2>
const IAMeshType* axom::quest::Delaunay< DIM >::getMeshData ( ) const
inline

Get the IA mesh data pointer.

◆ isValid()

template<int DIM = 2>
bool axom::quest::Delaunay< DIM >::isValid ( bool  verboseOutput = false) const
inline

Checks that the underlying mesh is a valid Delaunay triangulation of the point set.

A Delaunay triangulation is valid when none of the vertices are inside the circumspheres of any of the elements of the mesh

References axom::primal::BoundingBox< T, NDIMS >::addPoint(), axom::utilities::ceil(), axom::numerics::dot_product(), axom::quest::Delaunay< DIM >::getElement(), axom::primal::ON_NEGATIVE_SIDE, and SLIC_INFO.

◆ findContainingElement()

template<int DIM = 2>
IndexType axom::quest::Delaunay< DIM >::findContainingElement ( const PointType query_pt,
bool  warnOnInvalid = true 
) const
inline

◆ getBaryCoords() [1/3]

template<int DIM = 2>
BaryCoordType axom::quest::Delaunay< DIM >::getBaryCoords ( IndexType  element_idx,
const PointType q_pt 
) const

helper function to retrieve the barycentric coordinate of the query point in the element

◆ getBaryCoords() [2/3]

Delaunay< 2 >::BaryCoordType axom::quest::Delaunay< 2 >::getBaryCoords ( IndexType  element_idx,
const PointType query_pt 
) const
inline

◆ getBaryCoords() [3/3]

Delaunay< 3 >::BaryCoordType axom::quest::Delaunay< 3 >::getBaryCoords ( IndexType  element_idx,
const PointType query_pt 
) const
inline

Member Data Documentation

◆ VERT_PER_ELEMENT

template<int DIM = 2>
constexpr int axom::quest::Delaunay< DIM >::VERT_PER_ELEMENT = DIM + 1
staticconstexpr

◆ INVALID_INDEX

template<int DIM>
constexpr Delaunay< DIM >::IndexType axom::quest::Delaunay< DIM >::INVALID_INDEX = -1
staticconstexpr

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