Xpetra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Xpetra_CrsGraphFactory.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_CRSGRAPHFACTORY_HPP
11 #define XPETRA_CRSGRAPHFACTORY_HPP
12 
13 #include "Xpetra_ConfigDefs.hpp"
14 
15 #include "Xpetra_CrsGraph.hpp"
16 
17 #ifdef HAVE_XPETRA_TPETRA
18 #include "Xpetra_TpetraCrsGraph.hpp"
19 #endif
20 
21 #ifdef HAVE_XPETRA_EPETRA
23 #endif
24 
25 #include "Xpetra_Exceptions.hpp"
26 
27 namespace Xpetra {
28 
29 template <class LocalOrdinal,
30  class GlobalOrdinal,
31  class Node = Tpetra::KokkosClassic::DefaultNode::DefaultNodeType>
33  private:
36 
37  public:
39  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
40  Build(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap) {
41  TEUCHOS_TEST_FOR_EXCEPTION(rowMap->lib() == UseEpetra, std::logic_error,
42  "Can't create Xpetra::EpetraCrsMatrix with these scalar/LO/GO types");
43 #ifdef HAVE_XPETRA_TPETRA
44  if (rowMap->lib() == UseTpetra)
45  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(rowMap, 0));
46 #endif
47 
49  }
50 
52  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
53  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& map, size_t maxNumEntriesPerRow) {
54  XPETRA_MONITOR("CrsGraphFactory::Build");
55 
56 #ifdef HAVE_XPETRA_TPETRA
57  if (map->lib() == UseTpetra)
58  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(map, maxNumEntriesPerRow));
59 #endif
60 
63  TEUCHOS_UNREACHABLE_RETURN(null);
64  }
65 
67  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
68  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
69  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
70  size_t maxNumEntriesPerRow,
71  const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
72  XPETRA_MONITOR("CrsGraphFactory::Build");
73 
74 #ifdef HAVE_XPETRA_TPETRA
75  if (rowMap->lib() == UseTpetra)
76  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, maxNumEntriesPerRow, plist));
77 #endif
78 
79  XPETRA_FACTORY_ERROR_IF_EPETRA(rowMap->lib());
81  TEUCHOS_UNREACHABLE_RETURN(null);
82  }
83 
85  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
86  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
87  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
88  const ArrayRCP<const size_t>& NumEntriesPerRowToAlloc,
89  const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
90  XPETRA_MONITOR("CrsGraphFactory::Build");
91 
92 #ifdef HAVE_XPETRA_TPETRA
93  if (rowMap->lib() == UseTpetra)
94  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, NumEntriesPerRowToAlloc, plist));
95 #endif
96 
97  XPETRA_FACTORY_ERROR_IF_EPETRA(rowMap->lib());
99  TEUCHOS_UNREACHABLE_RETURN(null);
100  }
101 
103  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
104  Build(const RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>& sourceGraph,
106  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
107  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
108  const RCP<Teuchos::ParameterList>& params = Teuchos::null) {
109 #ifdef HAVE_XPETRA_TPETRA
110  if (sourceGraph->getRowMap()->lib() == UseTpetra)
111  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(sourceGraph, importer, domainMap, rangeMap, params));
112 #endif
113 
114  XPETRA_FACTORY_ERROR_IF_EPETRA(sourceGraph()->getRowMap()->lib());
116  TEUCHOS_UNREACHABLE_RETURN(null);
117  }
118 
119 #ifdef HAVE_XPETRA_TPETRA
120  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
140  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
141  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
144  const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
145  XPETRA_MONITOR("CrsMatrixFactory::Build");
146 
147  if (rowMap->lib() == UseTpetra)
149  colMap,
150  rowPointers,
151  columnIndices,
152  plist));
153 
155  }
156 
175  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
176  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
177  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
179  const Teuchos::RCP<Teuchos::ParameterList>& params) {
180  XPETRA_MONITOR("CrsMatrixFactory::Build");
181 
182  if (rowMap->lib() == UseTpetra)
184  colMap,
185  lclGraph,
186  params));
187 
189  }
190 
215  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
217  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
218  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
219  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
220  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
221  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
222  XPETRA_MONITOR("CrsMatrixFactory::Build");
223 
224  if (rowMap->lib() == UseTpetra)
226  rowMap,
227  colMap,
228  domainMap,
229  rangeMap,
230  params));
231 
233  }
234 #endif
235 
255  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
256  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
257  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
258  const Teuchos::ArrayRCP<size_t>& rowPointers,
259  const Teuchos::ArrayRCP<LocalOrdinal>& columnIndices,
260  const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
261  XPETRA_MONITOR("CrsMatrixFactory::Build");
262 
263  if (rowMap->lib() == UseTpetra)
265  colMap,
266  rowPointers,
267  columnIndices,
268  plist));
269 
271  }
272 };
273 
274 // we need the Epetra specialization only if Epetra is enabled
275 #if (defined(HAVE_XPETRA_EPETRA) && !defined(XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES))
276 
277 template <>
278 class CrsGraphFactory<int, int, EpetraNode> {
279  typedef int LocalOrdinal;
280  typedef int GlobalOrdinal;
281  typedef EpetraNode Node;
282 
283  private:
286 
287  public:
289  static RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
290  Build(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap) {
291  XPETRA_MONITOR("CrsMatrixFactory::Build");
292 #ifdef HAVE_XPETRA_TPETRA
293  if (rowMap->lib() == UseTpetra)
294  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(rowMap, 0));
295 #endif
296 #ifdef HAVE_XPETRA_EPETRA
297  if (rowMap->lib() == UseEpetra)
298  return rcp(new EpetraCrsGraphT<int, Node>(rowMap));
299 #endif
301  }
302 
303  static RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
304  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& map, size_t maxNumEntriesPerRow) {
305  XPETRA_MONITOR("CrsGraphFactory::Build");
306 
307 #ifdef HAVE_XPETRA_TPETRA
308  if (map->lib() == UseTpetra)
309  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(map, maxNumEntriesPerRow));
310 #endif
311 
312  if (map->lib() == UseEpetra)
313  return rcp(new EpetraCrsGraphT<int, Node>(map, maxNumEntriesPerRow));
314 
316  TEUCHOS_UNREACHABLE_RETURN(null);
317  }
318 
319  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
320  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) {
321  XPETRA_MONITOR("CrsGraphFactory::Build");
322 
323 #ifdef HAVE_XPETRA_TPETRA
324  if (rowMap->lib() == UseTpetra)
325  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, NumEntriesPerRowToAlloc, plist));
326 #endif
327 
328  if (rowMap->lib() == UseEpetra)
329  return rcp(new EpetraCrsGraphT<int, Node>(rowMap, colMap, NumEntriesPerRowToAlloc, plist));
330 
332  TEUCHOS_UNREACHABLE_RETURN(null);
333  }
334 
336  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
337  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
338  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
339  size_t maxNumEntriesPerRow,
340  const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
341  XPETRA_MONITOR("CrsGraphFactory::Build");
342 
343 #ifdef HAVE_XPETRA_TPETRA
344  if (rowMap->lib() == UseTpetra)
345  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, maxNumEntriesPerRow, plist));
346 #endif
347  if (rowMap->lib() == UseEpetra)
348  return rcp(new EpetraCrsGraphT<int, Node>(rowMap, colMap, maxNumEntriesPerRow, plist));
349 
351  TEUCHOS_UNREACHABLE_RETURN(null);
352  }
353 
355  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
356  Build(const RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>& sourceGraph,
358  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
359  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
360  const RCP<Teuchos::ParameterList>& params = Teuchos::null) {
361 #ifdef HAVE_XPETRA_TPETRA
362  if (sourceGraph->getRowMap()->lib() == UseTpetra)
363  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(sourceGraph, importer, domainMap, rangeMap, params));
364 #endif
365  if (sourceGraph->getRowMap()->lib() == UseEpetra)
366  return rcp(new EpetraCrsGraphT<int, Node>(sourceGraph, importer, domainMap, rangeMap, params));
367 
369  TEUCHOS_UNREACHABLE_RETURN(null);
370  }
371 
372 #ifdef HAVE_XPETRA_TPETRA
373  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
393  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
394  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
397  const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
398  XPETRA_MONITOR("CrsMatrixFactory::Build");
399 
400  if (rowMap->lib() == UseTpetra)
402  colMap,
403  rowPointers,
404  columnIndices,
405  plist));
406 
408  }
409 
428  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
429  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
430  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
432  const Teuchos::RCP<Teuchos::ParameterList>& params) {
433  XPETRA_MONITOR("CrsMatrixFactory::Build");
434 
435  if (rowMap->lib() == UseTpetra)
437  colMap,
438  lclGraph,
439  params));
440 
442  }
443 
468  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
470  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
471  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
472  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
473  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
474  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
475  XPETRA_MONITOR("CrsMatrixFactory::Build");
476 
477  if (rowMap->lib() == UseTpetra)
479  rowMap,
480  colMap,
481  domainMap,
482  rangeMap,
483  params));
484 
486  }
487 #endif
488 
508  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
509  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
510  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
511  const Teuchos::ArrayRCP<size_t>& rowPointers,
512  const Teuchos::ArrayRCP<LocalOrdinal>& columnIndices,
513  const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
514  XPETRA_MONITOR("CrsMatrixFactory::Build");
515 
516  if (rowMap->lib() == UseTpetra)
518  colMap,
519  rowPointers,
520  columnIndices,
521  plist));
522 
524  }
525 };
526 #endif
527 
528 // we need the Epetra specialization only if Epetra is enabled
529 #if (defined(HAVE_XPETRA_EPETRA) && !defined(XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES))
530 
531 template <>
532 class CrsGraphFactory<int, long long, EpetraNode> {
533  typedef int LocalOrdinal;
534  typedef long long GlobalOrdinal;
535  typedef EpetraNode Node;
536 
537  private:
540 
541  public:
543  static RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
544  Build(const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap) {
545  XPETRA_MONITOR("CrsMatrixFactory::Build");
546 #ifdef HAVE_XPETRA_TPETRA
547  if (rowMap->lib() == UseTpetra)
548  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(rowMap, 0));
549 #endif
550 #ifdef HAVE_XPETRA_EPETRA
551  if (rowMap->lib() == UseEpetra)
552  return rcp(new EpetraCrsGraphT<long long, Node>(rowMap));
553 #endif
555  }
556 
557  static RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
558  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& map, size_t maxNumEntriesPerRow) {
559  XPETRA_MONITOR("CrsGraphFactory::Build");
560 
561 #ifdef HAVE_XPETRA_TPETRA
562  if (map->lib() == UseTpetra)
563  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(map, maxNumEntriesPerRow));
564 #endif
565 
566  if (map->lib() == UseEpetra)
567  return rcp(new EpetraCrsGraphT<long long, Node>(map, maxNumEntriesPerRow));
568 
570  TEUCHOS_UNREACHABLE_RETURN(null);
571  }
572 
573  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
574  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) {
575  XPETRA_MONITOR("CrsGraphFactory::Build");
576 
577 #ifdef HAVE_XPETRA_TPETRA
578  if (rowMap->lib() == UseTpetra)
579  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, NumEntriesPerRowToAlloc, plist));
580 #endif
581 
582  if (rowMap->lib() == UseEpetra)
583  return rcp(new EpetraCrsGraphT<long long, Node>(rowMap, colMap, NumEntriesPerRowToAlloc, plist));
584 
586  TEUCHOS_UNREACHABLE_RETURN(null);
587  }
588 
590  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
591  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
592  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
593  size_t maxNumEntriesPerRow,
594  const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
595  XPETRA_MONITOR("CrsGraphFactory::Build");
596 
597 #ifdef HAVE_XPETRA_TPETRA
598  if (rowMap->lib() == UseTpetra)
599  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(rowMap, colMap, maxNumEntriesPerRow, plist));
600 #endif
601  if (rowMap->lib() == UseEpetra)
602  return rcp(new EpetraCrsGraphT<long long, Node>(rowMap, colMap, maxNumEntriesPerRow, plist));
603 
605  TEUCHOS_UNREACHABLE_RETURN(null);
606  }
607 
609  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
610  Build(const RCP<const CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>& sourceGraph,
612  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
613  const RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
614  const RCP<Teuchos::ParameterList>& params = Teuchos::null) {
615 #ifdef HAVE_XPETRA_TPETRA
616  if (sourceGraph->getRowMap()->lib() == UseTpetra)
617  return rcp(new TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node>(sourceGraph, importer, domainMap, rangeMap, params));
618 #endif
619  if (sourceGraph->getRowMap()->lib() == UseTpetra)
620  return rcp(new EpetraCrsGraphT<long long, Node><LocalOrdinal, GlobalOrdinal, Node>(sourceGraph, importer, domainMap, rangeMap, params));
621 
623  TEUCHOS_UNREACHABLE_RETURN(null);
624  }
625 
626 #ifdef HAVE_XPETRA_TPETRA
627  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
647  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
648  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
651  const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
652  XPETRA_MONITOR("CrsMatrixFactory::Build");
653 
654  if (rowMap->lib() == UseTpetra)
656  colMap,
657  rowPointers,
658  columnIndices,
659  plist));
660 
662  }
663 
682  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
683  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
684  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
686  const Teuchos::RCP<Teuchos::ParameterList>& params) {
687  XPETRA_MONITOR("CrsMatrixFactory::Build");
688 
689  if (rowMap->lib() == UseTpetra)
691  colMap,
692  lclGraph,
693  params));
694 
696  }
697 
722  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
724  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
725  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
726  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& domainMap = Teuchos::null,
727  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rangeMap = Teuchos::null,
728  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
729  XPETRA_MONITOR("CrsMatrixFactory::Build");
730 
731  if (rowMap->lib() == UseTpetra)
733  rowMap,
734  colMap,
735  domainMap,
736  rangeMap,
737  params));
738 
740  }
741 #endif
742 
762  static Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node>>
763  Build(const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& rowMap,
764  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node>>& colMap,
765  const Teuchos::ArrayRCP<size_t>& rowPointers,
766  const Teuchos::ArrayRCP<LocalOrdinal>& columnIndices,
767  const Teuchos::RCP<Teuchos::ParameterList>& plist = Teuchos::null) {
768  XPETRA_MONITOR("CrsMatrixFactory::Build");
769 
770  if (rowMap->lib() == UseTpetra)
772  colMap,
773  rowPointers,
774  columnIndices,
775  plist));
776 
778  }
779 };
780 #endif
781 } // namespace Xpetra
782 
783 #define XPETRA_CRSGRAPHFACTORY_SHORT
784 #endif
static Teuchos::RCP< CrsGraph< 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::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type &lclGraph, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor specifying column Map and a local (sorted) graph, which the resulting CrsGraph views...
Kokkos::StaticCrsGraph< LocalOrdinal, Kokkos::LayoutLeft, device_type, void, size_t > local_graph_type
static Teuchos::RCP< CrsGraph< 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::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type::row_map_type &rowPointers, const typename Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type::entries_type::non_const_type &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and arrays containing the graph in sorted, local ids...
static Teuchos::RCP< CrsGraph< 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::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type::row_map_type &rowPointers, const typename Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type::entries_type::non_const_type &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and arrays containing the graph in sorted, local ids...
static Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &sourceGraph, 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 RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor using fused import.
#define XPETRA_FACTORY_ERROR_IF_EPETRA(lib)
static Teuchos::RCP< CrsGraph< 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 Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &sourceGraph, 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 RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor using fused import.
static Teuchos::RCP< CrsGraph< 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::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type::row_map_type &rowPointers, const typename Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type::entries_type::non_const_type &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and arrays containing the graph in sorted, local ids...
static Teuchos::RCP< CrsGraph< 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)
static Teuchos::RCP< CrsGraph< 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)
static RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap)
Constructor for empty graph (intended use is an import/export target - can&#39;t insert entries directly)...
static Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &map, size_t maxNumEntriesPerRow)
Constructor specifying the number of non-zeros for all rows.
static Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const typename Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type &lclGraph, 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=Teuchos::null)
Constructor specifying column, domain and range maps, and a local (sorted) graph, which the resulting...
static Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap)
Constructor for empty graph (intended use is an import/export target - can&#39;t insert entries directly)...
#define XPETRA_FACTORY_END
static RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &map, size_t maxNumEntriesPerRow)
static Teuchos::RCP< CrsGraph< 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::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type &lclGraph, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor specifying column Map and a local (sorted) graph, which the resulting CrsGraph views...
static RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap)
Constructor for empty graph (intended use is an import/export target - can&#39;t insert entries directly)...
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
static Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const Teuchos::ArrayRCP< size_t > &rowPointers, const Teuchos::ArrayRCP< LocalOrdinal > &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and arrays containing the graph in sorted, local ids...
static Teuchos::RCP< CrsGraph< 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 number of entries per row.
static Teuchos::RCP< CrsGraph< 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 number of entries per row.
CrsGraphFactory()
Private constructor. This is a static class.
static Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const typename Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type &lclGraph, 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=Teuchos::null)
Constructor specifying column, domain and range maps, and a local (sorted) graph, which the resulting...
static RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &map, size_t maxNumEntriesPerRow)
#define XPETRA_MONITOR(funcName)
static Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const Teuchos::ArrayRCP< size_t > &rowPointers, const Teuchos::ArrayRCP< LocalOrdinal > &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and arrays containing the graph in sorted, local ids...
CrsGraphFactory()
Private constructor. This is a static class.
CrsGraphFactory()
Private constructor. This is a static class.
static Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node >> &sourceGraph, 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 RCP< Teuchos::ParameterList > &params=Teuchos::null)
Constructor using fused import.
static Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const typename Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type &lclGraph, 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=Teuchos::null)
Constructor specifying column, domain and range maps, and a local (sorted) graph, which the resulting...
static Teuchos::RCP< CrsGraph< 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 number of entries per row.
static Teuchos::RCP< CrsGraph< 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::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type &lclGraph, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor specifying column Map and a local (sorted) graph, which the resulting CrsGraph views...
static Teuchos::RCP< CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &rowMap, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node >> &colMap, const Teuchos::ArrayRCP< size_t > &rowPointers, const Teuchos::ArrayRCP< LocalOrdinal > &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map and arrays containing the graph in sorted, local ids...