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 "Albany_ModelFactory.hpp" 00007 00008 #include "Albany_Application.hpp" 00009 #include "Albany_ModelEvaluator.hpp" 00010 00011 #include "AAdapt_AdaptiveSolutionManager.hpp" 00012 00013 #ifdef ALBANY_MOR 00014 #include "MOR_ReducedOrderModelFactory.hpp" 00015 #endif 00016 00017 namespace Albany { 00018 00019 using Teuchos::RCP; 00020 using Teuchos::ParameterList; 00021 00022 ModelFactory::ModelFactory(const RCP<ParameterList> ¶ms, 00023 const RCP<Application> &app) : 00024 params_(params), 00025 app_(app) 00026 { 00027 // Nothing to do 00028 } 00029 00030 RCP<EpetraExt::ModelEvaluator> ModelFactory::create() const 00031 { 00032 RCP<EpetraExt::ModelEvaluator> model(new Albany::ModelEvaluator(app_, params_)); 00033 00034 // Wrap a decorator around the original model when an adaptive computation is requested. 00035 // const RCP<AAdapt::AdaptiveModelFactory> adaptMdlFactory = app_->getAdaptSolMgr()->modelFactory(); 00036 // model = adaptMdlFactory->create(model); 00037 00038 #ifdef ALBANY_MOR 00039 if(app_->getDiscretization()->supportsMOR()){ 00040 // Wrap a decorator around the original model when a reduced-order computation is requested. 00041 const RCP<MOR::ReducedOrderModelFactory> romFactory = app_->getMorFacade()->modelFactory(); 00042 model = romFactory->create(model); 00043 } 00044 #endif 00045 00046 return model; 00047 } 00048 00049 } // end namespace Albany