Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_EpetraRowMatrix.cpp
1// @HEADER
2// *****************************************************************************
3// Tpetra: Templated Linear Algebra Services Package
4//
5// Copyright 2008 NTESS and the Tpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#include "Tpetra_EpetraRowMatrix.hpp"
11#if defined(HAVE_TPETRA_EPETRA)
12
13#ifdef HAVE_TPETRACORE_MPI
14#include "Epetra_MpiComm.h"
16#else
17#include "Epetra_SerialComm.h"
18#endif // HAVE_TPETRACORE_MPI
19
20namespace Tpetra {
21namespace Details {
22
23#ifdef HAVE_TPETRACORE_MPI
24std::shared_ptr<Epetra_Comm>
25makeEpetraCommFromTeuchosComm(const Teuchos::Comm<int>& teuchosComm) {
26 using Tpetra::Details::extractMpiCommFromTeuchos;
27 // NOTE (mfh 11 Oct 2017) Tpetra or Teuchos may free this MPI_Comm
28 // before Epetra is done with it. To ensure that this doesn't
29 // happen, best practice is not to let the Epetra_Comm outlive the
30 // input teuchosComm.
31 MPI_Comm mpiComm = extractMpiCommFromTeuchos(teuchosComm);
32 Epetra_MpiComm* epetraComm = new Epetra_MpiComm(mpiComm);
33 return std::shared_ptr<Epetra_Comm>(static_cast<Epetra_Comm*>(epetraComm));
34}
35#else
36std::shared_ptr<Epetra_Comm>
37makeEpetraCommFromTeuchosComm(const Teuchos::Comm<int>&) {
38 return std::shared_ptr<Epetra_Comm>(static_cast<Epetra_Comm*>(new Epetra_SerialComm));
39}
40#endif // HAVE_TPETRACORE_MPI
41
42} // namespace Details
43} // namespace Tpetra
44
45#endif // defined(HAVE_TPETRA_EPETRA)
Declaration of Tpetra::Details::extractMpiCommFromTeuchos.
Implementation details of Tpetra.
Namespace Tpetra contains the class and methods constituting the Tpetra library.