Rythmos_RKButcherTableauBuilder_def.hpp

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 
00030 #ifndef RYTHMOS_RK_BUTCHER_TABLEAU_BUILDER_DEF_HPP
00031 #define RYTHMOS_RK_BUTCHER_TABLEAU_BUILDER_DEF_HPP
00032 
00033 #include "Rythmos_Types.hpp"
00034 
00035 #include "Rythmos_RKButcherTableauBuilder_decl.hpp"
00036 #include "Rythmos_RKButcherTableau.hpp"
00037 
00038 namespace Rythmos {
00039 
00040 // Nonmember constructor
00041 template<class Scalar>
00042 RCP<RKButcherTableauBuilder<Scalar> > rKButcherTableauBuilder()
00043 {
00044   RCP<RKButcherTableauBuilder<Scalar> > rkbtfn = rcp(new RKButcherTableauBuilder<Scalar>() );
00045   return rkbtfn;
00046 }
00047 // Nonmember helper function
00048 template<class Scalar>
00049 RCP<RKButcherTableauBase<Scalar> > createRKBT(const std::string& rkbt_name)
00050 {
00051   RCP<RKButcherTableauBuilder<Scalar> > rkbtfn = rKButcherTableauBuilder<Scalar>();
00052   RCP<RKButcherTableauBase<Scalar> > rkbt = rkbtfn->create(rkbt_name);
00053   return rkbt;
00054 }
00055 
00056 template<class Scalar>
00057 RKButcherTableauBuilder<Scalar>::RKButcherTableauBuilder()
00058 {
00059   this->initializeDefaults_();
00060 }
00061 
00062 template<class Scalar>
00063 void RKButcherTableauBuilder<Scalar>::setRKButcherTableauFactory(
00064     const RCP<const Teuchos::AbstractFactory<RKButcherTableauBase<Scalar> > > &rkbtFactory,
00065     const std::string &rkbtFactoryName
00066     )
00067 {
00068   builder_.setObjectFactory(rkbtFactory, rkbtFactoryName);
00069 }
00070 
00071 template<class Scalar>
00072 void RKButcherTableauBuilder<Scalar>::setParameterList(
00073   RCP<Teuchos::ParameterList> const& paramList
00074   )
00075 {
00076   builder_.setParameterList(paramList);
00077 }
00078 
00079 template<class Scalar>
00080 RCP<Teuchos::ParameterList>
00081 RKButcherTableauBuilder<Scalar>::getNonconstParameterList()
00082 {
00083   return builder_.getNonconstParameterList();
00084 }
00085 
00086 
00087 template<class Scalar>
00088 RCP<Teuchos::ParameterList>
00089 RKButcherTableauBuilder<Scalar>::unsetParameterList()
00090 {
00091   return builder_.unsetParameterList();
00092 }
00093 
00094 
00095 template<class Scalar>
00096 RCP<const Teuchos::ParameterList>
00097 RKButcherTableauBuilder<Scalar>::getParameterList() const
00098 {
00099   return builder_.getParameterList();
00100 }
00101 
00102 
00103 template<class Scalar>
00104 RCP<const Teuchos::ParameterList>
00105 RKButcherTableauBuilder<Scalar>::getValidParameters() const
00106 {
00107   return builder_.getValidParameters();
00108 }
00109 
00110 template<class Scalar>
00111 RCP<RKButcherTableauBase<Scalar> >
00112 RKButcherTableauBuilder<Scalar>::create(
00113     const std::string &rkbt_name
00114     ) const
00115 {
00116   return builder_.create(rkbt_name);
00117 }
00118 
00119 template<class Scalar>
00120 void RKButcherTableauBuilder<Scalar>::initializeDefaults_()
00121 {
00122 
00123   using Teuchos::abstractFactoryStd;
00124 
00125   builder_.setObjectName("Rythmos::RKButcherTableau");
00126   builder_.setObjectTypeName("Runge Kutta Butcher Tableau Type");
00127 
00128   //
00129   // RK Butcher Tableaus:
00130   //
00131 
00132   builder_.setObjectFactory(
00133       abstractFactoryStd< RKButcherTableauBase<Scalar>, BackwardEuler_RKBT<Scalar> >(),
00134       RKBT_BackwardEuler_name()
00135       );
00136 
00137   builder_.setObjectFactory(
00138       abstractFactoryStd< RKButcherTableauBase<Scalar>, ForwardEuler_RKBT<Scalar> >(),
00139       RKBT_ForwardEuler_name()
00140       );
00141 
00142   builder_.setObjectFactory(
00143       abstractFactoryStd< RKButcherTableauBase<Scalar>, Explicit4Stage4thOrder_RKBT<Scalar> >(),
00144       Explicit4Stage_name()
00145       );
00146 
00147   builder_.setObjectFactory(
00148       abstractFactoryStd< RKButcherTableauBase<Scalar>, Explicit3_8Rule_RKBT<Scalar> >(),
00149       Explicit3_8Rule_name()
00150       );
00151 
00152   builder_.setObjectFactory(
00153       abstractFactoryStd< RKButcherTableauBase<Scalar>, Explicit4Stage3rdOrderRunge_RKBT<Scalar> >(),
00154       Explicit4Stage3rdOrderRunge_name()
00155       );
00156 
00157   builder_.setObjectFactory(
00158       abstractFactoryStd< RKButcherTableauBase<Scalar>, Explicit3Stage3rdOrder_RKBT<Scalar> >(),
00159       Explicit3Stage3rdOrder_name()
00160       );
00161 
00162   builder_.setObjectFactory(
00163       abstractFactoryStd< RKButcherTableauBase<Scalar>, Explicit3Stage3rdOrderHeun_RKBT<Scalar> >(),
00164       Explicit3Stage3rdOrderHeun_name()
00165       );
00166 
00167   builder_.setObjectFactory(
00168       abstractFactoryStd< RKButcherTableauBase<Scalar>, Explicit2Stage2ndOrderRunge_RKBT<Scalar> >(),
00169       Explicit2Stage2ndOrderRunge_name()
00170       );
00171 
00172   builder_.setObjectFactory(
00173       abstractFactoryStd< RKButcherTableauBase<Scalar>, SDIRK2Stage3rdOrder_RKBT<Scalar> >(),
00174       SDIRK2Stage3rdOrder_name()
00175       );
00176 
00177   builder_.setObjectFactory(
00178       abstractFactoryStd< RKButcherTableauBase<Scalar>, DIRK2Stage3rdOrder_RKBT<Scalar> >(),
00179       DIRK2Stage3rdOrder_name()
00180       );
00181 
00182   builder_.setObjectFactory(
00183       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit3Stage6thOrderKuntzmannButcher_RKBT<Scalar> >(),
00184       Implicit3Stage6thOrderKuntzmannButcher_name()
00185       );
00186 
00187   //  This RKBT does not pass convergence testing, so we're disbaling it for now.
00188 //  builder_.setObjectFactory(
00189 //      abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit4Stage8thOrderKuntzmannButcher_RKBT<Scalar> >(),
00190 //      Implicit4Stage8thOrderKuntzmannButcher_name()
00191 //      );
00192 
00193   builder_.setObjectFactory(
00194       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit2Stage4thOrderHammerHollingsworth_RKBT<Scalar> >(),
00195       Implicit2Stage4thOrderHammerHollingsworth_name()
00196       );
00197 
00198   builder_.setObjectFactory(
00199       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit1Stage2ndOrderGauss_RKBT<Scalar> >(),
00200       Implicit1Stage2ndOrderGauss_name()
00201       );
00202 
00203   builder_.setObjectFactory(
00204       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit2Stage4thOrderGauss_RKBT<Scalar> >(),
00205       Implicit2Stage4thOrderGauss_name()
00206       );
00207 
00208   builder_.setObjectFactory(
00209       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit3Stage6thOrderGauss_RKBT<Scalar> >(),
00210       Implicit3Stage6thOrderGauss_name()
00211       );
00212 
00213   builder_.setObjectFactory(
00214       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit1Stage1stOrderRadauA_RKBT<Scalar> >(),
00215       Implicit1Stage1stOrderRadauA_name()
00216       );
00217 
00218   builder_.setObjectFactory(
00219       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit2Stage3rdOrderRadauA_RKBT<Scalar> >(),
00220       Implicit2Stage3rdOrderRadauA_name()
00221       );
00222 
00223   builder_.setObjectFactory(
00224       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit3Stage5thOrderRadauA_RKBT<Scalar> >(),
00225       Implicit3Stage5thOrderRadauA_name()
00226       );
00227 
00228   builder_.setObjectFactory(
00229       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit1Stage1stOrderRadauB_RKBT<Scalar> >(),
00230       Implicit1Stage1stOrderRadauB_name()
00231       );
00232 
00233   builder_.setObjectFactory(
00234       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit2Stage3rdOrderRadauB_RKBT<Scalar> >(),
00235       Implicit2Stage3rdOrderRadauB_name()
00236       );
00237 
00238   builder_.setObjectFactory(
00239       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit3Stage5thOrderRadauB_RKBT<Scalar> >(),
00240       Implicit3Stage5thOrderRadauB_name()
00241       );
00242 
00243   builder_.setObjectFactory(
00244       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit2Stage2ndOrderLobattoA_RKBT<Scalar> >(),
00245       Implicit2Stage2ndOrderLobattoA_name()
00246       );
00247 
00248   builder_.setObjectFactory(
00249       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit3Stage4thOrderLobattoA_RKBT<Scalar> >(),
00250       Implicit3Stage4thOrderLobattoA_name()
00251       );
00252 
00253   builder_.setObjectFactory(
00254       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit4Stage6thOrderLobattoA_RKBT<Scalar> >(),
00255       Implicit4Stage6thOrderLobattoA_name()
00256       );
00257 
00258   builder_.setObjectFactory(
00259       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit2Stage2ndOrderLobattoB_RKBT<Scalar> >(),
00260       Implicit2Stage2ndOrderLobattoB_name()
00261       );
00262 
00263   builder_.setObjectFactory(
00264       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit3Stage4thOrderLobattoB_RKBT<Scalar> >(),
00265       Implicit3Stage4thOrderLobattoB_name()
00266       );
00267 
00268   builder_.setObjectFactory(
00269       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit4Stage6thOrderLobattoB_RKBT<Scalar> >(),
00270       Implicit4Stage6thOrderLobattoB_name()
00271       );
00272 
00273   builder_.setObjectFactory(
00274       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit2Stage2ndOrderLobattoC_RKBT<Scalar> >(),
00275       Implicit2Stage2ndOrderLobattoC_name()
00276       );
00277 
00278   builder_.setObjectFactory(
00279       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit3Stage4thOrderLobattoC_RKBT<Scalar> >(),
00280       Implicit3Stage4thOrderLobattoC_name()
00281       );
00282 
00283   builder_.setObjectFactory(
00284       abstractFactoryStd< RKButcherTableauBase<Scalar>, Implicit4Stage6thOrderLobattoC_RKBT<Scalar> >(),
00285       Implicit4Stage6thOrderLobattoC_name()
00286       );
00287 
00288   builder_.setObjectFactory(
00289       abstractFactoryStd< RKButcherTableauBase<Scalar>, SDIRK5Stage5thOrder_RKBT<Scalar> >(),
00290       SDIRK5Stage5thOrder_name()
00291       );
00292 
00293   builder_.setObjectFactory(
00294       abstractFactoryStd< RKButcherTableauBase<Scalar>, SDIRK5Stage4thOrder_RKBT<Scalar> >(),
00295       SDIRK5Stage4thOrder_name()
00296       );
00297 
00298   builder_.setObjectFactory(
00299       abstractFactoryStd< RKButcherTableauBase<Scalar>, SDIRK3Stage4thOrder_RKBT<Scalar> >(),
00300       SDIRK3Stage4thOrder_name()
00301       );
00302 
00303   builder_.setDefaultObject("None");
00304 
00305 }
00306 
00307 // 
00308 // Explicit Instantiation macro
00309 //
00310 // Must be expanded from within the Rythmos namespace!
00311 //
00312 
00313 #define RYTHMOS_RK_BUTCHER_TABLEAU_BUILDER_INSTANT(SCALAR) \
00314   \
00315   template class RKButcherTableauBuilder< SCALAR >; \
00316   \
00317   template RCP<RKButcherTableauBuilder< SCALAR > > rKButcherTableauBuilder(); \
00318   \
00319   template RCP<RKButcherTableauBase< SCALAR > > createRKBT(const std::string& rkbt_name); 
00320 
00321 
00322 } // namespace Rythmos
00323 
00324 
00325 #endif // RYTHMOS_RK_BUTCHER_TABLEAU_BUILDER_DEF_HPP

Generated on Wed May 12 21:25:43 2010 for Rythmos - Transient Integration for Differential Equations by  doxygen 1.4.7