Advanced Multi-Physics (AMP)
On-Line Documentation
structuredMeshElement.h
Go to the documentation of this file.
1#ifndef included_AMP_structuredMeshElement
2#define included_AMP_structuredMeshElement
3
4#include "AMP/mesh/structured/BoxMesh.h"
5
6#include <vector>
7
8
9namespace AMP::Mesh {
10
11
20{
21public:
24
27
30
33
39
41 void reset();
42
44 void reset( const BoxMesh::MeshElementIndex &index, const AMP::Mesh::BoxMesh *mesh );
45
52
54 const auto &getIndex() const { return d_index; }
55
56
57public: // Functions derived from MeshElement
58 const typeID &getTypeID() const override;
59 MeshElementID globalID() const override { return d_mesh->convert( d_index ); }
60 inline std::string elementClass() const override { return "structuredMeshElement"; }
61 ElementListPtr getElements( const GeomType ) const override;
62 int getElementsID( const GeomType, MeshElementID * ) const override;
63 ElementListPtr getNeighbors() const override;
64 Point centroid() const override;
65 double volume() const override;
66 Point norm() const override;
67 Point coord() const override final
68 {
69 Point x;
71 d_mesh->coord( d_index, x.data() );
72 return x;
73 }
74 MeshPoint<double> nearest( const MeshPoint<double> &pos ) const override;
75 double distance( const MeshPoint<double> &pos, const MeshPoint<double> &dir ) const override;
76 bool containsPoint( const Point &pos, double TOL = 1e-12 ) const override;
77 bool isOnSurface() const override;
78 bool isOnBoundary( int id ) const override;
79 bool isInBlock( int id ) const override;
80 void getVertices( std::vector<Point> &vertices ) const override;
83
84public: // Expert interfaces
86
87protected:
88 // Clone the iterator
89 std::unique_ptr<MeshElement> clone() const override;
90
91 // Internal data
92 GeomType d_meshType; // Mesh logical dimension
93 unsigned char d_physicalDim; // Mesh physical dimension
95 const AMP::Mesh::BoxMesh *d_mesh; // Pointer to mesh
96
97 // Helper functions
98 void getElementIndex( const GeomType type, int &N, BoxMesh::MeshElementIndex *index ) const;
99 std::array<int8_t, 3> getBC() const;
100
101 // Reset just the mesh element
102 inline void reset( const BoxMesh::MeshElementIndex &index ) { d_index = index; }
103
104 friend class AMP::Mesh::BoxMesh;
106};
107
108
109} // namespace AMP::Mesh
110
111
112#endif
Structure to uniquely identify an element.
Definition BoxMesh.h:109
A class used to represent a logically rectangular box mesh.
Definition BoxMesh.h:71
virtual void coord(const MeshElementIndex &index, double *pos) const =0
Return a mesh element's coordinates given it's id.
MeshElementID convert(const MeshElementIndex &id) const
Convert the MeshElementIndex to the MeshElementID.
A pointer class to wrap a MeshElementVector.
virtual ElementListPtr getElements(const GeomType type) const
Return the elements composing the current element.
virtual ElementListPtr getNeighbors() const
constexpr TYPE * data() noexcept
Definition MeshPoint.h:105
constexpr void setNdim(uint8_t N)
Definition MeshPoint.h:102
A derived class used to define a mesh element.
structuredMeshElement(const structuredMeshElement &)
Copy constructor.
Point centroid() const override
Return the centroid of the element.
ElementListPtr getElements(const GeomType) const override
Return the elements composing the current element.
void reset(const BoxMesh::MeshElementIndex &index, const AMP::Mesh::BoxMesh *mesh)
Reset the internal data to the given element.
void getVertices(std::vector< Point > &vertices) const override
MeshPoint< double > nearest(const MeshPoint< double > &pos) const override
Calculate the nearest point on the element.
structuredMeshElement()
Empty constructor for a MeshElement.
virtual ~structuredMeshElement()
De-constructor for a MeshElement.
structuredMeshElement(const BoxMesh::MeshElementIndex &index, const AMP::Mesh::BoxMesh *mesh)
std::unique_ptr< MeshElement > clone() const override
Clone the element.
int getElementsID(const GeomType, MeshElementID *) const override
Return the IDs of the elements composing the current element.
int getNeighborIndex(BoxMesh::MeshElementIndex *index) const
ElementListPtr getParents(GeomType type) const
Get the parents of the given element.
const auto & getIndex() const
Return the index of the element.
std::string elementClass() const override
Return the element class.
bool isOnSurface() const override
Check if the element is on the surface.
MeshElementID globalID() const override
Return the unique global ID of the element.
double distance(const MeshPoint< double > &pos, const MeshPoint< double > &dir) const override
Calculate the distance to the element given a ray.
const typeID & getTypeID() const override
Return the typeID of the underlying element.
void reset(const BoxMesh::MeshElementIndex &index)
structuredMeshElement & operator=(const structuredMeshElement &)
Assignment operator.
void reset()
Reset the internal data to an empty element.
std::array< int8_t, 3 > getBC() const
const AMP::Mesh::BoxMesh * d_mesh
Point coord() const override final
Return the coordinates of the vertex (only applies to vertices)
bool isOnBoundary(int id) const override
Check if the current element is on the given boundary.
bool containsPoint(const Point &pos, double TOL=1e-12) const override
Return true if the element contains the point.
ElementListPtr getNeighbors() const override
double volume() const override
Return the volume of the current element (does not apply to vertices)
bool isInBlock(int id) const override
Check if the current element is in the given block.
void getElementIndex(const GeomType type, int &N, BoxMesh::MeshElementIndex *index) const
Point norm() const override
Return the normal to the current element (does not apply to all elements)
GeomType
Enumeration for basic mesh-based quantities.
Definition MeshID.h:12
A structure used to identify the mesh element.
Definition MeshID.h:156
Class to store type info.
Definition typeid.h:210



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:40.
Comments on this page