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 Status solutionStatus,
45  const bool output,
46  const bool outputScreen,
47  const bool isSynced,
48  const bool isInterpolated,
49  const Scalar accuracy);
50 
51  /// Copy constructor
53 
54  /// Clone constructor
55  Teuchos::RCP<SolutionStateMetaData<Scalar> > clone() const;
56 
57  /// This is a deep copy
58  void copy(const Teuchos::RCP<const SolutionStateMetaData<Scalar> >& ssmd);
59 
60  /// Destructor
62 
63  /// \name Accessor methods
64  //@{
65  Scalar getTime() const {return time_;}
66  int getIStep() const {return iStep_;}
67  Scalar getDt() const {return dt_;}
68  Scalar getErrorAbs() const {return errorAbs_;}
69  Scalar getErrorRel() const {return errorRel_;}
70  Scalar getOrder() const {return order_;}
71  int getNFailures() const {return nFailures_;}
72  int getNRunningFailures() const {return nRunningFailures_;}
75  bool getOutput() const {return output_;}
76  bool getOutputScreen() const {return outputScreen_;}
77  bool getIsSynced() const {return isSynced_;}
78  bool getIsInterpolated() const {return isInterpolated_;}
79  Scalar getAccuracy() const {return accuracy_;}
80  Scalar getTolAbs() const {return tolAbs_;}
81  Scalar getTolRel() const {return tolRel_;}
82 
83  void setTime(Scalar time) {time_ = time;}
84  void setIStep(int iStep) {iStep_ = iStep;}
85  void setDt(Scalar dt) {dt_ = dt;}
86  void setErrorAbs (Scalar errorAbs){errorAbs_ = errorAbs;}
87  void setErrorRel (Scalar errorRel){errorRel_ = errorRel;}
88  void setOrder(Scalar order) {order_ = order;}
89  void setNFailures(int nFailures) {nFailures_ = nFailures;}
90  void setNRunningFailures(int nFailures) {nRunningFailures_ = nFailures;}
91  void setNConsecutiveFailures(int nConsecutiveFailures)
92  {nConsecutiveFailures_ = nConsecutiveFailures;}
93  void setSolutionStatus(Status solutionStatus)
94  {solutionStatus_ = solutionStatus;}
95  void setOutput(bool output) {output_ = output;}
96  void setOutputScreen(bool outputScreen) {outputScreen_ = outputScreen;}
97  void setIsSynced(bool isSynced) {isSynced_=isSynced;}
98  void setIsInterpolated(bool isInterpolated)
99  {isInterpolated_ = isInterpolated;}
100  void setAccuracy(Scalar accuracy) {accuracy_ = accuracy;}
101  void setTolAbs(Scalar tolAbs){tolAbs_ = tolAbs;}
102  void setTolRel(Scalar tolRel){tolRel_ = tolRel;}
103 
104  //@}
105 
106  /// \name Overridden from Teuchos::Describable
107  //@{
108  virtual std::string description() const;
109  virtual void describe(Teuchos::FancyOStream &out,
110  const Teuchos::EVerbosityLevel verbLevel) const;
111  //@}
112 
113 protected:
114  Scalar time_; ///< Time of solution
115  int iStep_; ///< Time step index for this solution
116  Scalar dt_; ///< Time step for this solution
117  Scalar errorAbs_; ///< Absolute local truncation error
118  Scalar errorRel_; ///< Relative local truncation error
119  Scalar order_; ///< Order of this solution
120  int nFailures_; ///< Total number of stepper failures
121  int nRunningFailures_; ///< Total number of running stepper failures
122  int nConsecutiveFailures_; ///< Consecutive number of stepper failures
123  Scalar tolRel_; ///< Absolute tolerance
124  Scalar tolAbs_; ///< Relative tolerance
125 
126  /** \brief The solutionStatus is used to indicate
127  - if the solution is still being worked on; WORKING
128  - if the solution is accepted and completed (e.g., past solutions
129  in SolutionHistory); PASSED.
130  - if the time step has FAILED. This may be caused by the Stepper
131  failing, or Integrator not accepting the time step.
132  */
134  bool output_; ///< SolutionState should be or has been outputted
135  bool outputScreen_; ///< Output screen dump
136  /** \brief True - all of soln (x, xDot, xDotDot) is at the same time level.
137  * False - solution is at different time levels, e.g., leapfrog where
138  * \f$x_n\f$ and \f$\dot{x}_{n+1/2}\f$
139  */
140  bool isSynced_;
141  bool isInterpolated_; ///< F - soln is time integrated; T - soln is interpolated
142  Scalar accuracy_; ///< Interpolation accuracy of solution
143 
144 };
145 } // namespace Tempus
146 
147 #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.
void copy(const Teuchos::RCP< const SolutionStateMetaData< Scalar > > &ssmd)
This is a deep copy.
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 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.