Tempus  Version of the Day
Time Integration
Tempus_IntegratorObserverComposite_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_IntegratorObserverComposite_decl_hpp
10 #define Tempus_IntegratorObserverComposite_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 IntegratorObservers and sequentially calls each
21  * individual observer function.
22  */
23 template<class Scalar>
25  : virtual public Tempus::IntegratorObserver<Scalar>
26 {
27 public:
28 
29  /// Default constructor
31 
32  /// Destructor
34 
35  /// \name Override IntegratorObserver basic methods
36  //@{
37  /// Observe the beginning of the time integrator.
38  virtual void observeStartIntegrator(const Integrator<Scalar>& integrator) override;
39 
40  /// Observe the beginning of the time step loop.
41  virtual void observeStartTimeStep(const Integrator<Scalar>& integrator) override;
42 
43  /// Observe after the next time step size is selected.
44  virtual void observeNextTimeStep(const Integrator<Scalar>& integrator) override;
45 
46  /// Observe before Stepper takes step.
47  virtual void observeBeforeTakeStep(const Integrator<Scalar>& integrator) override;
48 
49  /// Observe after Stepper takes step.
50  virtual void observeAfterTakeStep(const Integrator<Scalar>& integrator) override;
51 
52  /// Observe after checking time step.
53  virtual void observeAfterCheckTimeStep(const Integrator<Scalar>& integrator) override;
54 
55  /// Observe the end of the time step loop.
56  virtual void observeEndTimeStep(const Integrator<Scalar>& integrator) override;
57 
58  /// Observe the end of the time integrator.
59  virtual void observeEndIntegrator(const Integrator<Scalar>& integrator) override;
60 
61  // add observer to the composite observer list
62  void addObserver(const Teuchos::RCP<IntegratorObserver<Scalar> > &observer);
63 
64  // clear all observer from the composite observer list
65  void clearObservers();
66  //@}
67 
68 private:
69 
70  std::vector<Teuchos::RCP<IntegratorObserver<Scalar > > > observers_;
71 
72 };
73 
74 } // namespace Tempus
75 #endif // Tempus_IntegratorObserverComposite_decl_hpp
virtual void observeEndIntegrator(const Integrator< Scalar > &integrator) override
Observe the end of the time integrator.
std::vector< Teuchos::RCP< IntegratorObserver< Scalar > > > observers_
virtual void observeStartIntegrator(const Integrator< Scalar > &integrator) override
Observe the beginning of the time integrator.
virtual void observeAfterTakeStep(const Integrator< Scalar > &integrator) override
Observe after Stepper takes step.
virtual void observeEndTimeStep(const Integrator< Scalar > &integrator) override
Observe the end of the time step loop.
virtual void observeNextTimeStep(const Integrator< Scalar > &integrator) override
Observe after the next time step size is selected.
virtual void observeBeforeTakeStep(const Integrator< Scalar > &integrator) override
Observe before Stepper takes step.
virtual void observeStartTimeStep(const Integrator< Scalar > &integrator) override
Observe the beginning of the time step loop.
void addObserver(const Teuchos::RCP< IntegratorObserver< Scalar > > &observer)
virtual void observeAfterCheckTimeStep(const Integrator< Scalar > &integrator) override
Observe after checking time step.
IntegratorObserver class for time integrators.
Thyra Base interface for time integrators. Time integrators are designed to advance the solution from...