Thyra Package Browser (Single Doxygen Collection) Version of the Day
Thyra_TpetraThyraWrappers.cpp
Go to the documentation of this file.
00001 //#include "Thyra_TpetraThyraWrappers.hpp"
00002 #include "Thyra_TpetraThyraWrappers_decl.hpp"
00003 
00004 
00005 #include "Teuchos_DefaultSerialComm.hpp"
00006 #ifdef HAVE_MPI
00007 #  include "Teuchos_DefaultMpiComm.hpp"
00008 #endif
00009 
00010 
00011 Teuchos::RCP<const Teuchos::Comm<Thyra::Ordinal> >
00012 Thyra::convertTpetraToThyraComm(const RCP<const Teuchos::Comm<int> > &tpetraComm)
00013 {
00014 
00015   using Teuchos::rcp_dynamic_cast;
00016 
00017 #ifdef HAVE_MPI
00018   const RCP<const Teuchos::MpiComm<int> > tpetraMpiComm = 
00019     rcp_dynamic_cast<const Teuchos::MpiComm<int> >(tpetraComm);
00020   if (nonnull(tpetraMpiComm)) {
00021     return Teuchos::createMpiComm<Ordinal>(tpetraMpiComm->getRawMpiComm());
00022   }
00023 #endif // HAVE_MPI
00024 
00025   // Assert conversion to Teuchos::SerialComm as a last resort (or throw)
00026   rcp_dynamic_cast<const Teuchos::SerialComm<int> >(tpetraComm, true);
00027    return Teuchos::createSerialComm<Ordinal>();
00028 
00029   // NOTE: Above will throw if the type is not Teuchos::SerialComm.  In this
00030   // case, the type could not be converted.  We need to either get rid of the
00031   // Ordinal templating on Comm or we need to use the same ordinal type for
00032   // Tpetra and Thyra so this conversion function goes away!
00033 
00034 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines