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{
27 using Tpetra::Details::extractMpiCommFromTeuchos;
28 // NOTE (mfh 11 Oct 2017) Tpetra or Teuchos may free this MPI_Comm
29 // before Epetra is done with it. To ensure that this doesn't
30 // happen, best practice is not to let the Epetra_Comm outlive the
31 // input teuchosComm.
32 MPI_Comm mpiComm = extractMpiCommFromTeuchos (teuchosComm);
33 Epetra_MpiComm* epetraComm = new Epetra_MpiComm (mpiComm);
34 return std::shared_ptr<Epetra_Comm> (static_cast<Epetra_Comm*> (epetraComm));
35}
36#else
37std::shared_ptr<Epetra_Comm>
38makeEpetraCommFromTeuchosComm (const Teuchos::Comm<int>&)
39{
40 return std::shared_ptr<Epetra_Comm> (static_cast<Epetra_Comm*> (new Epetra_SerialComm));
41}
42#endif // HAVE_TPETRACORE_MPI
43
44} // namespace Details
45} // namespace Tpetra
46
47#endif // defined(HAVE_TPETRA_EPETRA)
Declaration of Tpetra::Details::extractMpiCommFromTeuchos.
Nonmember function that computes a residual Computes R = B - A * X.
Namespace Tpetra contains the class and methods constituting the Tpetra library.