Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #include "Albany_ObserverImpl.hpp"
00007
00008 #include "Albany_AbstractDiscretization.hpp"
00009 #include "AAdapt_AdaptiveSolutionManager.hpp"
00010
00011 #include "Teuchos_TimeMonitor.hpp"
00012 #include "Teuchos_Ptr.hpp"
00013
00014 #include <string>
00015
00016 namespace Albany {
00017
00018 ObserverImpl::ObserverImpl(const Teuchos::RCP<Application> &app) :
00019 app_(app),
00020 solOutTime_(Teuchos::TimeMonitor::getNewTimer("Albany: Output to File"))
00021 {
00022
00023 }
00024
00025 RealType ObserverImpl::getTimeParamValueOrDefault(RealType defaultValue) const
00026 {
00027 const std::string label("Time");
00028
00029 return (app_->getParamLib()->isParameter(label)) ?
00030 app_->getParamLib()->getRealValue<PHAL::AlbanyTraits::Residual>(label) :
00031 defaultValue;
00032 }
00033
00034 Epetra_Map ObserverImpl::getNonOverlappedMap() const
00035 {
00036 return *app_->getMap();
00037 }
00038
00039 void ObserverImpl::observeSolution(
00040 double stamp,
00041 const Epetra_Vector &nonOverlappedSolution,
00042 Teuchos::Ptr<const Epetra_Vector> nonOverlappedSolutionDot)
00043 {
00044
00045
00046 {
00047
00048 if(nonOverlappedSolutionDot != Teuchos::null)
00049 app_->evaluateStateFieldManager(stamp, nonOverlappedSolutionDot.get(), NULL, nonOverlappedSolution);
00050 else
00051 app_->evaluateStateFieldManager(stamp, NULL, NULL, nonOverlappedSolution);
00052
00053
00054 app_->getStateMgr().updateStates();
00055 }
00056
00057 Teuchos::TimeMonitor timer(*solOutTime_);
00058 {
00059 const Teuchos::Ptr<const Epetra_Vector> overlappedSolution(
00060 app_->getAdaptSolMgr()->getOverlapSolution(nonOverlappedSolution));
00061 app_->getDiscretization()->writeSolution(*overlappedSolution, stamp, true);
00062 }
00063 }
00064
00065 }