Advanced Multi-Physics (AMP)
On-Line Documentation
Public Types | Public Member Functions | Private Attributes | List of all members
AMP::Mesh::TriangleMeshElement< NG > Class Template Reference

A derived class used to define a mesh element. More...

#include <TriangleMeshElement.h>

Inheritance diagram for AMP::Mesh::TriangleMeshElement< NG >:
Inheritance graph
[legend]

Public Types

using ElementListPtr = MeshElementVectorPtr
 

Public Member Functions

MeshPoint< double > centroid () const override
 Return the centroid of the element.
 
std::unique_ptr< MeshElementclone () const override
 Clone the iterator.
 
bool containsPoint (const MeshPoint< double > &pos, double TOL=1e-12) const override
 Return true if the element contains the point.
 
bool containsPoint (const std::vector< double > &pos, double TOL=1e-12) const
 Return true if the element contains the point.
 
MeshPoint< double > coord () const override
 Return the coordinates of all vertices composing the element.
 
double coord (int i) const
 Return the coordinate of the vertex.
 
virtual double distance (const MeshPoint< double > &pos, const MeshPoint< double > &dir) const override
 Calculate the distance to the element given a ray.
 
std::string elementClass () const override
 Return the element class.
 
GeomType elementType () const
 Return the element type.
 
ElementListPtr getElements (const GeomType type) const override
 Return the elements composing the current element.
 
int getElementsID (const GeomType type, MeshElementID *ID) const override
 Return the IDs of the elements composing the current element.
 
ElementListPtr getNeighbors () const override
 Return the elements neighboring the current element.
 
virtual void getNeighborVertices (std::vector< Point > &vertices) const
 
const typeIDgetTypeID () const override
 Get the typeID.
 
virtual void getVertices (std::vector< Point > &vertices) const
 
MeshElementID globalID () const override
 Return the unique global ID of the element.
 
unsigned int globalOwnerRank (const Mesh &mesh) const
 Return the owner rank according to AMP_COMM_WORLD.
 
bool isInBlock (int id) const override
 Check if the current element is in the given block.
 
bool isNull () const
 Is the mesh element null.
 
bool isOnBoundary (int id) const override
 Check if the current element is on the given boundary.
 
bool isOnSurface () const override
 Check if the element is on the surface.
 
MeshPoint< double > nearest (const MeshPoint< double > &pos) const override
 Calculate the nearest point on the element.
 
MeshPoint< double > norm () const override
 Return the normal to the current element (does not apply to all elements)
 
bool operator!= (const MeshElement &rhs) const
 
bool operator!= (const MeshElementID &rhs) const
 
bool operator< (const MeshElement &rhs) const
 
bool operator< (const MeshElementID &rhs) const
 
bool operator<= (const MeshElement &rhs) const
 
bool operator<= (const MeshElementID &rhs) const
 
TriangleMeshElementoperator= (const TriangleMeshElement &)
 Assignment operator.
 
TriangleMeshElementoperator= (TriangleMeshElement &&)
 Move assignment operator.
 
bool operator== (const MeshElement &rhs) const
 
bool operator== (const MeshElementID &rhs) const
 
bool operator> (const MeshElement &rhs) const
 
bool operator> (const MeshElementID &rhs) const
 
bool operator>= (const MeshElement &rhs) const
 
bool operator>= (const MeshElementID &rhs) const
 
std::string print (uint8_t indent=0) const
 Print info about the element.
 
void resetElemId (const ElementID &id)
 
 TriangleMeshElement ()
 Empty constructor for a MeshElement.
 
 TriangleMeshElement (const MeshElementID &id, const TriangleMesh< NG > *mesh)
 
 TriangleMeshElement (const TriangleMeshElement &)
 Copy constructor.
 
 TriangleMeshElement (TriangleMeshElement &&)
 Move operator.
 
double volume () const override
 Return the volume of the current element (does not apply to vertices)
 
virtual ~TriangleMeshElement ()=default
 De-constructor for a MeshElement.
 

Private Attributes

MeshElementID d_globalID
 
const TriangleMesh< NG > * d_mesh
 

Detailed Description

template<uint8_t NG>
class AMP::Mesh::TriangleMeshElement< NG >

A derived class used to define a mesh element.

This class provides routines for accessing and using a mesh element. A mesh element can be thought of as the smallest unit of a mesh. It is of a typeof GeomType. This class is derived to store a TriangleMesh element.

Definition at line 26 of file TriangleMeshElement.h.

Member Typedef Documentation

◆ ElementListPtr

Definition at line 29 of file MeshElement.h.

Constructor & Destructor Documentation

◆ TriangleMeshElement() [1/4]

template<uint8_t NG>
AMP::Mesh::TriangleMeshElement< NG >::TriangleMeshElement ( )

Empty constructor for a MeshElement.

◆ TriangleMeshElement() [2/4]

template<uint8_t NG>
AMP::Mesh::TriangleMeshElement< NG >::TriangleMeshElement ( const TriangleMeshElement< NG > &  )

Copy constructor.

◆ TriangleMeshElement() [3/4]

template<uint8_t NG>
AMP::Mesh::TriangleMeshElement< NG >::TriangleMeshElement ( TriangleMeshElement< NG > &&  )

Move operator.

◆ ~TriangleMeshElement()

template<uint8_t NG>
virtual AMP::Mesh::TriangleMeshElement< NG >::~TriangleMeshElement ( )
virtualdefault

De-constructor for a MeshElement.

◆ TriangleMeshElement() [4/4]

template<uint8_t NG>
AMP::Mesh::TriangleMeshElement< NG >::TriangleMeshElement ( const MeshElementID id,
const TriangleMesh< NG > *  mesh 
)

Member Function Documentation

◆ centroid()

template<uint8_t NG>
MeshPoint< double > AMP::Mesh::TriangleMeshElement< NG >::centroid ( ) const
overridevirtual

Return the centroid of the element.

This function returns the centroid of the element. The centroid is defined as the average of the coordinates of the vertices. The centroid of a vertex is the vertex and will return the same result as coord().

Reimplemented from AMP::Mesh::MeshElement.

◆ clone()

template<uint8_t NG>
std::unique_ptr< MeshElement > AMP::Mesh::TriangleMeshElement< NG >::clone ( ) const
overridevirtual

Clone the iterator.

Reimplemented from AMP::Mesh::MeshElement.

◆ containsPoint() [1/2]

template<uint8_t NG>
bool AMP::Mesh::TriangleMeshElement< NG >::containsPoint ( const MeshPoint< double > &  pos,
double  TOL = 1e-12 
) const
overridevirtual

Return true if the element contains the point.

This function checks if the given point is inside or within TOL of the given element. If the current element is a vertex, this function checks if the point is with TOL of the vertex.

Parameters
posThe coordinates of the point to check.
TOLThe tolerance to use for the computation.

Reimplemented from AMP::Mesh::MeshElement.

◆ containsPoint() [2/2]

bool AMP::Mesh::MeshElement::containsPoint ( const std::vector< double > &  pos,
double  TOL = 1e-12 
) const
inherited

Return true if the element contains the point.

This function checks if the given point is inside or within TOL of the given element. If the current element is a vertex, this function checks if the point is with TOL of the vertex.

Parameters
posThe coordinates of the point to check.
TOLThe tolerance to use for the computation.

◆ coord() [1/2]

template<uint8_t NG>
MeshPoint< double > AMP::Mesh::TriangleMeshElement< NG >::coord ( ) const
overridevirtual

Return the coordinates of all vertices composing the element.

Reimplemented from AMP::Mesh::MeshElement.

◆ coord() [2/2]

double AMP::Mesh::MeshElement::coord ( int  i) const
inlineinherited

Return the coordinate of the vertex.

This function returns the coordinates of the vertex in the given direction (only applies to vertices).

Parameters
iThe direction requested. Equivalent to coord()[i]

Definition at line 61 of file MeshElement.h.

References AMP::Mesh::MeshElement::coord().

Referenced by AMP::Mesh::MeshElement::coord().

◆ distance()

template<uint8_t NG>
virtual double AMP::Mesh::TriangleMeshElement< NG >::distance ( const MeshPoint< double > &  pos,
const MeshPoint< double > &  dir 
) const
overridevirtual

Calculate the distance to the element given a ray.

This function computes the distance to the element given a ray. If the ray will never intersect the element, this distance is inf.

Parameters
[in]posCurrent position of ray
[in]dirDirection of ray (should be normalized for most uses)
Returns
Returns the distance to the element surface

Reimplemented from AMP::Mesh::MeshElement.

◆ elementClass()

template<uint8_t NG>
std::string AMP::Mesh::TriangleMeshElement< NG >::elementClass ( ) const
overridevirtual

Return the element class.

Reimplemented from AMP::Mesh::MeshElement.

◆ elementType()

GeomType AMP::Mesh::MeshElement::elementType ( ) const
inlineinherited

Return the element type.

Definition at line 39 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID(), and AMP::Mesh::MeshElementID::type().

◆ getElements()

template<uint8_t NG>
ElementListPtr AMP::Mesh::TriangleMeshElement< NG >::getElements ( const GeomType  type) const
overridevirtual

Return the elements composing the current element.

Reimplemented from AMP::Mesh::MeshElement.

◆ getElementsID()

template<uint8_t NG>
int AMP::Mesh::TriangleMeshElement< NG >::getElementsID ( const GeomType  type,
MeshElementID ID 
) const
overridevirtual

Return the IDs of the elements composing the current element.

Reimplemented from AMP::Mesh::MeshElement.

◆ getNeighbors()

template<uint8_t NG>
ElementListPtr AMP::Mesh::TriangleMeshElement< NG >::getNeighbors ( ) const
overridevirtual

Return the elements neighboring the current element.

Reimplemented from AMP::Mesh::MeshElement.

◆ getNeighborVertices()

virtual void AMP::Mesh::MeshElement::getNeighborVertices ( std::vector< Point > &  vertices) const
virtualinherited

Return the vertex coordinates for all neighboring elements excluding verticies composing the current element. Note the default implementation will call getNeighbors followed by getVertices, derived classes may implement a more efficient alternative

◆ getTypeID()

template<uint8_t NG>
const typeID & AMP::Mesh::TriangleMeshElement< NG >::getTypeID ( ) const
overridevirtual

Get the typeID.

Reimplemented from AMP::Mesh::MeshElement.

◆ getVertices()

virtual void AMP::Mesh::MeshElement::getVertices ( std::vector< Point > &  vertices) const
virtualinherited

Return the vertex coordinates composing the current element. For a node, this will return the equivalent to coord(). For an element, this will return the equivalent to getElements(Vertex)->coord(). Note the default implementation will call getElements followed by coord, derived classes may implement a more efficient alternative

Reimplemented in AMP::Mesh::structuredMeshElement.

◆ globalID()

template<uint8_t NG>
MeshElementID AMP::Mesh::TriangleMeshElement< NG >::globalID ( ) const
inlineoverridevirtual

Return the unique global ID of the element.

Reimplemented from AMP::Mesh::MeshElement.

Definition at line 48 of file TriangleMeshElement.h.

References AMP::Mesh::TriangleMeshElement< NG >::d_globalID.

◆ globalOwnerRank()

unsigned int AMP::Mesh::MeshElement::globalOwnerRank ( const Mesh mesh) const
inherited

Return the owner rank according to AMP_COMM_WORLD.

◆ isInBlock()

template<uint8_t NG>
bool AMP::Mesh::TriangleMeshElement< NG >::isInBlock ( int  id) const
overridevirtual

Check if the current element is in the given block.

Check if the current element is in the block specified by the given id

Parameters
idThe block id to check

Reimplemented from AMP::Mesh::MeshElement.

◆ isNull()

bool AMP::Mesh::MeshElement::isNull ( ) const
inlineinherited

Is the mesh element null.

Definition at line 36 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID(), and AMP::Mesh::MeshElementID::isNull().

◆ isOnBoundary()

template<uint8_t NG>
bool AMP::Mesh::TriangleMeshElement< NG >::isOnBoundary ( int  id) const
overridevirtual

Check if the current element is on the given boundary.

Check if the current element is on the boundary specified by the given id

Parameters
idThe boundary id to check

Reimplemented from AMP::Mesh::MeshElement.

◆ isOnSurface()

template<uint8_t NG>
bool AMP::Mesh::TriangleMeshElement< NG >::isOnSurface ( ) const
overridevirtual

Check if the element is on the surface.

Reimplemented from AMP::Mesh::MeshElement.

◆ nearest()

template<uint8_t NG>
MeshPoint< double > AMP::Mesh::TriangleMeshElement< NG >::nearest ( const MeshPoint< double > &  pos) const
overridevirtual

Calculate the nearest point on the element.

This function computes nearest point on/in the element to the given point

Parameters
[in]posCurrent position of the point

Reimplemented from AMP::Mesh::MeshElement.

◆ norm()

template<uint8_t NG>
MeshPoint< double > AMP::Mesh::TriangleMeshElement< NG >::norm ( ) const
overridevirtual

Return the normal to the current element (does not apply to all elements)

Reimplemented from AMP::Mesh::MeshElement.

◆ operator!=() [1/2]

bool AMP::Mesh::MeshElement::operator!= ( const MeshElement rhs) const
inlineinherited

Definition at line 43 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID().

◆ operator!=() [2/2]

bool AMP::Mesh::MeshElement::operator!= ( const MeshElementID rhs) const
inlineinherited

Definition at line 49 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID().

◆ operator<() [1/2]

bool AMP::Mesh::MeshElement::operator< ( const MeshElement rhs) const
inlineinherited

Definition at line 44 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID().

◆ operator<() [2/2]

bool AMP::Mesh::MeshElement::operator< ( const MeshElementID rhs) const
inlineinherited

Definition at line 50 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID().

◆ operator<=() [1/2]

bool AMP::Mesh::MeshElement::operator<= ( const MeshElement rhs) const
inlineinherited

Definition at line 46 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID().

◆ operator<=() [2/2]

bool AMP::Mesh::MeshElement::operator<= ( const MeshElementID rhs) const
inlineinherited

Definition at line 52 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID().

◆ operator=() [1/2]

template<uint8_t NG>
TriangleMeshElement & AMP::Mesh::TriangleMeshElement< NG >::operator= ( const TriangleMeshElement< NG > &  )

Assignment operator.

◆ operator=() [2/2]

template<uint8_t NG>
TriangleMeshElement & AMP::Mesh::TriangleMeshElement< NG >::operator= ( TriangleMeshElement< NG > &&  )

Move assignment operator.

◆ operator==() [1/2]

bool AMP::Mesh::MeshElement::operator== ( const MeshElement rhs) const
inlineinherited

Definition at line 42 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID().

◆ operator==() [2/2]

bool AMP::Mesh::MeshElement::operator== ( const MeshElementID rhs) const
inlineinherited

Definition at line 48 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID().

◆ operator>() [1/2]

bool AMP::Mesh::MeshElement::operator> ( const MeshElement rhs) const
inlineinherited

Definition at line 45 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID().

◆ operator>() [2/2]

bool AMP::Mesh::MeshElement::operator> ( const MeshElementID rhs) const
inlineinherited

Definition at line 51 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID().

◆ operator>=() [1/2]

bool AMP::Mesh::MeshElement::operator>= ( const MeshElement rhs) const
inlineinherited

Definition at line 47 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID().

◆ operator>=() [2/2]

bool AMP::Mesh::MeshElement::operator>= ( const MeshElementID rhs) const
inlineinherited

Definition at line 53 of file MeshElement.h.

References AMP::Mesh::MeshElement::globalID().

◆ print()

std::string AMP::Mesh::MeshElement::print ( uint8_t  indent = 0) const
inherited

Print info about the element.

This function returns debug info about the element

Parameters
indentThe number of spaces to indent new lines

◆ resetElemId()

template<uint8_t NG>
void AMP::Mesh::TriangleMeshElement< NG >::resetElemId ( const ElementID id)
inline

◆ volume()

template<uint8_t NG>
double AMP::Mesh::TriangleMeshElement< NG >::volume ( ) const
overridevirtual

Return the volume of the current element (does not apply to vertices)

Reimplemented from AMP::Mesh::MeshElement.

Member Data Documentation

◆ d_globalID

template<uint8_t NG>
MeshElementID AMP::Mesh::TriangleMeshElement< NG >::d_globalID
private

◆ d_mesh

template<uint8_t NG>
const TriangleMesh<NG>* AMP::Mesh::TriangleMeshElement< NG >::d_mesh
private

Definition at line 141 of file TriangleMeshElement.h.


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



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:43.
Comments on this page