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

refactor: log levels solvers #3378

Merged
merged 10 commits into from
Oct 3, 2024
Merged
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
123 changes: 3 additions & 120 deletions src/coreComponents/dataRepository/LogLevelsInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/**
* @file LogLevelsInfo.hpp
* This file contains all log level informations and the mecanism to ensure LOG_LEVEL_INFO structure is valid
* This file contains log level information infrastructure and the mecanism to ensure LOG_LEVEL_INFO structure is valid
*/
#ifndef GEOS_COMMON_LOGLEVELSINFO_HPP
#define GEOS_COMMON_LOGLEVELSINFO_HPP
Expand All @@ -25,123 +25,6 @@
namespace geos
{

namespace logInfo
{

/**
* @name Common LogLevels info structures. They must comply with the `is_log_level_info` trait.
*/
///@{

/// @cond DO_NOT_DOCUMENT
struct LineSearch
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Information on line search"; }
};

struct LineSearchFailed
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "On Incorrect solution, output the failed line search step"; }
};

struct ScalingFactor
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Information on global solution scaling factor"; }
};

struct TimeStep
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Information on the timestep"; }
};

struct SolverTimers
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Information on solver timers"; }
};

struct ScreenLinearSystem
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Output to screen the assembled linear system and solutions (matrices and vectors)"; }

};

struct FileLinearSystem
{
static constexpr int getMinLogLevel() { return 2; }
static constexpr std::string_view getDescription() { return "Output to file the assembled linear system and solutions (matrices and vectors)"; }
};

struct SolverBaseNonlinearSystem
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "On non linear system, output informations about new configurations"; }
};

struct ResidualNorm
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Print residual norm"; }
};

struct ResidualValues
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Print the residual values"; }
};

struct LinearSystem
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Information on linear system"; }
};

struct CrossflowWarning
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "If the well is injector and crossflow enabled, display informations about crossflow for injectors"; }
};

struct HydraulicAperture
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Information on aperture and hydraulic aperture"; }
};

struct SolverTimeStep
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Informations on solver time step"; }
};

struct SolverNextDt
{
static constexpr int getMinLogLevel() { return 3; }
static constexpr std::string_view getDescription() { return "Informations on changing DT"; }
};

struct Dof
{
static constexpr int getMinLogLevel() { return 2; }
static constexpr std::string_view getDescription() { return "The summary of declared fields and coupling"; }
};

struct PoromechanicsPhaseFraction
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Print poromechanics phase volume fraction"; }
};
/// @endcond
///@}

}


/**
* @brief Trait used to check whether a LOG_LEVEL_INFO structure is valid.
* @tparam LOG_LEVEL_INFO The log level structure to check.
Expand All @@ -160,7 +43,7 @@ static constexpr bool is_log_level_info =
*
*/
template< typename LOG_LEVEL_INFO >
std::enable_if_t< geos::is_log_level_info< LOG_LEVEL_INFO >, bool >
std::enable_if_t< is_log_level_info< LOG_LEVEL_INFO >, bool >
isLogLevelActive( int level )
{
return level >= LOG_LEVEL_INFO::getMinLogLevel();
Expand Down Expand Up @@ -190,4 +73,4 @@ isLogLevelActive( int level )

}

#endif
#endif // GEOS_COMMON_LOGLEVELSINFO_HPP
3 changes: 2 additions & 1 deletion src/coreComponents/physicsSolvers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ set( physicsSolvers_headers
SolverBase.hpp
SolverBaseKernels.hpp
SolverStatistics.hpp
FieldStatisticsBase.hpp )
FieldStatisticsBase.hpp
LogLevelsInfo.hpp )

# Specify solver sources
set( physicsSolvers_sources
Expand Down
105 changes: 105 additions & 0 deletions src/coreComponents/physicsSolvers/LogLevelsInfo.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
* ------------------------------------------------------------------------------------------------------------
* SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
* Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
* Copyright (c) 2018-2020 TotalEnergies
* Copyright (c) 2019- GEOSX Contributors
* All rights reserved
*
* See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
* ------------------------------------------------------------------------------------------------------------
*/

/**
* @file LogLevelsInfo.hpp
* This file contains common log level informations for physics solvers
*/

#ifndef GEOS_PHYSICSSOLVERS_LOGLEVELSINFO_HPP
#define GEOS_PHYSICSSOLVERS_LOGLEVELSINFO_HPP

#include "common/DataTypes.hpp"

namespace geos
{

namespace logInfo
{

/**
* @name Common LogLevels info structures. They must comply with the `is_log_level_info` trait.
*/
///@{

/// @cond DO_NOT_DOCUMENT

struct Fields
{
static constexpr int getMinLogLevel() { return 2; }
static constexpr std::string_view getDescription() { return "The summary of declared fields and coupling"; }
};

struct LineSearch
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Line search information"; }
};

struct Solution
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Solution information (scaling, maximum changes, quality check)"; }
};

struct Convergence
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Convergence information"; }
};

struct TimeStep
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Time step information"; }
};

struct LinearSolver
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Linear solver information"; }
};

struct NonlinearSolver
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Nonlinear solver information"; }
};

struct Timers
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Solver timers information"; }
};

struct Initialization
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Initialization information"; }
};

struct Statistics
{
static constexpr int getMinLogLevel() { return 1; }
static constexpr std::string_view getDescription() { return "Print statistics when supported"; }
};

/// @endcond
///@}

}

}

#endif // GEOS_PHYSICSSOLVERS_LOGLEVELSINFO_HPP
Loading
Loading