Advanced Multi-Physics (AMP)
On-Line Documentation
MeshGeometry.h
Go to the documentation of this file.
1#ifndef included_AMP_MeshGeometry
2#define included_AMP_MeshGeometry
3
4#include "AMP/geometry/Geometry.h"
5#include "AMP/mesh/Mesh.h"
6#include "AMP/mesh/MeshUtilities.h"
7
8#include <memory>
9#include <vector>
10
11
12namespace AMP::Geometry {
13
14
20class MeshGeometry final : public Geometry
21{
22public:
24 MeshGeometry( std::shared_ptr<AMP::Mesh::Mesh> mesh );
25
27 virtual ~MeshGeometry() = default;
28
30 MeshGeometry( const MeshGeometry & ) = delete;
31
33 MeshGeometry &operator=( const MeshGeometry & ) = delete;
34
36 std::string getName() const override { return "MeshGeometry"; }
37
43 bool isConvex() const override;
44
51 Point nearest( const Point &pos ) const override;
52
63 double distance( const Point &pos, const Point &dir ) const override;
64
72 bool inside( const Point &pos ) const override;
73
79 int NSurface() const override;
80
87 int surface( const Point &x ) const override;
88
97 Point surfaceNorm( const Point &x ) const override;
98
104 Point centroid() const override;
105
111 std::pair<Point, Point> box() const override;
112
118 double volume() const override;
119
126 void displace( const double *x ) override;
127
129 std::unique_ptr<AMP::Geometry::Geometry> clone() const override;
130
132 const AMP::Mesh::Mesh &getMesh() const { return *d_mesh; }
133
135 bool operator==( const Geometry &rhs ) const override;
136
137 MeshGeometry( int64_t );
138
139protected: // Write/read restart data
140 void writeRestart( int64_t ) const override;
141
142private:
143 void updateCache() const; // Update cached data if underlying mesh has moved
144
145private: // Internal data
146 std::shared_ptr<AMP::Mesh::Mesh> d_mesh; // Underlying mesh
147 std::vector<int> d_surfaceIds; // Surface ids
148 mutable uint64_t d_pos_hash; // Position hash to update cached data
149 mutable bool d_isConvex; // Check if the mesh is convex
150 mutable double d_volume; // Cached value for the volume
151 mutable Point d_centroid; // Cached value for the centroid
152 AMP::Mesh::ElementFinder d_find; // Nearest element finder
153 mutable kdtree2<3, bool> d_inside; // Lookup to find points inside/outside
154};
155
156
157} // namespace AMP::Geometry
158
159
160#endif
A class used to abstract away geometry information from an application or mesh.
Definition Geometry.h:29
A class used to abstract away geometry information from an application or mesh.
MeshGeometry(const MeshGeometry &)=delete
Copy constructor.
int surface(const Point &x) const override
Get the surface id.
std::vector< int > d_surfaceIds
std::pair< Point, Point > box() const override
Return the bounding box.
double distance(const Point &pos, const Point &dir) const override
Calculate the distance to the object given a ray.
Point nearest(const Point &pos) const override
Calculate the nearest point on the surface.
Point centroid() const override
Return the centroid.
void displace(const double *x) override
Displace the entire geometry.
int NSurface() const override
Get the number of surfaces.
kdtree2< 3, bool > d_inside
virtual ~MeshGeometry()=default
Destructor.
bool operator==(const Geometry &rhs) const override
Check if two geometries are equal.
AMP::Mesh::ElementFinder d_find
Point surfaceNorm(const Point &x) const override
Return the outward normal to a surface.
double volume() const override
Return the volume.
const AMP::Mesh::Mesh & getMesh() const
Get the mesh.
MeshGeometry & operator=(const MeshGeometry &)=delete
Assignment operator.
std::shared_ptr< AMP::Mesh::Mesh > d_mesh
std::unique_ptr< AMP::Geometry::Geometry > clone() const override
Clone the object.
void writeRestart(int64_t) const override
Write restart data to file.
bool inside(const Point &pos) const override
Is the point in the geometry.
bool isConvex() const override
Is the object convex.
std::string getName() const override
Get the name of the geometry.
MeshGeometry(std::shared_ptr< AMP::Mesh::Mesh > mesh)
Default constructor.
A class used to help find the nearest element to a point.
A class used to abstract away mesh from an application.
Definition Mesh.h:57
A class used to to perform kd-tree based operations.
Definition kdtree2.h:28



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