Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperState.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_StepperState_hpp
10 #define Tempus_StepperState_hpp
11 
12 #include "Teuchos_VerboseObject.hpp"
13 #include "Teuchos_Describable.hpp"
14 #include <string>
15 
16 
17 namespace Tempus {
18 
19 template<class Scalar>
20 /** \brief StepperState is a simple class to hold state information about the stepper.
21  *
22  * <b>Design Considerations</b>
23  * - The purpose of StepperState is to provide a means to store any stepper
24  * information that is required to restart from a checkpoint.
25  * - The StepperState should be held by the SolutionState so that it has
26  * all the information needed to restart the solution.
27  * - Many Steppers will simply need this base class, because
28  * they do not have any other additional state information.
29  * - StepperState can be inherited to expand the state information.
30  * - Examples of other information that could be included in derived
31  * StepperStates:
32  * - Metadata and SolutionHistory for a BDF method
33  * - The base class currently has the Stepper name so the Stepper can
34  * check if the StepperState is usable.
35  */
36 class StepperState :
37  public Teuchos::Describable,
38  public Teuchos::VerboseObject<Tempus::StepperState<Scalar> >
39 
40 {
41 public:
42  /// Constructor
43  StepperState(std::string name = "Default") : stepperName_(name){}
44 
45  /// Clone copy constructor
46  virtual Teuchos::RCP<StepperState<Scalar> > clone() const
47  {
48  Teuchos::RCP<StepperState<Scalar> > ss_out =
49  Teuchos::rcp(new StepperState<Scalar> (this->stepperName_));
50  return ss_out;
51  }
52 
53  /// This is a deep copy
54  virtual void copy(const Teuchos::RCP<const StepperState<Scalar> >& ss)
55  {
56  stepperName_ = ss->stepperName_;
57  }
58 
59  /// \name Overridden from Teuchos::Describable
60  //@{
61  virtual std::string description() const { return "Tempus::StepperState"; }
62 
63  virtual void describe(Teuchos::FancyOStream & out,
64  const Teuchos::EVerbosityLevel /* verbLevel */) const
65  {
66  out << description() << "::describe" << std::endl
67  << " stepperName = " << stepperName_ << std::endl;
68  }
69  //@}
70 
71  std::string stepperName_; ///< Name of the creating Stepper.
72 
73 };
74 } // namespace Tempus
75 #endif // Tempus_StepperState_hpp
virtual std::string description() const
StepperState is a simple class to hold state information about the stepper.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel) const
virtual void copy(const Teuchos::RCP< const StepperState< Scalar > > &ss)
This is a deep copy.
virtual Teuchos::RCP< StepperState< Scalar > > clone() const
Clone copy constructor.
std::string stepperName_
Name of the creating Stepper.
StepperState(std::string name="Default")
Constructor.