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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Todd S. Coffey (tscoffe@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 //@HEADER 00028 00029 #ifndef Rythmos_STEPPER_BASE_H 00030 #define Rythmos_STEPPER_BASE_H 00031 00032 00033 #include "Rythmos_InterpolationBufferBase.hpp" 00034 #include "Rythmos_StepperSupportTypes.hpp" 00035 #include "Thyra_VectorBase.hpp" 00036 #include "Teuchos_Describable.hpp" 00037 #include "Teuchos_RCP.hpp" 00038 #include "Thyra_ModelEvaluator.hpp" 00039 00040 00041 namespace Rythmos { 00042 00043 00075 template<class Scalar> 00076 class StepperBase : virtual public InterpolationBufferBase<Scalar> 00077 { 00078 public: 00079 00087 virtual bool supportsCloning() const; 00088 00109 virtual RCP<StepperBase<Scalar> > cloneStepperAlgorithm() const; 00110 00116 virtual bool isImplicit() const; 00117 00128 virtual bool acceptsModel() const; 00129 00168 virtual void setModel( 00169 const RCP<const Thyra::ModelEvaluator<Scalar> > &model 00170 ) = 0; 00171 00179 virtual RCP<const Thyra::ModelEvaluator<Scalar> > 00180 getModel() const = 0; 00181 00200 virtual void setInitialCondition( 00201 const Thyra::ModelEvaluatorBase::InArgs<Scalar> &initialCondition 00202 ); 00203 00232 virtual Scalar takeStep(Scalar dt, StepSizeType stepType) = 0; 00233 00245 virtual const StepStatus<Scalar> getStepStatus() const = 0; 00246 00260 virtual void setStepControlData(const StepperBase & stepper); 00261 00262 }; 00263 00264 00269 template<class Scalar> 00270 bool isInitialized( const StepperBase<Scalar>& stepper ) 00271 { 00272 return stepper.getTimeRange().isValid(); 00273 } 00274 00275 00276 // /////////////////////////////// 00277 // Implementations 00278 00279 00280 template<class Scalar> 00281 bool StepperBase<Scalar>::isImplicit() const 00282 { 00283 return false; 00284 } 00285 00286 00287 template<class Scalar> 00288 bool StepperBase<Scalar>::acceptsModel() const 00289 { 00290 return true; 00291 } 00292 00293 00294 template<class Scalar> 00295 bool StepperBase<Scalar>::supportsCloning() const 00296 { 00297 return false; 00298 } 00299 00300 00301 template<class Scalar> 00302 RCP<StepperBase<Scalar> > 00303 StepperBase<Scalar>::cloneStepperAlgorithm() const 00304 { 00305 return Teuchos::null; 00306 } 00307 00308 00309 template<class Scalar> 00310 void StepperBase<Scalar>::setInitialCondition( 00311 const Thyra::ModelEvaluatorBase::InArgs<Scalar> &initialCondition 00312 ) 00313 { 00314 TEST_FOR_EXCEPTION( 00315 true, std::logic_error, 00316 "Error, the function setIntialCondition(...) is not implemented\n" 00317 "in the class \"" << Teuchos::typeName(*this) << "\"!" ); 00318 // ToDo: Remove this default implementation and make every concrete 00319 // subclass implement this! 00320 } 00321 00322 template<class Scalar> 00323 void StepperBase<Scalar>::setStepControlData(const StepperBase & stepper) 00324 { 00325 } 00326 00327 } // namespace Rythmos 00328 00329 #endif //Rythmos_STEPPER_BASE_H
1.6.1