20#include "libmesh/fe.h"
38 params.
addParam<
bool>(
"output_screen",
false,
"Output to the screen");
39 params.
addParam<
bool>(
"output_file",
true,
"Output to the file");
40 params.
addParam<std::string>(
"system_name",
"nl0",
"System to output");
45 params.
addParam<NonlinearSystemName>(
46 "nl_sys",
"nl0",
"The nonlinear system that we should output information for.");
52 _write_file(getParam<bool>(
"output_file")),
53 _write_screen(getParam<bool>(
"output_screen")),
54 _system_name(getParam<
std::string>(
"system_name")),
55 _mesh(_problem_ptr->
mesh()),
56 _nl_sys_num(_problem_ptr->nlSysNum(getParam<NonlinearSystemName>(
"nl_sys")))
72#if defined(LIBMESH_HAVE_GCC_ABI_DEMANGLE)
76 std::string demangled(
name);
77 while (demangled.length() && demangled[0] >=
'0' && demangled[0] <=
'9')
78 demangled.erase(0, 1);
107 std::ostringstream os;
108 for (T it = begin; it != end; ++it)
109 os << (it != begin ? delim :
"") << *it;
120 std::stringstream oss;
134 oss <<
"{\"ndof\": " << sys.
n_dofs() <<
", \"demangled\": ";
135#if defined(LIBMESH_HAVE_GCC_ABI_DEMANGLE)
140 oss <<
", \"vars\": [";
144 for (
unsigned int vn = 0; vn < vg_description.
n_variables(); ++vn)
146 unsigned int var = vg_description.
number(vn);
152 oss <<
"{\"name\": \"" << vg_description.
name(vn) <<
"\", \"subdomains\": [";
153 for (std::set<SubdomainID>::const_iterator sd = subdomains.begin(); sd != subdomains.end();
156 oss << (sd != subdomains.begin() ?
", " :
"") <<
"{\"id\": " << *sd <<
", \"kernels\": [";
159 if (kernels.hasActiveVariableBlockObjects(var, *sd))
161 const auto & active_kernels = kernels.getActiveVariableBlockObjects(var, *sd);
162 for (
unsigned i = 0; i < active_kernels.size(); ++i)
165 oss << (i > 0 ?
", " :
"") <<
"{\"name\": \"" << kb.
name() <<
"\", \"type\": \""
169 oss <<
"], \"dofs\": [";
173 std::set<dof_id_type> dofs;
175 for (
const auto & elem : *active_local_elems)
177 if (elem->subdomain_id() == *sd)
179 std::vector<dof_id_type> di;
181 dofs.insert(di.begin(), di.end());
189 oss <<
join(dofs.begin(), dofs.end(),
", ") <<
"]}";
194 oss <<
"]}" << std::endl;
202 _console << oss.str() << std::flush;
registerMooseObjectAliased("MooseApp", DOFMapOutput, "DOFMap")
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
const ExecFlagType EXEC_INITIAL
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
An output object for writing the DOF map of the system in a machine parsable format.
bool _write_file
Flag for controlling outputting console information to a file.
std::string join(const T &begin, const T &end, const char *const delim)
A helper method for joining items with a delimeter.
std::stringstream _file_output_stream
Stream for storing information to be written to a file.
static InputParameters validParams()
virtual std::string filename() override
Creates the output file name Appends the user-supplied 'file_base' input parameter with a '....
const unsigned int _nl_sys_num
The nonlinear system number we should output degree of freedom information for.
void output() override
Write the DOF mapt.
void writeStreamToFile(bool append=true)
Write the file stream to the file.
DOFMapOutput(const InputParameters ¶meters)
std::string demangle(const std::string &name)
Try to demangle type name.
MooseMesh & _mesh
Reference to the mesh object.
bool _write_screen
Flag for controlling outputting console information to screen.
std::string _system_name
The name of the system to extract DOF information.
A MultiMooseEnum object to hold "execute_on" flags.
virtual libMesh::EquationSystems & es() override
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
An outputter with filename support.
static InputParameters validParams()
std::string _file_base
The base filename from the input paramaters.
unsigned int & _file_num
A file number counter, initialized to 0 (this must be controlled by the child class,...
This is the common base class for the three main kernel types implemented in MOOSE,...
const std::string & name() const
Get the name of the class.
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
const libMesh::ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems,...
Nonlinear system to be solved.
MooseObjectTagWarehouse< KernelBase > & getKernelWarehouse()
Access functions to Warehouses from outside NonlinearSystemBase.
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
void set_union(T &data, const unsigned int root_id) const
unsigned int n_variable_groups() const
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
const VariableGroup & variable_group(const unsigned int c) const
const T_sys & get_system(std::string_view name) const
const Parallel::Communicator & _communicator
dof_id_type n_dofs() const
const DofMap & get_dof_map() const
unsigned int n_variables() const
const std::string & name(unsigned int v) const
unsigned int number(unsigned int v) const
std::string stringify(const T &t)
conversion to string
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
std::string demangle(const char *name)