Tempus Version of the Day
Time Integration
Loading...
Searching...
No Matches
Tempus_StepperHHTAlphaModifierXBase.hpp
Go to the documentation of this file.
1//@HEADER
2// *****************************************************************************
3// Tempus: Time Integration and Sensitivity Analysis Package
4//
5// Copyright 2017 NTESS and the Tempus contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8//@HEADER
9
10#ifndef Tempus_StepperHHTAlphaModifierXBase_hpp
11#define Tempus_StepperHHTAlphaModifierXBase_hpp
12
13#include "Tempus_config.hpp"
14#include "Tempus_SolutionHistory.hpp"
16
17namespace Tempus {
18
31template <class Scalar>
33 : virtual public Tempus::StepperHHTAlphaAppAction<Scalar> {
34 private:
35 /* \brief Adaptor execute function
36 *
37 * This is an adaptor function to bridge between the AppAction
38 * interface and the ModifierX interface. It is meant to be private
39 * and non-virtual as deriving from this class should only need to
40 * implement the modify function.
41 *
42 * For the ModifierX interface, this adaptor maps the
43 * StepperHHTAlphaAppAction::ACTION_LOCATION to the
44 * StepperHHTAlphaModifierX::MODIFIERX_TYPE, and only pass the solution
45 * (\f$x\f$ and/or \f$\dot{x}\f$ and other parameters to the modify
46 * function.
47 */
48 void execute(
49 Teuchos::RCP<SolutionHistory<Scalar> > sh,
50 Teuchos::RCP<StepperHHTAlpha<Scalar> > stepper,
52 {
53 using Teuchos::RCP;
54
56 RCP<SolutionState<Scalar> > workingState = sh->getWorkingState();
57 const Scalar time = workingState->getTime();
58 const Scalar dt = workingState->getTimeStep();
59 RCP<Thyra::VectorBase<Scalar> > x;
60
61 switch (actLoc) {
63 modType = X_BEGIN_STEP;
64 x = workingState->getX();
65 break;
66 }
68 modType = X_BEFORE_SOLVE;
69 x = workingState->getX();
70 break;
71 }
73 modType = X_AFTER_SOLVE;
74 x = workingState->getX();
75 break;
76 }
78 modType = X_END_STEP;
79 if (workingState->getX() != Teuchos::null)
80 x = workingState->getX();
81 else
82 x = stepper->getStepperX();
83 break;
84 }
85 default:
86 TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
87 "Error - unknown action location.\n");
88 }
89
90 this->modify(x, time, dt, modType);
91 }
92
93 public:
101
103 virtual void modify(Teuchos::RCP<Thyra::VectorBase<Scalar> > /* x */,
104 const Scalar /* time */, const Scalar /* dt */,
105 const MODIFIER_TYPE modType) = 0;
106};
107
108} // namespace Tempus
109
110#endif // Tempus_StepperHHTAlphaModifierXBase_hpp
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
ACTION_LOCATION
Indicates the location of application action (see algorithm).
void execute(Teuchos::RCP< SolutionHistory< Scalar > > sh, Teuchos::RCP< StepperHHTAlpha< Scalar > > stepper, const typename StepperHHTAlphaAppAction< Scalar >::ACTION_LOCATION actLoc)
Execute application action for HHTAlpha Stepper.
MODIFIER_TYPE
Indicates the location of application action (see algorithm).
virtual void modify(Teuchos::RCP< Thyra::VectorBase< Scalar > >, const Scalar, const Scalar, const MODIFIER_TYPE modType)=0
Modify solution based on the MODIFIER_TYPE.