Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding logLevel documentation #3089

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ CO2BrineFluid< PHASE1, PHASE2, FLASH >::
CO2BrineFluid( string const & name, Group * const parent ):
MultiFluidBase( name, parent )
{
enableLogLevelInput();

registerWrapper( viewKeyStruct::phasePVTParaFilesString(), &m_phasePVTParaFiles ).
setInputFlag( InputFlags::REQUIRED ).
setRestartFlags( RestartFlags::NO_WRITE ).
Expand All @@ -112,6 +110,8 @@ CO2BrineFluid( string const & name, Group * const parent ):
setPlotLevel( PlotLevel::LEVEL_0 ).
setRestartFlags( RestartFlags::WRITE_AND_READ );
}

addLogLevel( "logLevel >= 1", "Informations on PVT phase table" );
}

template< typename PHASE1, typename PHASE2, typename FLASH >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ PVTDriver::PVTDriver( const string & name,
Group * const parent ):
TaskBase( name, parent )
{
enableLogLevelInput();

registerWrapper( viewKeyStruct::fluidNameString(), &m_fluidName ).
setRTTypeName( rtTypes::CustomTypes::groupNameRef ).
setInputFlag( InputFlags::REQUIRED ).
Expand Down Expand Up @@ -90,6 +88,9 @@ PVTDriver::PVTDriver( const string & name,
setInputFlag( InputFlags::OPTIONAL ).
setApplyDefaultValue( "none" ).
setDescription( "Baseline file" );

addLogLevel( "logLevel >= 1", "Informations about PVT Driver" );
addLogLevel( "logLevel >= 1", "Indicate consistency of results" );
}

void PVTDriver::postInputInitialization()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ ReactiveBrineFluid( string const & name, Group * const parent ):
setPlotLevel( PlotLevel::LEVEL_0 ).
setRestartFlags( RestartFlags::WRITE_AND_READ );
}

addLogLevel( "logLevel >= 1", "Information on phase PVT Table" );
}

template< typename PHASE >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ ReactiveFluidDriver::ReactiveFluidDriver( const string & name,
Group * const parent ):
TaskBase( name, parent )
{
enableLogLevelInput();

registerWrapper( viewKeyStruct::fluidNameString(), &m_fluidName ).
setRTTypeName( rtTypes::CustomTypes::groupNameRef ).
setInputFlag( InputFlags::REQUIRED ).
Expand Down Expand Up @@ -66,6 +64,9 @@ ReactiveFluidDriver::ReactiveFluidDriver( const string & name,
setInputFlag( InputFlags::OPTIONAL ).
setApplyDefaultValue( "none" ).
setDescription( "Baseline file" );

addLogLevel( "logLevel >= 1", "Information on ReactiveFluidDriver" );
addLogLevel( "logLevel >= 1", "Indicate at the end if the internal results are consistent" );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ RelpermDriver::RelpermDriver( const geos::string & name,
:
TaskBase( name, parent )
{
enableLogLevelInput();

registerWrapper( viewKeyStruct::relpermNameString(), &m_relpermName ).
setRTTypeName( rtTypes::CustomTypes::groupNameRef ).
setInputFlag( InputFlags::REQUIRED ).
Expand All @@ -52,6 +50,9 @@ RelpermDriver::RelpermDriver( const geos::string & name,
setInputFlag( InputFlags::OPTIONAL ).
setApplyDefaultValue( "none" ).
setDescription( "Baseline file" );

addLogLevel( "logLevel >= 1", "Information on RelpermDriver" );
addLogLevel( "logLevel >= 1", "Indicate if the internal results are consistent" );
}


Expand Down
5 changes: 3 additions & 2 deletions src/coreComponents/constitutive/solid/TriaxialDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ TriaxialDriver::TriaxialDriver( const string & name,
Group * const parent ):
TaskBase( name, parent )
{
enableLogLevelInput();

registerWrapper( viewKeyStruct::solidMaterialNameString(), &m_solidMaterialName ).
setRTTypeName( rtTypes::CustomTypes::groupNameRef ).
setInputFlag( InputFlags::REQUIRED ).
Expand Down Expand Up @@ -67,6 +65,9 @@ TriaxialDriver::TriaxialDriver( const string & name,
setInputFlag( InputFlags::OPTIONAL ).
setApplyDefaultValue( "none" ).
setDescription( "Baseline file" );

addLogLevel( "logLevel >= 1", "Information on TriaxialDriver" );
addLogLevel( "logLevel >= 1", "Indicate if the internal results are consistent" );
}


Expand Down
21 changes: 12 additions & 9 deletions src/coreComponents/dataRepository/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ void Group::deregisterWrapper( string const & name )
m_conduitNode.remove( name );
}

void Group::addLogLevel( string_view levelCondition, string_view logDescription )
{
Wrapper< integer > * wrapper = getWrapperPointer< integer >( viewKeyStruct::logLevelString() );
if( wrapper == nullptr )
{
wrapper = &registerWrapper( viewKeyStruct::logLevelString(), &m_logLevel );
wrapper->setApplyDefaultValue( 0 );
wrapper->setInputFlag( InputFlags::OPTIONAL );
}
m_logLevelsDescriptions[ string( levelCondition ) ].push_back( string( logDescription ) );
wrapper->buildLogLevelDescription( m_logLevelsDescriptions );
}

void Group::resize( indexType const newSize )
{
Expand Down Expand Up @@ -638,15 +650,6 @@ void Group::postRestartInitializationRecursive()
postRestartInitialization();
}

void Group::enableLogLevelInput()
{
// TODO : Improve the Log Level description to clearly assign a usecase per log level (incoming PR).
registerWrapper( viewKeyStruct::logLevelString(), &m_logLevel ).
setApplyDefaultValue( 0 ).
setInputFlag( InputFlags::OPTIONAL ).
setDescription( "Log level" );
}

Group const & Group::getBaseGroupByPath( string const & path ) const
{
Group const * currentGroup = this;
Expand Down
15 changes: 12 additions & 3 deletions src/coreComponents/dataRepository/Group.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,13 @@ class Group
///@}
//END_SPHINX_INCLUDE_REGISTER_WRAPPER

/**
* @brief Append a levelCondition and a log description to the description of the wrapped object
* @param levelCondition The level condition to append
* @param logDescription The log description to append
*/
void addLogLevel( string_view levelCondition, string_view logDescription );

/**
* @name Schema generation methods
*/
Expand Down Expand Up @@ -1469,9 +1476,6 @@ class Group
*/
void loadFromConduit();

/// Enable verbosity input for object
void enableLogLevelInput();

/**
* @brief Set verbosity level
* @param logLevel new verbosity level value
Expand Down Expand Up @@ -1606,6 +1610,11 @@ class Group

/// Verbosity flag for group logs
integer m_logLevel;

/// Map for building the log level string for each wrapper
/// key : a logLevel condition, values : a set of description for a corresponding loglevel
std::map< std::string, std::vector< std::string > > m_logLevelsDescriptions;

//END_SPHINX_INCLUDE_02

/// Restart flag for this group... and subsequently all wrappers in this group.
Expand Down
27 changes: 24 additions & 3 deletions src/coreComponents/dataRepository/WrapperBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,15 +510,36 @@ class WrapperBase

/**
* @brief Add up more text to the existing description string of the wrapper.
* @param description the description to add to the end of the previous one.
* @param description the description to add
* @return a pointer to this wrapper
*/
WrapperBase & appendDescription( string const & description )
{
m_description += description;
m_description = description;
return *this;
}

/**
* @brief Construct the log level string description for a wrapper
*/
void buildLogLevelDescription( std::map< std::string, std::vector< std::string > > const & logLevelsDescriptions )
{
std::ostringstream description;
description << "Sets the level of information to write in the standard output (the console typically).\n"
"A level of 0 outputs minimal information, higher levels require more.";
for( auto const & [logLevel, logDescriptions] : logLevelsDescriptions )
{
description << GEOS_FMT( "\n{}\n", logLevel );
for( size_t idxDesc = 0; idxDesc< logDescriptions.size(); idxDesc++ )
{
description << " - " << logDescriptions[idxDesc];
if( idxDesc != logDescriptions.size() - 1 ) description << '\n';
}
}
appendDescription( description.str() );
}


/**
* @brief Get the description string of the wrapper.
* @return this wrapper's description string
Expand Down Expand Up @@ -782,7 +803,7 @@ class WrapperBase
parallelDeviceEvents & events ) const = 0;
};

} /// namespace dataRepository
} /// namespace dataRepository
} /// namespace geos

#endif /* GEOS_DATAREPOSITORY_WRAPPERBASE_HPP_ */
5 changes: 2 additions & 3 deletions src/coreComponents/events/EventBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ EventBase::EventBase( const string & name,
{
setInputFlags( InputFlags::OPTIONAL_NONUNIQUE );

// This enables logLevel filtering
enableLogLevelInput();

registerWrapper( viewKeyStruct::eventTargetString(), &m_eventTarget ).
setRTTypeName( rtTypes::CustomTypes::groupNameRef ).
setInputFlag( InputFlags::OPTIONAL ).
Expand Down Expand Up @@ -106,6 +103,8 @@ EventBase::EventBase( const string & name,

registerWrapper( viewKeyStruct::isTargetExecutingString(), &m_targetExecFlag ).
setDescription( "Index of the current subevent" );

addLogLevel( "logLevel >= 1", "Information about sub-event" );
}


Expand Down
5 changes: 2 additions & 3 deletions src/coreComponents/events/EventManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ EventManager::EventManager( string const & name,
{
setInputFlags( InputFlags::REQUIRED );

// This enables logLevel filtering
enableLogLevelInput();

registerWrapper( viewKeyStruct::minTimeString(), &m_minTime ).
setApplyDefaultValue( 0 ).
setInputFlag( InputFlags::OPTIONAL ).
Expand Down Expand Up @@ -82,6 +79,8 @@ EventManager::EventManager( string const & name,
setInputFlag( InputFlags::OPTIONAL ).
setRestartFlags( RestartFlags::NO_WRITE ).
setDescription( "Format of the time in the GEOS log." );

addLogLevel( "logLevel >= 1", "Information about current sub-event" );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ AquiferBoundaryCondition::AquiferBoundaryCondition( string const & name, Group *
getWrapper< int >( FieldSpecificationBase::viewKeyStruct::componentString() ).
setInputFlag( InputFlags::FALSE );

addLogLevel( "logLevel >= 1", "Information on boundary conditions" );
}

void AquiferBoundaryCondition::postInputInitialization()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ FieldSpecificationBase::FieldSpecificationBase( string const & name, Group * par
setInputFlag( InputFlags::OPTIONAL ).
setDescription( "Time at which the boundary condition will stop being applied." );

enableLogLevelInput();
addLogLevel( "logLevel >= 1 and regions with no dof", "Warning about non simulated region" );
addLogLevel( "logLevel >= 1 first nonlinear iteration", "Print boundary conditions log messages" );
addLogLevel( "logLevel >= 1 and first nonlinear iteration", "Information on the face boundary condition defined with pressure and temperature" );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,10 @@ SourceFluxBoundaryCondition::SourceFluxBoundaryCondition( string const & name, G
setInputFlag( InputFlags::FALSE );
setFieldName( catalogName() );

getWrapper< string >( FieldSpecificationBase::viewKeyStruct::functionNameString() ).
setDescription( GEOS_FMT( "Name of a function that specifies the variation of the production rate variations of this {}."
"Multiplied by {}. If no function is provided, a constant value of 1 is used."
"The producted fluid rate unit is in kg by default, or in mole if the flow solver has a {} of 0.",
catalogName(),
FieldSpecificationBase::viewKeyStruct::scaleString(),
CompositionalMultiphaseBase::viewKeyStruct::useMassFlagString() ) );

getWrapper< real64 >( FieldSpecificationBase::viewKeyStruct::scaleString() ).
setDescription( GEOS_FMT( "Multiplier of the {0} value. If no {0} is provided, this value is used directly.",
FieldSpecificationBase::viewKeyStruct::functionNameString() ) );
addLogLevel( "logLevel >= 1 and first newton iteration", "Print the log message issued by the solver if the boundary condition is called" );
addLogLevel( "logLevel >= 1 and regions with no dof", "Warnings about non-simulated region intersecting, that can cancel sourceFlux effects" );
addLogLevel( "logLevel >= 1 and first nonlinear iteration", "Information abonout the Dirichlet pressure, temperature boundary conditions" );
addLogLevel( "logLevel >= 1 and first nonlinear iteration and this is a thermal simulation", "Information on single phase thermal simulation" );
}

REGISTER_CATALOG_ENTRY( FieldSpecificationBase, SourceFluxBoundaryCondition, string const &, Group * const )
Expand Down
2 changes: 2 additions & 0 deletions src/coreComponents/fileIO/Outputs/ChomboIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ ChomboIO::ChomboIO( string const & name, Group * const parent ):
setInputFlag( InputFlags::OPTIONAL ).
setDefaultValue( 0 ).
setDescription( "True iff geosx should use the pressures chombo writes out." );

addLogLevel( "logLevel == 1", "Indicate chombo initializing" );
}

ChomboIO::~ChomboIO()
Expand Down
4 changes: 2 additions & 2 deletions src/coreComponents/fileIO/Outputs/VTKOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ VTKOutput::VTKOutput( string const & name,
m_levelNames(),
m_writer( getOutputDirectory() + '/' + m_plotFileRoot )
{
enableLogLevelInput();

registerWrapper( viewKeysStruct::plotFileRoot, &m_plotFileRoot ).
setDefaultValue( m_plotFileRoot ).
setInputFlag( InputFlags::OPTIONAL ).
Expand Down Expand Up @@ -122,6 +120,8 @@ void VTKOutput::postInputInitialization()
catalogName(), getDataContext(),
std::to_string( m_fieldNames.size() ), fieldNamesString, m_plotLevel ) );

addLogLevel( "logLevel >= 1", "Print field name and cycle number during execution" );

GEOS_ERROR_IF( m_writeFaceElementsAs3D, GEOS_FMT( "{} `{}`: 3D vtk plot of faceElements is not yet supported.",
catalogName(), getDataContext() ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void SuperLUDist< LAI >::setOptions()
m_data->options.ParSymbFact = m_params.direct.colPerm == LinearSolverParameters::Direct::ColPerm::parmetis ? YES : NO;
m_data->options.ReplaceTinyPivot = m_params.direct.replaceTinyPivot ? YES : NO;
m_data->options.IterRefine = m_params.direct.iterativeRefine ? SLU_DOUBLE : NOREFINE;

if( m_params.logLevel > 0 )
{
print_sp_ienv_dist( &m_data->options );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void hypre::mgr::createMGR( LinearSolverParameters const & params,
{
GEOS_LOG_RANK_0( GEOS_FMT( " MGR preconditioner: numComponentsPerField = {}", numComponentsPerField ) );
}
if( params.logLevel >= 1024 )
if( params.logLevel >= 1 )
{
GEOS_LOG_RANK( GEOS_FMT( " MGR preconditioner: pointMarkers = {}", mgrData.pointMarkers ) );
}
Expand Down
2 changes: 2 additions & 0 deletions src/coreComponents/mesh/DomainPartition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ DomainPartition::DomainPartition( string const & name,

registerGroup( groupKeys.meshBodies );
registerGroup< constitutive::ConstitutiveManager >( groupKeys.constitutiveManager );

addLogLevel( "logLevel >= 3", "Indication about setup communication" );
}


Expand Down
3 changes: 3 additions & 0 deletions src/coreComponents/mesh/MeshManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ MeshManager::MeshManager( string const & name,
Group * const parent ):
Group( name, parent )
{

setInputFlags( InputFlags::REQUIRED );

addLogLevel( "logLevel >= 1", "Information on imported field name on region/subRegion" );
}

MeshManager::~MeshManager()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ ExternalMeshGeneratorBase::ExternalMeshGeneratorBase( string const & name,
dataRepository::Group * const parent )
: MeshGeneratorBase( name, parent )
{
enableLogLevelInput();

registerWrapper( viewKeyStruct::filePathString(), &m_filePath ).
setInputFlag( InputFlags::REQUIRED ).
setRestartFlags( RestartFlags::NO_WRITE ).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ using namespace dataRepository;
InternalWellGenerator::InternalWellGenerator( string const & name, Group * const parent ):
WellGeneratorBase( name, parent )
{
enableLogLevelInput();

registerWrapper( viewKeyStruct::polylineNodeCoordsString(), &m_polyNodeCoords ).
setInputFlag( InputFlags::REQUIRED ).
setSizedFromParent( 0 ).
Expand Down
Loading
Loading