Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperBackwardEulerObserverBase.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_StepperBackwardEulerObserverBase_hpp
10 #define Tempus_StepperBackwardEulerObserverBase_hpp
11 
12 #include "Tempus_config.hpp"
13 #include "Tempus_SolutionHistory.hpp"
15 
16 
17 namespace Tempus {
18 
19 /** \brief Base observer for StepperBackwardEuler.
20  *
21  * This class provides a means to observe values (e.g., solution variables
22  * through SolutionHistory, and stepper member data through the Stepper),
23  * and cannot modify them.
24  *
25  * Users deriving from this class can observer a lot of data, and it is
26  * expected that users will NOT modify any of that data. If the user
27  * wishes to modify the solution and/or stepper data during the
28  * Stepper::takeStep, they should use the Modifier class (with care!).
29  *
30  * Below is the BackwardEuler algorithm with the locations of the observe calls
31  * italicized.
32  *
33  * \f{algorithm}{
34  * \renewcommand{\thealgorithm}{}
35  * \caption{DIRK Backward Euler with observe calls indicated.}
36  * \begin{algorithmic}[1]
37  * \State \quad {\it observer.observe(solutionHistory, stepper, BEGIN\_STEP)}
38  * \State Compute the predictor (e.g., apply stepper to $x_n$).
39  * \State \quad {\it observer.observe(solutionHistory, stepper, BEFORE\_SOLVE)}
40  * \State Solve $\mathcal{F}_n(\dot{x}=(x_n-x_{n-1})/\Delta t_n, x_n, t_n)=0$ for $x_n$
41  * \State \quad {\it observer.observe(solutionHistory, stepper, AFTER\_SOLVE)}
42  * \State $\dot{x}_n \leftarrow (x_n-x_{n-1})/\Delta t_n$
43  * \State \quad {\it observer.observe(solutionHistory, stepper, END\_STEP)}
44  * \end{algorithmic}
45  * \f}
46  */
47 template<class Scalar>
49  : virtual public Tempus::StepperBackwardEulerAppAction<Scalar>
50 {
51 private:
52 
53  /* \brief Adaptor execute function
54  *
55  * This is an adaptor function to bridge between the AppAction
56  * interface and this derived interface. It is meant to be private
57  * and non-virtual as deriving from this class should only need to
58  * implement the observe function.
59  *
60  * For the Observer interface, this adaptor simply "applies" constantness
61  * to the arguments.
62  */
63  void execute(
64  Teuchos::RCP<SolutionHistory<Scalar> > sh,
65  Teuchos::RCP<StepperBackwardEuler<Scalar> > stepper,
67  { this->observe(sh, stepper, actLoc); }
68 
69 public:
70 
71  /// Observe BackwardEuler Stepper.
72  virtual void observe(
73  Teuchos::RCP<const SolutionHistory<Scalar> > /* sh */,
74  Teuchos::RCP<const StepperBackwardEuler<Scalar> > /* stepper */,
76 
77 };
78 
79 } // namespace Tempus
80 
81 #endif // Tempus_StepperBackwardEulerObserverBase_hpp
void execute(Teuchos::RCP< SolutionHistory< Scalar > > sh, Teuchos::RCP< StepperBackwardEuler< Scalar > > stepper, const typename StepperBackwardEulerAppAction< Scalar >::ACTION_LOCATION actLoc)
Execute application action for BackwardEuler Stepper.
ACTION_LOCATION
Indicates the location of application action (see algorithm).
virtual void observe(Teuchos::RCP< const SolutionHistory< Scalar > >, Teuchos::RCP< const StepperBackwardEuler< Scalar > >, const typename StepperBackwardEulerAppAction< Scalar >::ACTION_LOCATION actLoc)=0
Observe BackwardEuler Stepper.
Application Action for StepperBackwardEuler.
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...