Tempus Version of the Day
Time Integration
Loading...
Searching...
No Matches
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
15namespace Tempus {
16
17template<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
33template<class Scalar>
35
36template<class Scalar>
39{ logCall(nameObserveStartIntegrator_); }
40
41template<class Scalar>
44{ logCall(nameObserveStartTimeStep_); }
45
46template<class Scalar>
49{ logCall(nameObserveNextTimeStep_); }
50
51template<class Scalar>
54{ logCall(nameObserveBeforeTakeStep_); }
55
56template<class Scalar>
59{ logCall(nameObserveAfterTakeStep_); }
60
61template<class Scalar>
64{ logCall(nameObserveAfterCheckTimeStep_); }
65
66template<class Scalar>
69{ logCall(nameObserveEndTimeStep_); }
70
71template<class Scalar>
74{ logCall(nameObserveEndIntegrator_); }
75
76template<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
90template<class Scalar>
91Teuchos::RCP<const std::map<std::string,int> >
93{ return counters_; }
94
95template<class Scalar>
96Teuchos::RCP<const std::list<std::string> >
98{ return order_; }
99
100template<class Scalar>
101void 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 observeAfterTakeStep(const Integrator< Scalar > &integrator) override
Observe after Stepper takes step.
Teuchos::RCP< std::list< std::string > > order_
Teuchos::RCP< std::map< std::string, int > > counters_
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.
virtual void observeStartIntegrator(const Integrator< Scalar > &integrator) override
Observe the beginning of the time integrator.
Teuchos::RCP< const std::map< std::string, int > > getCounters()
void logCall(const std::string call) const
Asserts next call on the stack is correct and removes from stack.
virtual void observeEndIntegrator(const Integrator< Scalar > &integrator) override
Observe the end of the time integrator.
virtual void observeEndTimeStep(const Integrator< Scalar > &integrator) override
Observe the end of the time step loop.
virtual void observeAfterCheckTimeStep(const Integrator< Scalar > &integrator) override
Observe after checking time step.
Thyra Base interface for time integrators. Time integrators are designed to advance the solution from...