Advanced Multi-Physics (AMP)
On-Line Documentation
Public Types | Public Member Functions | Protected Member Functions | List of all members
AMP::Mesh::MeshElement Class Reference

#include <MeshElement.h>

Inheritance diagram for AMP::Mesh::MeshElement:
Inheritance graph
[legend]

Public Types

using ElementListPtr = MeshElementVectorPtr
 

Public Member Functions

virtual Point centroid () const
 Return the centroid of the element.
 
virtual std::unique_ptr< MeshElementclone () const
 Clone the element.
 
virtual bool containsPoint (const Point &pos, double TOL=1e-12) const
 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.
 
virtual Point coord () const
 Return the coordinates of the vertex (only applies to vertices)
 
double coord (int i) const
 Return the coordinate of the vertex.
 
virtual double distance (const Point &pos, const Point &dir) const
 Calculate the distance to the element given a ray.
 
virtual std::string elementClass () const
 Return the element class.
 
GeomType elementType () const
 Return the element type.
 
virtual ElementListPtr getElements (const GeomType type) const
 Return the elements composing the current element.
 
virtual int getElementsID (const GeomType type, MeshElementID *ID) const
 Return the IDs of the elements composing the current element.
 
virtual ElementListPtr getNeighbors () const
 
virtual void getNeighborVertices (std::vector< Point > &vertices) const
 
virtual const typeIDgetTypeID () const
 Return the typeID of the underlying element.
 
virtual void getVertices (std::vector< Point > &vertices) const
 
virtual MeshElementID globalID () const
 Return the unique global ID of the element.
 
unsigned int globalOwnerRank (const Mesh &mesh) const
 Return the owner rank according to AMP_COMM_WORLD.
 
virtual bool isInBlock (int id) const
 Check if the current element is in the given block.
 
bool isNull () const
 Is the mesh element null.
 
virtual bool isOnBoundary (int id) const
 Check if the current element is on the given boundary.
 
virtual bool isOnSurface () const
 Check if the element is on the surface.
 
 MeshElement ()=default
 Empty constructor for a MeshElement.
 
virtual Point nearest (const Point &pos) const
 Calculate the nearest point on the element.
 
virtual Point norm () const
 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
 
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.
 
virtual double volume () const
 Return the volume of the current element (does not apply to vertices)
 
virtual ~MeshElement ()=default
 Destructor for a MeshElement.
 

Protected Member Functions

 MeshElement (const MeshElement &)=default
 
 MeshElement (MeshElement &&)=default
 
MeshElementoperator= (const MeshElement &)=default
 
MeshElementoperator= (MeshElement &&)=default
 

Detailed Description

Definition at line 26 of file MeshElement.h.

Member Typedef Documentation

◆ ElementListPtr

Definition at line 29 of file MeshElement.h.

Constructor & Destructor Documentation

◆ MeshElement() [1/3]

AMP::Mesh::MeshElement::MeshElement ( )
default

Empty constructor for a MeshElement.

◆ ~MeshElement()

virtual AMP::Mesh::MeshElement::~MeshElement ( )
virtualdefault

Destructor for a MeshElement.

◆ MeshElement() [2/3]

AMP::Mesh::MeshElement::MeshElement ( const MeshElement )
protecteddefault

◆ MeshElement() [3/3]

AMP::Mesh::MeshElement::MeshElement ( MeshElement &&  )
protecteddefault

Member Function Documentation

◆ centroid()

virtual Point AMP::Mesh::MeshElement::centroid ( ) const
virtual

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 in AMP::Mesh::libmeshMeshElement, AMP::Mesh::structuredMeshElement, and AMP::Mesh::TriangleMeshElement< NG >.

◆ clone()

virtual std::unique_ptr< MeshElement > AMP::Mesh::MeshElement::clone ( ) const
virtual

◆ containsPoint() [1/2]

virtual bool AMP::Mesh::MeshElement::containsPoint ( const Point pos,
double  TOL = 1e-12 
) const
virtual

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 in AMP::Mesh::TriangleMeshElement< NG >, AMP::Mesh::libmeshMeshElement, and AMP::Mesh::structuredMeshElement.

◆ containsPoint() [2/2]

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

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]

virtual Point AMP::Mesh::MeshElement::coord ( ) const
virtual

Return the coordinates of the vertex (only applies to vertices)

Reimplemented in AMP::Mesh::libmeshMeshElement, AMP::Mesh::TriangleMeshElement< NG >, and AMP::Mesh::structuredMeshElement.

◆ coord() [2/2]

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

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 coord().

Referenced by coord().

◆ distance()

virtual double AMP::Mesh::MeshElement::distance ( const Point pos,
const Point dir 
) const
virtual

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 in AMP::Mesh::structuredMeshElement, and AMP::Mesh::TriangleMeshElement< NG >.

◆ elementClass()

virtual std::string AMP::Mesh::MeshElement::elementClass ( ) const
virtual

◆ elementType()

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

Return the element type.

Definition at line 39 of file MeshElement.h.

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

◆ getElements()

virtual ElementListPtr AMP::Mesh::MeshElement::getElements ( const GeomType  type) const
virtual

◆ getElementsID()

virtual int AMP::Mesh::MeshElement::getElementsID ( const GeomType  type,
MeshElementID ID 
) const
virtual

Return the IDs of the elements composing the current element.

Reimplemented in AMP::Mesh::libmeshMeshElement, AMP::Mesh::TriangleMeshElement< NG >, and AMP::Mesh::structuredMeshElement.

◆ getNeighbors()

virtual ElementListPtr AMP::Mesh::MeshElement::getNeighbors ( ) const
virtual

Return the elements neighboring the current element. One neighbor is returned for each side of the element. If the side is on the surface, then it's neighbor is null. For Verticies, a list of all vertices that share an element is returned. This list is in unsorted order.

Reimplemented in AMP::Mesh::structuredMeshElement, AMP::Mesh::libmeshMeshElement, AMP::Mesh::structuredMeshElement, and AMP::Mesh::TriangleMeshElement< NG >.

◆ getNeighborVertices()

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

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()

virtual const typeID & AMP::Mesh::MeshElement::getTypeID ( ) const
virtual

◆ getVertices()

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

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()

virtual MeshElementID AMP::Mesh::MeshElement::globalID ( ) const
virtual

◆ globalOwnerRank()

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

Return the owner rank according to AMP_COMM_WORLD.

◆ isInBlock()

virtual bool AMP::Mesh::MeshElement::isInBlock ( int  id) const
virtual

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 in AMP::Mesh::libmeshMeshElement, AMP::Mesh::structuredMeshElement, and AMP::Mesh::TriangleMeshElement< NG >.

◆ isNull()

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

Is the mesh element null.

Definition at line 36 of file MeshElement.h.

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

◆ isOnBoundary()

virtual bool AMP::Mesh::MeshElement::isOnBoundary ( int  id) const
virtual

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 in AMP::Mesh::libmeshMeshElement, AMP::Mesh::structuredMeshElement, and AMP::Mesh::TriangleMeshElement< NG >.

◆ isOnSurface()

virtual bool AMP::Mesh::MeshElement::isOnSurface ( ) const
virtual

Check if the element is on the surface.

Reimplemented in AMP::Mesh::libmeshMeshElement, AMP::Mesh::structuredMeshElement, and AMP::Mesh::TriangleMeshElement< NG >.

◆ nearest()

virtual Point AMP::Mesh::MeshElement::nearest ( const Point pos) const
virtual

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 in AMP::Mesh::structuredMeshElement, and AMP::Mesh::TriangleMeshElement< NG >.

◆ norm()

virtual Point AMP::Mesh::MeshElement::norm ( ) const
virtual

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

Reimplemented in AMP::Mesh::libmeshMeshElement, AMP::Mesh::structuredMeshElement, and AMP::Mesh::TriangleMeshElement< NG >.

◆ operator!=() [1/2]

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

Definition at line 43 of file MeshElement.h.

References globalID().

◆ operator!=() [2/2]

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

Definition at line 49 of file MeshElement.h.

References globalID().

◆ operator<() [1/2]

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

Definition at line 44 of file MeshElement.h.

References globalID().

◆ operator<() [2/2]

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

Definition at line 50 of file MeshElement.h.

References globalID().

◆ operator<=() [1/2]

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

Definition at line 46 of file MeshElement.h.

References globalID().

◆ operator<=() [2/2]

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

Definition at line 52 of file MeshElement.h.

References globalID().

◆ operator=() [1/2]

MeshElement & AMP::Mesh::MeshElement::operator= ( const MeshElement )
protecteddefault

◆ operator=() [2/2]

MeshElement & AMP::Mesh::MeshElement::operator= ( MeshElement &&  )
protecteddefault

◆ operator==() [1/2]

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

Definition at line 42 of file MeshElement.h.

References globalID().

◆ operator==() [2/2]

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

Definition at line 48 of file MeshElement.h.

References globalID().

◆ operator>() [1/2]

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

Definition at line 45 of file MeshElement.h.

References globalID().

◆ operator>() [2/2]

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

Definition at line 51 of file MeshElement.h.

References globalID().

◆ operator>=() [1/2]

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

Definition at line 47 of file MeshElement.h.

References globalID().

◆ operator>=() [2/2]

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

Definition at line 53 of file MeshElement.h.

References globalID().

◆ print()

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

Print info about the element.

This function returns debug info about the element

Parameters
indentThe number of spaces to indent new lines

◆ volume()

virtual double AMP::Mesh::MeshElement::volume ( ) const
virtual

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

Reimplemented in AMP::Mesh::libmeshMeshElement, AMP::Mesh::structuredMeshElement, and AMP::Mesh::TriangleMeshElement< NG >.


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



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