15 #include "libmesh/boundary_info.h" 25 "This mesh generator assigns extraneous mesh metadata to the input mesh");
26 params.
addParam<MeshGeneratorName>(
"input",
"The mesh we want to modify");
28 params.
addParam<std::vector<std::string>>(
29 "real_scalar_metadata_names", {},
"Names of the real scalar mesh metadata.");
31 "real_scalar_metadata_values", {},
"Values of the real scalar mesh metadata.");
32 params.
addParam<std::vector<std::string>>(
33 "uint_scalar_metadata_names", {},
"Names of the unsigned integer scalar mesh metadata.");
34 params.
addParam<std::vector<unsigned int>>(
35 "uint_scalar_metadata_values", {},
"Values of the unsigned integer scalar mesh metadata.");
36 params.
addParam<std::vector<std::string>>(
37 "int_scalar_metadata_names", {},
"Names of the integer scalar mesh metadata.");
39 "int_scalar_metadata_values", {},
"Values of the integer scalar mesh metadata.");
40 params.
addParam<std::vector<std::string>>(
41 "dof_id_type_scalar_metadata_names", {},
"Names of the dof_id_type scalar mesh metadata.");
42 params.
addParam<std::vector<dof_id_type>>(
43 "dof_id_type_scalar_metadata_values", {},
"Values of the dof_id_type scalar mesh metadata.");
44 params.
addParam<std::vector<std::string>>(
"subdomain_id_type_scalar_metadata_names",
46 "Names of the subdomain_id_type scalar mesh metadata.");
47 params.
addParam<std::vector<subdomain_id_type>>(
48 "subdomain_id_type_scalar_metadata_values",
50 "Values of the subdomain_id_type scalar mesh metadata.");
51 params.
addParam<std::vector<std::string>>(
52 "boolean_scalar_metadata_names", {},
"Names of the boolean scalar mesh metadata.");
54 "boolean_scalar_metadata_values", {},
"Values of the boolean scalar mesh metadata.");
55 params.
addParam<std::vector<std::string>>(
56 "point_scalar_metadata_names", {},
"Names of the point scalar mesh metadata.");
58 "point_scalar_metadata_values", {},
"Values of the point scalar mesh metadata.");
60 params.
addParam<std::vector<std::string>>(
61 "real_vector_metadata_names", {},
"Names of the real vector mesh metadata.");
62 params.
addParam<std::vector<std::vector<Real>>>(
63 "real_vector_metadata_values", {},
"Values of the real vector mesh metadata.");
64 params.
addParam<std::vector<std::string>>(
65 "uint_vector_metadata_names", {},
"Names of the unsigned integer vector mesh metadata.");
66 params.
addParam<std::vector<std::vector<unsigned int>>>(
67 "uint_vector_metadata_values", {},
"Values of the unsigned integer vector mesh metadata.");
68 params.
addParam<std::vector<std::string>>(
69 "int_vector_metadata_names", {},
"Names of the integer vector mesh metadata.");
70 params.
addParam<std::vector<std::vector<int>>>(
71 "int_vector_metadata_values", {},
"Values of the integer vector mesh metadata.");
72 params.
addParam<std::vector<std::string>>(
73 "dof_id_type_vector_metadata_names", {},
"Names of the dof_id_type vector mesh metadata.");
74 params.
addParam<std::vector<std::vector<dof_id_type>>>(
75 "dof_id_type_vector_metadata_values", {},
"Values of the dof_id_type vector mesh metadata.");
76 params.
addParam<std::vector<std::string>>(
"subdomain_id_type_vector_metadata_names",
78 "Names of the subdomain_id_type vector mesh metadata.");
79 params.
addParam<std::vector<std::vector<subdomain_id_type>>>(
80 "subdomain_id_type_vector_metadata_values",
82 "Values of the subdomain_id_type vector mesh metadata.");
83 params.
addParam<std::vector<std::string>>(
84 "point_vector_metadata_names", {},
"Names of the Point vector mesh metadata.");
85 params.
addParam<std::vector<std::vector<Point>>>(
86 "point_vector_metadata_values", {},
"Values of the Point vector mesh metadata.");
96 _input(isParamValid(
"input") ? &getMesh(
"input") : nullptr),
97 _real_scalar_metadata_names(getParam<
std::vector<
std::string>>(
"real_scalar_metadata_names")),
98 _real_scalar_metadata_values(getParam<
std::vector<
Real>>(
"real_scalar_metadata_values")),
99 _uint_scalar_metadata_names(getParam<
std::vector<
std::string>>(
"uint_scalar_metadata_names")),
100 _uint_scalar_metadata_values(
101 getParam<
std::vector<unsigned
int>>(
"uint_scalar_metadata_values")),
102 _int_scalar_metadata_names(getParam<
std::vector<
std::string>>(
"int_scalar_metadata_names")),
103 _int_scalar_metadata_values(getParam<
std::vector<
int>>(
"int_scalar_metadata_values")),
104 _dof_id_type_scalar_metadata_names(
105 getParam<
std::vector<
std::string>>(
"dof_id_type_scalar_metadata_names")),
106 _dof_id_type_scalar_metadata_values(
107 getParam<
std::vector<
dof_id_type>>(
"dof_id_type_scalar_metadata_values")),
108 _subdomain_id_type_scalar_metadata_names(
109 getParam<
std::vector<
std::string>>(
"subdomain_id_type_scalar_metadata_names")),
110 _subdomain_id_type_scalar_metadata_values(
112 _boolean_scalar_metadata_names(
113 getParam<
std::vector<
std::string>>(
"boolean_scalar_metadata_names")),
114 _boolean_scalar_metadata_values(getParam<
std::vector<bool>>(
"boolean_scalar_metadata_values")),
115 _point_scalar_metadata_names(getParam<
std::vector<
std::string>>(
"point_scalar_metadata_names")),
116 _point_scalar_metadata_values(getParam<
std::vector<Point>>(
"point_scalar_metadata_values")),
117 _real_vector_metadata_names(getParam<
std::vector<
std::string>>(
"real_vector_metadata_names")),
118 _real_vector_metadata_values(
119 getParam<
std::vector<
std::vector<
Real>>>(
"real_vector_metadata_values")),
120 _uint_vector_metadata_names(getParam<
std::vector<
std::string>>(
"uint_vector_metadata_names")),
121 _uint_vector_metadata_values(
122 getParam<
std::vector<
std::vector<unsigned
int>>>(
"uint_vector_metadata_values")),
123 _int_vector_metadata_names(getParam<
std::vector<
std::string>>(
"int_vector_metadata_names")),
124 _int_vector_metadata_values(
125 getParam<
std::vector<
std::vector<
int>>>(
"int_vector_metadata_values")),
126 _dof_id_type_vector_metadata_names(
127 getParam<
std::vector<
std::string>>(
"dof_id_type_vector_metadata_names")),
128 _dof_id_type_vector_metadata_values(
129 getParam<
std::vector<
std::vector<
dof_id_type>>>(
"dof_id_type_vector_metadata_values")),
130 _subdomain_id_type_vector_metadata_names(
131 getParam<
std::vector<
std::string>>(
"subdomain_id_type_vector_metadata_names")),
133 "subdomain_id_type_vector_metadata_values")),
134 _point_vector_metadata_names(getParam<
std::vector<
std::string>>(
"point_vector_metadata_names")),
135 _point_vector_metadata_values(
136 getParam<
std::vector<
std::vector<Point>>>(
"point_vector_metadata_values"))
153 "dof_id_type_scalar");
160 "subdomain_id_type_scalar");
191 "dof_id_type_vector");
198 "subdomain_id_type_vector");
209 std::unique_ptr<MeshBase>
213 paramError(
"input",
"Input was not specified");
215 mooseAssert(
_input,
"Should be set");
216 std::unique_ptr<MeshBase>
mesh = std::move(*
_input);
229 const std::vector<T> data_values,
230 const std::string param_name)
232 std::vector<std::string> data_name_tmp(data_names);
233 if (std::unique(data_name_tmp.begin(), data_name_tmp.end()) != data_name_tmp.end())
234 paramError(param_name +
"_metadata_names",
"Elements of this parameter must be unique.");
235 if (data_names.size() != data_values.size())
237 "Length of this parameter must be the same as that of " + param_name +
std::unique_ptr< T_DEST, T_DELETER > dynamic_pointer_cast(std::unique_ptr< T_SRC, T_DELETER > &src)
These are reworked from https://stackoverflow.com/a/11003103.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
void paramError(const std::string ¶m, Args... args) const
Emits an error prefixed with the file and line number of the given param (from the input file) along ...
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static void setHasGenerateData(InputParameters ¶ms)
Sets that a mesh generator has a generateData() implementation.
T & declareMeshProperty(const std::string &data_name, Args &&... args)
Methods for writing out attributes to the mesh meta-data store, which can be retrieved from most othe...
MeshGenerators are objects that can modify or add to an existing mesh.
void ErrorVector unsigned int