AMDiS  0.1
The Adaptive Multi-Dimensional Simulation Toolbox
SolverInfo.hpp
1 #pragma once
2 
3 #include <string>
4 
5 #include <amdis/Initfile.hpp>
6 
7 namespace AMDiS
8 {
11  class SolverInfo
12  {
13  public:
15 
20  explicit SolverInfo(std::string const& prefix)
21  : prefix_(prefix)
22  {
23  Parameters::get(prefix + "->info", info_);
24  Parameters::get(prefix + "->break if tolerance not reached", breakTolNotReached_);
25  }
26 
31  int error() const
33  {
34  return error_;
35  }
36 
38  int info() const
39  {
40  return info_;
41  }
42 
44  double absResidual() const
45  {
46  return absResidual_;
47  }
48 
50  double relResidual() const
51  {
52  return relResidual_;
53  }
54 
56  bool doCreateMatrixData() const
57  {
58  return createMatrixData_;
59  }
60 
62  bool doStoreMatrixData() const
63  {
64  return storeMatrixData_;
65  }
66 
67  bool doBreak() const
68  {
69  return breakTolNotReached_;
70  }
71 
79  void setAbsResidual(double r)
81  {
82  absResidual_ = r;
83  }
84 
86  void setRelResidual(double r)
87  {
88  relResidual_ = r;
89  }
90 
92  void setInfo(int i)
93  {
94  info_ = i;
95  }
96 
98  void setError(int e)
99  {
100  error_ = e;
101  }
102 
104  void setCreateMatrixData(bool b)
105  {
106  createMatrixData_ = b;
107  }
108 
110  void setStoreMatrixData(bool b)
111  {
112  storeMatrixData_ = b;
113  }
114 
117  private:
119  std::string prefix_;
120 
122  bool breakTolNotReached_ = false;
123 
125  int info_ = 0;
126 
128  double absResidual_ = -1.0;
129 
131  double relResidual_ = -1.0;
132 
134  int error_ = -1;
135 
139  bool createMatrixData_ = true;
140 
142  bool storeMatrixData_ = false;
143  };
144 
145 } // end namespace AMDiS
void setInfo(int i)
Sets info_.
Definition: SolverInfo.hpp:92
double relResidual() const
Returns relResidual_.
Definition: SolverInfo.hpp:50
void setAbsResidual(double r)
Sets absResidual_.
Definition: SolverInfo.hpp:80
bool doCreateMatrixData() const
Returns createMatrixData.
Definition: SolverInfo.hpp:56
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
void setCreateMatrixData(bool b)
Sets createMatrixData_.
Definition: SolverInfo.hpp:104
void setRelResidual(double r)
Sets relResidual_.
Definition: SolverInfo.hpp:86
int info() const
Returns info.
Definition: SolverInfo.hpp:38
int error() const
Returns error code in last run of an iterative solver.
Definition: SolverInfo.hpp:32
SolverInfo(std::string const &prefix)
The constructor reads needed parameters and sets solver prefix.
Definition: SolverInfo.hpp:20
static std::optional< T > get(std::string const &key)
Get parameter-values from parameter-tree.
Definition: Initfile.hpp:25
bool doStoreMatrixData() const
Returns storeMatrixData.
Definition: SolverInfo.hpp:62
void setError(int e)
Sets error_.
Definition: SolverInfo.hpp:98
Definition: SolverInfo.hpp:11
void setStoreMatrixData(bool b)
Sets storeMatrixData_.
Definition: SolverInfo.hpp:110
double absResidual() const
Returns absResidual_.
Definition: SolverInfo.hpp:44