Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperRKObserverComposite_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_StepperRKObserverComposite_decl_hpp
10 #define Tempus_StepperRKObserverComposite_decl_hpp
11 
13 #include "Tempus_TimeStepControl.hpp"
14 #include <vector>
15 
16 namespace Tempus {
17 
18 /** \brief This observer is a composite observer,
19  *
20  * which takes other StepperRKObservers and sequentially calls each
21  * individual observer function.
22  *
23  * NOTE: certain RK observers (ERK,DIRK) methods execute 'back-to-back'
24  * without any intermediate code.
25  */
26 template<class Scalar>
28  : virtual public Tempus::StepperRKObserver<Scalar>
29 {
30 public:
31 
32  /// Default constructor
34 
35  /// Destructor
37 
38  /// \name Override StepperRKObserver basic methods
39  //@{
40  /// Observe Stepper at beginning of takeStep.
41  virtual void observeBeginTakeStep(
42  Teuchos::RCP<SolutionHistory<Scalar> > sh,
43  Stepper<Scalar> & stepper) override;
44 
45  /// Observe Stepper at beginning of each stage.
46  virtual void observeBeginStage(
47  Teuchos::RCP<SolutionHistory<Scalar> > sh,
48  Stepper<Scalar> & stepperRK) override;
49 
50  /// Observe Stepper before Explicit evaluation of Implicit ODE ME.
52  Teuchos::RCP<SolutionHistory<Scalar> > /* sh */,
53  Stepper<Scalar> & /* stepper */) override;
54 
55  /// Observe Stepper before nonlinear solve.
56  virtual void observeBeforeSolve(
57  Teuchos::RCP<SolutionHistory<Scalar> > sh ,
58  Stepper<Scalar> & stepperRK) override;
59 
60  /// Observe Stepper after nonlinear solve.
61  virtual void observeAfterSolve(
62  Teuchos::RCP<SolutionHistory<Scalar> > sh ,
63  Stepper<Scalar> & stepperRK) override;
64 
65  /// Observe Stepper before evaluation of Implicit ODE ME.
66  virtual void observeBeforeExplicit(
67  Teuchos::RCP<SolutionHistory<Scalar> > sh,
68  Stepper<Scalar> & stepperRK) override;
69 
70  /// Observe Stepper at end of each stage.
71  virtual void observeEndStage(
72  Teuchos::RCP<SolutionHistory<Scalar> > sh,
73  Stepper<Scalar> & stepperRK) override;
74 
75  /// Observe Stepper at end of takeStep.
76  virtual void observeEndTakeStep(
77  Teuchos::RCP<SolutionHistory<Scalar> > sh,
78  Stepper<Scalar> & stepper) override;
79 
80  // add observer to the composite observer list
81  void addObserver(const Teuchos::RCP<StepperRKObserver<Scalar> > &observer);
82 
83  // clear all observer from the composite observer list
84  void clearObservers();
85 
86  // get the number of RK stepper observers present in the composite
87  std::size_t getSize() const { return observers_.size(); }
88  //@}
89 
90 private:
91 
92  std::vector<Teuchos::RCP<StepperRKObserver<Scalar > > > observers_;
93 
94 };
95 
96 } // namespace Tempus
97 #endif // Tempus_StepperRKObserverComposite_decl_hpp
virtual void observeBeginTakeStep(Teuchos::RCP< SolutionHistory< Scalar > > sh, Stepper< Scalar > &stepper) override
Observe Stepper at beginning of takeStep.
virtual void observeEndTakeStep(Teuchos::RCP< SolutionHistory< Scalar > > sh, Stepper< Scalar > &stepper) override
Observe Stepper at end of takeStep.
virtual void observeBeforeSolve(Teuchos::RCP< SolutionHistory< Scalar > > sh, Stepper< Scalar > &stepperRK) override
Observe Stepper before nonlinear solve.
Thyra Base interface for time steppers.
void addObserver(const Teuchos::RCP< StepperRKObserver< Scalar > > &observer)
virtual void observeBeforeExplicit(Teuchos::RCP< SolutionHistory< Scalar > > sh, Stepper< Scalar > &stepperRK) override
Observe Stepper before evaluation of Implicit ODE ME.
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
std::vector< Teuchos::RCP< StepperRKObserver< Scalar > > > observers_
virtual void observeAfterSolve(Teuchos::RCP< SolutionHistory< Scalar > > sh, Stepper< Scalar > &stepperRK) override
Observe Stepper after nonlinear solve.
virtual void observeEndStage(Teuchos::RCP< SolutionHistory< Scalar > > sh, Stepper< Scalar > &stepperRK) override
Observe Stepper at end of each stage.
virtual void observeBeforeImplicitExplicitly(Teuchos::RCP< SolutionHistory< Scalar > >, Stepper< Scalar > &) override
Observe Stepper before Explicit evaluation of Implicit ODE ME.
StepperRKObserver class for StepperRK.
virtual void observeBeginStage(Teuchos::RCP< SolutionHistory< Scalar > > sh, Stepper< Scalar > &stepperRK) override
Observe Stepper at beginning of each stage.