Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_SolutionStateMetaData_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ****************************************************************************
3 // Tempus: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Tempus_SolutionStateMetaData_decl_hpp
10 #define Tempus_SolutionStateMetaData_decl_hpp
11 
12 // Teuchos
13 #include "Teuchos_VerboseObject.hpp"
14 #include "Teuchos_Describable.hpp"
15 // Tempus
16 #include "Tempus_Types.hpp"
17 
18 
19 namespace Tempus {
20 
21 /** \brief Solution state meta data.
22  */
23 template<class Scalar>
25  public Teuchos::Describable,
26  public Teuchos::VerboseObject<Tempus::SolutionStateMetaData<Scalar> >
27 {
28 public:
29 
30  /// Default constructor.
32 
33  /// Constructor
35  const Scalar time,
36  const int iStep,
37  const Scalar dt,
38  const Scalar errorAbs,
39  const Scalar errorRel,
40  const int order,
41  const int nFailures,
42  const int nRunningFailures,
43  const int nConsecutiveFailures,
44  const Scalar tolRel,
45  const Scalar tolAbs,
46  const Scalar xNormL2,
47  const Scalar dxNormL2Rel,
48  const Scalar dxNormL2Abs,
49  const bool computeNorms,
50  const Status solutionStatus,
51  const bool output,
52  const bool outputScreen,
53  const bool isSynced,
54  const bool isInterpolated,
55  const Scalar accuracy);
56 
57  /// Copy constructor
59 
60  /// Clone constructor
61  Teuchos::RCP<SolutionStateMetaData<Scalar> > clone() const;
62 
63  /// This is a deep copy
64  void copy(const Teuchos::RCP<const SolutionStateMetaData<Scalar> >& ssmd);
65 
66  /// Destructor
68 
69  /// \name Accessor methods
70  //@{
71  Scalar getTime() const {return time_;}
72  int getIStep() const {return iStep_;}
73  Scalar getDt() const {return dt_;}
74  Scalar getErrorAbs() const {return errorAbs_;}
75  Scalar getErrorRel() const {return errorRel_;}
76  Scalar getOrder() const {return order_;}
77  int getNFailures() const {return nFailures_;}
78  int getNRunningFailures() const {return nRunningFailures_;}
80  Scalar getTolAbs() const {return tolAbs_;}
81  Scalar getTolRel() const {return tolRel_;}
82  Scalar getXNormL2() const {return xNormL2_;}
83  Scalar getDxNormL2Abs() const {return dxNormL2Abs_;}
84  Scalar getDxNormL2Rel() const {return dxNormL2Rel_;}
85  bool getComputeNorms() const {return computeNorms_;}
87  bool getOutput() const {return output_;}
88  bool getOutputScreen() const {return outputScreen_;}
89  bool getIsSynced() const {return isSynced_;}
90  bool getIsInterpolated() const {return isInterpolated_;}
91  Scalar getAccuracy() const {return accuracy_;}
92 
93  void setTime(Scalar time) {time_ = time;}
94  void setIStep(int iStep) {iStep_ = iStep;}
95  void setDt(Scalar dt) {dt_ = dt;}
96  void setErrorAbs (Scalar errorAbs) {errorAbs_ = errorAbs;}
97  void setErrorRel (Scalar errorRel) {errorRel_ = errorRel;}
98  void setOrder(Scalar order) {order_ = order;}
99  void setNFailures(int nFailures) {nFailures_ = nFailures;}
100  void setNRunningFailures(int nFailures) {nRunningFailures_ = nFailures;}
101  void setNConsecutiveFailures(int nConsecutiveFailures)
102  {nConsecutiveFailures_ = nConsecutiveFailures;}
103  void setTolRel (Scalar tolRel) {tolRel_ = tolRel;}
104  void setTolAbs (Scalar tolAbs) {tolAbs_ = tolAbs;}
105  void setXNormL2 (Scalar xNormL2) {xNormL2_ = xNormL2;}
106  void setDxNormL2Rel (Scalar dxNormL2Rel) {dxNormL2Rel_ = dxNormL2Rel;}
107  void setDxNormL2Abs (Scalar dxNormL2Abs) {dxNormL2Abs_ = dxNormL2Abs;}
108  void setComputeNorms (bool computeNorms) {computeNorms_ = computeNorms;}
109  void setSolutionStatus(Status solutionStatus)
110  {solutionStatus_ = solutionStatus;}
111  void setOutput(bool output) {output_ = output;}
112  void setOutputScreen(bool outputScreen) {outputScreen_ = outputScreen;}
113  void setIsSynced(bool isSynced) {isSynced_=isSynced;}
114  void setIsInterpolated(bool isInterpolated)
115  {isInterpolated_ = isInterpolated;}
116  void setAccuracy(Scalar accuracy) {accuracy_ = accuracy;}
117  //@}
118 
119  /// \name Overridden from Teuchos::Describable
120  //@{
121  virtual std::string description() const;
122  virtual void describe(Teuchos::FancyOStream &out,
123  const Teuchos::EVerbosityLevel verbLevel) const;
124  //@}
125 
126 protected:
127  Scalar time_; ///< Time of solution
128  int iStep_; ///< Time step index for this solution
129  Scalar dt_; ///< Time step for this solution
130  Scalar errorAbs_; ///< Absolute local truncation error
131  Scalar errorRel_; ///< Relative local truncation error
132  Scalar order_; ///< Order of this solution
133  int nFailures_; ///< Total number of stepper failures
134  int nRunningFailures_; ///< Total number of running stepper failures
135  int nConsecutiveFailures_; ///< Consecutive number of stepper failures
136  Scalar tolRel_; ///< Relative tolerance
137  Scalar tolAbs_; ///< Absolute tolerance
138  Scalar xNormL2_; ///< L2-Norm of the solution
139  Scalar dxNormL2Rel_; ///< Relative L2-Norm of the change in solution, ||x_i-x_{i-1}||/||x_{i-1}||
140  Scalar dxNormL2Abs_; ///< Absolute L2-Norm of the change in solution, ||x_i-x_{i-1}||
141  bool computeNorms_; ///< flag to compute norms of solution
142 
143  /** \brief The solutionStatus is used to indicate
144  - if the solution is still being worked on; WORKING
145  - if the solution is accepted and completed (e.g., past solutions
146  in SolutionHistory); PASSED.
147  - if the time step has FAILED. This may be caused by the Stepper
148  failing, or Integrator not accepting the time step.
149  */
151  bool output_; ///< SolutionState should be or has been outputted
152  bool outputScreen_; ///< Output screen dump
153  /** \brief True - all of soln (x, xDot, xDotDot) is at the same time level.
154  * False - solution is at different time levels, e.g., leapfrog where
155  * \f$x_n\f$ and \f$\dot{x}_{n+1/2}\f$
156  */
157  bool isSynced_;
158  bool isInterpolated_; ///< F - soln is time integrated; T - soln is interpolated
159  Scalar accuracy_; ///< Interpolation accuracy of solution
160 
161 };
162 } // namespace Tempus
163 
164 #endif // Tempus_SolutionStateMetaData_decl_hpp
Teuchos::RCP< SolutionStateMetaData< Scalar > > clone() const
Clone constructor.
Status solutionStatus_
The solutionStatus is used to indicate.
int nFailures_
Total number of stepper failures.
Scalar dxNormL2Rel_
Relative L2-Norm of the change in solution, ||x_i-x_{i-1}||/||x_{i-1}||.
void copy(const Teuchos::RCP< const SolutionStateMetaData< Scalar > > &ssmd)
This is a deep copy.
Scalar dxNormL2Abs_
Absolute L2-Norm of the change in solution, ||x_i-x_{i-1}||.
int nRunningFailures_
Total number of running stepper failures.
void setNConsecutiveFailures(int nConsecutiveFailures)
int iStep_
Time step index for this solution.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
bool isInterpolated_
F - soln is time integrated; T - soln is interpolated.
Status
Status for the Integrator, the Stepper and the SolutionState.
bool output_
SolutionState should be or has been outputted.
int nConsecutiveFailures_
Consecutive number of stepper failures.
Scalar errorRel_
Relative local truncation error.
Scalar dt_
Time step for this solution.
Scalar accuracy_
Interpolation accuracy of solution.
bool computeNorms_
flag to compute norms of solution
bool isSynced_
True - all of soln (x, xDot, xDotDot) is at the same time level. False - solution is at different tim...
Scalar errorAbs_
Absolute local truncation error.