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_Pitchfork_MooreSpence_SolverFactory.H"
00047 #include "LOCA_Pitchfork_MooreSpence_SolverStrategy.H"
00048 #include "LOCA_Pitchfork_MooreSpence_SalingerBordering.H"
00049 #include "LOCA_Pitchfork_MooreSpence_PhippsBordering.H"
00050
00051 LOCA::Pitchfork::MooreSpence::SolverFactory::SolverFactory(
00052 const Teuchos::RCP<LOCA::GlobalData>& global_data) :
00053 globalData(global_data)
00054 {
00055 }
00056
00057 LOCA::Pitchfork::MooreSpence::SolverFactory::~SolverFactory()
00058 {
00059 }
00060
00061 Teuchos::RCP<LOCA::Pitchfork::MooreSpence::SolverStrategy>
00062 LOCA::Pitchfork::MooreSpence::SolverFactory::create(
00063 const Teuchos::RCP<LOCA::Parameter::SublistParser>& topParams,
00064 const Teuchos::RCP<Teuchos::ParameterList>& solverParams)
00065 {
00066 string methodName =
00067 "LOCA::Pitchfork::MooreSpence::SolverFactory::create()";
00068 Teuchos::RCP<LOCA::Pitchfork::MooreSpence::SolverStrategy> strategy;
00069
00070
00071 const string& name = strategyName(*solverParams);
00072
00073 if (name == "Salinger Bordering")
00074 strategy =
00075 Teuchos::rcp(new LOCA::Pitchfork::MooreSpence::SalingerBordering(
00076 globalData,
00077 topParams,
00078 solverParams));
00079
00080 else if (name == "Phipps Bordering")
00081 strategy =
00082 Teuchos::rcp(new LOCA::Pitchfork::MooreSpence::PhippsBordering(
00083 globalData,
00084 topParams,
00085 solverParams));
00086
00087 else if (name == "User-Defined") {
00088
00089
00090 string userDefinedName = solverParams->get("User-Defined Name",
00091 "???");
00092 if ((*solverParams).INVALID_TEMPLATE_QUALIFIER
00093 isType< Teuchos::RCP<LOCA::Pitchfork::MooreSpence::SolverStrategy> >(userDefinedName))
00094 strategy = (*solverParams).INVALID_TEMPLATE_QUALIFIER
00095 get< Teuchos::RCP<LOCA::Pitchfork::MooreSpence::SolverStrategy> >(userDefinedName);
00096 else
00097 globalData->locaErrorCheck->throwError(
00098 methodName,
00099 "Cannot find user-defined strategy: " +
00100 userDefinedName);
00101 }
00102 else
00103 globalData->locaErrorCheck->throwError(
00104 methodName,
00105 "Invalid bordered solver strategy: " +
00106 name);
00107
00108 return strategy;
00109 }
00110
00111 const string&
00112 LOCA::Pitchfork::MooreSpence::SolverFactory::strategyName(
00113 Teuchos::ParameterList& solverParams) const
00114 {
00115 return solverParams.get("Solver Method", "Salinger Bordering");
00116 }