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;
69 template <
class Scalar = ::Tpetra::Details::DefaultTypes::scalar_type,
71 class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
72 class Node = ::Tpetra::Details::DefaultTypes::node_type>
82 void deleteContents ();
95 Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
importMatrix;
97 Teuchos::RCP<const BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
origMatrix;
102 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
107 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
112 virtual ~CrsWrapper () {}
113 virtual Teuchos::RCP<const map_type> getRowMap ()
const = 0;
114 virtual bool isFillComplete () = 0;
117 insertGlobalValues (GlobalOrdinal globalRow,
118 const Teuchos::ArrayView<const GlobalOrdinal> &indices,
119 const Teuchos::ArrayView<const Scalar> &values) = 0;
121 sumIntoGlobalValues (GlobalOrdinal globalRow,
122 const Teuchos::ArrayView<const GlobalOrdinal> &indices,
123 const Teuchos::ArrayView<const Scalar> &values) = 0;
126 template <
class Scalar = ::Tpetra::Details::DefaultTypes::scalar_type,
128 class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
129 class Node = ::Tpetra::Details::DefaultTypes::node_type>
130 class CrsWrapper_CrsMatrix :
131 public CrsWrapper<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
133 typedef Map<LocalOrdinal, GlobalOrdinal, Node> map_type;
134 typedef CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> crs_matrix_type;
136 CrsWrapper_CrsMatrix (crs_matrix_type& crsmatrix);
137 virtual ~CrsWrapper_CrsMatrix ();
138 Teuchos::RCP<const map_type> getRowMap ()
const;
140 bool isFillComplete ();
143 insertGlobalValues (GlobalOrdinal globalRow,
144 const Teuchos::ArrayView<const GlobalOrdinal> &indices,
145 const Teuchos::ArrayView<const Scalar> &values);
147 sumIntoGlobalValues (GlobalOrdinal globalRow,
148 const Teuchos::ArrayView<const GlobalOrdinal> &indices,
149 const Teuchos::ArrayView<const Scalar> &values);
151 crs_matrix_type& crsmat_;
154 template <
class Scalar = ::Tpetra::Details::DefaultTypes::scalar_type,
156 class GlobalOrdinal = ::Tpetra::Details::DefaultTypes::global_ordinal_type,
157 class Node = ::Tpetra::Details::DefaultTypes::node_type>
158 class CrsWrapper_GraphBuilder :
159 public CrsWrapper<Scalar, LocalOrdinal, GlobalOrdinal, Node> {
161 typedef Map<LocalOrdinal, GlobalOrdinal, Node> map_type;
163 CrsWrapper_GraphBuilder (
const Teuchos::RCP<const map_type>& map);
164 virtual ~CrsWrapper_GraphBuilder ();
166 Teuchos::RCP<const map_type> getRowMap ()
const {
170 bool isFillComplete ();
172 insertGlobalValues (GlobalOrdinal globalRow,
173 const Teuchos::ArrayView<const GlobalOrdinal> &indices,
174 const Teuchos::ArrayView<const Scalar> &values);
176 sumIntoGlobalValues (GlobalOrdinal globalRow,
177 const Teuchos::ArrayView<const GlobalOrdinal> &indices,
178 const Teuchos::ArrayView<const Scalar> &values);
180 std::map<GlobalOrdinal, std::set<GlobalOrdinal>*>& get_graph ();
182 size_t get_max_row_length () {
183 return max_row_length_;
187 std::map<GlobalOrdinal, std::set<GlobalOrdinal>*> graph_;
188 const Teuchos::RCP<const map_type>& rowmap_;
192 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
194 insert_matrix_locations (CrsWrapper_GraphBuilder<Scalar, LocalOrdinal, GlobalOrdinal, Node>& graphbuilder,
195 CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C);
198 #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.