Rythmos - Transient Integration for Differential Equations
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
src
Rythmos_IntegrationObserverBase.hpp
1
2
#ifndef RYTHMOS_INTEGRATION_OBSERVER_BASE_HPP
3
#define RYTHMOS_INTEGRATION_OBSERVER_BASE_HPP
4
5
#include "Rythmos_Types.hpp"
6
#include "Teuchos_Describable.hpp"
7
#include "Teuchos_VerboseObject.hpp"
8
9
namespace
Rythmos {
10
11
12
// Forwards
13
template
<
class
Scalar>
class
TimeRange
;
14
template
<
class
Scalar>
class
StepControlInfo
;
15
template
<
class
Scalar>
class
StepperBase
;
16
17
23
template
<
class
Scalar>
24
class
IntegrationObserverBase
25
:
virtual
public
Teuchos::Describable,
26
virtual
public
Teuchos::VerboseObject<IntegrationObserverBase<Scalar> >
27
{
28
public
:
29
35
virtual
RCP<IntegrationObserverBase<Scalar> >
36
cloneIntegrationObserver
()
const
= 0;
37
49
virtual
void
resetIntegrationObserver
(
50
const
TimeRange<Scalar>
&integrationTimeDomain
51
// ToDo: Pass in the initial condition to the observer
52
) = 0;
53
68
virtual
void
observeStartTimeIntegration
(
69
const
StepperBase<Scalar>
&stepper);
70
85
virtual
void
observeEndTimeIntegration
(
86
const
StepperBase<Scalar>
&stepper);
87
88
// ToDo: add observeStartTimeStep(stepper, ...)
113
virtual
void
observeStartTimeStep
(
114
const
StepperBase<Scalar>
&stepper,
115
const
StepControlInfo<Scalar>
&stepCtrlInfo,
116
const
int
timeStepIter
117
);
118
150
virtual
void
observeCompletedTimeStep
(
151
const
StepperBase<Scalar>
&stepper,
152
const
StepControlInfo<Scalar>
&stepCtrlInfo,
153
const
int
timeStepIter
154
) = 0;
155
191
virtual
void
observeFailedTimeStep
(
192
const
StepperBase<Scalar>
&stepper,
193
const
StepControlInfo<Scalar>
&stepCtrlInfo,
194
const
int
timeStepIter
195
);
196
197
};
198
199
205
template
<
class
Scalar>
206
bool
isInitialTimeStep(
207
const
TimeRange<Scalar>
¤tTimeRange,
208
const
TimeRange<Scalar>
&fullTimeRange
209
)
210
{
211
typedef
Teuchos::ScalarTraits<Scalar> ST;
212
return
compareTimeValues
(currentTimeRange.
lower
(), fullTimeRange.
lower
()) == ST::zero();
213
}
214
215
221
template
<
class
Scalar>
222
bool
isFinalTimeStep(
223
const
TimeRange<Scalar> ¤tTimeRange,
224
const
TimeRange<Scalar> &fullTimeRange
225
)
226
{
227
typedef
Teuchos::ScalarTraits<Scalar> ST;
228
return
compareTimeValues(currentTimeRange.upper(), fullTimeRange.upper()) >= ST::zero();
229
}
230
231
232
// /////////////////////////////////////////////////////////////
233
/* Default implementations for backwards compatibility
234
235
Some of the observer methods were added after rythmos was released.
236
Even though all methods should be pure virtual, we provide a
237
default implementation here for the recently added methods to
238
maintain backwards compatibility. These should be removed in the
239
future.
240
*/
241
242
template
<
class
Scalar>
243
void
IntegrationObserverBase<Scalar>::
244
observeStartTimeIntegration
(
const
StepperBase<Scalar>
&
/* stepper */
)
245
{
246
247
}
248
249
template
<
class
Scalar>
250
void
IntegrationObserverBase<Scalar>::
251
observeEndTimeIntegration
(
const
StepperBase<Scalar>
&
/* stepper */
)
252
{
253
254
}
255
256
template
<
class
Scalar>
257
void
IntegrationObserverBase<Scalar>::
258
observeStartTimeStep
(
259
const
StepperBase<Scalar>
&
/* stepper */
,
260
const
StepControlInfo<Scalar>
&
/* stepCtrlInfo */
,
261
const
int
/* timeStepIter */
262
)
263
{
264
265
}
266
267
template
<
class
Scalar>
268
void
IntegrationObserverBase<Scalar>::
269
observeFailedTimeStep
(
270
const
StepperBase<Scalar>
&
/* stepper */
,
271
const
StepControlInfo<Scalar>
&
/* stepCtrlInfo */
,
272
const
int
/* timeStepIter */
273
)
274
{
275
276
}
277
278
279
}
// namespace Rythmos
280
281
282
#endif
// RYTHMOS_INTEGRATION_OBSERVER_BASE_HPP
Rythmos::IntegrationObserverBase
Base class for strategy objects that observe and time integration by observing the stepper object.
Definition
Rythmos_IntegrationObserverBase.hpp:27
Rythmos::IntegrationObserverBase::observeCompletedTimeStep
virtual void observeCompletedTimeStep(const StepperBase< Scalar > &stepper, const StepControlInfo< Scalar > &stepCtrlInfo, const int timeStepIter)=0
Observe a successfully completed integration step.
Rythmos::IntegrationObserverBase::observeStartTimeIntegration
virtual void observeStartTimeIntegration(const StepperBase< Scalar > &stepper)
Observe the beginning of a time integration loop.
Definition
Rythmos_IntegrationObserverBase.hpp:244
Rythmos::IntegrationObserverBase::observeEndTimeIntegration
virtual void observeEndTimeIntegration(const StepperBase< Scalar > &stepper)
Observe the end of a time integration loop.
Definition
Rythmos_IntegrationObserverBase.hpp:251
Rythmos::IntegrationObserverBase::resetIntegrationObserver
virtual void resetIntegrationObserver(const TimeRange< Scalar > &integrationTimeDomain)=0
Reset the observer to prepair it to observe another integration.
Rythmos::IntegrationObserverBase::observeStartTimeStep
virtual void observeStartTimeStep(const StepperBase< Scalar > &stepper, const StepControlInfo< Scalar > &stepCtrlInfo, const int timeStepIter)
Observer the beginning of an integration step.
Definition
Rythmos_IntegrationObserverBase.hpp:258
Rythmos::IntegrationObserverBase::observeFailedTimeStep
virtual void observeFailedTimeStep(const StepperBase< Scalar > &stepper, const StepControlInfo< Scalar > &stepCtrlInfo, const int timeStepIter)
Observer a failed integration step.
Definition
Rythmos_IntegrationObserverBase.hpp:269
Rythmos::IntegrationObserverBase::cloneIntegrationObserver
virtual RCP< IntegrationObserverBase< Scalar > > cloneIntegrationObserver() const =0
Clone this integration observer if supported .
Rythmos::StepControlInfo
Simple struct to aggregate integration/stepper control information.
Definition
Rythmos_StepControlInfo.hpp:18
Rythmos::StepperBase
Base class for defining stepper functionality.
Definition
Rythmos_StepperBase_decl.hpp:79
Rythmos::TimeRange
Represent a time range.
Definition
Rythmos_TimeRange_decl.hpp:73
Rythmos::TimeRange::lower
TimeType lower() const
Definition
Rythmos_TimeRange_decl.hpp:94
Rythmos::TimeRange::compareTimeValues
int compareTimeValues(const TimeType &t1, const TimeType &t2)
Compare two times taking into account floating point errors.
Definition
Rythmos_TimeRange_def.hpp:38
Generated by
1.17.0