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_Bifurcation_Factory.H"
00047 #include "LOCA_TurningPoint_MooreSpence_ExtendedGroup.H"
00048 #include "LOCA_TurningPoint_MooreSpence_AbstractGroup.H"
00049 #include "LOCA_TurningPoint_MinimallyAugmented_ExtendedGroup.H"
00050 #include "LOCA_TurningPoint_MinimallyAugmented_AbstractGroup.H"
00051 #include "LOCA_Pitchfork_MooreSpence_ExtendedGroup.H"
00052 #include "LOCA_Pitchfork_MooreSpence_AbstractGroup.H"
00053 #include "LOCA_Pitchfork_MinimallyAugmented_ExtendedGroup.H"
00054 #include "LOCA_Pitchfork_MinimallyAugmented_AbstractGroup.H"
00055 #include "LOCA_Hopf_MooreSpence_ExtendedGroup.H"
00056 #include "LOCA_Hopf_MooreSpence_AbstractGroup.H"
00057 #include "LOCA_Hopf_MinimallyAugmented_ExtendedGroup.H"
00058 #include "LOCA_Hopf_MinimallyAugmented_AbstractGroup.H"
00059
00060 LOCA::Bifurcation::Factory::Factory(
00061 const Teuchos::RCP<LOCA::GlobalData>& global_data) :
00062 globalData(global_data)
00063 {
00064 }
00065
00066 LOCA::Bifurcation::Factory::~Factory()
00067 {
00068 }
00069
00070 Teuchos::RCP<LOCA::MultiContinuation::AbstractGroup>
00071 LOCA::Bifurcation::Factory::create(
00072 const Teuchos::RCP<LOCA::Parameter::SublistParser>& topParams,
00073 const Teuchos::RCP<Teuchos::ParameterList>& bifurcationParams,
00074 const Teuchos::RCP<LOCA::MultiContinuation::AbstractGroup>& grp)
00075 {
00076 string methodName = "LOCA::Bifurcation::Factory::create()";
00077 Teuchos::RCP<LOCA::MultiContinuation::AbstractGroup> strategy;
00078
00079
00080 const string& name = strategyName(*bifurcationParams);
00081
00082 if (name == "None")
00083 strategy = grp;
00084
00085 else if (name == "Turning Point: Moore-Spence") {
00086
00087
00088 Teuchos::RCP<LOCA::TurningPoint::MooreSpence::AbstractGroup> msg =
00089 Teuchos::rcp_dynamic_cast<LOCA::TurningPoint::MooreSpence::AbstractGroup>(grp);
00090 if (msg.get() == NULL)
00091 globalData->locaErrorCheck->throwError(
00092 methodName,
00093 string("Underlying group must be derived from ") +
00094 string("LOCA::TurningPoint::MooreSpence::AbstractGroup ") +
00095 string("for Moore-Spence turning point continuation!"));
00096
00097 strategy =
00098 Teuchos::rcp(new LOCA::TurningPoint::MooreSpence::ExtendedGroup(
00099 globalData,
00100 topParams,
00101 bifurcationParams,
00102 msg));
00103 }
00104 else if (name == "Turning Point: Minimally Augmented") {
00105
00106
00107 Teuchos::RCP<LOCA::TurningPoint::MinimallyAugmented::AbstractGroup> mag =
00108 Teuchos::rcp_dynamic_cast<LOCA::TurningPoint::MinimallyAugmented::AbstractGroup>(grp);
00109 if (mag.get() == NULL)
00110 globalData->locaErrorCheck->throwError(
00111 methodName,
00112 string("Underlying group must be derived from ") +
00113 string("LOCA::TurningPoint::MinimallyAugmented::AbstractGroup ") +
00114 string("for minimally augmented turning point continuation!"));
00115
00116 strategy =
00117 Teuchos::rcp(new LOCA::TurningPoint::MinimallyAugmented::ExtendedGroup(
00118 globalData,
00119 topParams,
00120 bifurcationParams,
00121 mag));
00122 }
00123 else if (name == "Pitchfork: Moore-Spence") {
00124
00125
00126 Teuchos::RCP<LOCA::Pitchfork::MooreSpence::AbstractGroup> msg =
00127 Teuchos::rcp_dynamic_cast<LOCA::Pitchfork::MooreSpence::AbstractGroup>(grp);
00128 if (msg.get() == NULL)
00129 globalData->locaErrorCheck->throwError(
00130 methodName,
00131 string("Underlying group must be derived from ") +
00132 string("LOCA::Pitchfork::MooreSpence::AbstractGroup ") +
00133 string("for Moore-Spence pitchfork continuation!"));
00134
00135 strategy =
00136 Teuchos::rcp(new LOCA::Pitchfork::MooreSpence::ExtendedGroup(
00137 globalData,
00138 topParams,
00139 bifurcationParams,
00140 msg));
00141 }
00142 else if (name == "Pitchfork: Minimally Augmented") {
00143
00144
00145 Teuchos::RCP<LOCA::Pitchfork::MinimallyAugmented::AbstractGroup> mag =
00146 Teuchos::rcp_dynamic_cast<LOCA::Pitchfork::MinimallyAugmented::AbstractGroup>(grp);
00147 if (mag.get() == NULL)
00148 globalData->locaErrorCheck->throwError(
00149 methodName,
00150 string("Underlying group must be derived from ") +
00151 string("LOCA::Pitchfork::MinimallyAugmented::AbstractGroup ") +
00152 string("for minimally augmented pitchfork continuation!"));
00153
00154 strategy =
00155 Teuchos::rcp(new LOCA::Pitchfork::MinimallyAugmented::ExtendedGroup(
00156 globalData,
00157 topParams,
00158 bifurcationParams,
00159 mag));
00160 }
00161 else if (name == "Hopf: Moore-Spence") {
00162
00163
00164 Teuchos::RCP<LOCA::Hopf::MooreSpence::AbstractGroup> msg =
00165 Teuchos::rcp_dynamic_cast<LOCA::Hopf::MooreSpence::AbstractGroup>(grp);
00166 if (msg.get() == NULL)
00167 globalData->locaErrorCheck->throwError(
00168 methodName,
00169 string("Underlying group must be derived from ") +
00170 string("LOCA::Hopf::MooreSpence::AbstractGroup ") +
00171 string("for Moore-Spence Hopf continuation!"));
00172
00173 strategy =
00174 Teuchos::rcp(new LOCA::Hopf::MooreSpence::ExtendedGroup(
00175 globalData,
00176 topParams,
00177 bifurcationParams,
00178 msg));
00179 }
00180 else if (name == "Hopf: Minimally Augmented") {
00181
00182
00183 Teuchos::RCP<LOCA::Hopf::MinimallyAugmented::AbstractGroup> mag =
00184 Teuchos::rcp_dynamic_cast<LOCA::Hopf::MinimallyAugmented::AbstractGroup>(grp);
00185 if (mag.get() == NULL)
00186 globalData->locaErrorCheck->throwError(
00187 methodName,
00188 string("Underlying group must be derived from ") +
00189 string("LOCA::Hopf::MinimallyAugmented::AbstractGroup ") +
00190 string("for minimally augmented Hopf continuation!"));
00191
00192 strategy =
00193 Teuchos::rcp(new LOCA::Hopf::MinimallyAugmented::ExtendedGroup(
00194 globalData,
00195 topParams,
00196 bifurcationParams,
00197 mag));
00198 }
00199 else if (name == "User-Defined") {
00200
00201
00202 string userDefinedName = bifurcationParams->get(
00203 "User-Defined Name",
00204 "???");
00205 if ((*bifurcationParams).INVALID_TEMPLATE_QUALIFIER
00206 isType< Teuchos::RCP<LOCA::MultiContinuation::AbstractGroup> >(userDefinedName))
00207 strategy = (*bifurcationParams).INVALID_TEMPLATE_QUALIFIER
00208 get< Teuchos::RCP<LOCA::MultiContinuation::AbstractGroup> >(userDefinedName);
00209 else
00210 globalData->locaErrorCheck->throwError(
00211 methodName,
00212 "Cannot find user-defined strategy: " +
00213 userDefinedName);
00214 }
00215 else
00216 globalData->locaErrorCheck->throwError(
00217 methodName,
00218 "Invalid bifurcation method: " +
00219 name);
00220
00221 return strategy;
00222 }
00223
00224 string
00225 LOCA::Bifurcation::Factory::strategyName(
00226 Teuchos::ParameterList& bifurcationParams) const
00227 {
00228
00229 string bif_type = bifurcationParams.get("Type", "None");
00230
00231
00232 if (bif_type == "Turning Point" || bif_type == "Pitchfork" ||
00233 bif_type == "Hopf") {
00234 string formulation =
00235 bifurcationParams.get("Formulation", "Moore-Spence");
00236 bif_type += ": " + formulation;
00237 }
00238
00239 return bif_type;
00240 }