Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_CrsMatrixFactory.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_CRSMATRIXFACTORY_HPP
11 #define XPETRA_CRSMATRIXFACTORY_HPP
12 
13 #include "Xpetra_ConfigDefs.hpp"
14 
15 #include "Xpetra_CrsMatrix.hpp"
16 
17 #ifdef HAVE_XPETRA_TPETRA
18 #include "Xpetra_TpetraCrsMatrix.hpp"
19 #include "Xpetra_TpetraBlockCrsMatrix.hpp"
20 #endif
21 
22 #ifdef HAVE_XPETRA_EPETRA
24 #endif
25 
26 #include "Xpetra_Exceptions.hpp"
27 
28 namespace Xpetra {
29 
30 template <class Scalar,
31  class LocalOrdinal,
32  class GlobalOrdinal,
33  class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
35  private:
38 
39  public:
41  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
42  Build(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap) {
43  TEUCHOS_TEST_FOR_EXCEPTION(rowMap->lib() == UseEpetra, std::logic_error,
44  "Can't create Xpetra::EpetraCrsMatrix with these scalar/LO/GO types");
45 #ifdef HAVE_XPETRA_TPETRA
46  if (rowMap->lib() == UseTpetra)
48 #endif
49 
51  }
52 
54  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
56  size_t maxNumEntriesPerRow,
57  const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
58  XPETRA_MONITOR("CrsMatrixFactory::Build");
59 
60 #ifdef HAVE_XPETRA_TPETRA
61  if (rowMap->lib() == UseTpetra)
62  return Teuchos::rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, maxNumEntriesPerRow, plist));
63 #endif
64 
65  XPETRA_FACTORY_ERROR_IF_EPETRA(rowMap->lib());
67  }
68 
70  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
71  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
72  const ArrayRCP<const size_t>& NumEntriesPerRowToAlloc,
73  const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
74 #ifdef HAVE_XPETRA_TPETRA
75  if (rowMap->lib() == UseTpetra)
76  return Teuchos::rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, NumEntriesPerRowToAlloc, plist));
77 #endif
78 
79  XPETRA_FACTORY_ERROR_IF_EPETRA(rowMap->lib());
81  }
82 
84  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
85  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
86  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
87  size_t maxNumEntriesPerRow,
88  const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
89  XPETRA_MONITOR("CrsMatrixFactory::Build");
90 
91 #ifdef HAVE_XPETRA_TPETRA
92  if (rowMap->lib() == UseTpetra)
93  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, maxNumEntriesPerRow, plist));
94 #endif
95 
96  XPETRA_FACTORY_ERROR_IF_EPETRA(rowMap->lib());
98  }
99 
101  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap, const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap, const ArrayRCP<const size_t>& NumEntriesPerRowToAlloc, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
102  XPETRA_MONITOR("CrsMatrixFactory::Build");
103 
104 #ifdef HAVE_XPETRA_TPETRA
105  if (rowMap->lib() == UseTpetra)
106  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, NumEntriesPerRowToAlloc, plist));
107 #endif
108 
109  XPETRA_FACTORY_ERROR_IF_EPETRA(rowMap->lib());
111  }
112 
114  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const Teuchos::RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>& graph, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
115  XPETRA_MONITOR("CrsMatrixFactory::Build");
116 
117 #ifdef HAVE_XPETRA_TPETRA
118  if (graph->getRowMap()->lib() == UseTpetra)
120 #endif
121 
122  XPETRA_FACTORY_ERROR_IF_EPETRA(graph->getRowMap()->lib());
124  }
125 
127  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const Teuchos::RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>& graph, typename Xpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::local_matrix_type::values_type& values, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
128  XPETRA_MONITOR("CrsMatrixFactory::Build");
129 
130 #ifdef HAVE_XPETRA_TPETRA
131  if (graph->getRowMap()->lib() == UseTpetra)
132  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(graph, values, plist));
133 #endif
134 
135  XPETRA_FACTORY_ERROR_IF_EPETRA(graph->getRowMap()->lib());
137  }
138 
139  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
140  const Teuchos::RCP<const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& sourceMatrix,
142  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
143  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
144  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
145  XPETRA_MONITOR("CrsMatrixFactory::Build");
146 
147 #ifdef HAVE_XPETRA_TPETRA
148  if (sourceMatrix->getRowMap()->lib() == UseTpetra)
149  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(sourceMatrix, importer, domainMap, rangeMap, params));
150 #endif
151 
152  XPETRA_FACTORY_ERROR_IF_EPETRA(sourceMatrix->getRowMap()->lib());
154  }
155 
156  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
157  const Teuchos::RCP<const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& sourceMatrix,
159  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
160  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
161  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
162  XPETRA_MONITOR("CrsMatrixFactory::Build");
163 
164 #ifdef HAVE_XPETRA_TPETRA
165  if (sourceMatrix->getRowMap()->lib() == UseTpetra)
166  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(sourceMatrix, exporter, domainMap, rangeMap, params));
167 #endif
168 
169  XPETRA_FACTORY_ERROR_IF_EPETRA(sourceMatrix->getRowMap()->lib());
171  }
172 
173  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
174  const Teuchos::RCP<const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& sourceMatrix,
176  const RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> DomainImporter,
177  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap,
178  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap,
179  const Teuchos::RCP<Teuchos::ParameterList>& params) {
180  XPETRA_MONITOR("CrsMatrixFactory::Build");
181 
182 #ifdef HAVE_XPETRA_TPETRA
183  if (sourceMatrix->getRowMap()->lib() == UseTpetra)
184  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(sourceMatrix, RowImporter, DomainImporter, domainMap, rangeMap, params));
185 #endif
186 
187  XPETRA_FACTORY_ERROR_IF_EPETRA(sourceMatrix->getRowMap()->lib());
189  }
190 
191  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
192  const Teuchos::RCP<const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& sourceMatrix,
194  const RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> DomainExporter,
195  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap,
196  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap,
197  const Teuchos::RCP<Teuchos::ParameterList>& params) {
198  XPETRA_MONITOR("CrsMatrixFactory::Build");
199 
200 #ifdef HAVE_XPETRA_TPETRA
201  if (sourceMatrix->getRowMap()->lib() == UseTpetra)
202  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(sourceMatrix, RowExporter, DomainExporter, domainMap, rangeMap, params));
203 #endif
204 
205  XPETRA_FACTORY_ERROR_IF_EPETRA(sourceMatrix->getRowMap()->lib());
207  }
208 
209  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
210  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
211  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
213  const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
214  XPETRA_MONITOR("CrsMatrixFactory::Build");
215 
216 #ifdef HAVE_XPETRA_TPETRA
217  if (rowMap->lib() == UseTpetra)
218  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, lclMatrix, params));
219 #endif
220 
221  XPETRA_FACTORY_ERROR_IF_EPETRA(rowMap->lib());
223  }
224 
225  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
227  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
228  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
229  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
230  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
231  const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
232  XPETRA_MONITOR("CrsMatrixFactory::Build");
233 
234 #ifdef HAVE_XPETRA_TPETRA
235  if (rowMap->lib() == UseTpetra)
236  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(lclMatrix, rowMap, colMap, domainMap, rangeMap, params));
237 #endif
238 
239  XPETRA_FACTORY_ERROR_IF_EPETRA(rowMap->lib());
241  }
242 
243  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
245  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
246  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
247  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap,
248  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap,
249  const Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>>& importer,
250  const Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>>& exporter,
251  const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
252  XPETRA_MONITOR("CrsMatrixFactory::Build");
253 
254 #ifdef HAVE_XPETRA_TPETRA
255  if (rowMap->lib() == UseTpetra)
256  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(lclMatrix, rowMap, colMap, domainMap, rangeMap, importer, exporter, params));
257 #endif
258 
259  TEUCHOS_TEST_FOR_EXCEPTION(rowMap->lib() == UseEpetra, std::logic_error, "Epetra doesn't support this matrix constructor");
260 
262  }
263 
264  // Builds a BlockCrsMatrix
265  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> BuildBlock(
266  const Teuchos::RCP<const Xpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>& blockGraph,
267  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap,
268  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap,
269  LocalOrdinal blockSize) {
270  XPETRA_MONITOR("CrsMatrixFactory::BuildBlock");
271 
272 #ifdef HAVE_XPETRA_TPETRA
273  if (domainMap->lib() == UseTpetra) {
274  return rcp(new Xpetra::TpetraBlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(blockGraph, domainMap, rangeMap, blockSize));
275  }
276 #endif
277  TEUCHOS_TEST_FOR_EXCEPTION(domainMap->lib() == UseEpetra, std::logic_error, "Epetra doesn't support this matrix constructor");
278 
280  }
281 };
282 
283 // we need the Epetra specialization only if Epetra is enabled
284 #if (defined(HAVE_XPETRA_EPETRA) && !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES))
285 
286 // Specializtion for SC=double, LO=int, GO=int and Node=EpetraNode
287 // Used both for Epetra and Tpetra
288 template <>
289 class CrsMatrixFactory<double, int, int, EpetraNode> {
290  typedef double Scalar;
291  typedef int LocalOrdinal;
292  typedef int GlobalOrdinal;
293  typedef EpetraNode Node;
294 
295  private:
298 
299  public:
301  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
302  Build(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap) {
303  XPETRA_MONITOR("CrsMatrixFactory::Build");
304 #ifdef HAVE_XPETRA_TPETRA
305  if (rowMap->lib() == UseTpetra)
307 #endif
308  if (rowMap->lib() == UseEpetra)
309  return rcp(new EpetraCrsMatrixT<int, Node>(rowMap));
310 
312  }
313 
314  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
315  XPETRA_MONITOR("CrsMatrixFactory::Build");
316 
317 #ifdef HAVE_XPETRA_TPETRA
318  if (rowMap->lib() == UseTpetra)
319  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, maxNumEntriesPerRow, plist));
320 #endif
321 
322  if (rowMap->lib() == UseEpetra)
323  return rcp(new EpetraCrsMatrixT<int, Node>(rowMap, maxNumEntriesPerRow, plist));
324 
326  }
327 
328  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap, const ArrayRCP<const size_t>& NumEntriesPerRowToAlloc, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
329  XPETRA_MONITOR("CrsMatrixFactory::Build");
330 
331 #ifdef HAVE_XPETRA_TPETRA
332  if (rowMap->lib() == UseTpetra)
333  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, NumEntriesPerRowToAlloc, plist));
334 #endif
335 
336  if (rowMap->lib() == UseEpetra)
337  return rcp(new EpetraCrsMatrixT<int, Node>(rowMap, NumEntriesPerRowToAlloc, plist));
338 
340  }
341 
343  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap, const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
344  XPETRA_MONITOR("CrsMatrixFactory::Build");
345 
346 #ifdef HAVE_XPETRA_TPETRA
347  if (rowMap->lib() == UseTpetra)
348  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, maxNumEntriesPerRow, plist));
349 #endif
350 
351  if (rowMap->lib() == UseEpetra)
352  return rcp(new EpetraCrsMatrixT<int, Node>(rowMap, colMap, maxNumEntriesPerRow, plist));
353 
355  }
356 
358  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap, const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap, const ArrayRCP<const size_t>& NumEntriesPerRowToAlloc, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
359  XPETRA_MONITOR("CrsMatrixFactory::Build");
360 
361 #ifdef HAVE_XPETRA_TPETRA
362  if (rowMap->lib() == UseTpetra)
363  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, NumEntriesPerRowToAlloc, plist));
364 #endif
365 
366  if (rowMap->lib() == UseEpetra)
367  return rcp(new EpetraCrsMatrixT<int, Node>(rowMap, colMap, NumEntriesPerRowToAlloc, plist));
368 
370  }
371 
373  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const Teuchos::RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>& graph, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
374  XPETRA_MONITOR("CrsMatrixFactory::Build");
375 
376 #ifdef HAVE_XPETRA_TPETRA
377  if (graph->getRowMap()->lib() == UseTpetra)
379 #endif
380 
381  if (graph->getRowMap()->lib() == UseEpetra)
382  return rcp(new EpetraCrsMatrixT<int, Node>(graph, plist));
383 
385  }
386 
388  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const Teuchos::RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>& graph, typename Xpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::local_matrix_type::values_type& values, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
389  XPETRA_MONITOR("CrsMatrixFactory::Build");
390 
391 #ifdef HAVE_XPETRA_TPETRA
392  if (graph->getRowMap()->lib() == UseTpetra)
393  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(graph, values, plist));
394 #endif
395 
396  XPETRA_FACTORY_ERROR_IF_EPETRA(graph->getRowMap()->lib());
398  }
399 
401  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
402  const Teuchos::RCP<const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& sourceMatrix,
404  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
405  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
406  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
407  XPETRA_MONITOR("CrsMatrixFactory::Build");
408 
409 #ifdef HAVE_XPETRA_TPETRA
410  if (sourceMatrix->getRowMap()->lib() == UseTpetra)
411  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(sourceMatrix, importer, domainMap, rangeMap, params));
412 #endif
413 
414  if (sourceMatrix->getRowMap()->lib() == UseEpetra)
415  return rcp(new EpetraCrsMatrixT<int, Node>(sourceMatrix, importer, domainMap, rangeMap, params));
416 
418  }
419 
421  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
422  const Teuchos::RCP<const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& sourceMatrix,
424  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
425  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
426  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
427  XPETRA_MONITOR("CrsMatrixFactory::Build");
428 
429 #ifdef HAVE_XPETRA_TPETRA
430  if (sourceMatrix->getRowMap()->lib() == UseTpetra)
431  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(sourceMatrix, exporter, domainMap, rangeMap, params));
432 #endif
433 
434  if (sourceMatrix->getRowMap()->lib() == UseEpetra)
435  return rcp(new EpetraCrsMatrixT<int, Node>(sourceMatrix, exporter, domainMap, rangeMap, params));
436 
438  }
439 
441  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
442  const Teuchos::RCP<const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& sourceMatrix,
444  const RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> DomainImporter,
445  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap,
446  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap,
447  const Teuchos::RCP<Teuchos::ParameterList>& params) {
448  XPETRA_MONITOR("CrsMatrixFactory::Build");
449 
450 #ifdef HAVE_XPETRA_TPETRA
451  if (sourceMatrix->getRowMap()->lib() == UseTpetra)
452  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(sourceMatrix, RowImporter, DomainImporter, domainMap, rangeMap, params));
453 #endif
454 
455  if (sourceMatrix->getRowMap()->lib() == UseEpetra)
456  return rcp(new EpetraCrsMatrixT<int, Node>(sourceMatrix, RowImporter, DomainImporter, domainMap, rangeMap, params));
457 
459  }
460 
462  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
463  const Teuchos::RCP<const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& sourceMatrix,
465  const RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> DomainExporter,
466  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap,
467  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap,
468  const Teuchos::RCP<Teuchos::ParameterList>& params) {
469  XPETRA_MONITOR("CrsMatrixFactory::Build");
470 
471 #ifdef HAVE_XPETRA_TPETRA
472  if (sourceMatrix->getRowMap()->lib() == UseTpetra)
473  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(sourceMatrix, RowExporter, DomainExporter, domainMap, rangeMap, params));
474 #endif
475 
476  if (sourceMatrix->getRowMap()->lib() == UseEpetra)
477  return rcp(new EpetraCrsMatrixT<int, Node>(sourceMatrix, RowExporter, DomainExporter, domainMap, rangeMap, params));
478 
480  }
481 
482  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
483  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
484  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
486  const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
487  XPETRA_MONITOR("CrsMatrixFactory::Build");
488 
489 #ifdef HAVE_XPETRA_TPETRA
490  if (rowMap->lib() == UseTpetra)
491  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, lclMatrix, params));
492 #endif
493 
494  if (rowMap->lib() == UseEpetra)
495  return rcp(new EpetraCrsMatrixT<int, Node>(rowMap, colMap, lclMatrix, params));
496 
498  }
499 
500  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
502  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
503  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
504  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
505  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
506  const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
507  XPETRA_MONITOR("CrsMatrixFactory::Build");
508 
509 #ifdef HAVE_XPETRA_TPETRA
510  if (rowMap->lib() == UseTpetra)
511  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(lclMatrix, rowMap, colMap, domainMap, rangeMap, params));
512 #endif
513 
514  if (rowMap->lib() == UseEpetra)
515  return rcp(new EpetraCrsMatrixT<int, Node>(lclMatrix, rowMap, colMap, domainMap, rangeMap, params));
516 
518  }
519 
520  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
522  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
523  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
524  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap,
525  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap,
526  const Teuchos::RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>>& importer,
527  const Teuchos::RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>>& exporter,
528  const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
529  XPETRA_MONITOR("CrsMatrixFactory::Build");
530 
531 #ifdef HAVE_XPETRA_TPETRA
532  if (rowMap->lib() == UseTpetra)
533  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(lclMatrix, rowMap, colMap, domainMap, rangeMap, importer, exporter, params));
534 #endif
535 
536  TEUCHOS_TEST_FOR_EXCEPTION(rowMap->lib() == UseEpetra, std::logic_error, "Epetra doesn't support this matrix constructor");
537 
539  }
540 
542  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> BuildBlock(
543  const Teuchos::RCP<const Xpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>& blockGraph,
544  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap,
545  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap,
546  LocalOrdinal blockSize) {
547  XPETRA_MONITOR("CrsMatrixFactory::BuildBlock");
548 #ifdef HAVE_XPETRA_TPETRA
549  if (domainMap->lib() == UseTpetra)
550  return rcp(new Xpetra::TpetraBlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(blockGraph, domainMap, rangeMap, blockSize));
551 #endif
552  TEUCHOS_TEST_FOR_EXCEPTION(domainMap->lib() == UseEpetra, std::logic_error, "Epetra doesn't support this matrix constructor");
553 
555  }
556 };
557 #endif
558 
559 // we need the Epetra specialization only if Epetra is enabled
560 #if (defined(HAVE_XPETRA_EPETRA) && !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES))
561 
562 template <>
563 class CrsMatrixFactory<double, int, long long, EpetraNode> {
564  typedef double Scalar;
565  typedef int LocalOrdinal;
566  typedef long long GlobalOrdinal;
567  typedef EpetraNode Node;
568 
569  private:
572 
573  public:
575  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>
576  Build(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap) {
577  XPETRA_MONITOR("CrsMatrixFactory::Build");
578 #ifdef HAVE_XPETRA_TPETRA
579  if (rowMap->lib() == UseTpetra)
581 #endif
582 #ifdef HAVE_XPETRA_EPETRA
583  if (rowMap->lib() == UseEpetra)
584  return rcp(new EpetraCrsMatrixT<long long, Node>(rowMap, 0));
585 #endif
587  }
588 
589  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
590  XPETRA_MONITOR("CrsMatrixFactory::Build");
591 
592 #ifdef HAVE_XPETRA_TPETRA
593  if (rowMap->lib() == UseTpetra)
594  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, maxNumEntriesPerRow, plist));
595 #endif
596 
597  if (rowMap->lib() == UseEpetra)
598  return rcp(new EpetraCrsMatrixT<long long, Node>(rowMap, maxNumEntriesPerRow, plist));
599 
601  }
602 
603  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap, const ArrayRCP<const size_t>& NumEntriesPerRowToAlloc, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
604  XPETRA_MONITOR("CrsMatrixFactory::Build");
605 
606 #ifdef HAVE_XPETRA_TPETRA
607  if (rowMap->lib() == UseTpetra)
608  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, NumEntriesPerRowToAlloc, plist));
609 #endif
610 
611  if (rowMap->lib() == UseEpetra)
612  return rcp(new EpetraCrsMatrixT<long long, Node>(rowMap, NumEntriesPerRowToAlloc, plist));
613 
615  }
616 
618  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap, const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
619  XPETRA_MONITOR("CrsMatrixFactory::Build");
620 
621 #ifdef HAVE_XPETRA_TPETRA
622  if (rowMap->lib() == UseTpetra)
623  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, maxNumEntriesPerRow, plist));
624 #endif
625 
626  if (rowMap->lib() == UseEpetra)
627  return rcp(new EpetraCrsMatrixT<long long, Node>(rowMap, colMap, maxNumEntriesPerRow, plist));
628 
630  }
631 
633  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap, const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap, const ArrayRCP<const size_t>& NumEntriesPerRowToAlloc, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
634  XPETRA_MONITOR("CrsMatrixFactory::Build");
635 
636 #ifdef HAVE_XPETRA_TPETRA
637  if (rowMap->lib() == UseTpetra)
638  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, NumEntriesPerRowToAlloc, plist));
639 #endif
640 
641  if (rowMap->lib() == UseEpetra)
642  return rcp(new EpetraCrsMatrixT<long long, Node>(rowMap, colMap, NumEntriesPerRowToAlloc, plist));
643 
645  }
646 
648  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const Teuchos::RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>& graph, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
649  XPETRA_MONITOR("CrsMatrixFactory::Build");
650 
651 #ifdef HAVE_XPETRA_TPETRA
652  if (graph->getRowMap()->lib() == UseTpetra)
654 #endif
655 
656  if (graph->getRowMap()->lib() == UseEpetra)
657  return rcp(new EpetraCrsMatrixT<long long, Node>(graph, plist));
658 
660  }
661 
663  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(const Teuchos::RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>& graph, typename Xpetra::CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>::local_matrix_type::values_type& values, const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
664  XPETRA_MONITOR("CrsMatrixFactory::Build");
665 
666 #ifdef HAVE_XPETRA_TPETRA
667  if (graph->getRowMap()->lib() == UseTpetra) {
668  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(graph, values, plist));
669  }
670 #endif
671 
672  XPETRA_FACTORY_ERROR_IF_EPETRA(graph->getRowMap()->lib());
674  }
675 
677  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
678  const Teuchos::RCP<const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& sourceMatrix,
680  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
681  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
682  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
683  XPETRA_MONITOR("CrsMatrixFactory::Build");
684 
685 #ifdef HAVE_XPETRA_TPETRA
686  if (sourceMatrix->getRowMap()->lib() == UseTpetra)
687  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(sourceMatrix, importer, domainMap, rangeMap, params));
688 #endif
689 
690  if (sourceMatrix->getRowMap()->lib() == UseEpetra)
691  return rcp(new EpetraCrsMatrixT<long long, Node>(sourceMatrix, importer, domainMap, rangeMap, params));
692 
694  }
695 
697  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
698  const Teuchos::RCP<const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& sourceMatrix,
700  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
701  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
702  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
703  XPETRA_MONITOR("CrsMatrixFactory::Build");
704 
705 #ifdef HAVE_XPETRA_TPETRA
706  if (sourceMatrix->getRowMap()->lib() == UseTpetra)
707  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(sourceMatrix, exporter, domainMap, rangeMap, params));
708 #endif
709 
710  if (sourceMatrix->getRowMap()->lib() == UseEpetra)
711  return rcp(new EpetraCrsMatrixT<long long, Node>(sourceMatrix, exporter, domainMap, rangeMap, params));
712 
714  }
715 
717  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
718  const Teuchos::RCP<const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& sourceMatrix,
720  const RCP<const Import<LocalOrdinal, GlobalOrdinal, Node>> DomainImporter,
721  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap,
722  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap,
723  const Teuchos::RCP<Teuchos::ParameterList>& params) {
724  XPETRA_MONITOR("CrsMatrixFactory::Build");
725 
726 #ifdef HAVE_XPETRA_TPETRA
727  if (sourceMatrix->getRowMap()->lib() == UseTpetra)
728  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(sourceMatrix, RowImporter, DomainImporter, domainMap, rangeMap, params));
729 #endif
730 
731  if (sourceMatrix->getRowMap()->lib() == UseEpetra)
732  return rcp(new EpetraCrsMatrixT<long long, Node>(sourceMatrix, RowImporter, DomainImporter, domainMap, rangeMap, params));
733 
735  }
736 
738  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
739  const Teuchos::RCP<const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>>& sourceMatrix,
741  const RCP<const Export<LocalOrdinal, GlobalOrdinal, Node>> DomainExporter,
742  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap,
743  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap,
744  const Teuchos::RCP<Teuchos::ParameterList>& params) {
745  XPETRA_MONITOR("CrsMatrixFactory::Build");
746 
747 #ifdef HAVE_XPETRA_TPETRA
748  if (sourceMatrix->getRowMap()->lib() == UseTpetra)
749  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(sourceMatrix, RowExporter, DomainExporter, domainMap, rangeMap, params));
750 #endif
751 
752  if (sourceMatrix->getRowMap()->lib() == UseEpetra)
753  return rcp(new EpetraCrsMatrixT<long long, Node>(sourceMatrix, RowExporter, DomainExporter, domainMap, rangeMap, params));
754 
756  }
757 
758  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
759  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
760  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
762  const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
763  XPETRA_MONITOR("CrsMatrixFactory::Build");
764 
765 #ifdef HAVE_XPETRA_TPETRA
766  if (rowMap->lib() == UseTpetra)
767  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, lclMatrix, params));
768 #endif
769 
770  if (rowMap->lib() == UseEpetra)
771  return rcp(new EpetraCrsMatrixT<long long, Node>(rowMap, colMap, lclMatrix, params));
772 
774  }
775  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> Build(
777  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
778  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
779  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
780  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
781  const Teuchos::RCP<Teuchos::ParameterList>& params = null) {
782  XPETRA_MONITOR("CrsMatrixFactory::Build");
783 
784 #ifdef HAVE_XPETRA_TPETRA
785  if (rowMap->lib() == UseTpetra)
786  return rcp(new TpetraCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(lclMatrix, rowMap, colMap, domainMap, rangeMap, params));
787 #endif
788 
789  if (rowMap->lib() == UseEpetra)
790  return rcp(new EpetraCrsMatrixT<long long, Node>(lclMatrix, rowMap, colMap, domainMap, rangeMap, params));
791 
793  }
794 
796  static RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>> BuildBlock(
797  const Teuchos::RCP<const Xpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>& blockGraph,
798  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap,
799  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap,
800  LocalOrdinal blockSize) {
801  XPETRA_MONITOR("CrsMatrixFactory::BuildBlock");
802 
803 #ifdef HAVE_XPETRA_TPETRA
804  if (domainMap->lib() == UseTpetra) {
805  return rcp(new Xpetra::TpetraBlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>(blockGraph, domainMap, rangemap, blockSize));
806  }
807 #endif
808  TEUCHOS_TEST_FOR_EXCEPTION(domainMap->lib() == UseEpetra, std::logic_error, "Epetra doesn't support this matrix constructor");
809 
811  }
812 };
813 #endif
814 
815 } // namespace Xpetra
816 
817 #define XPETRA_CRSMATRIXFACTORY_SHORT
818 #endif
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap=Teuchos::null, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor using FusedExport.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &RowExporter, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> DomainExporter, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const typename Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type &lclMatrix, const Teuchos::RCP< Teuchos::ParameterList > &params=null)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const typename Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type &lclMatrix, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> &importer, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> &exporter, const Teuchos::RCP< Teuchos::ParameterList > &params=null)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &RowExporter, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> DomainExporter, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor using FusedExport.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const typename Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type &lclMatrix, const Teuchos::RCP< Teuchos::ParameterList > &params=null)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &RowImporter, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> DomainImporter, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &graph, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying a previously constructed graph.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &graph, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying a previously constructed graph.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap)
Constructor for empty matrix (intended use is an import/export target - can&#39;t insert entries directly...
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap=Teuchos::null, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor using FusedImport.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const typename Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type &lclMatrix, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=null)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > BuildBlock(const Teuchos::RCP< const Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &blockGraph, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, LocalOrdinal blockSize)
Build a BlockCrsMatrix.
#define XPETRA_FACTORY_ERROR_IF_EPETRA(lib)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and number of entries in each row.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &RowImporter, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> DomainImporter, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor using FusedImport.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &graph, typename Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type::values_type &values, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying a previously constructed graph and values array.
CrsMatrixFactory()
Private constructor. This is a static class.
CrsMatrixFactory()
Private constructor. This is a static class.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &graph, typename Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type::values_type &values, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying a previously constructed graph and values array.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > BuildBlock(const Teuchos::RCP< const Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &blockGraph, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, LocalOrdinal blockSize)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const typename Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type &lclMatrix, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=null)
CrsMatrixFactory()
Private constructor. This is a static class.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &RowExporter, const RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> DomainExporter, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor using FusedExport.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap=Teuchos::null, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor using FusedImport.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const typename Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type &lclMatrix, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> &importer, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node >> &exporter, const Teuchos::RCP< Teuchos::ParameterList > &params=null)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap=Teuchos::null, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap)
Constructor for empty matrix (intended use is an import/export target - can&#39;t insert entries directly...
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap)
Constructor for empty matrix (intended use is an import/export target - can&#39;t insert entries directly...
#define XPETRA_FACTORY_END
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap=Teuchos::null, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor using FusedExport.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &graph, typename Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type::values_type &values, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying a previously constructed graph and values array.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying (possibly different) number of entries in each row.
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying fixed number of entries for each row.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap=Teuchos::null, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const typename Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type &lclMatrix, const Teuchos::RCP< Teuchos::ParameterList > &params=null)
#define XPETRA_MONITOR(funcName)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and fixed number of entries for each row.
KokkosSparse::CrsMatrix< impl_scalar_type, LocalOrdinal, execution_space, void, typename local_graph_type::size_type > local_matrix_type
The specialization of Kokkos::CrsMatrix that represents the part of the sparse matrix on each MPI pro...
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >> &sourceMatrix, const Import< LocalOrdinal, GlobalOrdinal, Node > &RowImporter, const RCP< const Import< LocalOrdinal, GlobalOrdinal, Node >> DomainImporter, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor using FusedImport.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &graph, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying a previously constructed graph.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > BuildBlock(const Teuchos::RCP< const Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &blockGraph, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap, LocalOrdinal blockSize)
Build a BlockCrsMatrix.
static RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const typename Xpetra::CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node >::local_matrix_type &lclMatrix, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=null)