Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_IntegratorBasicOld_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_IntegratorBasicOld_decl_hpp
10 #define Tempus_IntegratorBasicOld_decl_hpp
11 
12 #include "Thyra_ModelEvaluator.hpp"
13 
14 #include "Tempus_config.hpp"
15 #include "Tempus_Stepper.hpp"
16 #include "Tempus_Integrator.hpp"
17 #include "Tempus_TimeStepControl.hpp"
18 #include "Tempus_IntegratorObserverBasic.hpp"
19 #include "Tempus_IntegratorObserverComposite.hpp"
20 #include "Teuchos_ParameterListAcceptorDefaultBase.hpp"
21 
22 
23 namespace Tempus {
24 
25 
28 template<class Scalar>
30  : virtual public Tempus::Integrator<Scalar>,
31  virtual public Teuchos::ParameterListAcceptor
32 {
33 public:
34 
39 
43  std::string stepperType);
44 
47 
51  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > > models);
52 
54  virtual ~IntegratorBasicOld() {}
55 
57 
58  virtual bool advanceTime();
61  virtual bool advanceTime(const Scalar timeFinal) override;
63  virtual void startIntegrator();
65  virtual void startTimeStep();
67  virtual void checkTimeStep();
69  virtual void endIntegrator();
72  override { return tempusPL_; }
73  virtual void setTempusParameterList(
75  {
76  if (tempusPL_==Teuchos::null) tempusPL_=Teuchos::parameterList("Tempus");
77  if (pl != Teuchos::null) *tempusPL_ = *pl;
78  this->setParameterList(Teuchos::null);
79  }
81 
83 
84  virtual Scalar getTime() const override
86  {return solutionHistory_->getCurrentTime();}
88  virtual int getIndex() const override
89  {return solutionHistory_->getCurrentIndex();}
91  virtual Status getStatus() const override
92  {return integratorStatus_;}
94  virtual Teuchos::RCP<Stepper<Scalar> > getStepper() const override
95  {return stepper_;}
97  virtual void setStepper(Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > model);
99  virtual void setStepper(
100  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > > models);
102  virtual void setStepperWStepper(Teuchos::RCP<Stepper<Scalar> > stepper);
104  virtual void initializeSolutionHistory(
105  Teuchos::RCP<SolutionState<Scalar> > state = Teuchos::null);
107  virtual void initializeSolutionHistory(Scalar t0,
109  Teuchos::RCP<const Thyra::VectorBase<Scalar> > xdot0 = Teuchos::null,
110  Teuchos::RCP<const Thyra::VectorBase<Scalar> > xdotdot0 = Teuchos::null);
113  {return solutionHistory_;}
115  virtual void setSolutionHistory(
116  Teuchos::RCP<SolutionHistory<Scalar> > sh = Teuchos::null);
119  {return timeStepControl_;}
121  {return timeStepControl_;}
123  virtual void setTimeStepControl(
124  Teuchos::RCP<TimeStepControl<Scalar> > tsc = Teuchos::null);
127  {return integratorObserver_;}
129  virtual void setObserver(
130  Teuchos::RCP<IntegratorObserver<Scalar> > obs = Teuchos::null);
132  virtual void initialize();
133  //TODO: finish this
136  { return integratorTimer_;}
138  { return stepperTimer_;}
139 
142  {return solutionHistory_->getCurrentState()->getX();}
145  {return solutionHistory_->getCurrentState()->getXDot();}
148  {return solutionHistory_->getCurrentState()->getXDotDot();}
149 
152  {return solutionHistory_->getCurrentState();}
153 
155  { return integratorPL_; }
156 
157  //virtual Teuchos::RCP<Teuchos::Time> getIntegratorTimer() const
158  //{return integratorTimer_;}
159 
160  virtual void setScreenOutputIndexInterval(int i)
161  { integratorPL_->set("Screen Output Index Interval", i); }
162 
163  virtual int getScreenOutputIndexInterval() const
164  { return integratorPL_->get<int>("Screen Output Index Interval"); }
165 
166  virtual void setScreenOutputIndexList(std::string s)
167  { integratorPL_->set("Screen Output Index List", s); }
168 
169  virtual std::string getScreenOutputIndexList() const
170  { return integratorPL_->get<std::string>("Screen Output Index List", ""); }
172 
174  void parseScreenOutput();
175 
177 
179  override;
183  const override;
185 
187 
188  std::string description() const override;
189  void describe(Teuchos::FancyOStream & out,
190  const Teuchos::EVerbosityLevel verbLevel) const override;
192 
193 protected:
194 
201 
204  Scalar runtime_;
205 
206  std::vector<int> outputScreenIndices_;
207 
214 };
215 
217 template<class Scalar>
221 
223 template<class Scalar>
226  std::string stepperType);
227 
229 template<class Scalar>
231 
233 template<class Scalar>
236  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > > models);
237 
238 
239 } // namespace Tempus
240 
241 #endif // Tempus_IntegratorBasicOld_decl_hpp
IntegratorBasicOld()
Constructor that requires a subsequent setParameterList, setStepper, and initialize calls...
void parseScreenOutput()
Parse when screen output should be executed.
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList() override
virtual Teuchos::RCP< Stepper< Scalar > > getStepper() const override
Get the Stepper.
T & get(const std::string &name, T def_value)
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Teuchos::RCP< Teuchos::ParameterList > tempusPL_
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList() override
Teuchos::RCP< Teuchos::Time > integratorTimer_
virtual Teuchos::RCP< const SolutionHistory< Scalar > > getSolutionHistory() const override
Get the SolutionHistory.
virtual Teuchos::RCP< TimeStepControl< Scalar > > getNonConstTimeStepControl() override
Teuchos::RCP< Teuchos::ParameterList > getIntegratorParameterList()
virtual Teuchos::RCP< const TimeStepControl< Scalar > > getTimeStepControl() const override
Get the TimeStepControl.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const override
Teuchos::RCP< SolutionHistory< Scalar > > solutionHistory_
virtual void initializeSolutionHistory(Teuchos::RCP< SolutionState< Scalar > > state=Teuchos::null)
Set the initial state which has the initial conditions.
Teuchos::RCP< Teuchos::Time > stepperTimer_
Thyra Base interface for time steppers.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Create valid IntegratorBasicOld ParameterList.
virtual void setObserver(Teuchos::RCP< IntegratorObserver< Scalar > > obs=Teuchos::null)
Set the Observer.
virtual Teuchos::RCP< Teuchos::Time > getIntegratorTimer() const override
Returns the IntegratorTimer_ for this Integrator.
virtual void checkTimeStep()
Check if time step has passed or failed.
Teuchos::RCP< TimeStepControl< Scalar > > timeStepControl_
Teuchos::RCP< IntegratorObserverComposite< Scalar > > integratorObserver_
virtual void setStepperWStepper(Teuchos::RCP< Stepper< Scalar > > stepper)
Set the Stepper.
virtual std::string getScreenOutputIndexList() const
virtual Teuchos::RCP< Teuchos::ParameterList > getTempusParameterList() override
Return a copy of the Tempus ParameterList.
Status
Status for the Integrator, the Stepper and the SolutionState.
virtual Teuchos::RCP< Teuchos::Time > getStepperTimer() const override
IntegratorObserver class for time integrators.
Teuchos::RCP< Teuchos::ParameterList > integratorPL_
virtual Teuchos::RCP< IntegratorObserverComposite< Scalar > > getObserver()
Get the Observer.
virtual int getIndex() const override
Get current index.
std::string description() const override
TimeStepControl manages the time step size. There several mechanisms that effect the time step size a...
Teuchos::RCP< Stepper< Scalar > > stepper_
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
virtual void setTimeStepControl(Teuchos::RCP< TimeStepControl< Scalar > > tsc=Teuchos::null)
Set the TimeStepControl.
virtual void setTempusParameterList(Teuchos::RCP< Teuchos::ParameterList > pl) override
virtual void initialize()
Initializes the Integrator after set* function calls.
Thyra Base interface for time integrators. Time integrators are designed to advance the solution from...
virtual Teuchos::RCP< SolutionState< Scalar > > getCurrentState()
Get current state.
virtual void setScreenOutputIndexList(std::string s)
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &pl) override
virtual Teuchos::RCP< Thyra::VectorBase< Scalar > > getXDot() const
Get current the time derivative of the solution, xdot.
virtual Teuchos::RCP< Thyra::VectorBase< Scalar > > getX() const
Get current the solution, x.
virtual Scalar getTime() const override
Get current time.
virtual Status getStatus() const override
Get Status.
virtual void startTimeStep()
Start time step.
virtual void setSolutionHistory(Teuchos::RCP< SolutionHistory< Scalar > > sh=Teuchos::null)
Set the SolutionHistory.
virtual void startIntegrator()
Perform tasks before start of integrator.
virtual void setStepper(Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > model)
Set the Stepper.
virtual Teuchos::RCP< Thyra::VectorBase< Scalar > > getXDotDot() const
Get current the second time derivative of the solution, xdotdot.
virtual void endIntegrator()
Perform tasks after end of integrator.
Teuchos::RCP< IntegratorBasicOld< Scalar > > integratorBasic(Teuchos::RCP< Teuchos::ParameterList > pList, const Teuchos::RCP< Thyra::ModelEvaluator< Scalar > > &model)
Nonmember constructor.
virtual bool advanceTime()
Advance the solution to timeMax, and return true if successful.
Solution state for integrators and steppers. SolutionState contains the metadata for solutions and th...
std::vector< int > outputScreenIndices_
Vector of screen output indices.