https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Functions | Variables
ConsoleUtils Namespace Reference

Functions

std::string indent (unsigned int spaces)
 Create empty string for indenting.
 
std::string outputFrameworkInformation (const MooseApp &app)
 Outputs framework information.
 
std::string outputMeshInformation (FEProblemBase &problem, bool verbose=true)
 Output the mesh information.
 
std::string outputAuxiliarySystemInformation (FEProblemBase &problem)
 Output the Auxiliary system information.
 
std::string outputSolverSystemInformation (FEProblemBase &problem, const unsigned int solver_sys_num)
 Output a solver system information.
 
std::string outputRelationshipManagerInformation (const MooseApp &app)
 Output action RelationshipManager information.
 
std::string outputExecutionInformation (const MooseApp &app, FEProblemBase &problem)
 Output execution information.
 
std::string outputOutputInformation (MooseApp &app)
 Output the output information.
 
std::string outputSystemInformationHelper (libMesh::System &system)
 Output system information.
 
std::string outputPreSMOResidualInformation ()
 Output the information about pre-SMO residual evaluation.
 
std::string outputLegacyInformation (MooseApp &app)
 Output the legacy flag information.
 
std::string outputDataFilePaths ()
 Output the registered data paths for searching.
 
std::string outputDataFileParams (MooseApp &app)
 Output the (param path = value) pairs for each DataFileName parameter.
 
void insertNewline (std::stringstream &oss, std::streampos &begin, std::streampos &curr)
 Helper function function for stringstream formatting.
 
std::string formatString (std::string message, const std::string &prefix)
 Add new lines and prefixes to a string for pretty display in output NOTE: This makes a copy of the string, on purpose, to be able to return a modified copy.
 
std::string mooseObjectVectorToString (const std::vector< MooseObject * > &objs, const std::string &sep=" ")
 Routine to output the name of MooseObjects in a string.
 
std::string outputSystemInformationHelper (std::stringstream &oss, System &system)
 

Variables

static const unsigned int console_field_width = 27
 Width used for printing simulation information.
 
static const unsigned int console_line_length = 100
 Line length for printing simulation information.
 

Function Documentation

◆ formatString()

std::string ConsoleUtils::formatString ( std::string  message,
const std::string &  prefix 
)

Add new lines and prefixes to a string for pretty display in output NOTE: This makes a copy of the string, on purpose, to be able to return a modified copy.

Returns
the formatted string

Definition at line 583 of file ConsoleUtils.C.

584{
585 MooseUtils::indentMessage(prefix, message, COLOR_DEFAULT, true, " ");
586 std::stringstream stream;
587 std::streampos start = stream.tellp();
588 stream << message;
589 std::streampos end = stream.tellp();
590 insertNewline(stream, start, end);
591 auto formatted_string = stream.str();
592 // no need to end with a line break
593 if (formatted_string.back() == '\n')
594 formatted_string.pop_back();
595 return formatted_string;
596}
void insertNewline(std::stringstream &oss, std::streampos &begin, std::streampos &curr)
Helper function function for stringstream formatting.
void indentMessage(const std::string &prefix, std::string &message, const char *color, bool indent_first_line, const std::string &post_prefix)
Definition MooseUtils.C:749

Referenced by MooseObjectWarehouseBase< T >::activeObjectsToFormattedString(), SolutionUserObjectBase::getLocalVarIndex(), ComputeLinearFVElementalThread::printBlockExecutionInformation(), ComputeLinearFVFaceThread::printBlockExecutionInformation(), ComputeFVFluxThread< RangeType, AttributeTagType >::printBlockExecutionInformation(), NonlinearThread::printBlockExecutionInformation(), ComputeFVFluxThread< RangeType, AttributeTagType >::printBoundaryExecutionInformation(), ComputeElemAuxBcsThread< AuxKernelType >::printBoundaryExecutionInformation(), ThreadedElementLoop< RangeType >::printExecutionOrdering(), and ComputeNodalUserObjectsThread::printGeneralExecutionInformation().

◆ indent()

std::string ConsoleUtils::indent ( unsigned int  spaces)

Create empty string for indenting.

Definition at line 41 of file ConsoleUtils.C.

42{
43 return std::string(spaces, ' ');
44}

Referenced by FEProblemBase::checkDependMaterialsHelper(), ControllableItem::dump(), ControllableAlias::dump(), MessageFromInput::execute(), ControlOutput::outputActiveObjects(), and ControlOutput::outputControls().

◆ insertNewline()

void ConsoleUtils::insertNewline ( std::stringstream &  oss,
std::streampos &  begin,
std::streampos &  curr 
)

Helper function function for stringstream formatting.

Definition at line 572 of file ConsoleUtils.C.

573{
574 if (curr - begin > console_line_length)
575 {
576 oss << "\n";
577 begin = oss.tellp();
578 oss << std::setw(console_field_width + 2) << ""; // "{ "
579 }
580}

Referenced by formatString(), outputSystemInformationHelper(), BlockRestrictionDebugOutput::printBlockRestrictionMap(), and MaterialPropertyDebugOutput::printMaterialProperties().

◆ mooseObjectVectorToString()

std::string ConsoleUtils::mooseObjectVectorToString ( const std::vector< MooseObject * > &  objs,
const std::string &  sep = " " 
)

Routine to output the name of MooseObjects in a string.

Parameters
objsthe vector with all the MooseObjects
sepa separator in between each object's name

Definition at line 599 of file ConsoleUtils.C.

600{
601 std::string object_names = "";
602 if (objs.size())
603 {
604 // Gather all the object names
605 std::vector<std::string> names;
606 names.reserve(objs.size());
607 for (const auto & obj : objs)
608 {
609 mooseAssert(obj, "Trying to print a null object");
610 names.push_back(obj->name());
611 }
612
613 object_names = MooseUtils::join(names, sep);
614 }
615 return object_names;
616}

Referenced by ComputeLinearFVElementalThread::printBlockExecutionInformation(), ComputeLinearFVFaceThread::printBlockExecutionInformation(), ComputeFVFluxThread< RangeType, AttributeTagType >::printBlockExecutionInformation(), ComputeFVFluxThread< RangeType, AttributeTagType >::printBoundaryExecutionInformation(), ComputeElemAuxBcsThread< AuxKernelType >::printBoundaryExecutionInformation(), ThreadedElementLoop< RangeType >::printExecutionOrdering(), and ComputeNodalUserObjectsThread::printGeneralExecutionInformation().

◆ outputAuxiliarySystemInformation()

std::string ConsoleUtils::outputAuxiliarySystemInformation ( FEProblemBase problem)

Output the Auxiliary system information.

Definition at line 197 of file ConsoleUtils.C.

198{
200}
virtual libMesh::System & system() override
Get the reference to the libMesh system.
AuxiliarySystem & getAuxiliarySystem()
std::string outputSystemInformationHelper(libMesh::System &system)
Output system information.

Referenced by Console::meshChanged(), and Console::outputSystemInformation().

◆ outputDataFileParams()

std::string ConsoleUtils::outputDataFileParams ( MooseApp app)

Output the (param path = value) pairs for each DataFileName parameter.

Definition at line 549 of file ConsoleUtils.C.

550{
551 std::map<std::string, std::string> values; // for A-Z sort
552 for (const auto & object_name_params_pair : app.getInputParameterWarehouse().getInputParameters())
553 {
554 const auto & params = object_name_params_pair.second;
555 for (const auto & name_value_pair : *params)
556 {
557 const auto & name = name_value_pair.first;
558 if (const auto path = params->queryDataFileNamePath(name))
559 if (params->getHitNode(name))
560 values.emplace(params->paramFullpath(name), path->path);
561 }
562 }
563
564 std::stringstream oss;
565 oss << "Data File Parameters:\n";
566 for (const auto & [param, value] : values)
567 oss << " " << param << " = " << value << "\n";
568 return oss.str() + '\n';
569}
std::array< Real, 2 > values
Definition MortarUtils.C:52
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)

Referenced by Console::outputSystemInformation().

◆ outputDataFilePaths()

std::string ConsoleUtils::outputDataFilePaths ( )

Output the registered data paths for searching.

Definition at line 539 of file ConsoleUtils.C.

540{
541 std::stringstream oss;
542 oss << "Data File Paths:\n";
543 for (const auto & [name, path] : Registry::getDataFilePaths())
544 oss << " " << name << ": " << path << "\n";
545 return oss.str() + "\n";
546}
The registry is used as a global singleton to collect information on all available MooseObject and Ac...
Definition Registry.h:179

Referenced by Console::outputSystemInformation().

◆ outputExecutionInformation()

std::string ConsoleUtils::outputExecutionInformation ( const MooseApp app,
FEProblemBase problem 
)

Output execution information.

Definition at line 371 of file ConsoleUtils.C.

372{
373
374 std::stringstream oss;
375 oss << std::left;
376
377 Executioner * exec = app.getExecutioner();
378
379 oss << "Execution Information:\n"
380 << std::setw(console_field_width) << " Executioner: " << exec->type() << '\n';
381
382 std::string time_stepper = exec->getTimeStepperName();
383 if (time_stepper != "")
384 oss << std::setw(console_field_width) << " TimeStepper: " << time_stepper << '\n';
385 const auto time_integrator_names = exec->getTimeIntegratorNames();
386 if (!time_integrator_names.empty())
387 oss << std::setw(console_field_width)
388 << " TimeIntegrator(s): " << MooseUtils::join(time_integrator_names, " ") << '\n';
389
390 oss << std::setw(console_field_width)
391 << std::string(" Solver") +
392 (problem.feBackend() == Moose::FEBackend::LibMesh ? " Mode" : "") + ": ";
393 for (const std::size_t i : make_range(problem.numSolverSystems()))
394 oss << (problem.numSolverSystems() > 1 ? "[" + problem.getSolverSystemNames()[i] + "]: " : "")
395 << problem.solverTypeString(i) << " ";
396 oss << '\n';
397
398 // Check for a selection of common PETSc pc options on the command line for
399 // all solver systems and all field splits within each nonlinear system
400 std::string pc_desc;
401 for (const std::size_t i : make_range(problem.numSolverSystems()))
402 {
403 std::vector<std::string> splits = {""};
404 if (problem.isSolverSystemNonlinear(i))
405 for (const auto & split : problem.getNonlinearSystemBase(i).getSplits().getObjects())
406 splits.push_back("fieldsplit_" + split->name() + "_");
407
408 for (const std::string & split : splits)
409 {
410 std::string pc_desc_split;
411 const std::string prefix = problem.solverParams(i)._prefix + split;
412 for (const auto & entry : std::as_const(*app.commandLine()).getEntries())
413 if (entry.name == prefix + "pc_type" || entry.name == prefix + "sub_pc_type" ||
414 entry.name == prefix + "pc_hypre_type" || entry.name == prefix + "pc_fieldsplit_type")
415 pc_desc_split += entry.value ? *entry.value + " " : "unspecified ";
416
417 if (!pc_desc_split.empty() && prefix.size() > 1)
418 pc_desc += "[" + prefix.substr(1, prefix.size() - 2) + "]: ";
419 pc_desc += pc_desc_split;
420 }
421 }
422
423 // Alert the user any unoverridden options will still be picked up from the input file
424 if (!pc_desc.empty())
425 pc_desc += "(see input file for unoverridden options)";
426
427 // If there are no PETSc pc options on the command line, print the input file options
428 if (pc_desc.empty())
429 pc_desc = problem.getPetscOptions().pc_description;
430
431 if (!pc_desc.empty())
432 oss << std::setw(console_field_width) << " PETSc Preconditioner: " << pc_desc << '\n';
433
434 std::string mpc_desc;
435 for (const std::size_t i : make_range(problem.numNonlinearSystems()))
436 {
438 if (mpc)
439 {
440 if (problem.numNonlinearSystems() > 1)
441 mpc_desc += "[" + problem.getNonlinearSystemNames()[i] + "]: ";
442 mpc_desc += mpc->type() + " ";
443 if (mpc->name().find("_moose_auto") != std::string::npos)
444 mpc_desc += "(auto) ";
445 }
446 }
447
448 if (!mpc_desc.empty())
449 oss << std::setw(console_field_width) << " MOOSE Preconditioner: " << mpc_desc << '\n';
450
451 oss << "\n";
452
453 return oss.str();
454}
Executioners are objects that do the actual work of solving your problem.
Definition Executioner.h:37
virtual std::string getTimeStepperName() const
The name of the TimeStepper This is an empty string for non-Transient executioners.
virtual std::vector< std::string > getTimeIntegratorNames() const
The name of the TimeIntegrator This is an empty string for non-Transient executioners.
virtual std::size_t numNonlinearSystems() const override
bool isSolverSystemNonlinear(const unsigned int sys_num)
Check if the solver system is nonlinear.
SolverParams & solverParams(unsigned int solver_sys_num=0)
Get the solver parameters.
const std::vector< NonlinearSystemName > & getNonlinearSystemNames() const
Moose::PetscSupport::PetscOptions & getPetscOptions()
Retrieve a writable reference the PETSc options (used by PetscSupport)
NonlinearSystemBase & getNonlinearSystemBase(const unsigned int sys_num)
virtual Moose::FEBackend feBackend() const
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
Definition MooseApp.C:2015
const std::string & type() const
Get the type of this class.
Definition MooseBase.h:93
const std::string & name() const
Get the name of the class.
Definition MooseBase.h:103
Base class for MOOSE preconditioners.
std::string pc_description
Preconditioner description.
MoosePreconditioner const * getPreconditioner() const
std::string _prefix
if(subdm)
IntRange< T > make_range(T beg, T end)

Referenced by Console::outputSystemInformation().

◆ outputFrameworkInformation()

std::string ConsoleUtils::outputFrameworkInformation ( const MooseApp app)

Outputs framework information.

This includes the versions and timestamps

Definition at line 47 of file ConsoleUtils.C.

48{
49 std::stringstream oss;
50 oss << std::left;
51
52 oss << app.getSystemInfo().getInfo();
53
54 oss << "Input File(s):\n";
55 for (const auto & entry : app.getInputFileNames())
56 oss << " " << std::filesystem::absolute(entry).c_str() << "\n";
57 oss << "\n";
58
59 const auto & cl = std::as_const(*app.commandLine());
60 // We skip the 0th argument of the main app, i.e., the name used to invoke the program
61 const auto cl_range =
62 as_range(std::next(cl.getEntries().begin(), app.multiAppLevel() == 0), cl.getEntries().end());
63
64 std::stringstream args_oss;
65 for (const auto & entry : cl_range)
66 if (!entry.hit_param && !entry.subapp_name && entry.name != "-i")
67 args_oss << " " << cl.formatEntry(entry) << "\n";
68 if (args_oss.str().size())
69 oss << "Command Line Argument(s):\n" << args_oss.str() << "\n";
70
71 std::stringstream input_args_oss;
72 for (const auto & entry : cl_range)
73 if (entry.hit_param && !entry.subapp_name)
74 input_args_oss << " " << cl.formatEntry(entry) << "\n";
75 if (input_args_oss.str().size())
76 oss << "Command Line Input Argument(s):\n" << input_args_oss.str() << "\n";
77
78 const auto checkpoints = app.getOutputWarehouse().getOutputs<Checkpoint>();
79 if (checkpoints.size())
80 {
81 oss << std::left << "Checkpoint:\n";
82 oss << checkpoints[0]->checkpointInfo().str();
83 oss << std::endl;
84 }
85
86 oss << std::left << "Parallelism:\n"
87 << std::setw(console_field_width)
88 << " Num Processors: " << static_cast<std::size_t>(app.n_processors()) << '\n'
89 << std::setw(console_field_width)
90 << " Num Threads: " << static_cast<std::size_t>(libMesh::n_threads()) << std::endl;
91
92 return oss.str();
93}
Writes out three things:
Definition Checkpoint.h:49
std::stringstream checkpointInfo() const
Gathers and records information used later for console output.
Definition Checkpoint.C:238
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
Definition MooseApp.C:2409
unsigned int multiAppLevel() const
The MultiApp Level.
Definition MooseApp.h:855
const SystemInfo & getSystemInfo() const
Get SystemInfo object.
Definition MooseApp.h:567
std::shared_ptr< CommandLine > commandLine() const
Get the command line.
Definition MooseApp.h:424
std::vector< T * > getOutputs(const std::vector< OutputName > &names)
Return a vector of objects by names.
std::string getInfo() const
Definition SystemInfo.C:29
processor_id_type n_processors() const
SimpleRange< IndexType > as_range(const std::pair< IndexType, IndexType > &p)
unsigned int n_threads()

Referenced by Console::outputSystemInformation(), and ExodusFormatter::printInputFile().

◆ outputLegacyInformation()

std::string ConsoleUtils::outputLegacyInformation ( MooseApp app)

Output the legacy flag information.

Definition at line 503 of file ConsoleUtils.C.

504{
505 std::stringstream oss;
506 oss << std::left;
507
508 if (app.parameters().get<bool>("use_legacy_material_output"))
509 {
510 oss << COLOR_RED << "LEGACY MODES ENABLED:" << COLOR_DEFAULT << '\n';
511 oss << " This application uses the legacy material output option: material properties are "
512 "output only on TIMESTEP_END, not INITIAL. To remove this message, set "
513 "'use_legacy_material_output' to false in this application. If there are gold output "
514 "files that contain material property output for which output occurs on INITIAL, then "
515 "these will generate diffs due to zero values being stored, and these tests should be "
516 "re-golded.\n"
517 << COLOR_DEFAULT << std::endl;
518 }
519
520 if (app.parameters().get<bool>("use_legacy_initial_residual_evaluation_behavior"))
521 {
522 oss << COLOR_RED << "LEGACY MODES ENABLED:" << COLOR_DEFAULT << '\n';
523 oss << " This application uses the legacy initial residual evaluation behavior. The legacy "
524 "behavior performs an often times redundant residual evaluation before the solution "
525 "modifying objects are executed prior to the initial (0th nonlinear iteration) residual "
526 "evaluation. The new behavior skips that redundant residual evaluation unless the "
527 "parameter Executioner/use_pre_smo_residual is set to true. To remove this message and "
528 "enable the new behavior, set the parameter "
529 "'use_legacy_initial_residual_evaluation_behavior' to false in *App.C. Some tests that "
530 "rely on the side effects of the legacy behavior may fail/diff and should be "
531 "re-golded.\n"
532 << COLOR_DEFAULT << std::endl;
533 }
534
535 return oss.str();
536}
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131

Referenced by Console::outputSystemInformation().

◆ outputMeshInformation()

std::string ConsoleUtils::outputMeshInformation ( FEProblemBase problem,
bool  verbose = true 
)

Output the mesh information.

Definition at line 96 of file ConsoleUtils.C.

97{
98 std::stringstream oss;
99 oss << std::left;
100
101 const MooseMesh & mesh = problem.mesh();
102
103 const auto fe_backend = problem.feBackend();
104
105 if (verbose)
106 {
107 oss << "\nMesh: " << '\n' << std::setw(console_field_width);
108
109 oss << " Parallel Type: " << (mesh.isDistributedMesh() ? "distributed" : "replicated");
110 if (fe_backend == Moose::FEBackend::LibMesh)
111 {
112 bool forced = mesh.isParallelTypeForced();
113 bool pre_split = mesh.isSplit();
114 oss << (forced || pre_split ? " (" : "") << (forced ? "forced" : "")
115 << (forced && pre_split ? ", " : "") << (pre_split ? "pre-split" : "")
116 << (forced || pre_split ? ")" : "");
117 }
118 oss << '\n';
119 oss << std::setw(console_field_width) << " Mesh Dimension: " << mesh.dimension() << '\n'
120 << std::setw(console_field_width) << " Spatial Dimension: " << mesh.spatialDimension()
121 << '\n';
122 }
123
124 // Nodes, only associated with the mesh in libMesh
125 if (fe_backend == Moose::FEBackend::LibMesh)
126 {
127 if (mesh.n_processors() > 1)
128 {
129 dof_id_type nnodes = mesh.nNodes();
130 dof_id_type nnodes_local = mesh.nLocalNodes();
131 oss << std::setw(console_field_width) << " Nodes:" << '\n'
132 << std::setw(console_field_width) << " Total:" << nnodes << '\n';
133 oss << std::setw(console_field_width) << " Local:" << nnodes_local << '\n';
134 dof_id_type min_nnodes = nnodes_local, max_nnodes = nnodes_local;
135 mesh.comm().min(min_nnodes);
136 mesh.comm().max(max_nnodes);
137 if (mesh.processor_id() == 0)
138 oss << std::setw(console_field_width) << " Min/Max/Avg:" << min_nnodes << '/'
139 << max_nnodes << '/' << nnodes / mesh.n_processors() << '\n';
140 }
141 else
142 oss << std::setw(console_field_width) << " Nodes:" << mesh.nNodes() << '\n';
143 }
144
145 // Elements
146 if (mesh.n_processors() > 1)
147 {
148 dof_id_type nelems = mesh.nActiveElem();
149 dof_id_type nelems_local = mesh.nActiveLocalElem();
150 oss << std::setw(console_field_width) << " Elems:" << '\n'
151 << std::setw(console_field_width) << " Total:" << nelems << '\n';
152 oss << std::setw(console_field_width) << " Local:" << nelems_local << '\n';
153 dof_id_type min_nelems = nelems_local, max_nelems = nelems_local;
154 mesh.comm().min(min_nelems);
155 mesh.comm().max(max_nelems);
156 if (mesh.processor_id() == 0)
157 oss << std::setw(console_field_width) << " Min/Max/Avg:" << min_nelems << '/' << max_nelems
158 << '/' << nelems / mesh.n_processors() << '\n';
159 }
160 else
161 oss << std::setw(console_field_width) << " Elems:" << mesh.nActiveElem() << '\n';
162
163 // P-refinement
164 if (fe_backend == Moose::FEBackend::LibMesh)
165 {
166 if (mesh.maxPLevel() > 0)
167 oss << std::setw(console_field_width)
168 << " Max p-Refinement Level: " << static_cast<std::size_t>(mesh.maxPLevel()) << '\n';
169 if (mesh.maxHLevel() > 0)
170 oss << std::setw(console_field_width)
171 << " Max h-Refinement Level: " << static_cast<std::size_t>(mesh.maxHLevel()) << '\n';
172 }
173
174 if (verbose)
175 {
176 oss << std::setw(console_field_width)
177 << " Num Subdomains: " << static_cast<std::size_t>(mesh.nSubdomains()) << '\n';
178 if (mesh.n_processors() > 1 && fe_backend == Moose::FEBackend::LibMesh)
179 {
180 oss << std::setw(console_field_width)
181 << " Num Partitions: " << static_cast<std::size_t>(mesh.nPartitions()) << '\n'
182 << std::setw(console_field_width) << " Partitioner: " << mesh.partitionerName()
183 << (mesh.isPartitionerForced() ? " (forced) " : "") << '\n';
184 if (mesh.skipPartitioning())
185 oss << std::setw(console_field_width) << " Skipping all partitioning!" << '\n';
186 else if (mesh.skipNoncriticalPartitioning())
187 oss << std::setw(console_field_width) << " Skipping noncritical partitioning!" << '\n';
188 }
189 }
190
191 oss << std::endl;
192
193 return oss.str();
194}
virtual MooseMesh & mesh() override
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition MooseMesh.h:95
void max(const T &r, T &o, Request &req) const
void min(const T &r, T &o, Request &req) const
processor_id_type processor_id() const
const Parallel::Communicator & comm() const
MeshBase & mesh
uint8_t dof_id_type

Referenced by Console::meshChanged(), and Console::outputSystemInformation().

◆ outputOutputInformation()

std::string ConsoleUtils::outputOutputInformation ( MooseApp app)

Output the output information.

Definition at line 457 of file ConsoleUtils.C.

458{
459 std::stringstream oss;
460 oss << std::left;
461
462 const std::vector<Output *> outputs = app.getOutputWarehouse().getOutputs<Output>();
463 oss << "Outputs:\n";
464 for (const auto & out : outputs)
465 {
466 // Display the "execute_on" settings
467 const MultiMooseEnum & execute_on = out->executeOn();
468 oss << " " << std::setw(console_field_width - 2) << out->name() << "\"" << execute_on
469 << "\"\n";
470
471 // Display the advanced "execute_on" settings, only if they are different from "execute_on"
472 if (out->isAdvanced())
473 {
474 const OutputOnWarehouse & adv_on = out->advancedExecuteOn();
475 for (const auto & adv_it : adv_on)
476 if (execute_on != adv_it.second)
477 oss << " " << std::setw(console_field_width - 4) << adv_it.first + ":" << "\""
478 << adv_it.second << "\"" << std::endl;
479 }
480 }
481
482 return oss.str();
483}
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type.
A helper warehouse class for storing the "execute_on" settings for the various output types.
Based class for output objects.
Definition Output.h:52
OStreamProxy out(std::cout)

Referenced by Console::outputSystemInformation().

◆ outputPreSMOResidualInformation()

std::string ConsoleUtils::outputPreSMOResidualInformation ( )

Output the information about pre-SMO residual evaluation.

Definition at line 486 of file ConsoleUtils.C.

487{
488 std::stringstream oss;
489 oss << std::left;
490
491 oss << COLOR_BLUE;
492 oss << "Executioner/use_pre_smo_residual is set to true. The pre-SMO residual will be evaluated "
493 "at the beginning of each time step before executing objects that could modify the "
494 "solution, such as preset BCs, predictors, correctors, constraints, and certain user "
495 "objects. The pre-SMO residuals will be prefixed with * and will be used in the relative "
496 "convergence check.\n";
497 oss << COLOR_DEFAULT;
498
499 return oss.str();
500}

Referenced by Console::outputSystemInformation().

◆ outputRelationshipManagerInformation()

std::string ConsoleUtils::outputRelationshipManagerInformation ( const MooseApp app)

Output action RelationshipManager information.

Definition at line 351 of file ConsoleUtils.C.

352{
353 std::stringstream oss;
354 oss << std::left;
355
356 auto info_strings = app.getRelationshipManagerInfo();
357 if (info_strings.size())
358 {
359 for (const auto & info_pair : info_strings)
360 oss << std::setw(console_field_width)
361 << " " + MooseUtils::underscoreToCamelCase(MooseUtils::toLower(info_pair.first), true) +
362 ":"
363 << info_pair.second << '\n';
364 oss << std::endl;
365 }
366
367 return oss.str();
368}
std::vector< std::pair< std::string, std::string > > getRelationshipManagerInfo() const
Returns the Relationship managers info suitable for printing.
Definition MooseApp.C:3319

Referenced by Console::outputSystemInformation().

◆ outputSolverSystemInformation()

std::string ConsoleUtils::outputSolverSystemInformation ( FEProblemBase problem,
const unsigned int  solver_sys_num 
)

Output a solver system information.

Definition at line 334 of file ConsoleUtils.C.

335{
336 std::stringstream oss;
337 oss << std::left;
338
339 return outputSystemInformationHelper(oss, problem.getSolverSystem(sys_num).system());
340}
SolverSystem & getSolverSystem(unsigned int sys_num)
Get non-constant reference to a solver system.
virtual libMesh::System & system()=0
Get the reference to the libMesh system.

Referenced by Console::meshChanged(), and Console::outputSystemInformation().

◆ outputSystemInformationHelper() [1/2]

std::string ConsoleUtils::outputSystemInformationHelper ( libMesh::System system)

Output system information.

Parameters
systemThe libMesh system to output
See also
outputAuxiliarySystemInformation outputNonlinearSystemInformation

Definition at line 343 of file ConsoleUtils.C.

344{
345 std::stringstream oss;
346
347 return outputSystemInformationHelper(oss, system);
348}

Referenced by outputAuxiliarySystemInformation(), outputSolverSystemInformation(), and outputSystemInformationHelper().

◆ outputSystemInformationHelper() [2/2]

std::string ConsoleUtils::outputSystemInformationHelper ( std::stringstream &  oss,
System system 
)

Definition at line 203 of file ConsoleUtils.C.

204{
205 oss << std::left;
206
207 if (system.n_dofs())
208 {
209 oss << std::setw(console_field_width) << " Num DOFs: " << system.n_dofs() << '\n'
210 << std::setw(console_field_width) << " Num Local DOFs: " << system.n_local_dofs() << '\n';
211
212 if (system.n_constrained_dofs())
213 {
214 oss << std::setw(console_field_width)
215 << " Num Constrained DOFs: " << system.n_constrained_dofs() << '\n'
216 << std::setw(console_field_width)
217 << " Local Constrained DOFs: " << system.n_local_constrained_dofs() << '\n';
218 }
219
220 std::streampos begin_string_pos = oss.tellp();
221 std::streampos curr_string_pos = begin_string_pos;
222 oss << std::setw(console_field_width) << " Variables: ";
223 for (unsigned int vg = 0; vg < system.n_variable_groups(); vg++)
224 {
225 const VariableGroup & vg_description(system.variable_group(vg));
226
227 if (vg_description.n_variables() > 1)
228 oss << "{ ";
229 if (vg_description.n_variables() > 10)
230 {
231 // when the number of variables in this group is larger than 10, we only output the first
232 // and the last 5 variable names
233 for (unsigned int vn = 0; vn < 5; vn++)
234 {
235 oss << "\"" << vg_description.name(vn) << "\" ";
236 curr_string_pos = oss.tellp();
237 insertNewline(oss, begin_string_pos, curr_string_pos);
238 }
239 oss << "... ";
240 curr_string_pos = oss.tellp();
241 insertNewline(oss, begin_string_pos, curr_string_pos);
242 for (unsigned int vn = vg_description.n_variables() - 5; vn < vg_description.n_variables();
243 vn++)
244 {
245 oss << "\"" << vg_description.name(vn) << "\" ";
246 curr_string_pos = oss.tellp();
247 insertNewline(oss, begin_string_pos, curr_string_pos);
248 }
249 }
250 else
251 for (unsigned int vn = 0; vn < vg_description.n_variables(); vn++)
252 {
253 oss << "\"" << vg_description.name(vn) << "\" ";
254 curr_string_pos = oss.tellp();
255 insertNewline(oss, begin_string_pos, curr_string_pos);
256 }
257
258 if (vg_description.n_variables() > 1)
259 oss << "} ";
260 }
261 oss << '\n';
262
263 begin_string_pos = oss.tellp();
264 curr_string_pos = begin_string_pos;
265 oss << std::setw(console_field_width) << " Finite Element Types: ";
266#ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
267 for (unsigned int vg = 0; vg < system.n_variable_groups(); vg++)
268 {
269 oss << "\""
270 << libMesh::Utility::enum_to_string<FEFamily>(
271 system.get_dof_map().variable_group(vg).type().family)
272 << "\" ";
273 curr_string_pos = oss.tellp();
274 insertNewline(oss, begin_string_pos, curr_string_pos);
275 }
276 oss << '\n';
277#else
278 for (unsigned int vg = 0; vg < system.n_variable_groups(); vg++)
279 {
280 oss << "\""
281 << libMesh::Utility::enum_to_string<FEFamily>(
282 system.get_dof_map().variable_group(vg).type().family)
283 << "\", \""
284 << libMesh::Utility::enum_to_string<FEFamily>(
286 << "\" ";
287 curr_string_pos = oss.tellp();
288 insertNewline(oss, begin_string_pos, curr_string_pos);
289 }
290 oss << '\n';
291
292 begin_string_pos = oss.tellp();
293 curr_string_pos = begin_string_pos;
294 oss << std::setw(console_field_width) << " Infinite Element Mapping: ";
295 for (unsigned int vg = 0; vg < system.n_variable_groups(); vg++)
296 {
297 oss << "\""
298 << libMesh::Utility::enum_to_string<InfMapType>(
299 system.get_dof_map().variable_group(vg).type().inf_map)
300 << "\" ";
301 curr_string_pos = oss.tellp();
302 insertNewline(oss, begin_string_pos, curr_string_pos);
303 }
304 oss << '\n';
305#endif
306
307 begin_string_pos = oss.tellp();
308 curr_string_pos = begin_string_pos;
309 oss << std::setw(console_field_width) << " Approximation Orders: ";
310 for (unsigned int vg = 0; vg < system.n_variable_groups(); vg++)
311 {
312#ifndef LIBMESH_ENABLE_INFINITE_ELEMENTS
313 oss << "\""
314 << Utility::enum_to_string<Order>(system.get_dof_map().variable_group(vg).type().order)
315 << "\" ";
316#else
317 oss << "\""
318 << Utility::enum_to_string<Order>(system.get_dof_map().variable_group(vg).type().order)
319 << "\", \""
320 << Utility::enum_to_string<Order>(
322 << "\" ";
323#endif
324 curr_string_pos = oss.tellp();
325 insertNewline(oss, begin_string_pos, curr_string_pos);
326 }
327 oss << "\n" << std::endl;
328 }
329
330 return oss.str();
331}
const VariableGroup & variable_group(const unsigned int c) const
InfMapType inf_map
OrderWrapper radial_order
OrderWrapper order
FEFamily radial_family
dof_id_type n_dofs() const
dof_id_type n_local_dofs() const
dof_id_type n_constrained_dofs() const
const VariableGroup & variable_group(unsigned int vg) const
unsigned int n_variable_groups() const
dof_id_type n_local_constrained_dofs() const
const DofMap & get_dof_map() const
const FEType & type() const

Variable Documentation

◆ console_field_width

const unsigned int ConsoleUtils::console_field_width = 27
static

◆ console_line_length

const unsigned int ConsoleUtils::console_line_length = 100
static

Line length for printing simulation information.

Definition at line 33 of file ConsoleUtils.h.

Referenced by insertNewline().