Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_TpetraThyraWrappers.cpp
1 // @HEADER
2 // *****************************************************************************
3 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
4 //
5 // Copyright 2004 NTESS and the Thyra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 //#include "Thyra_TpetraThyraWrappers.hpp"
11 #include "Thyra_TpetraThyraWrappers_decl.hpp"
12 
13 
14 #include "Teuchos_DefaultSerialComm.hpp"
15 #ifdef HAVE_MPI
16 # include "Teuchos_DefaultMpiComm.hpp"
17 #endif
18 
19 
22 {
23 
24  using Teuchos::rcp_dynamic_cast;
25 
26 #ifdef HAVE_MPI
27  const RCP<const Teuchos::MpiComm<int> > tpetraMpiComm =
28  rcp_dynamic_cast<const Teuchos::MpiComm<int> >(tpetraComm);
29  if (nonnull(tpetraMpiComm)) {
30  return Teuchos::createMpiComm<Ordinal>(tpetraMpiComm->getRawMpiComm(),tpetraMpiComm->getTag());
31  }
32 #endif // HAVE_MPI
33 
34  // Assert conversion to Teuchos::SerialComm as a last resort (or throw)
35  rcp_dynamic_cast<const Teuchos::SerialComm<int> >(tpetraComm, true);
36  return Teuchos::createSerialComm<Ordinal>();
37 
38  // NOTE: Above will throw if the type is not Teuchos::SerialComm. In this
39  // case, the type could not be converted. We need to either get rid of the
40  // Ordinal templating on Comm or we need to use the same ordinal type for
41  // Tpetra and Thyra so this conversion function goes away!
42 
43 }
RCP< const Teuchos::Comm< Ordinal > > convertTpetraToThyraComm(const RCP< const Teuchos::Comm< int > > &tpetraComm)
Given an Tpetra Teuchos::Comm&lt;int&gt; object, return an equivalent Teuchos::Comm&lt;Ordinal&gt; object...
bool nonnull(const boost::shared_ptr< T > &p)