Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_Helpers_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Xpetra: A linear algebra interface package
4 //
5 // Copyright 2012 NTESS and the Xpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef XPETRA_HELPERS_DECL_HPP
11 #define XPETRA_HELPERS_DECL_HPP
12 
13 #include "Xpetra_ConfigDefs.hpp"
14 
15 #include "Xpetra_BlockedCrsMatrix.hpp"
16 #include "Xpetra_CrsMatrixWrap.hpp"
17 #include "Xpetra_MapExtractor.hpp"
18 #include "Xpetra_Map.hpp"
19 #include "Xpetra_Matrix.hpp"
20 
21 #ifdef HAVE_XPETRA_EPETRA
23 #endif
24 
25 #ifdef HAVE_XPETRA_EPETRAEXT
26 #include <EpetraExt_MatrixMatrix.h>
27 #include <EpetraExt_RowMatrixOut.h>
28 #include <Epetra_RowMatrixTransposer.h>
29 #endif // HAVE_XPETRA_EPETRAEXT
30 
31 #ifdef HAVE_XPETRA_TPETRA
32 #include <Tpetra_CrsMatrix.hpp>
33 #include <Tpetra_BlockCrsMatrix.hpp>
34 #include <TpetraExt_MatrixMatrix.hpp>
35 #include <Tpetra_RowMatrixTransposer.hpp>
36 #include <MatrixMarket_Tpetra.hpp>
37 #include <Xpetra_TpetraCrsMatrix.hpp>
38 #include <Xpetra_TpetraBlockCrsMatrix.hpp>
39 #include <Tpetra_BlockCrsMatrix_Helpers.hpp>
40 #include <Xpetra_TpetraMultiVector.hpp>
41 #include <Xpetra_TpetraVector.hpp>
42 #endif // HAVE_XPETRA_TPETRA
43 
44 namespace Xpetra {
45 
52 template <class Scalar,
53  class LocalOrdinal = int,
54  class GlobalOrdinal = LocalOrdinal,
55  class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
56 class Helpers {
57 #include "Xpetra_UseShortNames.hpp"
58 
59  public:
60 #ifdef HAVE_XPETRA_EPETRA
61  static RCP<const Epetra_CrsMatrix> Op2EpetraCrs(RCP<Matrix> Op);
62 
63  static RCP<Epetra_CrsMatrix> Op2NonConstEpetraCrs(RCP<Matrix> Op);
64 
65  static const Epetra_CrsMatrix& Op2EpetraCrs(const Matrix& Op);
66 
67  static Epetra_CrsMatrix& Op2NonConstEpetraCrs(const Matrix& Op);
68 #endif // HAVE_XPETRA_EPETRA
69 
70 #ifdef HAVE_XPETRA_TPETRA
71  static RCP<const Tpetra::CrsMatrix<SC, LO, GO, NO> > Op2TpetraCrs(RCP<Matrix> Op);
72 
73  static RCP<Tpetra::CrsMatrix<SC, LO, GO, NO> > Op2NonConstTpetraCrs(RCP<Matrix> Op);
74 
75  static const Tpetra::CrsMatrix<SC, LO, GO, NO>& Op2TpetraCrs(const Matrix& Op);
76 
77  static Tpetra::CrsMatrix<SC, LO, GO, NO>& Op2NonConstTpetraCrs(const Matrix& Op);
78 
79  static bool isTpetraCrs(RCP<Matrix> Op);
80 
81  static bool isTpetraCrs(const Matrix& Op);
82 
83  static RCP<const Tpetra::BlockCrsMatrix<SC, LO, GO, NO> > Op2TpetraBlockCrs(RCP<Matrix> Op);
84 
85  static RCP<Tpetra::BlockCrsMatrix<SC, LO, GO, NO> > Op2NonConstTpetraBlockCrs(RCP<Matrix> Op);
86 
87  static const Tpetra::BlockCrsMatrix<SC, LO, GO, NO>& Op2TpetraBlockCrs(const Matrix& Op);
88 
89  static Tpetra::BlockCrsMatrix<SC, LO, GO, NO>& Op2NonConstTpetraBlockCrs(const Matrix& Op);
90 
91  static bool isTpetraBlockCrs(RCP<Matrix> Op);
92 
93  static bool isTpetraBlockCrs(const Matrix& Op);
94 #else // HAVE_XPETRA_TPETRA
95  static bool isTpetraCrs(const Matrix& Op);
96 
97  static bool isTpetraBlockCrs(const Matrix& Op);
98 
99 #endif // HAVE_XPETRA_TPETRA
100 
101 #ifdef HAVE_XPETRA_TPETRA
102  using tcrs_matrix_type = Tpetra::CrsMatrix<SC, LO, GO, NO>;
103  static Teuchos::RCP<Matrix> tpetraAdd(
104  const tcrs_matrix_type& A, bool transposeA, const typename tcrs_matrix_type::scalar_type alpha,
105  const tcrs_matrix_type& B, bool transposeB, const typename tcrs_matrix_type::scalar_type beta);
106 #endif
107 
108 #ifdef HAVE_XPETRA_EPETRAEXT
109  static void epetraExtMult(const Matrix& A, bool transposeA, const Matrix& B, bool transposeB, Matrix& C, bool fillCompleteResult);
110 #endif
111 };
112 } // namespace Xpetra
113 
114 #endif
Xpetra utility class containing transformation routines between Xpetra::Matrix and Epetra/Tpetra obje...
static bool isTpetraBlockCrs(RCP< Matrix > Op)
static RCP< const Tpetra::CrsMatrix< SC, LO, GO, NO > > Op2TpetraCrs(RCP< Matrix > Op)
static bool isTpetraCrs(RCP< Matrix > Op)
static RCP< Tpetra::CrsMatrix< SC, LO, GO, NO > > Op2NonConstTpetraCrs(RCP< Matrix > Op)
Tpetra::CrsMatrix< SC, LO, GO, NO > tcrs_matrix_type
static RCP< Tpetra::BlockCrsMatrix< SC, LO, GO, NO > > Op2NonConstTpetraBlockCrs(RCP< Matrix > Op)
static Teuchos::RCP< Matrix > tpetraAdd(const tcrs_matrix_type &A, bool transposeA, const typename tcrs_matrix_type::scalar_type alpha, const tcrs_matrix_type &B, bool transposeB, const typename tcrs_matrix_type::scalar_type beta)
static RCP< const Epetra_CrsMatrix > Op2EpetraCrs(RCP< Matrix > Op)
static void epetraExtMult(const Matrix &A, bool transposeA, const Matrix &B, bool transposeB, Matrix &C, bool fillCompleteResult)
static RCP< const Tpetra::BlockCrsMatrix< SC, LO, GO, NO > > Op2TpetraBlockCrs(RCP< Matrix > Op)
static RCP< Epetra_CrsMatrix > Op2NonConstEpetraCrs(RCP< Matrix > Op)
Xpetra-specific matrix class.