Rythmos - Transient Integration for Differential Equations  Version of the Day
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  );
82 
83 
84 #ifdef HAVE_THYRA_ME_POLYNOMIAL
85 
86 
87 template<class Scalar>
88 void eval_model_explicit_poly(
89  const Thyra::ModelEvaluator<Scalar> &model,
90  Thyra::ModelEvaluatorBase::InArgs<Scalar> &basePoint,
91  const Teuchos::Polynomial< VectorBase<Scalar> > &x_poly,
92  const typename Thyra::ModelEvaluatorBase::InArgs<Scalar>::ScalarMag &t,
93  const Ptr<Teuchos::Polynomial<VectorBase<Scalar> > >& f_poly
94  );
95 
96 
97 #endif // HAVE_THYRA_ME_POLYNOMIAL
98 
99 
100 // This function simply returns the boundary points if they're asked for. Otherwise it throws.
101 template<class Scalar>
102 void defaultGetPoints(
103  const Scalar& t_old, // required inArg
104  const Ptr<const VectorBase<Scalar> >& x_old, // optional inArg
105  const Ptr<const VectorBase<Scalar> >& xdot_old, // optional inArg
106  const Scalar& t, // required inArg
107  const Ptr<const VectorBase<Scalar> >& x, // optional inArg
108  const Ptr<const VectorBase<Scalar> >& xdot, // optional inArg
109  const Array<Scalar>& time_vec, // required inArg
110  const Ptr<Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > > >& x_vec, // optional outArg
111  const Ptr<Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > > >& xdot_vec, // optional outArg
112  const Ptr<Array<typename Teuchos::ScalarTraits<Scalar>::magnitudeType> >& accuracy_vec, // optional outArg
113  const Ptr<InterpolatorBase<Scalar> > interpolator // optional inArg (note: not const)
114  );
115 
116 // This function sets a model on a stepper by creating the appropriate
117 // ConstNonconstObjectContainer object.
118 template<class Scalar>
119  void setStepperModel(
120  const Ptr<StepperBase<Scalar> >& stepper,
121  const RCP<const Thyra::ModelEvaluator<Scalar> >& model
122  );
123 
124 template<class Scalar>
125  void setStepperModel(
126  const Ptr<StepperBase<Scalar> >& stepper,
127  const RCP<Thyra::ModelEvaluator<Scalar> >& model
128  );
129 
130 template<class Scalar>
131  void setStepperModel(
132  const Ptr<StepperBase<Scalar> >& stepper,
133  Teuchos::ConstNonconstObjectContainer<Thyra::ModelEvaluator<Scalar> >&
134  model
135  );
136 
137 
138 } // namespace Rythmos
139 
140 
141 #endif // RYTHMOS_STEPPER_HELPERS_DECL_HPP