21 params.
addParam<std::vector<SubdomainName>>(
"block",
23 "The list of subdomains (names or ids) that this " 24 "object will be restricted to. Leave empty to apply " 25 "to all subdomains.");
30 const mfem::ParMesh & mfem_mesh)
31 : _mfem_mesh(mfem_mesh),
32 _subdomain_names(parameters.
get<
std::vector<SubdomainName>>(
"block")),
33 _subdomain_attributes(_subdomain_names.size())
37 mfem::common::AttrToMarker(
44 mfem::Array<int> attributes(subdomain_names.size());
47 subdomain_names.begin(),
48 subdomain_names.end(),
50 [&
mesh](
const SubdomainName & subdomain) ->
int 55 return std::stoi(subdomain);
60 auto & subdomain_ids =
mesh.attribute_sets.GetAttributeSet(subdomain);
61 if (subdomain_ids.Size() != 1)
63 "There should be a 1-to-1 correspondence between subdomain name and subdomain ID");
64 return subdomain_ids[0];
70 std::vector<std::string>
74 std::vector<std::string> subdomain_attr_strings(subdomain_names.size());
76 subdomain_attr_strings[i] = std::to_string(attributes[i]);
77 return subdomain_attr_strings;
mfem::Array< int > subdomainsToAttributes(const std::vector< SubdomainName > &subdomain_names)
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application...
const mfem::ParMesh & _mfem_mesh
Stores the names of the subdomains.
T * get(const std::unique_ptr< T > &u)
The MooseUtils::get() specializations are used to support making forwards-compatible code changes fro...
std::vector< std::string > subdomainsToStrings(const std::vector< SubdomainName > &subdomain_names)
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.
static InputParameters validParams()
MFEMBlockRestrictable(const InputParameters ¶meters, const mfem::ParMesh &mfem_mesh)
const mfem::ParMesh & getMesh() const
auto index_range(const T &sizable)