11 #include <axom/fmt.hpp>
12 #include <axom/slic.hpp>
21 Mesh::Mesh(
const std::string& meshfile,
const std::string& meshtag,
int refine_serial,
int refine_parallel,
30 Mesh::Mesh(mfem::Mesh&& mesh,
const std::string& meshtag,
int refine_serial,
int refine_parallel, MPI_Comm comm)
38 Mesh::Mesh(mfem::ParMesh&& mesh,
const std::string& meshtag) : mesh_tag_(meshtag)
40 auto meshtmp = std::make_unique<mfem::ParMesh>(std::move(mesh));
41 meshtmp->EnsureNodes();
42 meshtmp->ExchangeFaceNbrData();
49 void Mesh::createDomains()
64 SLIC_ERROR_IF(domains_.find(domain_name) == domains_.end(),
65 axom::fmt::format(
"Could not find domain named {0} in mesh with tag {1}", domain_name, mesh_tag_));
66 return domains_.at(domain_name);
70 std::function<
bool(std::vector<vec2>,
int)> func)
72 SLIC_ERROR_IF(domains_.find(domain_name) != domains_.end(),
73 axom::fmt::format(
"A domain named {0} already exists in mesh with tag {1}", domain_name, mesh_tag_));
75 return domain(domain_name);
79 std::function<
bool(std::vector<vec3>,
int)> func)
81 SLIC_ERROR_IF(domains_.find(domain_name) != domains_.end(),
82 axom::fmt::format(
"A domain named {0} already exists in mesh with tag {1}", domain_name, mesh_tag_));
84 return domain(domain_name);
88 std::function<
bool(std::vector<vec2>,
int)> func)
90 SLIC_ERROR_IF(domains_.find(domain_name) != domains_.end(),
91 axom::fmt::format(
"A domain named {0} already exists in mesh with tag {1}", domain_name, mesh_tag_));
93 return domain(domain_name);
97 std::function<
bool(std::vector<vec3>,
int)> func)
99 SLIC_ERROR_IF(domains_.find(domain_name) != domains_.end(),
100 axom::fmt::format(
"A domain named {0} already exists in mesh with tag {1}", domain_name, mesh_tag_));
102 return domain(domain_name);
Class for encapsulating the dual vector space of a finite element space (i.e. the space of linear for...
Class for encapsulating the critical MFEM components of a primal finite element field.
mfem::ParFiniteElementSpace & space()
Returns a non-owning reference to the internal FESpace.
serac::Domain & entireBody() const
Returns domain corresponding to the entire mesh.
Mesh(mfem::Mesh &&mesh, const std::string &meshtag, int serial_refine=0, int parallel_refine=0, MPI_Comm comm=MPI_COMM_WORLD)
Construct from existing serial mfem mesh.
serac::Domain & addDomainOfBodyElements(const std::string &domain_name, std::function< bool(std::vector< vec3 >, int)> func)
create domain of 3D elements with specified name The second argument is a function taking a std::vect...
static std::string internalBoundaryName()
Returns string, name used to access the internal boundary elements.
const mfem::ParFiniteElementSpace & shapeDisplacementSpace()
get space associated with shape displacement
serac::Domain & internalBoundary() const
Returns domain boundary corresponding to the internal boundary elements.
serac::Domain & addDomainOfBoundaryElements(const std::string &domain_name, std::function< bool(std::vector< vec3 >, int)> func)
create domain of 3D boundary elements with specified name The second argument is a function taking a ...
serac::FiniteElementState newShapeDisplacement()
create new shape displacement
static std::string entireBoundaryName()
Returns string, name used to access the entire boundary.
serac::Domain & entireBoundary() const
Returns domain boundary corresponding to the entire mesh.
serac::FiniteElementDual newShapeDisplacementDual()
create new shape displacement sensitivity
static std::string entireBodyName()
Returns string, name used to access the entire domain body.
const std::string & tag() const
Returns string tag for mesh.
MPI_Comm getComm() const
Returns parallel communicator.
serac::Domain & domain(const std::string &domain_name) const
Returns registered domain with specified name.
static FiniteElementDual & shapeDisplacementDual(const std::string &mesh_tag)
Get the shape displacement finite element dual.
static FiniteElementState & shapeDisplacement(const std::string &mesh_tag)
Get the shape displacement finite element state.
static mfem::ParMesh & setMesh(std::unique_ptr< mfem::ParMesh > pmesh, const std::string &mesh_tag)
Gives ownership of mesh to StateManager.
This file contains helper traits and enumerations for classifying finite elements.
This contains a class that represents the dual of a finite element vector space, i....
Serac mesh class which assists in constructing the appropriate parallel mfem meshes and registering a...
This file contains helper functions for importing and managing various mesh objects.
std::unique_ptr< mfem::ParMesh > refineAndDistribute(mfem::Mesh &&serial_mesh, const int refine_serial, const int refine_parallel, const MPI_Comm comm)
Finalizes a serial mesh into a refined parallel mesh.
Accelerator functionality.
Domain InteriorFaces(const mesh_t &mesh)
constructs a domain from all the interior face elements in a mesh
mfem::Mesh buildMeshFromFile(const std::string &mesh_file)
Constructs an MFEM mesh from a file.
Domain EntireBoundary(const mesh_t &mesh)
constructs a domain from all the boundary elements in a mesh
Domain EntireDomain(const mesh_t &mesh)
constructs a domain from all the elements in a mesh
This file contains the declaration of the StateManager class.
a class for representing a geometric region that can be used for integration
static Domain ofBoundaryElements(const mesh_t &mesh, std::function< bool(std::vector< vec2 >, int)> func)
create a domain from some subset of the boundary elements (spatial dim == geometry dim + 1) in an mfe...
static Domain ofElements(const mesh_t &mesh, std::function< bool(std::vector< vec2 >, int)> func)
create a domain from some subset of the elements (spatial dim == geometry dim) in an mfem::Mesh