Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_IntegratorObserver.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_IntegratorObserver_hpp
10 #define Tempus_IntegratorObserver_hpp
11 
12 #include "Tempus_TimeStepControl.hpp"
13 
14 // Forward declarations
15 namespace Tempus {
16  template<typename Scalar> class Integrator;
17 }
18 
19 namespace Tempus {
20 
21 /** \brief IntegratorObserver class for time integrators.
22  *
23  * This is a means for application developers to perform tasks
24  * during the time integrator, e.g.,
25  * - Compute specific quantities
26  * - Output information
27  * - Adjust the time step (CFL stability)
28  * - "Massage" the working solution state
29  * - ...
30  *
31  * <b>Design Considerations</b>
32  * - IntegratorObserver should have access to the entire SolutionHistory,
33  * as application developers may have that need.
34  * - The needed IntegratorObserver functions are determined by the
35  * access needs in Integrator::advanceTime().
36  * - IntegratorObserver is not stateless! Developers may touch the
37  * solution state! Developers need to be careful not to break the
38  * restart (checkpoint) capability.
39  */
40 template<class Scalar>
42 {
43 public:
44 
45  /// \name Basic IntegratorObserver methods
46  //@{
47  /// Observe the beginning of the time integrator.
48  virtual void observeStartIntegrator(const Integrator<Scalar>& integrator) = 0;
49 
50  /// Observe the beginning of the time step loop.
51  virtual void observeStartTimeStep(const Integrator<Scalar>& integrator) = 0;
52 
53  /// Observe after the next time step size is selected. The
54  /// observer can choose to change the current integratorStatus.
55  virtual void observeNextTimeStep(const Integrator<Scalar>& integrator) = 0;
56 
57  /// Observe before Stepper takes step.
58  virtual void observeBeforeTakeStep(const Integrator<Scalar>& integrator) = 0;
59 
60  /// Observe after Stepper takes step.
61  virtual void observeAfterTakeStep(const Integrator<Scalar>& integrator) = 0;
62 
63  /// Observe after checking time step. Observer can still fail the time step here.
64  virtual void observeAfterCheckTimeStep(const Integrator<Scalar>& integrator) = 0;
65 
66  /// Observe the end of the time step loop.
67  virtual void observeEndTimeStep(const Integrator<Scalar>& integrator) = 0;
68 
69  /// Observe the end of the time integrator.
70  virtual void observeEndIntegrator(const Integrator<Scalar>& integrator) = 0;
71 
72  /// default destructor
73  virtual ~IntegratorObserver() = default;
74  //@}
75 
76 };
77 } // namespace Tempus
78 #endif // Tempus_IntegratorObserver_hpp
virtual void observeEndIntegrator(const Integrator< Scalar > &integrator)=0
Observe the end of the time integrator.
virtual void observeNextTimeStep(const Integrator< Scalar > &integrator)=0
virtual void observeStartIntegrator(const Integrator< Scalar > &integrator)=0
Observe the beginning of the time integrator.
IntegratorObserver class for time integrators.
virtual void observeBeforeTakeStep(const Integrator< Scalar > &integrator)=0
Observe before Stepper takes step.
virtual void observeAfterCheckTimeStep(const Integrator< Scalar > &integrator)=0
Observe after checking time step. Observer can still fail the time step here.
virtual void observeAfterTakeStep(const Integrator< Scalar > &integrator)=0
Observe after Stepper takes step.
virtual void observeStartTimeStep(const Integrator< Scalar > &integrator)=0
Observe the beginning of the time step loop.
Thyra Base interface for time integrators. Time integrators are designed to advance the solution from...
virtual void observeEndTimeStep(const Integrator< Scalar > &integrator)=0
Observe the end of the time step loop.
virtual ~IntegratorObserver()=default
default destructor