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

MOR_SnapshotPreprocessorFactory.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_SnapshotPreprocessorFactory.hpp"
00008 
00009 #include "MOR_TrivialSnapshotPreprocessor.hpp"
00010 #include "MOR_FirstVectorSubstractingSnapshotPreprocessor.hpp"
00011 #include "MOR_MeanSubstractingSnapshotPreprocessor.hpp"
00012 #include "MOR_SubstractingSnapshotPreprocessor.hpp"
00013 
00014 #include "Teuchos_TestForException.hpp"
00015 
00016 #include <string>
00017 #include <stdexcept>
00018 
00019 namespace MOR {
00020 
00021 Teuchos::RCP<SnapshotPreprocessor>
00022 SnapshotPreprocessorFactory::instanceNew(const Teuchos::RCP<Teuchos::ParameterList> &params)
00023 {
00024   const std::string typeToken = params->get("Type", "None");
00025 
00026   if (typeToken == "None") {
00027     return Teuchos::rcp(new TrivialSnapshotPreprocessor);
00028   } else if (typeToken == "Substract First Vector") {
00029     return Teuchos::rcp(new FirstVectorSubstractingSnapshotPreprocessor);
00030   } else if (typeToken == "Substract Arithmetic Mean") {
00031     return Teuchos::rcp(new MeanSubstractingSnapshotPreprocessor);
00032   } else if (typeToken == "Substract Provided Origin") {
00033     return Teuchos::rcp(new SubstractingSnapshotPreprocessor(userProvidedOrigin_));
00034   }
00035 
00036   TEUCHOS_TEST_FOR_EXCEPTION(
00037       true,
00038       std::invalid_argument,
00039       typeToken + " is not a valid snapshot preprocessor type.");
00040   return Teuchos::null;
00041 }
00042 
00043 Teuchos::RCP<const Epetra_Vector>
00044 SnapshotPreprocessorFactory::userProvidedOrigin() const
00045 {
00046   return userProvidedOrigin_;
00047 }
00048 
00049 void
00050 SnapshotPreprocessorFactory::userProvidedOriginIs(
00051     const Teuchos::RCP<const Epetra_Vector> &origin)
00052 {
00053   userProvidedOrigin_ = origin;
00054 }
00055 
00056 } // namespace MOR

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