Skip to content

Commit

Permalink
Almost all working refs idaholab#15444
Browse files Browse the repository at this point in the history
Fixup a couple of tests refs idaholab#15444

Remove debugging statement refs idaholab#15444

Clang format idaholab#15444

Fixup build error refs idaholab#15444
  • Loading branch information
friedmud committed Aug 17, 2021
1 parent eb35440 commit e8f2d76
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 37 deletions.
6 changes: 6 additions & 0 deletions framework/include/base/MooseApp.h
Expand Up @@ -891,6 +891,9 @@ class MooseApp : public ConsoleStreamInterface,
/// Input file names used
std::vector<std::string> _input_filenames;

/// Input file name used
std::string _input_filename;

/// The output file basename
std::string _output_file_base;

Expand Down Expand Up @@ -924,6 +927,9 @@ class MooseApp : public ConsoleStreamInterface,
/// The PerfGraph object for this applciation
PerfGraph _perf_graph;

/// The RankMap is a useful object for determining how
const RankMap _rank_map;

/// Input parameter storage structure (this is a raw pointer so the destruction time can be explicitly controlled)
InputParameterWarehouse * _input_parameter_warehouse;

Expand Down
10 changes: 8 additions & 2 deletions framework/include/utils/MooseUtils.h
Expand Up @@ -566,6 +566,7 @@ void MaterialPropertyStorageDump(
* @param prefix The prefix to use for indenting
* @param message The message that will be indented
* @param color The color to apply to the prefix (default CYAN)
* @param indent_first_line If true this will indent the first line too (default)
*
* Takes a message like the following and indents it with another color code (see below)
*
Expand All @@ -584,9 +585,14 @@ void MaterialPropertyStorageDump(
*
* Also handles single line color codes
* COLOR_CYAN sub_app: 0 Nonline |R| = COLOR_GREEN 1.0e-10 COLOR_DEFAULT
*
* Not indenting the first line is useful in the case where the first line is actually finishing
* the line before it.
*/
void
indentMessage(const std::string & prefix, std::string & message, const char * color = COLOR_CYAN);
void indentMessage(const std::string & prefix,
std::string & message,
const char * color = COLOR_CYAN,
bool dont_indent_first_line = true);

/**
* remove ANSI escape sequences for teminal color from msg
Expand Down
2 changes: 1 addition & 1 deletion framework/src/actions/CouplingFunctorCheckAction.C
Expand Up @@ -30,7 +30,7 @@ CouplingFunctorCheckAction::validParams()
}

CouplingFunctorCheckAction::CouplingFunctorCheckAction(InputParameters parameters)
: Action(parameters)
: Action(parameters)
{
_name = "coupling_functor_check";
}
Expand Down
2 changes: 1 addition & 1 deletion framework/src/actions/MeshOnlyAction.C
Expand Up @@ -36,7 +36,7 @@ MeshOnlyAction::act()
auto & mesh_ptr = _app.actionWarehouse().mesh();

// Print information about the mesh
_console << mesh_ptr->getMesh().get_info(/* verbosity = */ 2);
_console << mesh_ptr->getMesh().get_info(/* verbosity = */ 2) << std::endl;

bool should_generate = false;
// If no argument specified or if the argument following --mesh-only starts
Expand Down
10 changes: 7 additions & 3 deletions framework/src/actions/SetupMeshCompleteAction.C
Expand Up @@ -104,12 +104,16 @@ SetupMeshCompleteAction::act()
}
else
{
TIME_SECTION("completeSetup", 2, "Completing Mesh Setup");

// Prepare the mesh (may occur multiple times)
_mesh->prepare();
{
TIME_SECTION("completeSetupUndisplaced", 2, "Setting Up Undisplaced Mesh");
_mesh->prepare();
}

if (_displaced_mesh)
{
TIME_SECTION("completeSetupDisplaced", 2, "Setting Up Displaced Mesh");
_displaced_mesh->prepare();
}
}
}
2 changes: 1 addition & 1 deletion framework/src/base/MooseApp.C
Expand Up @@ -305,14 +305,14 @@ MooseApp::MooseApp(InputParameters parameters)
_pars(parameters),
_type(getParam<std::string>("_type")),
_comm(getParam<std::shared_ptr<Parallel::Communicator>>("_comm")),
_rank_map(*_comm, _perf_graph),
_file_base_set_by_user(false),
_output_position_set(false),
_start_time_set(false),
_start_time(0.0),
_global_time_offset(0.0),
_output_warehouse(*this),
_perf_graph(type() + " (" + name() + ')', *this, getParam<bool>("perf_graph_live_all")),
_rank_map(*_comm, _perf_graph),
_input_parameter_warehouse(new InputParameterWarehouse()),
_action_factory(*this),
_action_warehouse(*this, _syntax, _action_factory),
Expand Down
2 changes: 1 addition & 1 deletion framework/src/outputs/MaterialPropertyDebugOutput.C
Expand Up @@ -49,7 +49,7 @@ MaterialPropertyDebugOutput::output(const ExecFlagType & /*type*/)
}

_console << "\n\nConsumed Material Properties:\n";
_console << std::setw(ConsoleUtils::console_field_width) << consumed.str() << '\n';
_console << std::setw(ConsoleUtils::console_field_width) << consumed.str() << std::endl;
}

void
Expand Down
8 changes: 4 additions & 4 deletions framework/src/outputs/OutputWarehouse.C
Expand Up @@ -29,8 +29,7 @@ OutputWarehouse::OutputWarehouse(MooseApp & app)
_output_exec_flag(EXEC_CUSTOM),
_force_output(false),
_logging_requested(false),
_last_message_ended_in_newline(true),
_num_printed(0)
_last_message_ended_in_newline(true)
{
// Set the reserved names
_reserved.insert("none"); // allows 'none' to be used as a keyword in 'outputs' parameter
Expand Down Expand Up @@ -216,8 +215,9 @@ OutputWarehouse::mooseConsole(std::ostringstream & buffer)

// If that last message ended in newline then this one may need
// to start with indenting
if (_last_message_ended_in_newline && _app.multiAppLevel() > 0)
MooseUtils::indentMessage(_app.name(), message);
// Note that we only indent the first line if the last message ended in new line
if (_app.multiAppLevel() > 0)
MooseUtils::indentMessage(_app.name(), message, COLOR_CYAN, _last_message_ended_in_newline);

Moose::out << message << std::flush;
buffer.clear();
Expand Down
2 changes: 1 addition & 1 deletion framework/src/problems/FEProblemBase.C
Expand Up @@ -985,7 +985,7 @@ FEProblemBase::initialSetup()
// Call initialSetup on the MultiApps
if (_multi_apps.hasObjects())
{
TIME_SECTION("initialSetupMultiApps", 2, "Initializing MultiApps");
TIME_SECTION("initialSetupMultiApps", 2, "Initializing MultiApps", false);
_multi_apps.initialSetup();
}

Expand Down
13 changes: 11 additions & 2 deletions framework/src/utils/MooseUtils.C
Expand Up @@ -645,7 +645,8 @@ removeColor(std::string & msg)
void
indentMessage(const std::string & prefix,
std::string & message,
const char * color /*= COLOR_CYAN*/)
const char * color /*= COLOR_CYAN*/,
bool indent_first_line)
{
// First we need to see if the message we need to indent (with color) also contains color codes
// that span lines.
Expand All @@ -658,20 +659,28 @@ indentMessage(const std::string & prefix,

bool ends_in_newline = message.empty() ? true : message.back() == '\n';

bool first = true;

std::istringstream iss(message);
for (std::string line; std::getline(iss, line);) // loop over each line
{
const static pcrecpp::RE match_color(".*(\\33\\[3\\dm)((?!\\33\\[3\\d)[^\n])*");
pcrecpp::StringPiece line_piece(line);
match_color.FindAndConsume(&line_piece, &color_code);
colored_message += color + prefix + ": " + curr_color + line;

if (!first || indent_first_line)
colored_message += color + prefix + ": " + curr_color;

colored_message += line;

// Only add a newline to the last line if it had one to begin with!
if (!iss.eof() || ends_in_newline)
colored_message += "\n";

if (!color_code.empty())
curr_color = color_code; // remember last color of this line

first = false;
}
message = colored_message;
}
Expand Down
5 changes: 3 additions & 2 deletions framework/src/utils/PerfGraphLivePrint.C
Expand Up @@ -99,7 +99,8 @@ PerfGraphLivePrint::printStats(PerfGraph::SectionIncrement & section_increment_s
(_last_printed_increment &&
_last_printed_increment != &section_increment_start)) // Print Finished
{
if ((_last_printed_increment->_state == PerfGraph::IncrementState::printed &&
if ((_last_printed_increment &&
_last_printed_increment->_state == PerfGraph::IncrementState::printed &&
_id_to_section_info[_last_printed_increment->_id]._print_dots))
_console << '\n';

Expand Down Expand Up @@ -268,7 +269,7 @@ PerfGraphLivePrint::start()
continue;

// The last entry in the current execution list for convenience
_current_execution_list_last = _current_execution_list_end - 1 >= 0
_current_execution_list_last = static_cast<long int>(_current_execution_list_end) - 1 >= 0
? _current_execution_list_end - 1
: MAX_EXECUTION_LIST_SIZE;

Expand Down
11 changes: 6 additions & 5 deletions modules/contact/src/constraints/MechanicalContactConstraint.C
Expand Up @@ -401,13 +401,14 @@ MechanicalContactConstraint::AugmentedLagrangianContactConverged()
_communicator.max(converged);

if (converged == 1)
_console
<< "The Augmented Lagrangian contact tangential sliding enforcement is NOT satisfied " << std::endl;
_console << "The Augmented Lagrangian contact tangential sliding enforcement is NOT satisfied "
<< std::endl;
else if (converged == 2)
_console
<< "The Augmented Lagrangian contact tangential sliding enforcement is NOT satisfied " << std::endl;
_console << "The Augmented Lagrangian contact tangential sliding enforcement is NOT satisfied "
<< std::endl;
else if (converged == 3)
_console << "The Augmented Lagrangian contact frictional force enforcement is NOT satisfied " << std::endl;
_console << "The Augmented Lagrangian contact frictional force enforcement is NOT satisfied "
<< std::endl;
else
return true;

Expand Down
Expand Up @@ -267,7 +267,8 @@ GeochemicalModelInterrogator::outputTemperature(const std::string & eqm_species)
rhs = -std::log10(getActivity(eqm_species));
else
{
_console << "Not enough activites known to compute equilibrium temperature for reaction\n " << std::flush;
_console << "Not enough activites known to compute equilibrium temperature for reaction\n "
<< std::flush;
outputReaction(eqm_species);
return;
}
Expand All @@ -280,8 +281,8 @@ GeochemicalModelInterrogator::outputTemperature(const std::string & eqm_species)
rhs += _mgd.eqm_stoichiometry(row, i) * std::log10(getActivity(sp));
else
{
_console
<< "Not enough activites known to compute equilibrium temperature for reaction\n " << std::flush;
_console << "Not enough activites known to compute equilibrium temperature for reaction\n "
<< std::flush;
outputReaction(eqm_species);
return;
}
Expand Down
3 changes: 2 additions & 1 deletion modules/misc/src/userobjects/RigidBodyModes3D.C
Expand Up @@ -67,7 +67,8 @@ RigidBodyModes3D::RigidBodyModes3D(const InputParameters & parameters)
if (_modes.size() > 6)
{
std::stringstream err;
err << "Expected between 0 and 6 rigid body modes, got " << _modes.size() << " instead" << std::endl;
err << "Expected between 0 and 6 rigid body modes, got " << _modes.size() << " instead"
<< std::endl;
mooseError(err.str());
}
for (std::set<std::string>::const_iterator it = _modes.begin(); it != _modes.end(); ++it)
Expand Down
3 changes: 1 addition & 2 deletions modules/phase_field/src/userobjects/EBSDReader.C
Expand Up @@ -337,8 +337,7 @@ EBSDReader::readFile()
if (!data_quality_ok)
_console << COLOR_YELLOW << "EBSD data may not be reliable"
<< "\n"
<< COLOR_DEFAULT
<< std::flush;
<< COLOR_DEFAULT << std::flush;

// compute eigen values and eigen vectors
Eigen::EigenSolver<Eigen::MatrixXd> EigenSolver(quat_mat * weight * quat_mat.transpose());
Expand Down
Expand Up @@ -404,5 +404,6 @@ ADSingleVariableReturnMappingSolution::outputIterationSummary(std::stringstream
if (iter_output)
*iter_output << "In " << total_it << " iterations the residual went from "
<< MetaPhysicL::raw_value(_initial_residual) << " to "
<< MetaPhysicL::raw_value(_residual) << " in '" << _svrms_name << "'." << std::endl;
<< MetaPhysicL::raw_value(_residual) << " in '" << _svrms_name << "'."
<< std::endl;
}
Expand Up @@ -68,7 +68,8 @@ TensorMechanicsPlasticMohrCoulombMulti::TensorMechanicsPlasticMohrCoulombMulti(
mooseError("Value of 'shift' in TensorMechanicsPlasticMohrCoulombMulti must not be negative\n");
if (_shift > _f_tol)
_console << "WARNING: value of 'shift' in TensorMechanicsPlasticMohrCoulombMulti is probably "
"set too high" << std::endl;
"set too high"
<< std::endl;
if (LIBMESH_DIM != 3)
mooseError("TensorMechanicsPlasticMohrCoulombMulti is only defined for LIBMESH_DIM=3");
MooseRandom::seed(0);
Expand Down
Expand Up @@ -59,7 +59,8 @@ TensorMechanicsPlasticTensileMulti::TensorMechanicsPlasticTensileMulti(
mooseError("Value of 'shift' in TensorMechanicsPlasticTensileMulti must not be negative\n");
if (_shift > _f_tol)
_console << "WARNING: value of 'shift' in TensorMechanicsPlasticTensileMulti is probably set "
"too high" << std::endl;
"too high"
<< std::endl;
if (LIBMESH_DIM != 3)
mooseError("TensorMechanicsPlasticTensileMulti is only defined for LIBMESH_DIM=3");
MooseRandom::seed(0);
Expand Down
3 changes: 2 additions & 1 deletion modules/tensor_mechanics/src/utils/MultiPlasticityDebugger.C
Expand Up @@ -516,7 +516,8 @@ MultiPlasticityDebugger::checkSolution(const RankFourTensor & E_inv)
L2_numer += Utility::pow<2>(orig_rhs[i] - fd_times_x[i]);
L2_denom += Utility::pow<2>(orig_rhs[i] + fd_times_x[i]);
}
Moose::err << "\nRelative L2norm of these is " << std::sqrt(L2_numer / L2_denom) / 0.5 << std::endl;
Moose::err << "\nRelative L2norm of these is " << std::sqrt(L2_numer / L2_denom) / 0.5
<< std::endl;
}

void
Expand Down
8 changes: 4 additions & 4 deletions test/tests/postprocessors/perf_graph_data/perf_graph.i
Expand Up @@ -41,25 +41,25 @@
type = PerfGraphData
section_name = FEProblem::computeResidualInternal
data_type = CALLS
execute_on = 'INITIAL TIMESTEP_END'
execute_on = 'TIMESTEP_END'
[]
[self]
type = PerfGraphData
section_name = FEProblem::computeResidualInternal
data_type = SELF
execute_on = 'INITIAL TIMESTEP_END'
execute_on = 'TIMESTEP_END'
[]
[children]
type = PerfGraphData
section_name = FEProblem::computeResidualInternal
data_type = CHILDREN
execute_on = 'INITIAL TIMESTEP_END'
execute_on = 'TIMESTEP_END'
[]
[total]
type = PerfGraphData
section_name = FEProblem::computeResidualInternal
data_type = TOTAL
execute_on = 'INITIAL TIMESTEP_END'
execute_on = 'TIMESTEP_END'
[]
[]

Expand Down

0 comments on commit e8f2d76

Please sign in to comment.