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

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

#include <MFEMBoundaryRestrictable.h>

Inheritance diagram for MFEMBoundaryRestrictable:
[legend]

Public Member Functions

 MFEMBoundaryRestrictable (const InputParameters &parameters, const mfem::ParMesh &mfem_mesh)
 
mfem::Array< intboundariesToAttributes (const std::vector< BoundaryName > &boundary_names)
 
bool isBoundaryRestricted () const
 Returns a bool indicating if the object is restricted to a subset of boundaries. More...
 
const mfem::ParMesh & getMesh ()
 
const mfem::Array< int > & getBoundaryAttributes ()
 
mfem::Array< int > & getBoundaryMarkers ()
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Attributes

const mfem::ParMesh & _mfem_mesh
 Stores the names of the boundaries. More...
 
std::vector< BoundaryName > _boundary_names
 Stores the names of the boundaries. More...
 
mfem::Array< int_boundary_attributes
 Array storing boundary attribute IDs for this object. More...
 
mfem::Array< int_boundary_markers
 Boolean array indicating which boundaries are active in this object. More...
 

Detailed Description

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

Definition at line 23 of file MFEMBoundaryRestrictable.h.

Constructor & Destructor Documentation

◆ MFEMBoundaryRestrictable()

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

Definition at line 27 of file MFEMBoundaryRestrictable.C.

29  : _mfem_mesh(mfem_mesh),
30  _boundary_names(parameters.get<std::vector<BoundaryName>>("boundary")),
32 {
34  if (!_boundary_attributes.IsEmpty())
35  mfem::common::AttrToMarker(
36  _mfem_mesh.bdr_attributes.Max(), _boundary_attributes, _boundary_markers);
37 }
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.
mfem::Array< int > _boundary_markers
Boolean array indicating which boundaries are active in this object.
std::vector< BoundaryName > _boundary_names
Stores the names of the boundaries.
const mfem::ParMesh & _mfem_mesh
Stores the names of the boundaries.
mfem::Array< int > boundariesToAttributes(const std::vector< BoundaryName > &boundary_names)
mfem::Array< int > _boundary_attributes
Array storing boundary attribute IDs for this object.

Member Function Documentation

◆ boundariesToAttributes()

mfem::Array< int > MFEMBoundaryRestrictable::boundariesToAttributes ( const std::vector< BoundaryName > &  boundary_names)

Definition at line 40 of file MFEMBoundaryRestrictable.C.

Referenced by MFEMBoundaryRestrictable().

41 {
42  mfem::Array<int> attributes(boundary_names.size());
43  auto & mesh = getMesh();
44  std::transform(
45  boundary_names.begin(),
46  boundary_names.end(),
47  attributes.begin(),
48  [&mesh](const BoundaryName & boundary) -> int
49  {
50  try
51  {
52  // Is this a sideset ID?
53  return std::stoi(boundary);
54  }
55  catch (...)
56  {
57  // It was not
58  auto & boundary_ids = mesh.bdr_attribute_sets.GetAttributeSet(boundary);
59  if (boundary_ids.Size() != 1)
60  mooseError(
61  "There should be a 1-to-1 correspondence between boundary name and boundary ID");
62  return boundary_ids[0];
63  }
64  });
65  return attributes;
66 }
const mfem::ParMesh & getMesh()
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
Definition: MooseError.h:302
MeshBase & mesh

◆ getBoundaryAttributes()

const mfem::Array<int>& MFEMBoundaryRestrictable::getBoundaryAttributes ( )
inline

Definition at line 39 of file MFEMBoundaryRestrictable.h.

Referenced by MFEMBoundarySubMesh::buildSubMesh().

39 { return _boundary_attributes; }
mfem::Array< int > _boundary_attributes
Array storing boundary attribute IDs for this object.

◆ getBoundaryMarkers()

mfem::Array<int>& MFEMBoundaryRestrictable::getBoundaryMarkers ( )
inline

Definition at line 40 of file MFEMBoundaryRestrictable.h.

Referenced by MFEMScalarDirichletBC::ApplyBC(), MFEMVectorDirichletBC::ApplyBC(), MFEMVectorNormalDirichletBC::ApplyBC(), and MFEMVectorTangentialDirichletBC::ApplyBC().

40 { return _boundary_markers; }
mfem::Array< int > _boundary_markers
Boolean array indicating which boundaries are active in this object.

◆ getMesh()

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

Definition at line 38 of file MFEMBoundaryRestrictable.h.

Referenced by boundariesToAttributes(), and MFEMBoundarySubMesh::buildSubMesh().

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

◆ isBoundaryRestricted()

bool MFEMBoundaryRestrictable::isBoundaryRestricted ( ) const
inline

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

Definition at line 33 of file MFEMBoundaryRestrictable.h.

34  {
35  return !(_boundary_attributes.Size() == 1 && _boundary_attributes[0] == -1);
36  }
mfem::Array< int > _boundary_attributes
Array storing boundary attribute IDs for this object.

◆ validParams()

InputParameters MFEMBoundaryRestrictable::validParams ( )
static

Definition at line 15 of file MFEMBoundaryRestrictable.C.

Referenced by MFEMBoundaryCondition::validParams(), and MFEMBoundarySubMesh::validParams().

16 {
17  // Create InputParameters object that will be appended to the parameters for the inheriting object
19  params.addParam<std::vector<BoundaryName>>(
20  "boundary",
21  {"-1"},
22  "The list of boundaries (ids or names) from the mesh where this object applies. "
23  "Defaults to all boundaries.");
24  return params;
25 }
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

◆ _boundary_attributes

mfem::Array<int> MFEMBoundaryRestrictable::_boundary_attributes
protected

Array storing boundary attribute IDs for this object.

Definition at line 48 of file MFEMBoundaryRestrictable.h.

Referenced by getBoundaryAttributes(), isBoundaryRestricted(), and MFEMBoundaryRestrictable().

◆ _boundary_markers

mfem::Array<int> MFEMBoundaryRestrictable::_boundary_markers
protected

Boolean array indicating which boundaries are active in this object.

Definition at line 50 of file MFEMBoundaryRestrictable.h.

Referenced by getBoundaryMarkers(), and MFEMBoundaryRestrictable().

◆ _boundary_names

std::vector<BoundaryName> MFEMBoundaryRestrictable::_boundary_names
protected

Stores the names of the boundaries.

Definition at line 46 of file MFEMBoundaryRestrictable.h.

Referenced by MFEMBoundaryRestrictable().

◆ _mfem_mesh

const mfem::ParMesh& MFEMBoundaryRestrictable::_mfem_mesh
protected

Stores the names of the boundaries.

Definition at line 44 of file MFEMBoundaryRestrictable.h.

Referenced by getMesh(), and MFEMBoundaryRestrictable().


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