10 #ifndef TPETRA_MMHELPERS_DECL_HPP
11 #define TPETRA_MMHELPERS_DECL_HPP
13 #include <Tpetra_CrsMatrix.hpp>
14 #include <Tpetra_BlockCrsMatrix.hpp>
15 #include <Teuchos_Array.hpp>
32 template <
class Scalar = ::Tpetra::Details::DefaultTypes::scalar_type,
34 class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
35 class Node = ::Tpetra::Details::DefaultTypes::node_type>
45 void deleteContents();
58 Teuchos::RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
importMatrix;
60 Teuchos::RCP<const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
origMatrix;
68 template <
class Scalar = ::Tpetra::Details::DefaultTypes::scalar_type,
70 class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
71 class Node = ::Tpetra::Details::DefaultTypes::node_type>
81 void deleteContents();
94 Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
importMatrix;
96 Teuchos::RCP<const BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
origMatrix;
101 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
104 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
109 virtual ~CrsWrapper() {}
110 virtual Teuchos::RCP<const map_type> getRowMap()
const = 0;
111 virtual bool isFillComplete() = 0;
114 insertGlobalValues(GlobalOrdinal globalRow,
115 const Teuchos::ArrayView<const GlobalOrdinal> &indices,
116 const Teuchos::ArrayView<const Scalar> &values) = 0;
118 sumIntoGlobalValues(GlobalOrdinal globalRow,
119 const Teuchos::ArrayView<const GlobalOrdinal> &indices,
120 const Teuchos::ArrayView<const Scalar> &values) = 0;
123 template <
class Scalar = ::Tpetra::Details::DefaultTypes::scalar_type,
125 class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
126 class Node = ::Tpetra::Details::DefaultTypes::node_type>
127 class CrsWrapper_CrsMatrix :
public CrsWrapper<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
129 typedef Map<LocalOrdinal, GlobalOrdinal, Node> map_type;
130 typedef CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> crs_matrix_type;
132 CrsWrapper_CrsMatrix(crs_matrix_type &crsmatrix);
133 virtual ~CrsWrapper_CrsMatrix();
134 Teuchos::RCP<const map_type> getRowMap()
const;
136 bool isFillComplete();
139 insertGlobalValues(GlobalOrdinal globalRow,
140 const Teuchos::ArrayView<const GlobalOrdinal> &indices,
141 const Teuchos::ArrayView<const Scalar> &values);
143 sumIntoGlobalValues(GlobalOrdinal globalRow,
144 const Teuchos::ArrayView<const GlobalOrdinal> &indices,
145 const Teuchos::ArrayView<const Scalar> &values);
148 crs_matrix_type &crsmat_;
151 template <
class Scalar = ::Tpetra::Details::DefaultTypes::scalar_type,
153 class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
154 class Node = ::Tpetra::Details::DefaultTypes::node_type>
155 class CrsWrapper_GraphBuilder :
public CrsWrapper<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
157 typedef Map<LocalOrdinal, GlobalOrdinal, Node> map_type;
159 CrsWrapper_GraphBuilder(
const Teuchos::RCP<const map_type> &map);
160 virtual ~CrsWrapper_GraphBuilder();
162 Teuchos::RCP<const map_type> getRowMap()
const {
166 bool isFillComplete();
168 insertGlobalValues(GlobalOrdinal globalRow,
169 const Teuchos::ArrayView<const GlobalOrdinal> &indices,
170 const Teuchos::ArrayView<const Scalar> &values);
172 sumIntoGlobalValues(GlobalOrdinal globalRow,
173 const Teuchos::ArrayView<const GlobalOrdinal> &indices,
174 const Teuchos::ArrayView<const Scalar> &values);
176 std::map<GlobalOrdinal, std::set<GlobalOrdinal> *> &get_graph();
178 size_t get_max_row_length() {
179 return max_row_length_;
183 std::map<GlobalOrdinal, std::set<GlobalOrdinal> *> graph_;
184 const Teuchos::RCP<const map_type> &rowmap_;
188 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
189 void insert_matrix_locations(CrsWrapper_GraphBuilder<Scalar, LocalOrdinal, GlobalOrdinal, Node> &graphbuilder,
190 CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> &C);
193 #endif // TPETRA_MMHELPERS_DECL_HPP
Teuchos::RCP< const map_type > importColMap
Colmap garnered as a result of the import.
Sparse matrix that presents a row-oriented interface that lets users read or modify entries...
Sparse matrix whose entries are small dense square blocks, all of the same dimensions.
Teuchos::RCP< const map_type > domainMap
Domain map for original matrix.
Teuchos::RCP< const map_type > colMap
Col map for the original version of the matrix.
Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > origMatrix
The original matrix.
Teuchos::RCP< BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > importMatrix
The imported matrix.
int local_ordinal_type
Default value of Scalar template parameter.
Teuchos::RCP< const map_type > importColMap
Colmap garnered as a result of the import.
size_t global_size_t
Global size_t object.
Teuchos::RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > importMatrix
The imported matrix.
Struct that holds views of the contents of a BlockCrsMatrix.
Teuchos::RCP< const map_type > origRowMap
Original row map of matrix.
Teuchos::RCP< const map_type > rowMap
Desired row map for "imported" version of the matrix.
const LocalOrdinal blocksize
The blocksize of all matrices.
A parallel distribution of indices over processes.
Teuchos::RCP< const map_type > rowMap
Desired row map for "imported" version of the matrix.
Struct that holds views of the contents of a CrsMatrix.
Teuchos::RCP< const BlockCrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > origMatrix
The original matrix.
Teuchos::RCP< const map_type > colMap
Col map for the original version of the matrix.
Teuchos::RCP< const map_type > origRowMap
Original row map of matrix.
Teuchos::RCP< const map_type > domainMap
Domain map for original matrix.