18 #include <type_traits>
43 const mfem::ParFiniteElementSpace&
space,
const std::set<int>& attrs);
54 const mfem::ParFiniteElementSpace&
space,
const mfem::Array<int>& true_dofs);
62 template <
typename Tag>
65 static_assert(std::is_enum_v<Tag>,
"Only enumerations can be used to tag a boundary condition.");
66 SLIC_ERROR_ROOT_IF(!tag_,
"No tag has been configured for this boundary condition");
67 bool tags_same_type =
typeid(tag).hash_code() == tag_->second;
68 SLIC_WARNING_ROOT_IF(!tags_same_type,
"Attempting to compare tags of two different enum types (always false)");
69 return (
static_cast<int>(tag) == tag_->first) && tags_same_type;
78 template <
typename Tag>
81 static_assert(std::is_enum_v<Tag>,
"Only enumerations can be used to tag a boundary condition.");
82 tag_ = {
static_cast<int>(tag),
typeid(tag).hash_code()};
89 const mfem::Array<int>&
markers()
const {
return attr_markers_; }
95 mfem::Array<int>&
markers() {
return attr_markers_; }
117 const std::optional<int>&
component()
const {
return component_; }
124 void setDofs(mfem::Vector& state,
const double time = 0.0)
const;
150 void apply(mfem::HypreParMatrix& k_mat, mfem::Vector& rhs, mfem::Vector& state)
const;
159 void setDofListsFromAttributeMarkers();
168 void setTrueDofList(
const mfem::Array<int>& true_dofs);
177 std::optional<int> component_;
181 mfem::Array<int> attr_markers_;
186 mfem::Array<int> true_dofs_;
191 mfem::Array<int> local_dofs_;
196 const mfem::ParFiniteElementSpace& space_;
203 std::optional<std::pair<int, std::size_t>> tag_;
Boundary condition information bundle.
const std::optional< int > & component() const
Returns constrained vector component, if any.
void setTag(const Tag tag)
Sets the tag for the BC.
const mfem::Array< int > & getLocalDofList() const
Returns the DOF indices for an essential boundary condition.
mfem::Array< int > & markers()
Returns a non-owning reference to the array of boundary attribute markers.
const mfem::Array< int > & markers() const
Returns a non-owning reference to the array of boundary attribute markers.
const GeneralCoefficient & coefficient() const
Returns stored coefficient.
void apply(mfem::HypreParMatrix &k_mat, mfem::Vector &rhs, mfem::Vector &state) const
Modify the system of equations by replacing equations that correspond to essential boundary conditio...
void setDofs(mfem::Vector &state, const double time=0.0) const
Projects the associated coefficient over a solution vector on the DOFs constrained by the boundary co...
BoundaryCondition(GeneralCoefficient coef, const std::optional< int > component, const mfem::ParFiniteElementSpace &space, const std::set< int > &attrs)
Constructor for setting up a boundary condition using a set of attributes.
const mfem::Array< int > & getTrueDofList() const
Returns the DOF indices for an essential boundary condition.
bool tagEquals(const Tag tag) const
Determines whether a boundary condition is associated with a tag.
This file contains the declaration of structure that manages the MFEM objects that make up the state ...
This file contains the declaration of structure that manages vectors derived from an MFEM finite elem...
This file contains the all the necessary functions and macros required for logging as well as a helpe...
Accelerator functionality.
mfem::ParFiniteElementSpace & space(FieldState field)
Get the space from the primal field of a field states.