https://mooseframework.inl.gov
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
MFEMBlockRestrictable Class Reference

Base class for construction of an object that is restricted to a subset of subdomains of the problem mesh. More...

#include <MFEMBlockRestrictable.h>

Inheritance diagram for MFEMBlockRestrictable:
[legend]

Public Member Functions

 MFEMBlockRestrictable (const InputParameters &parameters, const mfem::ParMesh &mfem_mesh)
 
mfem::Array< intsubdomainsToAttributes (const std::vector< SubdomainName > &subdomain_names)
 
std::vector< std::string > subdomainsToStrings (const std::vector< SubdomainName > &subdomain_names)
 
bool isSubdomainRestricted ()
 Returns a bool indicating if the object is restricted to a subset of subdomains. More...
 
const mfem::Array< int > & getSubdomainAttributes ()
 
mfem::Array< int > & getSubdomainMarkers ()
 
const mfem::ParMesh & getMesh () const
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Attributes

const mfem::ParMesh & _mfem_mesh
 Stores the names of the subdomains. More...
 
std::vector< SubdomainName > _subdomain_names
 Stores the names of the subdomains. More...
 
mfem::Array< int_subdomain_attributes
 Array storing subdomain attribute IDs for this object. More...
 
mfem::Array< int_subdomain_markers
 Boolean array indicating which subdomains are active in this object. More...
 

Detailed Description

Base class for construction of an object that is restricted to a subset of subdomains of the problem mesh.

Definition at line 23 of file MFEMBlockRestrictable.h.

Constructor & Destructor Documentation

◆ MFEMBlockRestrictable()

MFEMBlockRestrictable::MFEMBlockRestrictable ( const InputParameters parameters,
const mfem::ParMesh &  mfem_mesh 
)

Definition at line 29 of file MFEMBlockRestrictable.C.

31  : _mfem_mesh(mfem_mesh),
32  _subdomain_names(parameters.get<std::vector<SubdomainName>>("block")),
34 {
36  if (!_subdomain_attributes.IsEmpty())
37  mfem::common::AttrToMarker(
39 }
mfem::Array< int > subdomainsToAttributes(const std::vector< SubdomainName > &subdomain_names)
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
const mfem::ParMesh & _mfem_mesh
Stores the names of the subdomains.
std::vector< SubdomainName > _subdomain_names
Stores the names of the subdomains.
mfem::Array< int > _subdomain_markers
Boolean array indicating which subdomains are active in this object.
mfem::Array< int > _subdomain_attributes
Array storing subdomain attribute IDs for this object.

Member Function Documentation

◆ getMesh()

const mfem::ParMesh& MFEMBlockRestrictable::getMesh ( ) const
inline

Definition at line 38 of file MFEMBlockRestrictable.h.

Referenced by MFEMDomainSubMesh::buildSubMesh(), MFEMCutTransitionSubMesh::buildSubMesh(), and subdomainsToAttributes().

38 { return _mfem_mesh; }
const mfem::ParMesh & _mfem_mesh
Stores the names of the subdomains.

◆ getSubdomainAttributes()

const mfem::Array<int>& MFEMBlockRestrictable::getSubdomainAttributes ( )
inline

Definition at line 36 of file MFEMBlockRestrictable.h.

Referenced by MFEMDomainSubMesh::buildSubMesh(), MFEMCutTransitionSubMesh::labelMesh(), and MFEMCutTransitionSubMesh::setAttributes().

36 { return _subdomain_attributes; }
mfem::Array< int > _subdomain_attributes
Array storing subdomain attribute IDs for this object.

◆ getSubdomainMarkers()

mfem::Array<int>& MFEMBlockRestrictable::getSubdomainMarkers ( )
inline

Definition at line 37 of file MFEMBlockRestrictable.h.

Referenced by MFEMVectorFEInnerProductIntegralPostprocessor::MFEMVectorFEInnerProductIntegralPostprocessor().

37 { return _subdomain_markers; }
mfem::Array< int > _subdomain_markers
Boolean array indicating which subdomains are active in this object.

◆ isSubdomainRestricted()

bool MFEMBlockRestrictable::isSubdomainRestricted ( )
inline

Returns a bool indicating if the object is restricted to a subset of subdomains.

Definition at line 34 of file MFEMBlockRestrictable.h.

Referenced by MFEMVectorFEInnerProductIntegralPostprocessor::MFEMVectorFEInnerProductIntegralPostprocessor().

34 { return _subdomain_names.size(); }
std::vector< SubdomainName > _subdomain_names
Stores the names of the subdomains.

◆ subdomainsToAttributes()

mfem::Array< int > MFEMBlockRestrictable::subdomainsToAttributes ( const std::vector< SubdomainName > &  subdomain_names)

Definition at line 42 of file MFEMBlockRestrictable.C.

Referenced by MFEMBlockRestrictable(), and subdomainsToStrings().

43 {
44  mfem::Array<int> attributes;
45  auto & mesh = getMesh();
46 
47  for (const SubdomainName & subdomain_name : subdomain_names)
48  {
49  try
50  {
51  // Is this a block ID?
52  const int attribute_id = std::stoi(subdomain_name);
53  attributes.Append(attribute_id);
54  }
55  catch (...)
56  {
57  // It was not
58  auto & subdomain_ids = mesh.attribute_sets.GetAttributeSet(subdomain_name);
59  for (const auto & subdomain_id : subdomain_ids)
60  attributes.Append(subdomain_id);
61  }
62  }
63  return attributes;
64 }
MeshBase & mesh
const mfem::ParMesh & getMesh() const

◆ subdomainsToStrings()

std::vector< std::string > MFEMBlockRestrictable::subdomainsToStrings ( const std::vector< SubdomainName > &  subdomain_names)

Definition at line 67 of file MFEMBlockRestrictable.C.

Referenced by MFEMGenericFunctorMaterial::MFEMGenericFunctorMaterial(), and MFEMGenericFunctorVectorMaterial::MFEMGenericFunctorVectorMaterial().

68 {
69  auto attributes = subdomainsToAttributes(subdomain_names);
70  std::vector<std::string> subdomain_attr_strings(subdomain_names.size());
71  for (const auto i : index_range(subdomain_names))
72  subdomain_attr_strings[i] = std::to_string(attributes[i]);
73  return subdomain_attr_strings;
74 }
mfem::Array< int > subdomainsToAttributes(const std::vector< SubdomainName > &subdomain_names)
auto index_range(const T &sizable)

◆ validParams()

InputParameters MFEMBlockRestrictable::validParams ( )
static

Definition at line 15 of file MFEMBlockRestrictable.C.

Referenced by MFEMFunctorMaterial::validParams(), MFEMDomainSubMesh::validParams(), MFEMKernel::validParams(), MFEMVectorFEInnerProductIntegralPostprocessor::validParams(), and MFEMCutTransitionSubMesh::validParams().

16 {
17  // Create InputParameters object that will be appended to the parameters for the inheriting object
19  // Create user-facing 'boundary' input for restricting inheriting object to boundaries
20  // MFEM uses the boundary -1 to signify every sideset
21  params.addParam<std::vector<SubdomainName>>("block",
22  {},
23  "The list of subdomains (names or ids) that this "
24  "object will be restricted to. Leave empty to apply "
25  "to all subdomains.");
26  return params;
27 }
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters emptyInputParameters()
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...

Member Data Documentation

◆ _mfem_mesh

const mfem::ParMesh& MFEMBlockRestrictable::_mfem_mesh
protected

Stores the names of the subdomains.

Definition at line 42 of file MFEMBlockRestrictable.h.

Referenced by getMesh(), and MFEMBlockRestrictable().

◆ _subdomain_attributes

mfem::Array<int> MFEMBlockRestrictable::_subdomain_attributes
protected

Array storing subdomain attribute IDs for this object.

Definition at line 46 of file MFEMBlockRestrictable.h.

Referenced by getSubdomainAttributes(), and MFEMBlockRestrictable().

◆ _subdomain_markers

mfem::Array<int> MFEMBlockRestrictable::_subdomain_markers
protected

Boolean array indicating which subdomains are active in this object.

Definition at line 48 of file MFEMBlockRestrictable.h.

Referenced by getSubdomainMarkers(), and MFEMBlockRestrictable().

◆ _subdomain_names

std::vector<SubdomainName> MFEMBlockRestrictable::_subdomain_names
protected

The documentation for this class was generated from the following files: