21 #ifndef GEOS_PHYSICSSOLVERS_SOLVERSTATISTICS_HPP
22 #define GEOS_PHYSICSSOLVERS_SOLVERSTATISTICS_HPP
28 #include "common/format/table/TableTypes.hpp"
80 { m_logOutputRequest = state; }
88 { m_CSVOutputRequest = state; }
94 {
return m_CSVOutputRequest; }
100 {
return m_CSVOutputOpened; }
153 { m_iterationsFilename = filename; }
160 {
return m_iterationsFilename; }
166 {
return m_iterationsFilename; }
174 { m_tableIterationName = name; }
185 {
if( m_CSVOutputOpened ) { m_logStream.close(); m_CSVOutputOpened =
false; } }
230 bool m_logOutputRequest =
false;
232 bool m_CSVOutputRequest =
false;
234 bool m_CSVOutputOpened =
false;
236 std::ofstream m_logStream;
242 std::unique_ptr< TableCSVFormatter > m_iterationCSVFormatter;
244 string m_tableIterationName;
246 string m_iterationsFilename;
266 { m_CSVOutputRequest = state; }
272 {
return m_CSVOutputRequest; }
278 {
return m_CSVOutputOpened; }
303 {
if( m_CSVOutputRequest ) m_residuals.insert( {key, value} ); }
310 { m_convergenceFilename = filename; }
317 { m_tableConvergenceName = name; }
323 {
return m_convergenceFilename; }
329 {
return m_convergenceFilename; }
335 {
if( m_CSVOutputOpened ) { m_logStream.close(); m_CSVOutputOpened =
false; } }
354 bool m_CSVOutputRequest =
false;
356 bool m_CSVOutputOpened =
false;
358 std::ofstream m_logStream;
365 std::unique_ptr< TableCSVFormatter > m_convergenceFormatter;
367 string m_tableConvergenceName;
369 string m_convergenceFilename;
422 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 setResidualValue(string const &key, real64 const value)
Set a residual value given a key ( column in the CSV )
void updateSolverStep(real64 const &time_n, real64 const &dt, integer const cycleNumber, integer const newtonIter)
Update the solver step with the time informations.
ConvergenceStatistics()
Construct a new Convergence Statistics object.
string const & getFilename() const
void setTableName(string_view name)
Set the filename output file.
bool getCSVOutputOpened() const
bool getCSVOutputRequest()
void closeFile()
Close the stream output file if a file was created.
void setCSVOutputRequest(bool state)
Set the csv output state. Set this to true when a CSV output is requested.
Class containing solver iterations data for a time-step.
void incrementConfigIteration()
Tell the solverStatistics that we have done a configuration iteration.
void outputStatistics() const
Output the statistics to the console in table format.
void setTableName(string_view name)
Set the filename output file.
void setLogOutputRequest(bool state)
Set the log state state request.
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 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.
bool getCSVOutputOpened() const
integer m_numSuccessfulConfigIterations
Cumulative number of successful configuration iterations.
void closeFile()
Close the stream output file if a file was created.
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...
bool getCSVOutputRequest()
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.
void setCSVOutputRequest(bool state)
Set the csv output state. Set this to true when a CSV output is requested.
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.
internal::StdMapWrapper< std::map< Key, T, Compare, Allocator >, USE_STD_CONTAINER_BOUNDS_CHECKING > stdMap
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()