Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_StepperForwardEulerObserverBase.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_StepperForwardEulerObserverBase_hpp
10 #define Tempus_StepperForwardEulerObserverBase_hpp
11 
12 #include "Tempus_config.hpp"
13 #include "Tempus_SolutionHistory.hpp"
15 
16 
17 namespace Tempus {
18 
19 /** \brief Base observer for StepperForwardEuler.
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 ForwardEuler algorithm with the locations of the observe calls
31  * italicized.
32  *
33  * \f{algorithm}{
34  * \renewcommand{\thealgorithm}{}
35  * \caption{Forward Euler with the locations of the application actions indicated.}
36  * \begin{algorithmic}[1]
37  * \State Start with $x_n$, $\Delta t_n$
38  * \State {\it appAction.execute(solutionHistory, stepper, BEGIN\_STEP)}
39  * \State Form $f(x_{n},t_{n})$
40  * \State {\it appAction.execute(solutionHistory, stepper, BEFORE\_EXPLICIT\_EVAL)}
41  * \State Form $x_n \leftarrow x_{n} + \Delta t_n f(x_{n},t_n)$
42  * \State {\it appAction.execute(solutionHistory, stepper, END\_STEP)}
43  * \end{algorithmic}
44  * \f}
45  */
46 template<class Scalar>
48  : virtual public Tempus::StepperForwardEulerAppAction<Scalar>
49 {
50 private:
51 
52  /* \brief Adaptor execute function
53  *
54  * This is an adaptor function to bridge between the AppAction
55  * interface and this derived interface. It is meant to be private
56  * and non-virtual as deriving from this class should only need to
57  * implement the observe function.
58  *
59  * For the Observer interface, this adaptor simply "applies" constantness
60  * to the arguments.
61  */
62  void execute(
63  Teuchos::RCP<SolutionHistory<Scalar> > sh,
64  Teuchos::RCP<StepperForwardEuler<Scalar> > stepper,
66  { this->observe(sh, stepper, actLoc); }
67 
68 public:
69 
70  /// Observe ForwardEuler Stepper.
71  virtual void observe(
72  Teuchos::RCP<const SolutionHistory<Scalar> > /* sh */,
73  Teuchos::RCP<const StepperForwardEuler<Scalar> > /* stepper */,
75 
76 };
77 
78 } // namespace Tempus
79 
80 #endif // Tempus_StepperForwardEulerObserverBase_hpp
void execute(Teuchos::RCP< SolutionHistory< Scalar > > sh, Teuchos::RCP< StepperForwardEuler< Scalar > > stepper, const typename StepperForwardEulerAppAction< Scalar >::ACTION_LOCATION actLoc)
Execute application action for ForwardEuler Stepper.
virtual void observe(Teuchos::RCP< const SolutionHistory< Scalar > >, Teuchos::RCP< const StepperForwardEuler< Scalar > >, const typename StepperForwardEulerAppAction< Scalar >::ACTION_LOCATION actLoc)=0
Observe ForwardEuler Stepper.
ACTION_LOCATION
Indicates the location of application action (see algorithm).
Application Action for StepperForwardEuler.
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...