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

Albany_ObserverImpl.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 "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   // Nothing to do
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   // If solution == "Steady" or "Continuation", we need to update the solution from the initial guess prior to
00045   // writing it out, or we will not get the proper state of things like "Stress" in the Exodus file.
00046   {
00047     // Evaluate state field manager
00048     if(nonOverlappedSolutionDot != Teuchos::null)
00049       app_->evaluateStateFieldManager(stamp, nonOverlappedSolutionDot.get(), NULL, nonOverlappedSolution);
00050     else
00051       app_->evaluateStateFieldManager(stamp, NULL, NULL, nonOverlappedSolution);
00052 
00053     // Renames the New state as the Old state in preparation for the next step
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, /*overlapped =*/ true);
00062   }
00063 }
00064 
00065 } // namespace Albany

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