|
Rythmos - Transient Integration for Differential Equations
Version of the Day
|
00001 //@HEADER 00002 // *********************************************************************** 00003 // 00004 // Rythmos Package 00005 // Copyright (2006) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 00023 // USA 00024 // Questions? Contact Todd S. Coffey (tscoffe@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 //@HEADER 00028 00029 #ifndef Rythmos_ExplicitRK_STEPPER_DECL_H 00030 #define Rythmos_ExplicitRK_STEPPER_DECL_H 00031 00032 #include "Rythmos_RKButcherTableauAcceptingStepperBase.hpp" 00033 #include "Rythmos_RKButcherTableauBase.hpp" 00034 #include "Rythmos_Types.hpp" 00035 #include "Thyra_ModelEvaluator.hpp" 00036 00037 namespace Rythmos { 00038 00040 template<class Scalar> 00041 class ExplicitRKStepper : virtual public RKButcherTableauAcceptingStepperBase<Scalar> 00042 { 00043 public: 00044 typedef Teuchos::ScalarTraits<Scalar> ST; 00045 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag; 00046 00048 ExplicitRKStepper(); 00049 00052 00054 bool supportsCloning() const; 00055 00057 RCP<StepperBase<Scalar> > cloneStepperAlgorithm() const; 00058 00060 00063 00065 void setRKButcherTableau(const RCP<const RKButcherTableauBase<Scalar> > &rkbt); 00066 00068 RCP<const RKButcherTableauBase<Scalar> > getRKButcherTableau() const; 00069 00071 00073 Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_x_space() const; 00074 00076 void setModel(const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model); 00077 00079 void setNonconstModel(const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& model); 00080 00082 Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > getModel() const; 00083 00085 RCP<Thyra::ModelEvaluator<Scalar> > getNonconstModel(); 00086 00088 ~ExplicitRKStepper(); 00089 00091 void setInitialCondition( 00092 const Thyra::ModelEvaluatorBase::InArgs<Scalar> &initialCondition 00093 ); 00094 00096 Thyra::ModelEvaluatorBase::InArgs<Scalar> getInitialCondition() const; 00097 00099 Scalar takeStep(Scalar dt, StepSizeType flag); 00100 00102 const StepStatus<Scalar> getStepStatus() const; 00103 00105 void describe( 00106 Teuchos::FancyOStream &out, 00107 const Teuchos::EVerbosityLevel verbLevel 00108 ) const; 00109 00112 void addPoints( 00113 const Array<Scalar>& time_vec 00114 ,const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > >& x_vec 00115 ,const Array<Teuchos::RCP<const Thyra::VectorBase<Scalar> > >& xdot_vec 00116 ); 00117 00119 void getPoints( 00120 const Array<Scalar>& time_vec 00121 ,Array<RCP<const VectorBase<Scalar> > >* x_vec 00122 ,Array<RCP<const VectorBase<Scalar> > >* xdot_vec 00123 ,Array<ScalarMag>* accuracy_vec) const; 00124 00126 TimeRange<Scalar> getTimeRange() const; 00127 00129 void getNodes(Array<Scalar>* time_vec) const; 00130 00132 void removeNodes(Array<Scalar>& time_vec); 00133 00135 int getOrder() const; 00136 00138 00139 void setParameterList(Teuchos::RCP<Teuchos::ParameterList> const& paramList); 00140 00142 Teuchos::RCP<Teuchos::ParameterList> getNonconstParameterList(); 00143 00145 Teuchos::RCP<Teuchos::ParameterList> unsetParameterList(); 00146 00148 RCP<const Teuchos::ParameterList> getValidParameters() const; 00149 00150 private: 00151 00152 Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > model_; 00153 Teuchos::RCP<Thyra::VectorBase<Scalar> > solution_vector_; 00154 Teuchos::RCP<Thyra::VectorBase<Scalar> > solution_vector_old_; 00155 Array<Teuchos::RCP<Thyra::VectorBase<Scalar> > > k_vector_; 00156 Teuchos::RCP<Thyra::VectorBase<Scalar> > ktemp_vector_; 00157 00158 Thyra::ModelEvaluatorBase::InArgs<Scalar> basePoint_; 00159 00160 RCP<const RKButcherTableauBase<Scalar> > erkButcherTableau_; 00161 00162 Scalar t_; 00163 Scalar t_old_; 00164 Scalar dt_; 00165 int numSteps_; 00166 00167 Teuchos::RCP<Teuchos::ParameterList> parameterList_; 00168 00169 bool isInitialized_; 00170 00171 bool haveInitialCondition_; 00172 00173 // Private member functions: 00174 void defaultInitializeAll_(); 00175 void initialize_(); 00176 00177 }; 00178 00179 // Non-member constructors 00180 template<class Scalar> 00181 RCP<ExplicitRKStepper<Scalar> > explicitRKStepper(); 00182 00183 template<class Scalar> 00184 RCP<ExplicitRKStepper<Scalar> > explicitRKStepper( 00185 const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& model 00186 ); 00187 00188 template<class Scalar> 00189 RCP<ExplicitRKStepper<Scalar> > explicitRKStepper( 00190 const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& model, 00191 const RCP<const RKButcherTableauBase<Scalar> >& rkbt 00192 ); 00193 00194 } // namespace Rythmos 00195 00196 #endif //Rythmos_ExplicitRK_STEPPER_DECL_H 00197
1.7.6.1