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

MOR_RythmosProjectionErrorObserver.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 "MOR_RythmosProjectionErrorObserver.hpp"
00007 
00008 #include "MOR_RythmosUtils.hpp"
00009 
00010 #include "Epetra_Vector.h"
00011 #include "Epetra_Map.h"
00012 #include "Epetra_Comm.h"
00013 
00014 #include "Thyra_EpetraThyraWrappers.hpp"
00015 
00016 #include "Teuchos_RCP.hpp"
00017 
00018 namespace MOR {
00019 
00020 RythmosProjectionErrorObserver::RythmosProjectionErrorObserver(
00021       const Teuchos::RCP<ReducedSpace> &projectionSpace,
00022       const Teuchos::RCP<MultiVectorOutputFile> &errorFile) :
00023   projectionError_(projectionSpace, errorFile)
00024 {
00025   // Nothing to do
00026 }
00027 
00028 Teuchos::RCP<Rythmos::IntegrationObserverBase<double> > RythmosProjectionErrorObserver::cloneIntegrationObserver() const {
00029   return Teuchos::null; // TODO Enable cloning
00030 }
00031 
00032 void RythmosProjectionErrorObserver::resetIntegrationObserver(const Rythmos::TimeRange<double> &/*integrationTimeDomain*/) {
00033   // Not implemented
00034 }
00035 
00036 void RythmosProjectionErrorObserver::observeStartTimeIntegration(
00037     const Rythmos::StepperBase<double> &stepper) {
00038   this->observeTimeStep(stepper);
00039 }
00040 
00041 void RythmosProjectionErrorObserver::observeCompletedTimeStep(
00042     const Rythmos::StepperBase<double> &stepper,
00043     const Rythmos::StepControlInfo<double> &/*stepCtrlInfo*/,
00044     const int /*timeStepIter*/) {
00045   this->observeTimeStep(stepper);
00046 }
00047 
00048 void RythmosProjectionErrorObserver::observeTimeStep(
00049     const Rythmos::StepperBase<double> &stepper) {
00050   const Rythmos::StepStatus<double> stepStatus = stepper.getStepStatus();
00051 
00052   const Teuchos::RCP<const Thyra::VectorBase<double> > stepperSolution = stepStatus.solution;
00053   const Teuchos::RCP<const Thyra::VectorBase<double> > stepperState = getRythmosState(stepperSolution);
00054   const Teuchos::RCP<const Thyra::VectorSpaceBase<double> > stateSpace = stepperState->space();
00055 
00056   const Teuchos::RCP<const Epetra_Comm> stateComm = Teuchos::rcpFromRef(projectionError_.projectionBasisComm());
00057   const Teuchos::RCP<const Epetra_Map> stateMap = Thyra::get_Epetra_Map(*stateSpace, stateComm);
00058   const Teuchos::RCP<const Epetra_Vector> state = Thyra::get_Epetra_Vector(*stateMap, stepperState);
00059 
00060   projectionError_.process(*state);
00061 }
00062 
00063 } // namespace MOR

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