00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #include "Teuchos_ParameterList.hpp"
00043 #include "LOCA_GlobalData.H"
00044 #include "LOCA_ErrorCheck.H"
00045
00046 #include "LOCA_Hopf_MooreSpence_SolverFactory.H"
00047 #include "LOCA_Hopf_MooreSpence_SolverStrategy.H"
00048 #include "LOCA_Hopf_MooreSpence_SalingerBordering.H"
00049
00050 LOCA::Hopf::MooreSpence::SolverFactory::SolverFactory(
00051 const Teuchos::RCP<LOCA::GlobalData>& global_data) :
00052 globalData(global_data)
00053 {
00054 }
00055
00056 LOCA::Hopf::MooreSpence::SolverFactory::~SolverFactory()
00057 {
00058 }
00059
00060 Teuchos::RCP<LOCA::Hopf::MooreSpence::SolverStrategy>
00061 LOCA::Hopf::MooreSpence::SolverFactory::create(
00062 const Teuchos::RCP<LOCA::Parameter::SublistParser>& topParams,
00063 const Teuchos::RCP<Teuchos::ParameterList>& solverParams)
00064 {
00065 string methodName =
00066 "LOCA::Hopf::MooreSpence::SolverFactory::create()";
00067 Teuchos::RCP<LOCA::Hopf::MooreSpence::SolverStrategy> strategy;
00068
00069
00070 const string& name = strategyName(*solverParams);
00071
00072 if (name == "Salinger Bordering")
00073 strategy =
00074 Teuchos::rcp(new LOCA::Hopf::MooreSpence::SalingerBordering(
00075 globalData,
00076 topParams,
00077 solverParams));
00078
00079 else if (name == "User-Defined") {
00080
00081
00082 string userDefinedName = solverParams->get("User-Defined Name", "???");
00083 if ((*solverParams).INVALID_TEMPLATE_QUALIFIER
00084 isType< Teuchos::RCP<LOCA::Hopf::MooreSpence::SolverStrategy> >(userDefinedName))
00085 strategy = (*solverParams).INVALID_TEMPLATE_QUALIFIER
00086 get< Teuchos::RCP<LOCA::Hopf::MooreSpence::SolverStrategy> >(userDefinedName);
00087 else
00088 globalData->locaErrorCheck->throwError(
00089 methodName,
00090 "Cannot find user-defined strategy: " +
00091 userDefinedName);
00092 }
00093 else
00094 globalData->locaErrorCheck->throwError(
00095 methodName,
00096 "Invalid bordered solver strategy: " +
00097 name);
00098
00099 return strategy;
00100 }
00101
00102 const string&
00103 LOCA::Hopf::MooreSpence::SolverFactory::strategyName(
00104 Teuchos::ParameterList& solverParams) const
00105 {
00106 return solverParams.get("Solver Method", "Salinger Bordering");
00107 }