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

MOR_RythmosUtils.hpp

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 #ifndef MOR_RYTHMOSUTILS_HPP
00007 #define MOR_RYTHMOSUTILS_HPP
00008 
00009 #include "Rythmos_StepperBase.hpp"
00010 
00011 #include "Thyra_ProductVectorBase.hpp"
00012 
00013 #include "Thyra_SpmdVectorSpaceBase.hpp"
00014 #include "Teuchos_Comm.hpp"
00015 
00016 #include "Teuchos_RCP.hpp"
00017 #include "Teuchos_Ptr.hpp"
00018 
00019 namespace MOR {
00020 
00021 template <typename Scalar>
00022 Teuchos::RCP<const Thyra::VectorBase<Scalar> > getRythmosState(const Teuchos::RCP<const Thyra::VectorBase<Scalar> > &in) {
00023   typedef Thyra::ProductVectorBase<Scalar> PVB;
00024   const Teuchos::RCP<const PVB> in_with_sens = Teuchos::rcp_dynamic_cast<const PVB>(in);
00025   if (Teuchos::nonnull(in_with_sens)) {
00026     return in_with_sens->getVectorBlock(0);
00027   } else {
00028     return in;
00029   }
00030 }
00031 
00032 template <typename Scalar>
00033 Teuchos::RCP<const Teuchos::Comm<Teuchos::Ordinal> > getComm(const Thyra::VectorSpaceBase<Scalar> &space) {
00034   typedef Thyra::SpmdVectorSpaceBase<Scalar> SVSB;
00035   const Teuchos::Ptr<const SVSB> space_downcasted = Teuchos::ptr_dynamic_cast<const SVSB>(Teuchos::ptrFromRef(space));
00036   if (Teuchos::nonnull(space_downcasted)) {
00037     return space_downcasted->getComm();
00038   } else {
00039     return Teuchos::null;
00040   }
00041 }
00042 
00043 } // namespace MOR
00044 
00045 #endif /* MOR_RYTHMOSUTILS_HPP */

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