1#ifndef included_AMP_Mesh
2#define included_AMP_Mesh
4#include "AMP/mesh/MeshID.h"
5#include "AMP/mesh/MeshIterator.h"
6#include "AMP/mesh/MeshParameters.h"
7#include "AMP/utils/AMP_MPI.h"
8#include "AMP/utils/Database.h"
9#include "AMP/utils/enable_shared_from_this.h"
30class MeshElementVectorBase;
65 typedef std::function<std::shared_ptr<Mesh>( std::shared_ptr<const MeshParameters> )>
83 explicit Mesh( std::shared_ptr<const MeshParameters> params );
134 static size_t maxProcs( std::shared_ptr<const MeshParameters> params );
142 virtual std::unique_ptr<Mesh>
clone()
const = 0;
171 virtual std::shared_ptr<Mesh>
Subset( std::string name )
const;
183 bool isGlobal =
true )
const;
459 virtual void displaceMesh( std::shared_ptr<const AMP::LinearAlgebra::Vector> x ) = 0;
469 virtual std::shared_ptr<AMP::LinearAlgebra::Vector>
484 std::ostream &out = std::cout,
485 const std::string &prefix =
"" );
Provides C++ wrapper around MPI routines.
Class to manage reading/writing restart data.
A pointer class to wrap a MeshElementVector.
A base class used to represent the end iterator.
A class used to iterate over elements in a Mesh.
A class used to abstract away mesh from an application.
const AMP_MPI & getComm() const
Get the communicator for the mesh.
std::string d_name
A name for the mesh.
std::function< std::shared_ptr< Mesh >(std::shared_ptr< const MeshParameters >)> generatorType
Generator for meshes.
const auto & getBoundingBox() const
Get the bounding box for the mesh.
virtual Movable isMeshMovable() const =0
Is the mesh movable.
std::vector< double > d_box_local
The bounding box for the mesh.
virtual std::vector< MeshID > getLocalMeshIDs() const
Mesh(std::shared_ptr< const MeshParameters > params)
Read in mesh files, partition domain, and prepare environment for simulation.
Mesh(int64_t fid, AMP::IO::RestartManager *manager)
Initialize the base class from file.
uint8_t d_max_gcw
The maximum ghost cell width.
virtual bool operator==(const Mesh &mesh) const =0
Check if two meshes are equal.
auto getGeometry() const
Return the geometry of the mesh.
virtual void displaceMesh(std::shared_ptr< const AMP::LinearAlgebra::Vector > x)=0
Displace the entire mesh.
static void printMeshHierarchy(const Mesh &mesh, std::ostream &out=std::cout, const std::string &prefix="")
Print the mesh hierarchy<iostream>
virtual MeshIterator isMember(const MeshIterator &it) const
Check if elements are in the mesh.
std::vector< double > d_box
The bounding box for the mesh.
static size_t maxProcs(std::shared_ptr< const MeshParameters > params)
Return the maximum number of processors that can be used with the mesh.
const auto & getLocalBoundingBox() const
Get the bounding box for the local part of the mesh.
virtual void displaceMesh(const std::vector< double > &x)=0
Displace the entire mesh.
bool operator!=(const Mesh &mesh) const
Check if two meshes are not equal.
uint8_t getDim() const
Get the physical dimension of the mesh.
virtual void registerChildObjects(AMP::IO::RestartManager *manager) const
Register child objects.
virtual MeshIterator getBlockIDIterator(const GeomType type, const int id, const int gcw=0) const
Return an MeshIterator over the given geometric objects on the given block ID set.
virtual std::vector< MeshID > getLocalBaseMeshIDs() const
static MeshIterator getIterator(SetOP OP, MeshIteratorEnd, MeshIteratorEnd)
virtual std::string getName() const
Get the mesh name.
virtual std::vector< int > getBlockIDs() const
Return the list of all boundary ID sets in the mesh.
virtual uint64_t positionHash() const =0
Identify if the position has moved.
AMP_MPI d_comm
The communicator over which the mesh is stored.
virtual void writeRestart(int64_t fid) const
Write restart data to file.
virtual bool isBaseMesh() const
Is the current mesh a base mesh.
GeomType getGeomType() const
Get the largest geometric type in the mesh.
virtual MeshIterator getIterator(const GeomType type, const int gcw=0) const
Return an MeshIterator over the given geometric objects.
uint8_t PhysicalDim
The physical dimension.
virtual std::unique_ptr< Mesh > clone() const =0
Virtual function to clone the mesh (allows us to properly copy the derived class)
std::unique_ptr< MeshElement > MeshElementPtr
Pointer to MeshElement and MeshElementVector.
static std::shared_ptr< Mesh > createView(const Mesh &mesh, const AMP::Database &db)
Create a view of existing mesh(s)
static MeshIterator getIterator(SetOP OP, const MeshIterator &A, const MeshIterator &B)
Return an MeshIterator constructed through a set operation of two other MeshIterators.
virtual std::vector< MeshID > getBaseMeshIDs() const
virtual ElementListPtr getElementParents(const MeshElement &elem, const GeomType type) const
Return the parent elements of the given mesh element.
static CompareResult compare(const Mesh &a, const Mesh &b)
Compare two meshes.
virtual std::vector< int > getBoundaryIDs() const
Return the list of all boundary ID sets in the mesh.
MeshID meshID() const
Get the mesh ID.
virtual std::string meshClass() const =0
Return a string with the mesh class name.
Mesh & operator=(const Mesh &old)=delete
virtual MeshIterator getSurfaceIterator(const GeomType type, const int gcw=0) const
Return an MeshIterator over the given geometric objects on the surface.
virtual MeshIterator getBoundaryIDIterator(const GeomType type, const int id, const int gcw=0) const
Iterate on the given boundary ID.
static std::vector< double > reduceBox(const std::vector< double > &, const AMP_MPI &)
Fill the domain box from the local box (requires communication)
static MeshIterator getIterator(SetOP OP, const MeshIterator &, MeshIteratorEnd)
virtual ~Mesh()
Deconstructor.
Movable
Enumeration for basic mesh-based quantities.
static MeshIterator getIterator(SetOP OP, MeshIteratorEnd, const MeshIterator &)
virtual std::shared_ptr< Mesh > Subset(std::string name) const
Subset a mesh given a mesh name.
virtual size_t numGhostElements(const GeomType type, const int gcw) const
virtual std::shared_ptr< Mesh > Subset(Mesh &mesh) const
Subset a mesh given another mesh.
std::shared_ptr< Geometry::Geometry > d_geometry
The geometry parameters.
uint8_t getMaxGhostWidth() const
Get the maximum ghost width.
virtual size_t numLocalElements(const GeomType type) const
virtual std::shared_ptr< AMP::LinearAlgebra::Vector > getPositionVector(std::string name, const int gcw=0) const
Get a vector of the coordinates of the nodes.
virtual bool isMember(const MeshElementID &id) const
Check if an element is in the mesh.
static size_t estimateMeshSize(std::shared_ptr< const MeshParameters > params)
Estimate the number of elements in the mesh.
virtual bool containsElement(const MeshElementID &id) const
Mesh(const std::shared_ptr< Mesh > &old_mesh, MeshIterator &iterator)
Construct a new mesh from an existing mesh.
Mesh()
Empty constructor for a mesh.
virtual std::vector< MeshID > getAllMeshIDs() const
MeshID d_meshID
A unique id for each mesh.
virtual size_t numGlobalElements(const GeomType type) const
virtual MeshElementPtr getElement(const MeshElementID &id) const
Return a mesh element given it's id.
virtual std::shared_ptr< Mesh > Subset(MeshID meshID) const
Subset a mesh given a MeshID.
GeomType GeomDim
The geometric dimension.
auto getGeometry()
Return the geometry of the mesh.
virtual std::shared_ptr< Mesh > Subset(const MeshIterator &iterator, bool isGlobal=true) const
Subset a mesh given a MeshIterator.
virtual void setName(std::string name)
Set the mesh name.
Enhancement of std::enable_shared_from_this.
GeomType
Enumeration for basic mesh-based quantities.
SetOP
Enumeration for basic mesh-based quantities.
A structure used to identify the mesh element.
A structure used to identify the mesh.
Structure used to compare matricies.
bool surface
surface ids match
bool domain
domain matches
bool block
block ids match
bool operator==(const CompareResult &) const
bool geometry
geometries match
bool equal
Meshes are equal (operator==)
CompareResult(int state=0)