Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperRKBase.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_StepperRKBase_hpp
10 #define Tempus_StepperRKBase_hpp
11 
12 #include "Thyra_VectorBase.hpp"
13 
14 #include "Tempus_Stepper.hpp"
18 
19 
20 namespace Tempus {
21 
22 /** \brief Base class for Runge-Kutta methods, ExplicitRK, DIRK and IMEX.
23  *
24  * Only common RK methods should be implemented in StepperRKBase. All
25  * other Stepper methods should be implemented through Stepper,
26  * StepperExplicit or StepperImplicit.
27  */
28 template<class Scalar>
29 class StepperRKBase : virtual public Tempus::Stepper<Scalar>
30 {
31 
32 public:
33 
34  virtual Teuchos::RCP<const RKButcherTableau<Scalar> > getTableau() const
35  { return tableau_; }
36 
37  virtual Scalar getOrder() const{return getTableau()->order();}
38  virtual Scalar getOrderMin() const{return getTableau()->orderMin();}
39  virtual Scalar getOrderMax() const{return getTableau()->orderMax();}
40  virtual int getNumberOfStages() const {return getTableau()->numStages();}
41 
42  virtual int getStageNumber() const { return stageNumber_; }
43  virtual void setStageNumber(int s) { stageNumber_ = s; }
44 
45  virtual Teuchos::RCP<Thyra::VectorBase<Scalar> > getStageX() {return stageX_;}
46  virtual Teuchos::RCP<const Thyra::VectorBase<Scalar> > getStageX() const {return stageX_;}
47 
48  virtual void setAppAction(Teuchos::RCP<StepperRKAppAction<Scalar> > appAction)
49  {
50  if (appAction == Teuchos::null) {
51  // Create default appAction
53  Teuchos::rcp(new StepperRKModifierDefault<Scalar>());
54  } else {
55  stepperRKAppAction_ = appAction;
56  }
57  this->isInitialized_ = false;
58  }
59 
60  virtual Teuchos::RCP<StepperRKAppAction<Scalar> > getAppAction() const
61  { return stepperRKAppAction_; }
62 
63 protected:
64 
65  Teuchos::RCP<RKButcherTableau<Scalar> > tableau_;
66 
67  /// The current Runge-Kutta stage number, {0,...,s-1}. -1 indicates outside stage loop.
69  Teuchos::RCP<Thyra::VectorBase<Scalar> > stageX_;
70  Teuchos::RCP<StepperRKAppAction<Scalar> > stepperRKAppAction_;
71 
72 };
73 
74 } // namespace Tempus
75 
76 #endif // Tempus_StepperRKBase_hpp
virtual void setAppAction(Teuchos::RCP< StepperRKAppAction< Scalar > > appAction)
virtual Teuchos::RCP< StepperRKAppAction< Scalar > > getAppAction() const
Teuchos::RCP< RKButcherTableau< Scalar > > tableau_
virtual Scalar getOrderMin() const
virtual void setStageNumber(int s)
virtual Scalar getOrder() const
bool isInitialized_
True if stepper&#39;s member data is initialized.
Thyra Base interface for time steppers.
Application Action for StepperRKBase.
virtual int getNumberOfStages() const
int stageNumber_
The current Runge-Kutta stage number, {0,...,s-1}. -1 indicates outside stage loop.
virtual Teuchos::RCP< const Thyra::VectorBase< Scalar > > getStageX() const
virtual int getStageNumber() const
virtual Teuchos::RCP< Thyra::VectorBase< Scalar > > getStageX()
virtual Scalar getOrderMax() const
Teuchos::RCP< StepperRKAppAction< Scalar > > stepperRKAppAction_
virtual Teuchos::RCP< const RKButcherTableau< Scalar > > getTableau() const
Teuchos::RCP< Thyra::VectorBase< Scalar > > stageX_