Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperObserverComposite_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_StepperObserverComposite_decl_hpp
10 #define Tempus_StepperObserverComposite_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 StepperObservers and sequentially calls each
21  * individual observer function.
22  */
23 template<class Scalar>
25  : virtual public Tempus::StepperObserver<Scalar>
26 {
27 public:
28 
29  /// Default constructor
31 
32  /// Destructor
33  virtual ~StepperObserverComposite();
34 
35  /// \name Override StepperObserver basic methods
36  //@{
37  /// Observe the beginning of the time integrator.
38  virtual void observeBeginTakeStep(Teuchos::RCP<SolutionHistory<Scalar> > sh, Stepper<Scalar> & stepper) override;
39 
40  /// Observe the beginning of the time step loop.
41  virtual void observeEndTakeStep(Teuchos::RCP<SolutionHistory<Scalar> > sh, Stepper<Scalar> & stepper) override;
42 
43  // add observer to the composite observer list
44  void addObserver(const Teuchos::RCP<StepperObserver<Scalar> > &observer);
45 
46  // clear all observer from the composite observer list
47  void clearObservers();
48 
49  // get the number of RK stepper observers present in the composite
50  std::size_t getSize() const { return observers_.size(); }
51  //@}
52 
53 private:
54 
55  std::vector<Teuchos::RCP<StepperObserver<Scalar > > > observers_;
56 
57 };
58 
59 } // namespace Tempus
60 #endif // Tempus_StepperObserverComposite_decl_hpp
void addObserver(const Teuchos::RCP< StepperObserver< Scalar > > &observer)
Thyra Base interface for time steppers.
This observer is a composite observer,.
virtual void observeBeginTakeStep(Teuchos::RCP< SolutionHistory< Scalar > > sh, Stepper< Scalar > &stepper) override
Observe the beginning of the time integrator.
StepperObserver class for Stepper class.
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
virtual void observeEndTakeStep(Teuchos::RCP< SolutionHistory< Scalar > > sh, Stepper< Scalar > &stepper) override
Observe the beginning of the time step loop.
std::vector< Teuchos::RCP< StepperObserver< Scalar > > > observers_