18 #include <type_traits>
42 const mfem::ParFiniteElementSpace& space,
const std::set<int>& attrs);
53 const mfem::ParFiniteElementSpace& space,
const mfem::Array<int>& true_dofs);
61 template <
typename Tag>
64 static_assert(std::is_enum_v<Tag>,
"Only enumerations can be used to tag a boundary condition.");
65 SLIC_ERROR_ROOT_IF(!tag_,
"No tag has been configured for this boundary condition");
66 bool tags_same_type =
typeid(tag).hash_code() == tag_->second;
67 SLIC_WARNING_ROOT_IF(!tags_same_type,
"Attempting to compare tags of two different enum types (always false)");
68 return (
static_cast<int>(tag) == tag_->first) && tags_same_type;
77 template <
typename Tag>
80 static_assert(std::is_enum_v<Tag>,
"Only enumerations can be used to tag a boundary condition.");
81 tag_ = {
static_cast<int>(tag),
typeid(tag).hash_code()};
88 const mfem::Array<int>&
markers()
const {
return attr_markers_; }
94 mfem::Array<int>&
markers() {
return attr_markers_; }
157 void setDofs(mfem::Vector& state,
const double time = 0.0)
const;
183 void apply(mfem::HypreParMatrix& k_mat, mfem::Vector& rhs, mfem::Vector& state)
const;
192 void setDofListsFromAttributeMarkers();
201 void setTrueDofList(
const mfem::Array<int>& true_dofs);
211 void setLocalDofList(
const mfem::Array<int>& local_dofs);
220 std::optional<int> component_;
224 mfem::Array<int> attr_markers_;
229 mfem::Array<int> true_dofs_;
234 mfem::Array<int> local_dofs_;
239 const mfem::ParFiniteElementSpace& space_;
246 std::optional<std::pair<int, std::size_t>> tag_;
Boundary condition information bundle.
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...
const mfem::VectorCoefficient & vectorCoefficient() const
Accessor for the underlying vector coefficient.
const mfem::Coefficient & scalarCoefficient() const
Accessor for the underlying scalar coefficient.
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.
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.
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.
const mfem::Array< int > & getTrueDofList() const
Returns the DOF indices for an essential boundary condition.
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...
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 all the necessary functions and macros required for logging as well as a helpe...
Accelerator functionality.