20 #include "libmesh/fe.h" 36 params.
addParam<
bool>(
"output_screen",
false,
"Output to the screen");
37 params.
addParam<
bool>(
"output_file",
true,
"Output to the file");
38 params.
addParam<std::string>(
"system_name",
"nl0",
"System to output");
43 params.
addParam<NonlinearSystemName>(
44 "nl_sys",
"nl0",
"The nonlinear system that we should output information for.");
50 _write_file(getParam<bool>(
"output_file")),
51 _write_screen(getParam<bool>(
"output_screen")),
52 _system_name(getParam<
std::string>(
"system_name")),
53 _mesh(_problem_ptr->
mesh()),
54 _nl_sys_num(_problem_ptr->nlSysNum(getParam<NonlinearSystemName>(
"nl_sys")))
70 #if defined(LIBMESH_HAVE_GCC_ABI_DEMANGLE) 74 std::string demangled(
name);
75 while (demangled.length() && demangled[0] >=
'0' && demangled[0] <=
'9')
76 demangled.erase(0, 1);
101 template <
typename T>
105 std::ostringstream
os;
106 for (T it = begin; it != end; ++it)
107 os << (it != begin ? delim :
"") << *it;
118 std::stringstream oss;
122 const DofMap & dof_map = sys.get_dof_map();
132 oss <<
"{\"ndof\": " << sys.n_dofs() <<
", \"demangled\": ";
133 #if defined(LIBMESH_HAVE_GCC_ABI_DEMANGLE) 138 oss <<
", \"vars\": [";
139 for (
unsigned int vg = 0; vg < dof_map.n_variable_groups(); ++vg)
141 const VariableGroup & vg_description(dof_map.variable_group(vg));
142 for (
unsigned int vn = 0; vn < vg_description.n_variables(); ++vn)
144 unsigned int var = vg_description.number(vn);
150 oss <<
"{\"name\": \"" << vg_description.name(vn) <<
"\", \"subdomains\": [";
151 for (std::set<SubdomainID>::const_iterator sd = subdomains.begin(); sd != subdomains.end();
154 oss << (sd != subdomains.begin() ?
", " :
"") <<
"{\"id\": " << *sd <<
", \"kernels\": [";
157 if (kernels.hasActiveVariableBlockObjects(var, *sd))
159 const auto & active_kernels = kernels.getActiveVariableBlockObjects(var, *sd);
160 for (
unsigned i = 0; i < active_kernels.size(); ++i)
163 oss << (i > 0 ?
", " :
"") <<
"{\"name\": \"" << kb.
name() <<
"\", \"type\": \"" 167 oss <<
"], \"dofs\": [";
171 std::set<dof_id_type> dofs;
173 for (
const auto & elem : *active_local_elems)
175 if (elem->subdomain_id() == *sd)
177 std::vector<dof_id_type> di;
178 dof_map.dof_indices(elem, di, var);
179 dofs.insert(di.begin(), di.end());
187 oss <<
join(dofs.begin(), dofs.end(),
", ") <<
"]}";
192 oss <<
"]}" << std::endl;
200 _console << oss.str() << std::flush;
static InputParameters validParams()
ConstElemRange * getActiveLocalElementRange()
Return pointers to range objects for various types of ranges (local nodes, boundary elems...
A MultiMooseEnum object to hold "execute_on" flags.
std::stringstream _file_output_stream
Stream for storing information to be written to a file.
registerMooseObjectAliased("MooseApp", DOFMapOutput, "DOFMap")
MooseObjectTagWarehouse< KernelBase > & getKernelWarehouse()
Access functions to Warehouses from outside NonlinearSystemBase.
std::string _file_base
The base filename from the input paramaters.
const unsigned int _nl_sys_num
The nonlinear system number we should output degree of freedom information for.
const Parallel::Communicator & _communicator
std::basic_ostream< charT, traits > * os
virtual const std::string & name() const
Get the name of the class.
virtual EquationSystems & es() override
Nonlinear system to be solved.
This is the common base class for the three main kernel types implemented in MOOSE, Kernel, VectorKernel and ArrayKernel.
MooseMesh & _mesh
Reference to the mesh object.
bool _write_screen
Flag for controlling outputting console information to screen.
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
static InputParameters validParams()
void output() override
Write the DOF mapt.
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
An output object for writing the DOF map of the system in a machine parsable format.
virtual std::string filename() override
Creates the output file name Appends the user-supplied 'file_base' input parameter with a '...
std::string stringify(const T &t)
conversion to string
std::string demangle(const char *name)
DOFMapOutput(const InputParameters ¶meters)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type.
unsigned int & _file_num
A file number counter, initialized to 0 (this must be controlled by the child class, see Exodus)
std::string _system_name
The name of the system to extract DOF information.
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
void writeStreamToFile(bool append=true)
Write the file stream to the file.
An outputter with filename support.
std::string join(const T &begin, const T &end, const char *const delim)
A helper method for joining items with a delimeter.
std::string demangle(const std::string &name)
Try to demangle type name.
const std::set< SubdomainID > & meshSubdomains() const
Returns a read-only reference to the set of subdomains currently present in the Mesh.
bool _write_file
Flag for controlling outputting console information to a file.
void set_union(T &data, const unsigned int root_id) const
const ExecFlagType EXEC_INITIAL