Advanced Multi-Physics (AMP)
On-Line Documentation
MeshUtilities.h
Go to the documentation of this file.
1#ifndef included_AMP_MeshUtilities
2#define included_AMP_MeshUtilities
3
4
5#include "AMP/geometry/Geometry.h"
6#include "AMP/mesh/Mesh.h"
7#include "AMP/mesh/MeshElement.h"
8#include "AMP/utils/Array.h"
9#include "AMP/utils/MeshPoint.h"
10#include "AMP/utils/kdtree2.h"
11
12
13namespace AMP::Mesh {
14
15
24std::tuple<std::vector<Point>, std::vector<MeshElementID>> sample( const Mesh &mesh, double dx );
25
26
33std::vector<Point> sample( const MeshElement &elem, double dx );
34
35
43Array<double> volumeOverlap( const AMP::Geometry::Geometry &geom, const std::vector<int> &N );
44
45
52{
53public:
56
58 ElementFinder( std::shared_ptr<AMP::Mesh::Mesh> mesh );
59
61 ElementFinder( std::shared_ptr<AMP::Mesh::Mesh> mesh, AMP::Mesh::MeshIterator it );
62
64 ElementFinder( const ElementFinder & ) = delete;
65
68
71
73 std::pair<std::unique_ptr<MeshElement>, Point> nearest( const Point &x ) const;
74
85 double distance( const Point &pos, const Point &dir ) const;
86
88 inline const auto &getTree() const { return d_tree; }
89
91 void update() const;
92
93private:
94 void initialize() const;
95
96private:
97 std::shared_ptr<AMP::Mesh::Mesh> d_mesh;
98 mutable uint64_t d_pos_hash;
100 mutable double d_dist;
102};
103
104
105} // namespace AMP::Mesh
106
107
108#endif
A class used to abstract away geometry information from an application or mesh.
Definition Geometry.h:29
A class used to help find the nearest element to a point.
const auto & getTree() const
Return the underlying tree.
double distance(const Point &pos, const Point &dir) const
Calculate the distance to the object given a ray.
std::pair< std::unique_ptr< MeshElement >, Point > nearest(const Point &x) const
Get the nearest element and point.
kdtree2< 3, AMP::Mesh::MeshElementID > d_tree
ElementFinder()
Empty constructor.
AMP::Mesh::MeshIterator d_elements
ElementFinder(ElementFinder &&)=default
Move constructor.
ElementFinder(std::shared_ptr< AMP::Mesh::Mesh > mesh, AMP::Mesh::MeshIterator it)
Empty constructor.
ElementFinder(std::shared_ptr< AMP::Mesh::Mesh > mesh)
Empty constructor.
ElementFinder(const ElementFinder &)=delete
Copy constructor.
void update() const
Ensure the tree is up-to-date.
ElementFinder & operator=(ElementFinder &&)=default
Move operator.
std::shared_ptr< AMP::Mesh::Mesh > d_mesh
A class used to iterate over elements in a Mesh.
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
Array< double > volumeOverlap(const AMP::Geometry::Geometry &geom, const std::vector< int > &N)
Get a grid with the overlap with the given geometry.
std::tuple< std::vector< Point >, std::vector< MeshElementID > > sample(const Mesh &mesh, double dx)
Get points in the mesh.



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