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 ()
 
std::vector< std::string > subdomainsToStrings ()
 
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 {
35  if (!_subdomain_attributes.IsEmpty())
36  mfem::common::AttrToMarker(
38 }
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 > subdomainsToAttributes()
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

◆ 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 MFEMComplexVectorPeriodAveragedPostprocessor::MFEMComplexVectorPeriodAveragedPostprocessor(), MFEMFunctorMaterial::MFEMFunctorMaterial(), and MFEMVectorFEInnerProductIntegralPostprocessor::MFEMVectorFEInnerProductIntegralPostprocessor().

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

◆ subdomainsToAttributes()

mfem::Array< int > MFEMBlockRestrictable::subdomainsToAttributes ( )

Definition at line 41 of file MFEMBlockRestrictable.C.

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

◆ subdomainsToStrings()

std::vector< std::string > MFEMBlockRestrictable::subdomainsToStrings ( )

Definition at line 66 of file MFEMBlockRestrictable.C.

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

67 {
68  const auto & attrs = _subdomain_attributes;
69  std::vector<std::string> strs(attrs.Size());
70  std::transform(attrs.begin(), attrs.end(), strs.begin(), [](int n) { return std::to_string(n); });
71  return strs;
72 }
mfem::Array< int > _subdomain_attributes
Array storing subdomain attribute IDs for this object.

◆ validParams()

InputParameters MFEMBlockRestrictable::validParams ( )
static

Definition at line 15 of file MFEMBlockRestrictable.C.

Referenced by MFEMFunctorMaterial::validParams(), MFEMKernel::validParams(), MFEMDomainSubMesh::validParams(), MFEMVectorFEInnerProductIntegralPostprocessor::validParams(), MFEMComplexVectorPeriodAveragedPostprocessor::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(), MFEMBlockRestrictable(), and subdomainsToStrings().

◆ _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

Stores the names of the subdomains.

Definition at line 44 of file MFEMBlockRestrictable.h.

Referenced by isSubdomainRestricted(), and subdomainsToAttributes().


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