diff --git a/src/coreComponents/common/format/LogPart.cpp b/src/coreComponents/common/format/LogPart.cpp index cadd5e79f77..bab7c9a6922 100644 --- a/src/coreComponents/common/format/LogPart.cpp +++ b/src/coreComponents/common/format/LogPart.cpp @@ -31,9 +31,6 @@ LogPart::LogPart( string_view logpartName, bool enableOutput ) m_formattedEndDescription.m_title = GEOS_FMT( "{}{}", m_prefixEndTitle, logpartName ); m_enableOutput = enableOutput; - - ErrorLogger::global().setCurrentLogPart( std::string( logpartName ) ); - } void LogPart::addDescription( string_view description ) @@ -190,10 +187,11 @@ string LogPart::outputTitle( LogPart::FormattedDescription & formattedDescriptio void LogPart::begin( std::ostream & os ) { + ErrorLogger::global().setCurrentLogPart( m_formattedStartDescription.m_title ); + if( !m_enableOutput ) return; - if( !m_startDescription.m_names.empty()) { formatDescriptions( m_startDescription, m_formattedStartDescription ); diff --git a/src/coreComponents/common/format/LogPart.hpp b/src/coreComponents/common/format/LogPart.hpp index 3d52c8a45a5..e7d0c76535b 100644 --- a/src/coreComponents/common/format/LogPart.hpp +++ b/src/coreComponents/common/format/LogPart.hpp @@ -36,7 +36,7 @@ class LogPart /** * @brief Initialize a LogPart given a title * @param logPartTitle The title who will be used for top and bottom LogPart - * @param enableOutput Boolean to activate or not csv output + * @param enableOutput Boolean to activate or not log output */ LogPart( string_view logPartTitle, bool enableOutput ); diff --git a/src/coreComponents/common/logger/ErrorHandling.hpp b/src/coreComponents/common/logger/ErrorHandling.hpp index bd90fc0798c..ae6c133af82 100644 --- a/src/coreComponents/common/logger/ErrorHandling.hpp +++ b/src/coreComponents/common/logger/ErrorHandling.hpp @@ -21,7 +21,6 @@ #define INITIALIZATION_ERROR_LOGGER_HPP #include "common/DataTypes.hpp" -#include "common/format/LogPart.hpp" #include "common/logger/LogHistory.hpp" #include diff --git a/src/coreComponents/common/logger/LogHistory.hpp b/src/coreComponents/common/logger/LogHistory.hpp index 2e74f9f2f73..a99cd6d2e7c 100644 --- a/src/coreComponents/common/logger/LogHistory.hpp +++ b/src/coreComponents/common/logger/LogHistory.hpp @@ -22,11 +22,8 @@ #include "common/DataTypes.hpp" #include "common/StdContainerWrappers.hpp" -#include "common/format/LogPart.hpp" #include "common/format/table/TableFormatter.hpp" #include "DiagnosticMessage.hpp" -#include - namespace geos { diff --git a/src/coreComponents/mainInterface/GeosxState.cpp b/src/coreComponents/mainInterface/GeosxState.cpp index e4ffd96b132..0f39b1388be 100644 --- a/src/coreComponents/mainInterface/GeosxState.cpp +++ b/src/coreComponents/mainInterface/GeosxState.cpp @@ -20,6 +20,7 @@ #include "mainInterface/initialization.hpp" #include "mesh/mpiCommunications/CommunicationTools.hpp" #include "common/Timer.hpp" +#include "common/format/LogPart.hpp" // TPL includes #include diff --git a/src/coreComponents/mainInterface/ProblemManager.cpp b/src/coreComponents/mainInterface/ProblemManager.cpp index 33b7dc01503..1e7ad587b39 100644 --- a/src/coreComponents/mainInterface/ProblemManager.cpp +++ b/src/coreComponents/mainInterface/ProblemManager.cpp @@ -274,11 +274,13 @@ void ProblemManager::problemSetup() generateMesh(); meshGenerationLog.end(); -// initialize_postMeshGeneration(); - LogPart numericalMethodLog( "Numerical Methods", MpiWrapper::commRank() == 0 ); - numericalMethodLog.begin(); - applyNumericalMethods(); - numericalMethodLog.end(); + // initialize_postMeshGeneration(); + { + LogPart numericalMethodLog( "Numerical Methods", MpiWrapper::commRank() == 0 ); + numericalMethodLog.begin(); + applyNumericalMethods(); + numericalMethodLog.end(); + } registerDataOnMeshRecursive( getDomainPartition().getMeshBodies() ); @@ -288,7 +290,7 @@ void ProblemManager::problemSetup() logHypredriveInputs( *m_physicsSolverManager, getDomainPartition() ); #endif - LogPart importFieldsLog( "Import fields", MpiWrapper::commRank() == 0 ); + LogPart importFieldsLog( "Import Fields", MpiWrapper::commRank() == 0 ); importFieldsLog.begin(); importFields(); importFieldsLog.end(); diff --git a/src/coreComponents/physicsSolvers/PhysicsSolverBase.cpp b/src/coreComponents/physicsSolvers/PhysicsSolverBase.cpp index c4f7b9322ec..1f6c6427370 100644 --- a/src/coreComponents/physicsSolvers/PhysicsSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/PhysicsSolverBase.cpp @@ -384,24 +384,27 @@ void PhysicsSolverBase::logEndOfCycleInformation( integer const cycleNumber, integer const numOfSubSteps, stdVector< real64 > const & subStepDts ) const { - LogPart logpart( "Time step", MpiWrapper::commRank() == 0 ); - logpart.addEndDescription( "- Cycle ", cycleNumber ); - logpart.addEndDescription( "- N substeps ", numOfSubSteps ); - std::stringstream logMessage; - for( integer i = 0; i < numOfSubSteps; ++i ) { - if( i > 0 ) + LogPart logpart( "Time step", MpiWrapper::commRank() == 0 ); + logpart.addEndDescription( "- Cycle ", cycleNumber ); + logpart.addEndDescription( "- N substeps ", numOfSubSteps ); + + std::stringstream logMessage; + for( integer i = 0; i < numOfSubSteps; ++i ) { - logMessage << ", "; + if( i > 0 ) + { + logMessage << ", "; + } + logMessage << subStepDts[i] << " " << units::getSymbol( units::Unit::Time ); } - logMessage << subStepDts[i] << " " << units::getSymbol( units::Unit::Time ); - } - if( logMessage.rdbuf()->in_avail() == 0 ) - logMessage << "/"; + if( logMessage.rdbuf()->in_avail() == 0 ) + logMessage << "/"; - logpart.addEndDescription( "- substep dts ", logMessage.str() ); - logpart.end(); + logpart.addEndDescription( "- substep dts ", logMessage.str() ); + logpart.end(); + } if( isLogLevelActive< logInfo::SolverExecutionDetails >( getLogLevel())) getIterationStats().outputStatistics();