Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #include "MOR_CollocationMetricCriterionFactory.hpp"
00008
00009 #include "MOR_ContainerUtils.hpp"
00010
00011 #include "Teuchos_Tuple.hpp"
00012 #include "Teuchos_TestForException.hpp"
00013
00014 #include <string>
00015 #include <stdexcept>
00016
00017 namespace MOR {
00018
00019 CollocationMetricCriterionFactory::CollocationMetricCriterionFactory(
00020 const Teuchos::RCP<Teuchos::ParameterList> ¶ms) :
00021 params_(params)
00022 {}
00023
00024 Teuchos::RCP<CollocationMetricCriterion>
00025 CollocationMetricCriterionFactory::instanceNew(int rankMax)
00026 {
00027 const Teuchos::Tuple<std::string, 2> allowedTypes = Teuchos::tuple<std::string>("Two Norm", "Frobenius");
00028 const std::string type = params_->get("Collocation Metric Criterion", allowedTypes[0]);
00029 TEUCHOS_TEST_FOR_EXCEPTION(!contains(allowedTypes, type),
00030 std::out_of_range,
00031 type + " not in " + allowedTypes.toString());
00032
00033 if (type == "Two Norm") {
00034 return Teuchos::rcp(new TwoNormCriterion(rankMax));
00035 } else if (type == "Frobenius") {
00036 return Teuchos::rcp(new FrobeniusNormCriterion);
00037 }
00038
00039 TEUCHOS_TEST_FOR_EXCEPT_MSG(true, "Should not happen");
00040 }
00041
00042 }