21 #ifndef GEOS_PHYSICSSOLVERS_SOLVERSTATISTICS_HPP
22 #define GEOS_PHYSICSSOLVERS_SOLVERSTATISTICS_HPP
28 #include "common/format/table/TableTypes.hpp"
80 { m_csvOutputEnabled = state; }
87 { m_logOutput = state; }
141 { m_iterationsFilename = filename; }
148 {
return m_iterationsFilename; }
154 {
return m_iterationsFilename; }
162 { m_tableIterationName = name; }
173 {
if( m_csvOutputOpened ) { m_logStream.close(); m_csvOutputOpened =
false; } }
218 bool m_logOutput =
false;
220 bool m_csvOutputEnabled =
false;
222 bool m_csvOutputOpened =
false;
224 std::ofstream m_logStream;
230 std::unique_ptr< TableCSVFormatter > m_iterationCSVFormatter;
232 string m_tableIterationName;
234 string m_iterationsFilename;
276 void setResidualValue(
string const & key,
real64 const value )
284 { m_convergenceFilename = filename; }
291 { m_tableConvergenceName = name; }
297 {
return m_convergenceFilename; }
303 {
return m_convergenceFilename; }
309 {
if( m_csvOutputOpened ) { m_logStream.close(); m_csvOutputOpened =
false; } }
325 std::map< string, real64 > m_residuals;
328 bool m_csvOutputOpened =
false;
330 std::ofstream m_logStream;
337 std::unique_ptr< TableCSVFormatter > m_convergenceFormatter;
339 string m_tableConvergenceName;
341 string m_convergenceFilename;
394 string m_directoryName =
"convergence";
Class containing convergence information given a time-step.
void setFilename(string_view filename)
Set the filename output file.
string & getFilename()
A string reference to a convergence filename.
void writeConvergenceStatsToTable()
Write all the convergence statistics into the ouput stream.
void updateSolverStep(real64 const &time_n, real64 const &dt, integer const cycleNumber, integer const newtonIter)
Update the solver step with the time informations.
bool m_csvOutputEnabled
State of csv output. True when writeSolver is set to 2.
ConvergenceStatistics()
Construct a new Convergence Statistics object.
string const & getFilename() const
void setTableName(string_view name)
Set the filename output file.
void closeFile()
Close the stream output file.
void setCSVOutputState(bool state)
Set the csv state output.
Class containing solver iterations data for a time-step.
void incrementConfigIteration()
Tell the solverStatistics that we have done a configuration iteration.
void setTableName(string_view name)
Set the filename output file.
integer m_numTimeStepCuts
Number of time step cuts.
integer m_currentNumConfigIterations
Number of configuration iterations in the current time step (utility variable constantly overwritten)
void outputStatistics()
Output the statistics to the console in table format.
void resetSolverLinearTime()
Reset the setupTime & solveTime to 0 at the end of each cycle.
void accumulateSolverLinearTime(real64 setupTime, real64 solveTime)
Accumulate the setupTime & solveTime result over each newton iteration.
integer m_numDiscardedConfigIterations
Cumulative number of discarded configuration iterations.
integer m_currentNumLinearIterations
Number of linear iterations in the current time step (utility variable constantly overwritten)
void iterateTimeStepStatistics()
Increment the cumulative number of nonlinear and linear iterations This fonction must be set after a ...
void updateNonlinearIteration(integer const numLinearIterations)
Tell the solverStatistics that we have done a newton iteration.
string const & getFilename() const
void writeIterationStatsToTable()
Write all the iteration statistics into the ouput stream.
integer m_numTimeSteps
Number of time steps.
void setCSVOutputState(bool state)
Set the csv state output.
void setLogOutputState(bool state)
Set the log state output.
integer m_numSuccessfulConfigIterations
Cumulative number of successful configuration iterations.
void closeFile()
Close the stream output file.
integer m_numDiscardedNonlinearIterations
Cumulative number of discarded nonlinear iterations.
integer m_numSuccessfulLinearIterations
Cumulative number of successful linear iterations.
void updateTimeStepCut()
Tell the solverStatistics that we cut the time step and we increment the cumulative counters for disc...
integer m_numSuccessfulNonlinearIterations
Cumulative number of successful nonlinear iterations.
real64 m_setupTime
Linear solver setup.
integer m_numDiscardedLinearIterations
Cumulative number of discarded linear iterations.
IterationsStatistics(string const &name, dataRepository::Group *const parent)
Constructor for SolverStatistics Objects.
void setFilename(string_view filename)
Set the filename output file.
integer m_currentNumNonlinearIterations
Number of nonlinear iterations in the current time step (utility variable constantly overwritten)
string & getFilename()
A string reference to an iteration filename.
void resetCurrentTimeStepStatistics()
Reset the counters used for an individual time step.
real64 m_solveTime
Linear solver solve.
This class records solver statistics for each time step.
void setOutputFilesName(string_view solverName)
Set the Residual Norms filename.
SolverStatistics(string const &name, dataRepository::Group *const parent)
Constructor for SolverStatistics Objects.
void makeDir(bool writeSolverIteration)
Create a convergence directory if we enable the csv for iteration or convergence statistics.
IterationsStatistics m_iterationsStats
Contain iteration data given a time step.
string m_outputDir
Output directory for solver statistics (CSV), passed in the constructor.
ConvergenceStatistics m_convergenceStats
Contain convergence data given a time step.
Class for managing table data.
Class for setup the table layout.
void makeDirsForPath(std::string const &path)
Make directories for path.
double real64
64-bit floating point type.
int integer
Signed integer type.
std::string_view string_view
String type.
Struct to serve as a container for variable strings and keys.
static constexpr char const * numDiscardedLinearIterationsString()
String key for the discarded number of linear iterations.
static constexpr char const * numDiscardedNonlinearIterationsString()
String key for the discarded number of nonlinear iterations.
static constexpr char const * numSuccessfulConfigIterationsString()
String key for the successful number of configuration iterations.
static constexpr char const * numTimeStepCutsString()
String key for the number of time step cuts.
static constexpr char const * numSuccessfulNonlinearIterationsString()
String key for the successful number of nonlinear iterations.
static constexpr char const * numDiscardedConfigIterationsString()
String key for the discarded number of configuration iterations.
static constexpr char const * numSuccessfulLinearIterationsString()
String key for the successful number of linear iterations.
static constexpr char const * numTimeStepsString()
String key for the number of time steps.
Group key associated with IterationsStatistics.
static constexpr char const * IterationsStatisticsString()