Console::~Console() { // Write the libMesh performance log header if (_perf_header) write(Moose::perf_log.get_info_header(), false); // Write the solve log (Moose Test Performance) if (_solve_log) write(Moose::perf_log.get_perf_info(), false); // Write the libMesh log #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING if (_libmesh_log) write(libMesh::perflog.get_perf_info(), false); #endif // Write the file output stream writeStreamToFile(); /* If --timing was not used disable the logging b/c the destructor of these * object does the output, if --timing was used do nothing because all other * screen related output was disabled above */ if (!_timing) { /* Disable the logs, without this the logs will be printed during the destructors of the logs themselves */ Moose::perf_log.disable_logging(); #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING libMesh::perflog.disable_logging(); #endif } }
int main(int argc, char **argv) { struct ByteStream *data; FILE *output; --argc; if (argc < 1) { fprintf(stderr, "\t\x1b[1m\x1b[91mSyntax: %s <path to test file> [<path to executable>]\x1b[0m\n", *argv); exit(-1); } ++argv; data = compileFile(*argv); printf("\n"); --argc; if (argc) { ++argv; output = fopen(*argv, "w"); } else { output = fopen("b.out", "w"); } writeStreamToFile(output, data); fclose(output); fprintf(stdout, "\x1b[1m\x1b[92mExiting...\x1b[0m\n"); return 0; }
Console::~Console() { // Write the libMesh performance log header if (_perf_header) write(Moose::perf_log.get_info_header(), false); // Write the solve log (Moose Test Performance) if (_solve_log) write(Moose::perf_log.get_perf_info(), false); // Write the libMesh log if (_libmesh_log) write(libMesh::perflog.get_perf_info(), false); // Write the file output stream writeStreamToFile(); /* If --timing was not used disable the logging b/c the destructor of these * object does the output, if --timing was used do nothing because all other * screen related output was disabled above */ if (!_timing && _app.name() == "main") { /* Disable the logs, without this the logs will be printed during the destructors of the logs themselves */ Moose::perf_log.disable_logging(); libMesh::perflog.disable_logging(); } }
void Console::output(const ExecFlagType & type) { // Return if the current output is not on the desired interval if (type != EXEC_FINAL && !onInterval()) return; // Output the system information first; this forces this to be the first item to write by default // However, 'output_system_information_on' still operates correctly, so it may be changed by the user if (shouldOutput("system_information", type) && !(type == EXEC_INITIAL && _initialized)) outputSystemInformation(); // Write the input if (shouldOutput("input", type)) outputInput(); // Write the timestep information ("Time Step 0 ..."), this is controlled with "execute_on" if (type == EXEC_TIMESTEP_BEGIN || (type == EXEC_INITIAL && _execute_on.contains(EXEC_INITIAL)) || (type == EXEC_FINAL && _execute_on.contains(EXEC_FINAL))) writeTimestepInformation(); // Print Non-linear Residual (control with "execute_on") if (type == EXEC_NONLINEAR && _execute_on.contains(EXEC_NONLINEAR)) { if (_nonlinear_iter == 0) _old_nonlinear_norm = std::numeric_limits<Real>::max(); _console << std::setw(2) << _nonlinear_iter << " Nonlinear |R| = " << outputNorm(_old_nonlinear_norm, _norm) << '\n'; _old_nonlinear_norm = _norm; } // Print Linear Residual (control with "execute_on") else if (type == EXEC_LINEAR && _execute_on.contains(EXEC_LINEAR)) { if (_linear_iter == 0) _old_linear_norm = std::numeric_limits<Real>::max(); _console << std::setw(7) << _linear_iter << " Linear |R| = " << outputNorm(_old_linear_norm, _norm) << '\n'; _old_linear_norm = _norm; } // Write variable norms else if (type == EXEC_TIMESTEP_END) writeVariableNorms(); // Write Postprocessors and Scalars if (shouldOutput("postprocessors", type)) outputPostprocessors(); if (shouldOutput("scalars", type)) outputScalarVariables(); // Write the file writeStreamToFile(); }
void Console::initialSetup() { // If --timing was used from the command-line, do nothing, all logs are enabled // Also, only allow the main app to change the perf_log settings. if (!_timing && _app.name() == "main") { if (_perf_log || _setup_log || _solve_log || _perf_header || _setup_log_early) _app.getOutputWarehouse().setLoggingRequested(); // Disable performance logging if nobody needs logging if (!_app.getOutputWarehouse().getLoggingRequested()) Moose::perf_log.disable_logging(); // Disable libMesh log if (!_libmesh_log) libMesh::perflog.disable_logging(); } // system info flag can be changed only before console initial setup _allow_changing_sysinfo_flag = false; // If execute_on = 'initial' perform the output if (wantOutput("system_information", EXEC_INITIAL)) outputSystemInformation(); // Call the base class method TableOutput::initialSetup(); // If file output is desired, wipe out the existing file if not recovering if (!_app.isRecovering()) writeStreamToFile(false); // Enable verbose output if Executioner has it enabled if (_app.getExecutioner()->isParamValid("verbose") && _app.getExecutioner()->getParam<bool>("verbose")) _verbose = true; // Display a message to indicate the application is running (useful for MultiApps) if (_problem_ptr->hasMultiApps() || _app.multiAppLevel() > 0) write(std::string("\nRunning App: ") + _app.name() + "\n"); // If the user adds "final" to the execute on, append this to the postprocessors, scalars, etc., // but only // if the parameter (e.g., postprocessor_execute_on) has not been modified by the user. if (_execute_on.contains("final")) { if (!_pars.isParamSetByUser("postprocessor_execute_on")) _advanced_execute_on["postprocessors"].push_back("final"); if (!_pars.isParamSetByUser("scalars_execute_on")) _advanced_execute_on["scalars"].push_back("final"); if (!_pars.isParamSetByUser("vector_postprocessor_execute_on")) _advanced_execute_on["vector_postprocessors"].push_back("final"); } }
Console::~Console() { // Write the libMesh log if (_libmesh_log) write(libMesh::perflog.get_perf_info(), false); // Write the file output stream writeStreamToFile(); // Disable logging so that the destructor in libMesh doesn't print Moose::perf_log.disable_logging(); libMesh::perflog.disable_logging(); }
Console::~Console() { // Write the libMesh performance log header if (_perf_header) write(Moose::perf_log.get_info_header(), false); // Write the solve log (Moose Test Performance) if (_solve_log) write(Moose::perf_log.get_perf_info(), false); // Write the libMesh log if (_libmesh_log) write(libMesh::perflog.get_perf_info(), false); // Write the file output stream writeStreamToFile(); // Disable logging so that the destructor in libMesh doesn't print Moose::perf_log.disable_logging(); libMesh::perflog.disable_logging(); }
void Console::initialSetup() { // If execute_on = 'initial' perform the output if (shouldOutput("system_information", EXEC_INITIAL)) outputSystemInformation(); // Call the base class method TableOutput::initialSetup(); // If file output is desired, wipe out the existing file if not recovering if (!_app.isRecovering()) writeStreamToFile(false); // Enable verbose output if Executioner has it enabled if (_app.getExecutioner()->isParamValid("verbose") && _app.getExecutioner()->getParam<bool>("verbose")) _verbose = true; // Display a message to indicate the application is running (useful for MultiApps) if (_problem_ptr->hasMultiApps() || _app.multiAppLevel() > 0) write(std::string("\nRunning App: ") + _app.name() + "\n"); // Output the performance log early if (getParam<bool>("setup_log_early")) write(Moose::setup_perf_log.get_perf_info()); // If the user adds "final" to the execute on, append this to the postprocessors, scalars, etc., but only // if the parameter (e.g., postprocessor_execute_on) has not been modified by the user. if (_execute_on.contains("final")) { if (!_pars.paramSetByUser("postprocessor_execute_on")) _advanced_execute_on["postprocessors"].push_back("final"); if (!_pars.paramSetByUser("scalars_execute_on")) _advanced_execute_on["scalars"].push_back("final"); if (!_pars.paramSetByUser("vector_postprocessor_execute_on")) _advanced_execute_on["vector_postprocessors"].push_back("final"); } }
void Console::initialSetup() { // Set the string for multiapp output indending if (_app.getOutputWarehouse().multiappLevel() > 0) _multiapp_indent = COLOR_CYAN + _app.name() + ": " + COLOR_DEFAULT; // If file output is desired, wipe out the existing file if not recovering if (!_app.isRecovering()) writeStreamToFile(false); // Enable verbose output if Executioner has it enabled if (_app.getExecutioner()->isParamValid("verbose") && _app.getExecutioner()->getParam<bool>("verbose")) { _verbose = true; _pars.set<bool>("verbose") = true; } // Display a message to indicate the application is running (useful for MultiApps) if (_problem_ptr->hasMultiApps() || _app.getOutputWarehouse().multiappLevel() > 0) write(std::string("\nRunning App: ") + _app.name() + "\n"); // Output the performance log early if (getParam<bool>("setup_log_early")) write(Moose::setup_perf_log.get_perf_info()); // Output the input file if (_output_input) outputInput(); // Output the system information if (_system_information && _allow_output && !_force_output) outputSystemInformation(); // Output the timestep information timestepSetup(); }
void Console::output() { // Print Non-linear Residual if (onNonlinearResidual()) { if (_write_screen) Moose::out << _multiapp_indent << std::setw(2) << _nonlinear_iter << " Nonlinear |R| = " << outputNorm(_old_nonlinear_norm, _norm) << std::endl; if (_write_file) _file_output_stream << std::setw(2) << _nonlinear_iter << " Nonlinear |R| = " << std::scientific << _norm << std::endl; } // Print Linear Residual else if (onLinearResidual()) { if (_write_screen) Moose::out << _multiapp_indent << std::setw(7) << _linear_iter << " Linear |R| = " << outputNorm(_old_linear_norm, _norm) << std::endl; if (_write_file) _file_output_stream << std::setw(7) << _linear_iter << std::scientific << " Linear |R| = " << std::scientific << _norm << std::endl; } // Call the base class output function else { // Write variable norms writeVariableNorms(); // Perform output of scalars and postprocessors TableOutput::output(); } // Write the file writeStreamToFile(); }
void DOFMapOutput::output(const ExecFlagType & /*type*/) { // Don't build this information if nothing is to be written if (!_write_screen && !_write_file) return; std::stringstream oss; // Get the DOF Map through the equation system const System & sys = _problem_ptr->es().get_system(_system_name); // TransientNonlinearImplicit const DofMap & dof_map = sys.get_dof_map(); // fetch the KernelWarehouse through the NonlinearSystem NonlinearSystem & nl = _problem_ptr->getNonlinearSystem(); const KernelWarehouse & kernels = nl.getKernelWarehouse(); // get a set of all subdomains const std::set<SubdomainID> & subdomains = _mesh.meshSubdomains(); bool first = true; oss << "{\"ndof\": " << sys.n_dofs() << ", \"demangled\": "; #if defined(LIBMESH_HAVE_GCC_ABI_DEMANGLE) oss << "true"; #else oss << "false"; #endif oss << ", \"vars\": ["; for (unsigned int vg = 0; vg < dof_map.n_variable_groups(); ++vg) { const VariableGroup &vg_description (dof_map.variable_group(vg)); for (unsigned int vn = 0; vn < vg_description.n_variables(); ++vn) { unsigned int var = vg_description.number(vn); if (!first) oss << ", "; first = false; oss << "{\"name\": \"" << vg_description.name(vn) << "\", \"subdomains\": ["; for (std::set<SubdomainID>::const_iterator sd = subdomains.begin(); sd != subdomains.end(); ++sd) { oss << (sd != subdomains.begin() ? ", " : "") << "{\"id\": " << *sd << ", \"kernels\": ["; // if this variable has active kernels output them if (kernels.hasActiveVariableBlockObjects(var, *sd)) { const std::vector<MooseSharedPointer<KernelBase> > & active_kernels = kernels.getActiveVariableBlockObjects(var, *sd); for (unsigned i = 0; i<active_kernels.size(); ++i) { KernelBase & kb = *(active_kernels[i].get()); oss << (i>0 ? ", " : "") << "{\"name\": \"" << kb.name() << "\", \"type\": \"" << demangle(typeid(kb).name()) << "\"}"; } } oss << "], \"dofs\": ["; // get the list of unique DOFs for this variable std::set<dof_id_type> dofs; for (unsigned int i = 0; i < _mesh.nElem(); ++i) if (_mesh.elem(i)->subdomain_id() == *sd) { std::vector<dof_id_type> di; dof_map.dof_indices(_mesh.elem(i), di, var); dofs.insert(di.begin(), di.end()); } oss << join(dofs.begin(), dofs.end(), ", ") << "]}"; } oss << "]}"; } } oss << "]}\n"; // Write the message to file stream if (_write_file) _file_output_stream << oss.str() << std::endl; // Write message to the screen if (_write_screen) _console << oss.str() << std::flush; // Write the actual file if (_write_file) writeStreamToFile(); }