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: Time Integration and Sensitivity Analysis Package
4 //
5 // Copyright 2017 NTESS and the Tempus contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 //@HEADER
9 
10 #ifndef Tempus_TimeStepControlStrategy_hpp
11 #define Tempus_TimeStepControlStrategy_hpp
12 
13 #include "Tempus_config.hpp"
14 #include "Tempus_SolutionHistory.hpp"
15 
16 namespace Tempus {
17 
18 template <class Scalar>
19 class TimeStepControl;
20 
31 template <class Scalar>
33  virtual public Teuchos::VerboseObject<
34  Tempus::TimeStepControlStrategy<Scalar> > {
35  public:
38  : strategyType_("Base Strategy"),
39  stepType_("Constant"),
40  name_("Base Strategy"),
41  isInitialized_(false)
42  {
43  }
44 
47 
49  virtual void setNextTimeStep(const TimeStepControl<Scalar>& /* tsc */,
51  Status& /* integratorStatus */)
52  {
53  }
54 
55  virtual void initialize() const { isInitialized_ = true; }
56  virtual bool isInitialized() { return isInitialized_; }
57  virtual void checkInitialized()
58  {
59  if (!isInitialized_) {
60  this->describe(*(this->getOStream()), Teuchos::VERB_MEDIUM);
62  !isInitialized_, std::logic_error,
63  "Error - " << this->description() << " is not initialized!");
64  }
65  }
66 
67  virtual void setName(std::string s) { name_ = s; }
68 
69  virtual std::string getStrategyType() const { return strategyType_; }
70  virtual std::string getStepType() const { return stepType_; }
71  virtual std::string getName() const { return name_; }
72 
75  {
76  return Teuchos::parameterList();
77  }
78 
79  protected:
80  virtual void setStrategyType(std::string s) { strategyType_ = s; }
81  virtual void setStepType(std::string s) { stepType_ = s; }
82 
83  std::string strategyType_;
84  std::string stepType_;
85  std::string name_;
86  mutable bool isInitialized_;
87 };
88 
89 } // namespace Tempus
90 #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