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

MOR_ReducedBasisRepository.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 #include "MOR_ReducedBasisRepository.hpp"
00007 
00008 namespace MOR {
00009 
00010 ReducedBasisRepository::ReducedBasisRepository(const Teuchos::RCP<ReducedBasisFactory> &factory) :
00011   factory_(factory)
00012 {
00013   // Nothing to do
00014 }
00015 
00016 Teuchos::RCP<const Epetra_Vector>
00017 ReducedBasisRepository::getOrigin(const Teuchos::RCP<Teuchos::ParameterList> &params)
00018 {
00019   const ReducedBasisElements instance = this->getInstance(params);
00020   return instance.origin;
00021 }
00022 
00023 Teuchos::RCP<const Epetra_MultiVector>
00024 ReducedBasisRepository::getBasis(const Teuchos::RCP<Teuchos::ParameterList> &params)
00025 {
00026   const ReducedBasisElements instance = this->getInstance(params);
00027   return instance.basis;
00028 }
00029 
00030 ReducedBasisElements
00031 ReducedBasisRepository::getInstance(const Teuchos::RCP<Teuchos::ParameterList> &params)
00032 {
00033   const std::string key = params->name();
00034   const InstanceMap::iterator it = instances_.lower_bound(key);
00035   if (it != instances_.end() && it->first == key) {
00036     return it->second;
00037   }
00038   const ReducedBasisElements newInstance = factory_->create(params);
00039   instances_.insert(it, std::make_pair(key, newInstance));
00040   return newInstance;
00041 }
00042 
00043 } // namespace MOR

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