• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

MOR_CollocationMetricCriterionFactory.cpp

Go to the documentation of this file.
00001 //*****************************************************************//
00002 //    Albany 2.0:  Copyright 2012 Sandia Corporation               //
00003 //    This Software is released under the BSD license detailed     //
00004 //    in the file "license.txt" in the top-level Albany directory  //
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> &params) :
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 } // end namespace MOR

Generated on Wed Mar 26 2014 18:36:40 for Albany: a Trilinos-based PDE code by  doxygen 1.7.1