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_MultiContinuation_Factory.H"
00047 #include "LOCA_MultiContinuation_AbstractStrategy.H"
00048 #include "LOCA_MultiContinuation_NaturalGroup.H"
00049 #include "LOCA_MultiContinuation_ArcLengthGroup.H"
00050
00051 LOCA::MultiContinuation::Factory::Factory(
00052 const Teuchos::RCP<LOCA::GlobalData>& global_data) :
00053 globalData(global_data)
00054 {
00055 }
00056
00057 LOCA::MultiContinuation::Factory::~Factory()
00058 {
00059 }
00060
00061 Teuchos::RCP<LOCA::MultiContinuation::AbstractStrategy>
00062 LOCA::MultiContinuation::Factory::create(
00063 const Teuchos::RCP<LOCA::Parameter::SublistParser>& topParams,
00064 const Teuchos::RCP<Teuchos::ParameterList>& stepperParams,
00065 const Teuchos::RCP<LOCA::MultiContinuation::AbstractGroup>& grp,
00066 const Teuchos::RCP<LOCA::MultiPredictor::AbstractStrategy>& pred,
00067 const vector<int>& paramIDs)
00068 {
00069 string methodName = "LOCA::MultiContinuation::Factory::create()";
00070 Teuchos::RCP<LOCA::MultiContinuation::AbstractStrategy> strategy;
00071
00072
00073 const string& name = strategyName(*stepperParams);
00074
00075 if (name == "Natural")
00076 strategy =
00077 Teuchos::rcp(new LOCA::MultiContinuation::NaturalGroup(globalData,
00078 topParams,
00079 stepperParams,
00080 grp,
00081 pred,
00082 paramIDs));
00083
00084 else if (name == "Arc Length")
00085 strategy =
00086 Teuchos::rcp(new LOCA::MultiContinuation::ArcLengthGroup(
00087 globalData,
00088 topParams,
00089 stepperParams,
00090 grp,
00091 pred,
00092 paramIDs));
00093 else if (name == "User-Defined") {
00094
00095
00096 string userDefinedName = stepperParams->get("User-Defined Name",
00097 "???");
00098 if ((*stepperParams).INVALID_TEMPLATE_QUALIFIER
00099 isType< Teuchos::RCP<LOCA::MultiContinuation::AbstractStrategy> >(userDefinedName))
00100 strategy = (*stepperParams).INVALID_TEMPLATE_QUALIFIER
00101 get< Teuchos::RCP<LOCA::MultiContinuation::AbstractStrategy> >(userDefinedName);
00102 else
00103 globalData->locaErrorCheck->throwError(
00104 methodName,
00105 "Cannot find user-defined strategy: " +
00106 userDefinedName);
00107 }
00108 else
00109 globalData->locaErrorCheck->throwError(
00110 methodName,
00111 "Invalid continuation method: " +
00112 name);
00113
00114 return strategy;
00115 }
00116
00117 const string&
00118 LOCA::MultiContinuation::Factory::strategyName(
00119 Teuchos::ParameterList& stepperParams) const
00120 {
00121 return stepperParams.get("Continuation Method", "Arc Length");
00122 }