Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus_IntegratorObserverLogging_impl.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_IntegratorObserverLogging_impl_hpp
10 #define Tempus_IntegratorObserverLogging_impl_hpp
11 
13 #include "Tempus_TimeStepControl.hpp"
14 
15 namespace Tempus {
16 
17 template<class Scalar>
19  : nameObserveStartIntegrator_ ("observeStartIntegrator" ),
20  nameObserveStartTimeStep_ ("observeStartTimeStep" ),
21  nameObserveNextTimeStep_ ("observeNextTimeStep" ),
22  nameObserveBeforeTakeStep_ ("observeBeforeTakeStep" ),
23  nameObserveAfterTakeStep_ ("observeAfterTakeStep" ),
24  nameObserveAfterCheckTimeStep_("observeAfterCheckTimeStep"),
25  nameObserveEndTimeStep_ ("observeEndTimeStep" ),
26  nameObserveEndIntegrator_ ("observeEndIntegrator" )
27 {
28  counters_ = Teuchos::rcp(new std::map<std::string,int>);
29  order_ = Teuchos::rcp(new std::list<std::string>);
30  this->resetLogCounters();
31 }
32 
33 template<class Scalar>
35 
36 template<class Scalar>
39 { logCall(nameObserveStartIntegrator_); }
40 
41 template<class Scalar>
44 { logCall(nameObserveStartTimeStep_); }
45 
46 template<class Scalar>
49 { logCall(nameObserveNextTimeStep_); }
50 
51 template<class Scalar>
54 { logCall(nameObserveBeforeTakeStep_); }
55 
56 template<class Scalar>
59 { logCall(nameObserveAfterTakeStep_); }
60 
61 template<class Scalar>
64 { logCall(nameObserveAfterCheckTimeStep_); }
65 
66 template<class Scalar>
69 { logCall(nameObserveEndTimeStep_); }
70 
71 template<class Scalar>
74 { logCall(nameObserveEndIntegrator_); }
75 
76 template<class Scalar>
78 {
79  (*counters_)[nameObserveStartIntegrator_ ] = 0;
80  (*counters_)[nameObserveStartTimeStep_ ] = 0;
81  (*counters_)[nameObserveNextTimeStep_ ] = 0;
82  (*counters_)[nameObserveBeforeTakeStep_ ] = 0;
83  (*counters_)[nameObserveAfterTakeStep_ ] = 0;
84  (*counters_)[nameObserveAfterCheckTimeStep_] = 0;
85  (*counters_)[nameObserveEndTimeStep_ ] = 0;
86  (*counters_)[nameObserveEndIntegrator_ ] = 0;
87  order_->clear();
88 }
89 
90 template<class Scalar>
91 Teuchos::RCP<const std::map<std::string,int> >
93 { return counters_; }
94 
95 template<class Scalar>
96 Teuchos::RCP<const std::list<std::string> >
98 { return order_; }
99 
100 template<class Scalar>
101 void IntegratorObserverLogging<Scalar>::logCall(const std::string call) const
102 {
103  (*counters_)[call] += 1;
104  order_->push_back(call);
105 }
106 
107 } // namespace Tempus
108 #endif // Tempus_IntegratorObserverLogging_impl_hpp
Teuchos::RCP< const std::list< std::string > > getOrder()
virtual void observeNextTimeStep(const Integrator< Scalar > &integrator) override
Observe after the next time step size is selected.
Teuchos::RCP< std::list< std::string > > order_
Teuchos::RCP< std::map< std::string, int > > counters_
virtual void observeBeforeTakeStep(const Integrator< Scalar > &integrator) override
Observe before Stepper takes step.
void logCall(const std::string call) const
Asserts next call on the stack is correct and removes from stack.
virtual void observeAfterCheckTimeStep(const Integrator< Scalar > &integrator) override
Observe after checking time step.
virtual void observeEndTimeStep(const Integrator< Scalar > &integrator) override
Observe the end of the time step loop.
Thyra Base interface for time integrators. Time integrators are designed to advance the solution from...
virtual void observeAfterTakeStep(const Integrator< Scalar > &integrator) override
Observe after Stepper takes step.
virtual void observeEndIntegrator(const Integrator< Scalar > &integrator) override
Observe the end of the time integrator.
Teuchos::RCP< const std::map< std::string, int > > getCounters()
virtual void observeStartIntegrator(const Integrator< Scalar > &integrator) override
Observe the beginning of the time integrator.
virtual void observeStartTimeStep(const Integrator< Scalar > &integrator) override
Observe the beginning of the time step loop.