https://mooseframework.inl.gov
Functions | Variables
ConsoleUtils Namespace Reference

Functions

std::string indent (unsigned int spaces)
 Create empty string for indenting. More...
 
std::string outputFrameworkInformation (const MooseApp &app)
 Outputs framework information. More...
 
std::string outputMeshInformation (FEProblemBase &problem, bool verbose=true)
 Output the mesh information. More...
 
std::string outputAuxiliarySystemInformation (FEProblemBase &problem)
 Output the Auxiliary system information. More...
 
std::string outputSolverSystemInformation (FEProblemBase &problem, const unsigned int solver_sys_num)
 Output a solver system information. More...
 
std::string outputRelationshipManagerInformation (const MooseApp &app)
 Output action RelationshipManager information. More...
 
std::string outputExecutionInformation (const MooseApp &app, FEProblemBase &problem)
 Output execution information. More...
 
std::string outputOutputInformation (MooseApp &app)
 Output the output information. More...
 
std::string outputSystemInformationHelper (libMesh::System &system)
 Output system information. More...
 
std::string outputPreSMOResidualInformation ()
 Output the information about pre-SMO residual evaluation. More...
 
std::string outputLegacyInformation (MooseApp &app)
 Output the legacy flag information. More...
 
std::string outputDataFilePaths ()
 Output the registered data paths for searching. More...
 
std::string outputDataFileParams (MooseApp &app)
 Output the (param path = value) pairs for each DataFileName parameter. More...
 
void insertNewline (std::stringstream &oss, std::streampos &begin, std::streampos &curr)
 Helper function function for stringstream formatting. More...
 
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. More...
 
std::string mooseObjectVectorToString (const std::vector< MooseObject *> &objs, const std::string &sep=" ")
 Routine to output the name of MooseObjects in a string. More...
 
std::string outputSystemInformationHelper (std::stringstream &oss, System &system)
 

Variables

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

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 582 of file ConsoleUtils.C.

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

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

◆ indent()

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

◆ insertNewline()

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

Helper function function for stringstream formatting.

Definition at line 571 of file ConsoleUtils.C.

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

572 {
573  if (curr - begin > console_line_length)
574  {
575  oss << "\n";
576  begin = oss.tellp();
577  oss << std::setw(console_field_width + 2) << ""; // "{ "
578  }
579 }
static const unsigned int console_field_width
Width used for printing simulation information.
Definition: ConsoleUtils.h:30
static const unsigned int console_line_length
Line length for printing simulation information.
Definition: ConsoleUtils.h:33

◆ 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 598 of file ConsoleUtils.C.

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

599 {
600  std::string object_names = "";
601  if (objs.size())
602  {
603  // Gather all the object names
604  std::vector<std::string> names;
605  names.reserve(objs.size());
606  for (const auto & obj : objs)
607  {
608  mooseAssert(obj, "Trying to print a null object");
609  names.push_back(obj->name());
610  }
611 
612  object_names = MooseUtils::join(names, sep);
613  }
614  return object_names;
615 }
std::string join(Iterator begin, Iterator end, const std::string &delimiter)
Python-like join function for strings over an iterator range.
Definition: MooseUtils.h:142

◆ outputAuxiliarySystemInformation()

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

Output the Auxiliary system information.

Definition at line 198 of file ConsoleUtils.C.

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

199 {
201 }
std::string outputSystemInformationHelper(std::stringstream &oss, System &system)
Definition: ConsoleUtils.C:204
AuxiliarySystem & getAuxiliarySystem()
virtual libMesh::System & system() override
Get the reference to the libMesh system.

◆ outputDataFileParams()

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

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

Definition at line 548 of file ConsoleUtils.C.

Referenced by Console::outputSystemInformation().

549 {
550  std::map<std::string, std::string> values; // for A-Z sort
551  for (const auto & object_name_params_pair : app.getInputParameterWarehouse().getInputParameters())
552  {
553  const auto & params = object_name_params_pair.second;
554  for (const auto & name_value_pair : *params)
555  {
556  const auto & name = name_value_pair.first;
557  if (const auto path = params->queryDataFileNamePath(name))
558  if (params->getHitNode(name))
559  values.emplace(params->paramFullpath(name), path->path);
560  }
561  }
562 
563  std::stringstream oss;
564  oss << "Data File Parameters:\n";
565  for (const auto & [param, value] : values)
566  oss << " " << param << " = " << value << "\n";
567  return oss.str() + '\n';
568 }
std::string name(const ElemQuality q)
InputParameterWarehouse & getInputParameterWarehouse()
Get the InputParameterWarehouse for MooseObjects.
Definition: MooseApp.C:2839
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
const std::multimap< MooseObjectName, std::shared_ptr< InputParameters > > & getInputParameters(THREAD_ID tid=0) const
Return const reference to the map containing the InputParameter objects.

◆ outputDataFilePaths()

std::string ConsoleUtils::outputDataFilePaths ( )

Output the registered data paths for searching.

Definition at line 538 of file ConsoleUtils.C.

Referenced by Console::outputSystemInformation().

539 {
540  std::stringstream oss;
541  oss << "Data File Paths:\n";
542  for (const auto & [name, path] : Registry::getDataFilePaths())
543  oss << " " << name << ": " << path << "\n";
544  return oss.str() + "\n";
545 }
std::string name(const ElemQuality q)
static const std::map< std::string, std::string > & getDataFilePaths()
Returns a map of all registered data file paths (name -> path)
Definition: Registry.h:243

◆ outputExecutionInformation()

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

Output execution information.

Definition at line 372 of file ConsoleUtils.C.

Referenced by Console::outputSystemInformation().

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

◆ 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.

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

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

◆ outputLegacyInformation()

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

Output the legacy flag information.

Definition at line 502 of file ConsoleUtils.C.

Referenced by Console::outputSystemInformation().

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

◆ outputMeshInformation()

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

Output the mesh information.

Definition at line 97 of file ConsoleUtils.C.

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

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

◆ outputOutputInformation()

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

Output the output information.

Definition at line 456 of file ConsoleUtils.C.

Referenced by Console::outputSystemInformation().

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

◆ outputPreSMOResidualInformation()

std::string ConsoleUtils::outputPreSMOResidualInformation ( )

Output the information about pre-SMO residual evaluation.

Definition at line 485 of file ConsoleUtils.C.

Referenced by Console::outputSystemInformation().

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

◆ outputRelationshipManagerInformation()

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

Output action RelationshipManager information.

Definition at line 352 of file ConsoleUtils.C.

Referenced by Console::outputSystemInformation().

353 {
354  std::stringstream oss;
355  oss << std::left;
356 
357  auto info_strings = app.getRelationshipManagerInfo();
358  if (info_strings.size())
359  {
360  for (const auto & info_pair : info_strings)
361  oss << std::setw(console_field_width)
362  << " " + MooseUtils::underscoreToCamelCase(MooseUtils::toLower(info_pair.first), true) +
363  ":"
364  << info_pair.second << '\n';
365  oss << std::endl;
366  }
367 
368  return oss.str();
369 }
std::string toLower(const std::string &name)
Convert supplied string to lower case.
std::vector< std::pair< std::string, std::string > > getRelationshipManagerInfo() const
Returns the Relationship managers info suitable for printing.
Definition: MooseApp.C:3288
static const unsigned int console_field_width
Width used for printing simulation information.
Definition: ConsoleUtils.h:30
std::string underscoreToCamelCase(const std::string &underscore_name, bool leading_upper_case)
Function for converting an underscore name to a camel case name.
Definition: MooseUtils.C:576

◆ outputSolverSystemInformation()

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

Output a solver system information.

Definition at line 335 of file ConsoleUtils.C.

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

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

◆ 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 344 of file ConsoleUtils.C.

345 {
346  std::stringstream oss;
347 
348  return outputSystemInformationHelper(oss, system);
349 }
std::string outputSystemInformationHelper(std::stringstream &oss, System &system)
Definition: ConsoleUtils.C:204

◆ outputSystemInformationHelper() [2/2]

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

Definition at line 204 of file ConsoleUtils.C.

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

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