Rythmos - Transient Integration for Differential Equations  Version of the Day
 All Classes Functions Variables Typedefs Pages
Rythmos_StepperHelpers_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_HELPERS_DECL_HPP
30 #define RYTHMOS_STEPPER_HELPERS_DECL_HPP
31 
32 
33 #include "Rythmos_Types.hpp"
34 #include "Rythmos_StepperBase.hpp"
35 #include "Thyra_ModelEvaluator.hpp"
36 #include "Rythmos_InterpolatorBase.hpp"
37 #include "Teuchos_ConstNonconstObjectContainer.hpp"
38 
39 namespace Rythmos {
40 
41 
45 template<class Scalar>
46 void assertValidModel(
47  const StepperBase<Scalar>& stepper,
48  const Thyra::ModelEvaluator<Scalar>& model
49  );
50 
51 
58 template<class Scalar>
59 bool setDefaultInitialConditionFromNominalValues(
60  const Thyra::ModelEvaluator<Scalar>& model,
61  const Ptr<StepperBase<Scalar> >& stepper
62  );
63 
71 template<class Scalar>
72 void restart( StepperBase<Scalar> *stepper );
73 
74 template<class Scalar>
75 void eval_model_explicit(
76  const Thyra::ModelEvaluator<Scalar> &model,
77  Thyra::ModelEvaluatorBase::InArgs<Scalar> &basePoint,
78  const VectorBase<Scalar>& x_in,
79  const typename Thyra::ModelEvaluatorBase::InArgs<Scalar>::ScalarMag &t_in,
80  const Ptr<VectorBase<Scalar> >& f_out,
81  const Scalar scaled_dt = 0,
82  const Scalar stage_point = 0 /* default value */
83  );
84 
85 
86 #ifdef HAVE_THYRA_ME_POLYNOMIAL
87 
88 
89 template<class Scalar>
90 void eval_model_explicit_poly(
91  const Thyra::ModelEvaluator<Scalar> &model,
92  Thyra::ModelEvaluatorBase::InArgs<Scalar> &basePoint,
93  const Teuchos::Polynomial< VectorBase<Scalar> > &x_poly,
94  const typename Thyra::ModelEvaluatorBase::InArgs<Scalar>::ScalarMag &t,
95  const Ptr<Teuchos::Polynomial<VectorBase<Scalar> > >& f_poly
96  );
97 
98 
99 #endif // HAVE_THYRA_ME_POLYNOMIAL
100 
101 
102 // This function simply returns the boundary points if they're asked for. Otherwise it throws.
103 template<class Scalar>
104 void defaultGetPoints(
105  const Scalar& t_old, // required inArg
106  const Ptr<const VectorBase<Scalar> >& x_old, // optional inArg
107  const Ptr<const VectorBase<Scalar> >& xdot_old, // optional inArg
108  const Scalar& t, // required inArg
109  const Ptr<const VectorBase<Scalar> >& x, // optional inArg
110  const Ptr<const VectorBase<Scalar> >& xdot, // optional inArg
111  const Array<Scalar>& time_vec, // required inArg
112  const Ptr<Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > > >& x_vec, // optional outArg
113  const Ptr<Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > > >& xdot_vec, // optional outArg
114  const Ptr<Array<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> >& accuracy_vec, // optional outArg
115  const Ptr<InterpolatorBase<Scalar> > interpolator // optional inArg (note: not const)
116  );
117 
118 // This function sets a model on a stepper by creating the appropriate
119 // ConstNonconstObjectContainer object.
120 template<class Scalar>
121  void setStepperModel(
122  const Ptr<StepperBase<Scalar> >& stepper,
123  const RCP<const Thyra::ModelEvaluator<Scalar> >& model
124  );
125 
126 template<class Scalar>
127  void setStepperModel(
128  const Ptr<StepperBase<Scalar> >& stepper,
129  const RCP<Thyra::ModelEvaluator<Scalar> >& model
130  );
131 
132 template<class Scalar>
133  void setStepperModel(
134  const Ptr<StepperBase<Scalar> >& stepper,
135  Teuchos::ConstNonconstObjectContainer<Thyra::ModelEvaluator<Scalar> >&
136  model
137  );
138 
139 
140 } // namespace Rythmos
141 
142 
143 #endif // RYTHMOS_STEPPER_HELPERS_DECL_HPP