Rythmos - Transient Integration for Differential Equations  Version of the Day
 All Classes Functions Variables Typedefs Pages
Rythmos_StepperBase_decl.hpp
1 //@HEADER
2 // ***********************************************************************
3 //
4 // Rythmos Package
5 // Copyright (2006) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 // USA
24 // Questions? Contact Todd S. Coffey (tscoffe@sandia.gov)
25 //
26 // ***********************************************************************
27 //@HEADER
28 
29 #ifndef Rythmos_STEPPER_BASE_DECL_H
30 #define Rythmos_STEPPER_BASE_DECL_H
31 
32 
33 #include "Rythmos_InterpolationBufferBase.hpp"
34 #include "Rythmos_StepperSupportTypes.hpp"
35 #include "Rythmos_Types.hpp"
36 #include "Teuchos_Describable.hpp"
37 #include "Thyra_ModelEvaluator.hpp"
38 
39 
40 namespace Rythmos {
41 
42 namespace {
43  const std::string RythmosStepControlSettings_name = "Step Control Settings";
44 }
45 
77 template<class Scalar>
78 class StepperBase : virtual public InterpolationBufferBase<Scalar>
79 {
80 public:
81 
89  virtual bool supportsCloning() const;
90 
111  virtual RCP<StepperBase<Scalar> > cloneStepperAlgorithm() const;
112 
118  virtual bool isImplicit() const;
119 
130  virtual bool acceptsModel() const;
131 
166  virtual void setModel(
167  const RCP<const Thyra::ModelEvaluator<Scalar> >& model
168  ) = 0;
169 
170 
181  virtual void setNonconstModel(
182  const RCP<Thyra::ModelEvaluator<Scalar> >& model
183  ) = 0;
184 
188  virtual bool modelIsConst() const { return true; }
189 
190  // 2009/09/05: rabartl: ToDo: Make setModel(const model) and modelIsConst()
191  // pure virtual and make all subclasses implement them. All subclasses will
192  // need to use the Teuchos::ConstNonconstObjectContainer class to make this
193  // work. See Rythmos::ForwardSensitivityStepper and Rythmos::BackwardEuler
194  // to see how this works.
195 
203  virtual RCP<const Thyra::ModelEvaluator<Scalar> >
204  getModel() const = 0;
205 
208  virtual RCP<Thyra::ModelEvaluator<Scalar> >
209  getNonconstModel() = 0;
210 
229  virtual void setInitialCondition(
230  const Thyra::ModelEvaluatorBase::InArgs<Scalar> &initialCondition
231  ) = 0;
232 
239  virtual Thyra::ModelEvaluatorBase::InArgs<Scalar>
240  getInitialCondition() const = 0;
241 
278  virtual Scalar takeStep(Scalar dt, StepSizeType stepType) = 0;
279 
291  virtual const StepStatus<Scalar> getStepStatus() const = 0;
292 
306  virtual void setStepControlData(const StepperBase & stepper);
307 
308  // if the stepper is embedded (and allows for adaptive time stepping)
309  bool isEmbeddedRK_ = false;
310 
311 };
312 
313 
318 template<class Scalar>
319 bool isInitialized( const StepperBase<Scalar>& stepper );
320 
321 
322 } // namespace Rythmos
323 
324 #endif //Rythmos_STEPPER_BASE_DECL_H
virtual Scalar takeStep(Scalar dt, StepSizeType stepType)=0
Take a step.
Base class for defining stepper functionality.
virtual const StepStatus< Scalar > getStepStatus() const =0
Get current stepper status after a step has been taken.
virtual void setInitialCondition(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &initialCondition)=0
Specify initial condition and re-initialize.
virtual void setModel(const RCP< const Thyra::ModelEvaluator< Scalar > > &model)=0
Specify the model problem to integrate.
virtual bool acceptsModel() const
Return if this stepper accepts a model.
virtual void setNonconstModel(const RCP< Thyra::ModelEvaluator< Scalar > > &model)=0
Accept a nonconst model.
virtual void setStepControlData(const StepperBase &stepper)
Set step control data from another stepper.
virtual RCP< Thyra::ModelEvaluator< Scalar > > getNonconstModel()=0
Get the model nonconst.
virtual RCP< const Thyra::ModelEvaluator< Scalar > > getModel() const =0
Get the model.
virtual bool isImplicit() const
Return if this stepper is an implicit stepper.
virtual bool supportsCloning() const
Return if this stepper supports cloning or not.
virtual Thyra::ModelEvaluatorBase::InArgs< Scalar > getInitialCondition() const =0
Get the currently set initial condtion.
virtual bool modelIsConst() const
Return of the model is only const or can be returned as a non-const object.
virtual RCP< StepperBase< Scalar > > cloneStepperAlgorithm() const
Clone the stepper object if supported.