GEOS
SolverStatistics.hpp
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 Total, S.A
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
16 /*
17  * @file SolverStatistics.hpp
18  */
19 
20 
21 #ifndef GEOS_PHYSICSSOLVERS_SOLVERSTATISTICS_HPP
22 #define GEOS_PHYSICSSOLVERS_SOLVERSTATISTICS_HPP
23 
24 #include "dataRepository/Group.hpp"
25 
26 namespace geos
27 {
28 
34 {
35 public:
36 
42  SolverStatistics( string const & name,
43  dataRepository::Group * const parent );
44 
49 
55  void logNonlinearIteration( integer const numLinearIterations );
56 
62 
67 
72 
77 
81  void outputStatistics() const;
82 
87  { return m_numTimeSteps; }
88 
93  { return m_numTimeStepCuts; }
94 
99  { return m_numSuccessfulOuterLoopIterations; }
100 
105  { return m_numSuccessfulNonlinearIterations; }
106 
111  { return m_numSuccessfulLinearIterations; }
112 
117  { return m_numDiscardedOuterLoopIterations; }
118 
123  { return m_numDiscardedNonlinearIterations; }
124 
129  { return m_numDiscardedLinearIterations; }
130 
131 
137  {
139  static constexpr char const * numTimeStepsString() { return "numTimeSteps"; }
141  static constexpr char const * numTimeStepCutsString() { return "numTimeStepCuts"; }
142 
144  static constexpr char const * numSuccessfulOuterLoopIterationsString() { return "numSuccessfulOuterLoopIterations"; }
146  static constexpr char const * numSuccessfulNonlinearIterationsString() { return "numSuccessfulNonlinearIterations"; }
148  static constexpr char const * numSuccessfulLinearIterationsString() { return "numSuccessfulLinearIterations"; }
149 
151  static constexpr char const * numDiscardedOuterLoopIterationsString() { return "numDiscardedOuterLoopIterations"; }
153  static constexpr char const * numDiscardedNonlinearIterationsString() { return "numDiscardedNonlinearIterations"; }
155  static constexpr char const * numDiscardedLinearIterationsString() { return "numDiscardedLinearIterations"; }
156  };
157 
158 private:
160  integer m_numTimeSteps;
161 
163  integer m_numTimeStepCuts;
164 
165 
167  integer m_currentNumOuterLoopIterations;
168 
170  integer m_currentNumNonlinearIterations;
171 
173  integer m_currentNumLinearIterations;
174 
175 
177  integer m_numSuccessfulOuterLoopIterations;
178 
180  integer m_numSuccessfulNonlinearIterations;
181 
183  integer m_numSuccessfulLinearIterations;
184 
185 
187  integer m_numDiscardedOuterLoopIterations;
188 
190  integer m_numDiscardedNonlinearIterations;
191 
193  integer m_numDiscardedLinearIterations;
194 
195 };
196 
197 } //namespace geos
198 
199 #endif // GEOS_PHYSICSSOLVERS_SOLVERSTATISTICS_HPP
This class is used to log the solver statistics.
SolverStatistics(string const &name, dataRepository::Group *const parent)
Constructor for SolverStatistics Objects.
integer getNumTimeStepCuts() const
integer getNumSuccessfulLinearIterations() const
void logTimeStepCut()
Tell the solverStatistics that there is a time step cut.
integer getNumTimeSteps() const
integer getNumDiscardedLinearIterations() const
void logNonlinearIteration(integer const numLinearIterations)
Tell the solverStatistics that we are doing a nonlinear iteration.
integer getNumSuccessfulOuterLoopIterations() const
integer getNumDiscardedNonlinearIterations() const
void outputStatistics() const
Output the cumulative statistics to the terminal.
void saveTimeStepStatistics()
Save the statistics for the individual time step and increment the cumulative stats.
integer getNumSuccessfulNonlinearIterations() const
integer getNumDiscardedOuterLoopIterations() const
void logNonlinearIteration()
Tell the solverStatistics that we are doing a nonlinear iteration @detail This function is well suite...
void logOuterLoopIteration()
Tell the solverStatistics that we are doing an outer loop iteration.
void initializeTimeStepStatistics()
Initialize the counters used for an individual time step.
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:82
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 * numDiscardedOuterLoopIterationsString()
String key for the discarded number of outer loop iterations.
static constexpr char const * numTimeStepsString()
String key for the number of time steps.
static constexpr char const * numSuccessfulOuterLoopIterationsString()
String key for the successful number of outer loop iterations.
static constexpr char const * numSuccessfulNonlinearIterationsString()
String key for the successful number of nonlinear iterations.
static constexpr char const * numSuccessfulLinearIterationsString()
String key for the successful number of linear iterations.
static constexpr char const * numTimeStepCutsString()
String key for the number of time step cuts.