Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_TimeStepControlStrategy.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_TimeStepControlStrategy_hpp
10 #define Tempus_TimeStepControlStrategy_hpp
11 
12 #include "Tempus_config.hpp"
13 #include "Tempus_SolutionHistory.hpp"
14 
15 
16 namespace Tempus {
17 
18 template<class Scalar> class TimeStepControl;
19 
30 template<class Scalar>
32  : virtual public Teuchos::Describable,
33  virtual public Teuchos::VerboseObject<Tempus::TimeStepControlStrategy<Scalar> >
34 {
35 public:
36 
39  : strategyType_("Base Strategy"), stepType_("Constant"),
40  name_("Base Strategy"), isInitialized_(false)
41  {}
42 
45 
46 #ifndef TEMPUS_HIDE_DEPRECATED_CODE
47  virtual void getNextTimeStep(
49  const TimeStepControl<Scalar> tsc,
51  Status & integratorStatus)
52  {
53  this->setNextTimeStep(tsc, sh, integratorStatus);
54  }
55 #endif
56 
58  virtual void setNextTimeStep(
59  const TimeStepControl<Scalar> & /* tsc */,
61  Status & /* integratorStatus */) {}
62 
63  virtual void initialize() const { isInitialized_ = true; }
64  virtual bool isInitialized() { return isInitialized_; }
65  virtual void checkInitialized()
66  {
67  if ( !isInitialized_ ) {
68  this->describe( *(this->getOStream()), Teuchos::VERB_MEDIUM);
69  TEUCHOS_TEST_FOR_EXCEPTION( !isInitialized_, std::logic_error,
70  "Error - " << this->description() << " is not initialized!");
71  }
72  }
73 
74  virtual void setName(std::string s) { name_ = s; }
75 
76  virtual std::string getStrategyType() const { return strategyType_; }
77  virtual std::string getStepType() const { return stepType_; }
78  virtual std::string getName() const { return name_; }
79 
82  { return Teuchos::parameterList(); }
83 
84 protected:
85 
86  virtual void setStrategyType(std::string s) { strategyType_ = s; }
87  virtual void setStepType(std::string s) { stepType_ = s; }
88 
89  std::string strategyType_;
90  std::string stepType_;
91  std::string name_;
92  mutable bool isInitialized_;
93 
94 };
95 
96 
97 } // namespace Tempus
98 #endif // Tempus_TimeStepControlStrategy_hpp
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return ParameterList with current values.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual void setNextTimeStep(const TimeStepControl< Scalar > &, Teuchos::RCP< SolutionHistory< Scalar > >, Status &)
Set the time step size.
Status
Status for the Integrator, the Stepper and the SolutionState.
bool isInitialized_
Bool if strategy is initialized.
virtual std::string description() const
TimeStepControl manages the time step size. There several mechanisms that effect the time step size a...
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
std::string stepType_
Step Type - &quot;Constant&quot; or &quot;Variable&quot;.
TimeStepControlStrategy class for TimeStepControl.
virtual RCP< FancyOStream > getOStream() const
virtual void describe(FancyOStream &out, const EVerbosityLevel verbLevel=verbLevel_default) const
virtual void getNextTimeStep(const TimeStepControl< Scalar > tsc, Teuchos::RCP< SolutionHistory< Scalar > > sh, Status &integratorStatus)
Deprecated get the time step size.