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 "Albany_PiroObserver.hpp" 00008 00009 #include "PHAL_AlbanyTraits.hpp" 00010 00011 #include "Thyra_EpetraThyraWrappers.hpp" 00012 00013 #include "Teuchos_ENull.hpp" 00014 00015 Albany::PiroObserver::PiroObserver( 00016 const Teuchos::RCP<Albany::Application> &app) : 00017 impl_(app) 00018 {} 00019 00020 void 00021 Albany::PiroObserver::observeSolution(const Thyra::VectorBase<double> &solution) 00022 { 00023 // Create non-owning RCP to solution to use the Thyra -> Epetra converter 00024 // This is safe since we will not be creating any persisting relations 00025 const Teuchos::RCP<const Thyra::VectorBase<double> > solution_ptr = 00026 Teuchos::rcpFromRef(solution); 00027 const Teuchos::RCP<const Epetra_Vector> solution_epetra = 00028 Thyra::get_Epetra_Vector(impl_.getNonOverlappedMap(), solution_ptr); 00029 00030 // Determine the stamp associated with the snapshot 00031 const double stamp = impl_.getTimeParamValueOrDefault(0.0); 00032 00033 impl_.observeSolution(stamp, *solution_epetra, Teuchos::null); 00034 }