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_ObserverFactory.hpp" 00007 00008 #include "Albany_NOXObserver.hpp" 00009 #include "Albany_RythmosObserver.hpp" 00010 00011 #ifdef ALBANY_MOR 00012 #include "MOR_ObserverFactory.hpp" 00013 #endif 00014 00015 #include "Teuchos_ParameterList.hpp" 00016 00017 #include <string> 00018 00019 namespace Albany { 00020 00021 NOXObserverFactory::NOXObserverFactory(const Teuchos::RCP<Application> &app) : 00022 app_(app) 00023 {} 00024 00025 Teuchos::RCP<NOX::Epetra::Observer> 00026 NOXObserverFactory::createInstance() 00027 { 00028 Teuchos::RCP<NOX::Epetra::Observer> result(new Albany_NOXObserver(app_)); 00029 #ifdef ALBANY_MOR 00030 if(app_->getDiscretization()->supportsMOR()){ 00031 const Teuchos::RCP<MOR::ObserverFactory> morObserverFactory = app_->getMorFacade()->observerFactory(); 00032 result = morObserverFactory->create(result); 00033 } 00034 #endif 00035 return result; 00036 } 00037 00038 RythmosObserverFactory::RythmosObserverFactory(const Teuchos::RCP<Application> &app) : 00039 app_(app) 00040 {} 00041 00042 Teuchos::RCP<Rythmos::IntegrationObserverBase<double> > 00043 RythmosObserverFactory::createInstance() 00044 { 00045 Teuchos::RCP<Rythmos::IntegrationObserverBase<double> > result(new Albany_RythmosObserver(app_)); 00046 #ifdef ALBANY_MOR 00047 if(app_->getDiscretization()->supportsMOR()){ 00048 const Teuchos::RCP<MOR::ObserverFactory> morObserverFactory = app_->getMorFacade()->observerFactory(); 00049 result = morObserverFactory->create(result); 00050 } 00051 #endif 00052 return result; 00053 } 00054 00055 } // namespace Albany