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_SaveEigenData_Factory.H"
00047 #include "LOCA_SaveEigenData_AbstractStrategy.H"
00048 #include "LOCA_SaveEigenData_DefaultStrategy.H"
00049
00050 LOCA::SaveEigenData::Factory::Factory(
00051 const Teuchos::RCP<LOCA::GlobalData>& global_data) :
00052 globalData(global_data)
00053 {
00054 }
00055
00056 LOCA::SaveEigenData::Factory::~Factory()
00057 {
00058 }
00059
00060 Teuchos::RCP<LOCA::SaveEigenData::AbstractStrategy>
00061 LOCA::SaveEigenData::Factory::create(
00062 const Teuchos::RCP<LOCA::Parameter::SublistParser>& topParams,
00063 const Teuchos::RCP<Teuchos::ParameterList>& eigenParams)
00064 {
00065 string methodName = "LOCA::SaveEigenData::Factory::create()";
00066 Teuchos::RCP<LOCA::SaveEigenData::AbstractStrategy> strategy;
00067
00068
00069 const string& name = strategyName(*eigenParams);
00070
00071 if (name == "Default")
00072 strategy =
00073 Teuchos::rcp(new LOCA::SaveEigenData::DefaultStrategy(globalData,
00074 topParams,
00075 eigenParams));
00076 else if (name == "User-Defined") {
00077
00078
00079 string userDefinedName = eigenParams->get(
00080 "User-Defined Save Eigen Data Name",
00081 "???");
00082 if ((*eigenParams).INVALID_TEMPLATE_QUALIFIER
00083 isType< Teuchos::RCP<LOCA::SaveEigenData::AbstractStrategy> >(userDefinedName))
00084 strategy = (*eigenParams).INVALID_TEMPLATE_QUALIFIER
00085 get< Teuchos::RCP<LOCA::SaveEigenData::AbstractStrategy> >(userDefinedName);
00086 else
00087 globalData->locaErrorCheck->throwError(
00088 methodName,
00089 "Cannot find user-defined strategy: " +
00090 userDefinedName);
00091 }
00092 else
00093 globalData->locaErrorCheck->throwError(
00094 methodName,
00095 "Invalid save eigen data strategy: " +
00096 name);
00097
00098 return strategy;
00099 }
00100
00101 const string&
00102 LOCA::SaveEigenData::Factory::strategyName(
00103 Teuchos::ParameterList& eigenParams) const
00104 {
00105 return eigenParams.get("Save Eigen Data Method", "Default");
00106 }