12 #include "libmesh/system.h" 13 #include "libmesh/equation_systems.h" 14 #include "libmesh/parallel_sync.h" 23 "Report mesh information, such as the number of elements, nodes, and degrees of freedom.");
26 "num_dofs num_dofs_nonlinear num_dofs_auxiliary num_elements num_nodes num_local_dofs " 27 "num_local_dofs_nonlinear num_local_dofs_auxiliary num_local_elements num_local_nodes " 28 "local_sidesets local_sideset_elems sidesets sideset_elems local_subdomains " 29 "local_subdomain_elems subdomains subdomain_elems");
33 "The iteration information to output, if nothing is provided everything will be output.");
44 _num_dofs_constrained(
73 _equation_systems(_fe_problem.es()),
74 _nonlinear_system(_fe_problem.es().get_system(
"nl0")),
75 _aux_system(_fe_problem.es().get_system(
"aux0")),
76 _mesh(_fe_problem.
mesh().getMesh())
106 auto add_sideset_names = [&](std::map<BoundaryID, SidesetInfo> & sidesets)
108 for (
auto & pair : sidesets)
113 auto sort_sides = [](std::map<BoundaryID, SidesetInfo> & sidesets)
115 for (
auto & pair : sidesets)
116 std::sort(pair.second.sides.begin(), pair.second.sides.end());
129 std::map<BoundaryID, SidesetInfo> sidesets;
130 for (
const auto & bnd_elem :
134 auto & entry = sidesets[bnd_elem->_bnd_id];
135 entry.id = bnd_elem->_bnd_id;
136 entry.sides.emplace_back(bnd_elem->_elem->id(), bnd_elem->_side);
145 pair.second.sides.clear();
162 std::vector<std::tuple<boundary_id_type, dof_id_type, unsigned int>>>
164 auto & root_info = send_info[0];
165 for (
const auto & pair : sidesets)
166 for (
const auto & side : pair.second.sides)
167 root_info.emplace_back(pair.second.id, side.first, side.second);
170 auto accumulate_info =
172 const std::vector<std::tuple<boundary_id_type, dof_id_type, unsigned int>> &
info)
174 for (
const auto & tuple :
info)
176 const auto id = std::get<0>(tuple);
179 entry.sides.emplace_back(std::get<1>(tuple), std::get<2>(tuple));
184 Parallel::push_parallel_vector_data(
comm(), send_info, accumulate_info);
202 for (
const auto id : boundary_ids)
210 to_json(nlohmann::json & json,
const std::map<BoundaryID, MeshInfo::SidesetInfo> & sidesets)
212 for (
const auto & pair : sidesets)
216 nlohmann::json sideset_json;
217 sideset_json[
"id"] = sideset_info.
id;
218 if (sideset_info.
name.size())
219 sideset_json[
"name"] = sideset_info.
name;
222 auto & sides_json = sideset_json[
"sides"];
224 for (
const std::pair<dof_id_type, unsigned int> & pair : sideset_info.
sides)
226 nlohmann::json side_json;
227 side_json[
"elem_id"] = pair.first;
228 side_json[
"side"] = pair.second;
229 sides_json.push_back(side_json);
233 json.push_back(sideset_json);
257 auto add_subdomain_names = [&](std::map<SubdomainID, SubdomainInfo> & subdomains)
259 for (
auto & pair : subdomains)
264 auto sort_elems = [](std::map<SubdomainID, SubdomainInfo> & subdomains)
266 for (
auto & pair : subdomains)
267 std::sort(pair.second.elems.begin(), pair.second.elems.end());
280 std::map<SubdomainID, SubdomainInfo> subdomains;
283 auto & entry = subdomains[elem->subdomain_id()];
284 entry.id = elem->subdomain_id();
285 entry.elems.push_back(elem->id());
293 pair.second.elems.clear();
309 std::map<processor_id_type, std::vector<std::pair<subdomain_id_type, dof_id_type>>> send_info;
310 auto & root_info = send_info[0];
311 for (
const auto & pair : subdomains)
312 for (
const auto elem_id : pair.second.elems)
313 root_info.emplace_back(pair.second.id, elem_id);
316 auto accumulate_info =
318 const std::vector<std::pair<subdomain_id_type, dof_id_type>> &
info)
320 for (
const auto & subdomain_elem_pair :
info)
323 entry.id = subdomain_elem_pair.first;
324 entry.elems.emplace_back(subdomain_elem_pair.second);
329 Parallel::push_parallel_vector_data(
comm(), send_info, accumulate_info);
345 std::set<subdomain_id_type> subdomain_ids;
350 for (
const auto id : subdomain_ids)
358 to_json(nlohmann::json & json,
const std::map<SubdomainID, MeshInfo::SubdomainInfo> & subdomains)
360 for (
const auto & pair : subdomains)
364 nlohmann::json subdomain_json;
365 subdomain_json[
"id"] = subdomain_info.
id;
366 if (subdomain_info.
name.size())
367 subdomain_json[
"name"] = subdomain_info.
name;
368 if (subdomain_info.
elems.size())
370 auto & sides_json = subdomain_json[
"elems"];
371 for (
const auto &
id : subdomain_info.
elems)
372 sides_json.push_back(
id);
375 json.push_back(subdomain_json);
virtual bnd_elem_iterator bndElemsEnd()
Helper struct for defining information about a single sideset.
std::vector< dof_id_type > elems
libMesh::ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
unsigned int n_systems() const
static InputParameters validParams()
unsigned int & _num_local_elem
void possiblyAddSidesetInfo()
Possibly add to _local_sidesets, _local_sideset_elems, _sidesets, and _sideset_elems.
const libMesh::MeshBase & _mesh
unsigned int & _num_dofs_constrained
Reporter object that has a single execution of the "execute" method for for each execute flag...
std::size_t n_dofs() const
const ReporterMode REPORTER_MODE_ROOT
virtual void execute() override
Execute method.
virtual bool isValid() const override
IsValid.
std::map< SubdomainID, SubdomainInfo > & _subdomains
unsigned int & _num_dofs_aux
dof_id_type n_local_nodes() const
std::map< BoundaryID, SidesetInfo > & _sideset_elems
const Parallel::Communicator & comm() const
virtual bnd_elem_iterator bndElemsBegin()
Return iterators to the beginning/end of the boundary elements list.
static InputParameters validParams()
dof_id_type n_local_dofs() const
const BoundaryInfo & get_boundary_info() const
const T_sys & get_system(std::string_view name) const
unsigned int & _num_local_dofs_aux
unsigned int & _num_local_node
dof_id_type n_local_elem() const
void to_json(nlohmann::json &json, const std::map< BoundaryID, MeshInfo::SidesetInfo > &sidesets)
dof_id_type n_dofs() const
MeshInfo(const InputParameters ¶meters)
unsigned int & _num_dofs_nl
Report mesh information, such as the number of elements, nodes, and degrees of freedom.
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
uint8_t processor_id_type
const libMesh::EquationSystems & _equation_systems
boundary_id_type BoundaryID
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
std::vector< std::pair< dof_id_type, unsigned int > > sides
void subdomain_ids(std::set< subdomain_id_type > &ids, const bool global=true) const
std::string & subdomain_name(subdomain_id_type id)
void possiblyAddSubdomainInfo()
Possibly add to _local_subdomains, _local_subdomain_elems, _subdomains, and _subdomain_elems.
std::map< BoundaryID, SidesetInfo > & _local_sidesets
bool isValueSet(const std::string &value) const
Methods for seeing if a value is set in the MultiMooseEnum.
const ReporterMode REPORTER_MODE_DISTRIBUTED
Helper struct for defining information about a single subdomain.
const std::set< boundary_id_type > & get_boundary_ids() const
const libMesh::System & _aux_system
FEProblemBase & _fe_problem
Reference to the FEProblemBase for this user object.
std::map< BoundaryID, SidesetInfo > & _sidesets
if(!dmm->_nl) SETERRQ(PETSC_COMM_WORLD
void dataLoad(std::istream &stream, MeshInfo::SidesetInfo &sideset_info, void *context)
const std::string & get_sideset_name(boundary_id_type id) const
std::map< SubdomainID, SubdomainInfo > & _local_subdomain_elems
IntRange< T > make_range(T beg, T end)
virtual MooseMesh & mesh() override
std::map< SubdomainID, SubdomainInfo > & _local_subdomains
const ReporterMode REPORTER_MODE_REPLICATED
unsigned int & _num_local_dofs
std::map< SubdomainID, SubdomainInfo > & _subdomain_elems
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type...
const MultiMooseEnum & _items
void dataStore(std::ostream &stream, MeshInfo::SidesetInfo &sideset_info, void *context)
virtual dof_id_type n_elem() const=0
processor_id_type processor_id() const
unsigned int & _num_local_dofs_nl
std::map< BoundaryID, SidesetInfo > & _local_sideset_elems
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
const libMesh::System & _nonlinear_system
void ErrorVector unsigned int
registerMooseObject("MooseApp", MeshInfo)
virtual dof_id_type n_nodes() const=0
void set_union(T &data, const unsigned int root_id) const