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

MOR_GeneralizedCoordinatesRythmosObserver.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_GeneralizedCoordinatesRythmosObserver.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 GeneralizedCoordinatesRythmosObserver::GeneralizedCoordinatesRythmosObserver(
00021     const std::string &filename,
00022     const std::string &stampsFilename) :
00023   impl_(filename, stampsFilename)
00024 {
00025   // Nothing to do
00026 }
00027 
00028 Teuchos::RCP<Rythmos::IntegrationObserverBase<double> > GeneralizedCoordinatesRythmosObserver::cloneIntegrationObserver() const {
00029   // Cloning disabled
00030   return Teuchos::null;
00031 }
00032 
00033 void GeneralizedCoordinatesRythmosObserver::resetIntegrationObserver(const Rythmos::TimeRange<double> &/*integrationTimeDomain*/) {
00034   // Not implemented
00035 }
00036 
00037 void GeneralizedCoordinatesRythmosObserver::observeStartTimeIntegration(
00038     const Rythmos::StepperBase<double> &stepper) {
00039   this->observeTimeStep(stepper);
00040 }
00041 
00042 void GeneralizedCoordinatesRythmosObserver::observeCompletedTimeStep(
00043     const Rythmos::StepperBase<double> &stepper,
00044     const Rythmos::StepControlInfo<double> &/*stepCtrlInfo*/,
00045     const int /*timeStepIter*/) {
00046   this->observeTimeStep(stepper);
00047 }
00048 
00049 void GeneralizedCoordinatesRythmosObserver::observeTimeStep(
00050     const Rythmos::StepperBase<double> &stepper) {
00051   const Rythmos::StepStatus<double> stepStatus = stepper.getStepStatus();
00052 
00053   const Teuchos::RCP<const Thyra::VectorBase<double> > stepperSolution = stepStatus.solution;
00054   const Teuchos::RCP<const Thyra::VectorBase<double> > stepperState = getRythmosState(stepperSolution);
00055   const Teuchos::RCP<const Thyra::VectorSpaceBase<double> > stateSpace = stepperState->space();
00056   const Teuchos::RCP<const Teuchos::Comm<Thyra::Ordinal> > stateSpaceComm = getComm(*stateSpace);
00057 
00058   const Teuchos::RCP<const Epetra_Comm> stateComm = Thyra::get_Epetra_Comm(*stateSpaceComm);
00059   const Teuchos::RCP<const Epetra_Map> stateMap = Thyra::get_Epetra_Map(*stateSpace, stateComm);
00060   const Teuchos::RCP<const Epetra_Vector> state = Thyra::get_Epetra_Vector(*stateMap, stepperState);
00061 
00062   impl_.stampedVectorAdd(stepStatus.time, *state);
00063 }
00064 
00065 } // namespace MOR

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