https://mooseframework.inl.gov
MFEMDomainSubMesh.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #ifdef MOOSE_MFEM_ENABLED
11 
12 #include "MFEMDomainSubMesh.h"
13 #include "MFEMProblem.h"
14 
16 
19 {
22  params.addClassDescription("Class to construct an MFEMSubMesh formed from the subspace of the "
23  "parent mesh restricted to the set of user-specified subdomains.");
24  params.addParam<BoundaryName>("submesh_boundary", "Name to assign submesh boundary.");
25  return params;
26 }
27 
29  : MFEMSubMesh(parameters),
30  MFEMBlockRestrictable(parameters, getMFEMProblem().mesh().getMFEMParMesh())
31 {
32 }
33 
34 void
36 {
37  _submesh = std::make_shared<mfem::ParSubMesh>(
38  mfem::ParSubMesh::CreateFromDomain(getMesh(), getSubdomainAttributes()));
39  _submesh->attribute_sets.attr_sets = getMesh().attribute_sets.attr_sets;
40  _submesh->bdr_attribute_sets.attr_sets = getMesh().bdr_attribute_sets.attr_sets;
41 
42  if (isParamSetByUser("submesh_boundary"))
43  {
44  const BoundaryName & submesh_boundary = getParam<BoundaryName>("submesh_boundary");
45  _submesh->bdr_attribute_sets.CreateAttributeSet(submesh_boundary);
46  _submesh->bdr_attribute_sets.AddToAttributeSet(submesh_boundary,
47  getMesh().bdr_attributes.Max() + 1);
48  }
49 }
50 
51 #endif
MeshBase & mesh
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const mfem::Array< int > & getSubdomainAttributes()
static InputParameters validParams()
static InputParameters validParams()
Definition: MFEMSubMesh.C:16
Constructs and stores an mfem::ParSubMesh object as as a restriction of the parent mesh to the set of...
Base class for construction of a mfem::ParSubMesh object.
Definition: MFEMSubMesh.h:22
MFEMDomainSubMesh(const InputParameters &parameters)
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
const mfem::ParMesh & getMesh() const
registerMooseObject("MooseApp", MFEMDomainSubMesh)
bool isParamSetByUser(const std::string &name) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
Definition: MooseBase.h:205
std::shared_ptr< mfem::ParSubMesh > _submesh
Stores the constructed submesh.
Definition: MFEMSubMesh.h:39
Base class for construction of an object that is restricted to a subset of subdomains of the problem ...
virtual void buildSubMesh() override
Constructs the submesh.