Xpetra Version of the Day
Loading...
Searching...
No Matches
Xpetra_EpetraCrsGraph.hpp
Go to the documentation of this file.
1// @HEADER
2//
3// ***********************************************************************
4//
5// Xpetra: A linear algebra interface package
6// Copyright 2012 Sandia Corporation
7//
8// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9// the U.S. Government retains certain rights in this software.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact
39// Jonathan Hu (jhu@sandia.gov)
40// Andrey Prokopenko (aprokop@sandia.gov)
41// Ray Tuminaro (rstumin@sandia.gov)
42//
43// ***********************************************************************
44//
45// @HEADER
46#ifndef XPETRA_EPETRACRSGRAPH_HPP
47#define XPETRA_EPETRACRSGRAPH_HPP
48
49/* this file is automatically generated - do not edit (see script/epetra.py) */
50
52#include "Xpetra_Exceptions.hpp"
53
54#include "Xpetra_CrsGraph.hpp"
55
58#include "Xpetra_EpetraMap.hpp"
60
61#include <Epetra_CrsGraph.h>
62
63namespace Xpetra {
64
65// TODO: move that elsewhere
66template<class GlobalOrdinal, class Node>
67RCP< const CrsGraph<int, GlobalOrdinal, Node> >
68toXpetra (const Epetra_CrsGraph& graph);
69
70template<class GlobalOrdinal, class Node>
71const Epetra_CrsGraph&
72toEpetra (const RCP<const CrsGraph<int, GlobalOrdinal, Node> > &graph);
73
74template<class GlobalOrdinal, class Node>
76 : public CrsGraph<int, GlobalOrdinal, Node>
77{
78 typedef int LocalOrdinal;
79
82
83#ifdef HAVE_XPETRA_TPETRA
86 typedef typename node_type::execution_space execution_space;
87#endif
88
89public:
90
92
93
94 EpetraCrsGraphT(const RCP< const map_type > &rowMap, const RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
96 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
97 }
98
100 EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
102 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
103 }
104
106 EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &plist=null) {
108 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
109 }
110
112 // Definition not in cpp, so comment out
113 EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null) {
115 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
116 }
117
118 // Constructor for fused import
121 const RCP<const Map< LocalOrdinal, GlobalOrdinal, Node >>& domainMap = Teuchos::null,
122 const RCP<const Map< LocalOrdinal, GlobalOrdinal, Node > >& rangeMap = Teuchos::null,
123 const RCP<Teuchos::ParameterList>& params = Teuchos::null) {
125 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
126 }
127
128
129
130#ifdef HAVE_XPETRA_TPETRA
133 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
134 const typename local_graph_type::row_map_type& rowPointers,
135 const typename local_graph_type::entries_type::non_const_type& columnIndices,
136 const RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
138 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
139 }
140
143 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
144 const local_graph_type& lclGraph,
145 const RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
147 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
148 }
149
152 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap,
153 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
154 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
155 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
156 const RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
158 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
159 }
160#endif
161
163 virtual ~EpetraCrsGraphT() { }
164
166
168
169
171 void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) { }
172
174 void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal> &indices) { }
175
178
180 void allocateAllIndices(size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind) { }
181
183 void setAllIndices(const ArrayRCP<size_t> & rowptr, const ArrayRCP<LocalOrdinal> & colind){ }
184
187
188
190
192
193
195 void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null){ }
196
198 void fillComplete(const RCP< ParameterList > &params=null) { }
199
201 void
202 expertStaticFillComplete (const Teuchos::RCP<const Map < LocalOrdinal, GlobalOrdinal, Node > >& domainMap,
203 const Teuchos::RCP<const Map < LocalOrdinal, GlobalOrdinal, Node > >& rangeMap,
205 Teuchos::null,
207 Teuchos::null,
209 Teuchos::null) { }
210
212
214
215
218 return Teuchos::null;
219 }
220
223
226
229
232
235
238
240 global_size_t getGlobalNumRows() const { return 0; }
241
243 global_size_t getGlobalNumCols() const { return 0; }
244
246 size_t getLocalNumRows() const { return 0; }
247
249 size_t getLocalNumCols() const { return 0; }
250
252 GlobalOrdinal getIndexBase() const { return 0; }
253
255 global_size_t getGlobalNumEntries() const { return 0; }
256
258 size_t getLocalNumEntries() const { return 0; }
259
261 size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
262
264 size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
265
267 size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
268
270 size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
271
273 size_t getGlobalMaxNumRowEntries() const { return 0; }
274
276 size_t getLocalMaxNumRowEntries() const { return 0; }
277
279 bool hasColMap() const { return false; }
280
282 bool isLocallyIndexed() const { return false; }
283
285 bool isGloballyIndexed() const { return false; }
286
288 bool isFillComplete() const { return false; }
289
291 bool isStorageOptimized() const { return false; }
292
294 void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const { }
295
298
299#ifdef HAVE_XPETRA_TPETRA
300 typename local_graph_type::HostMirror getLocalGraphHost () const {
302 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
303 TEUCHOS_UNREACHABLE_RETURN((typename local_graph_type::HostMirror()));
304 }
305#else
306#ifdef __GNUC__
307#warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
308#endif
309#endif
310
311#ifdef HAVE_XPETRA_TPETRA
314 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
316 }
317#else
318#ifdef __GNUC__
319#warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
320#endif
321
322#endif
323
324
327
329
331
332
334 std::string description() const { return std::string(""); }
335
338
340
342 //{@
343
346
350
354
358
363
365
366
370 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
371 }
372
374 RCP< const Epetra_CrsGraph> getEpetra_CrsGraph() const { return Teuchos::null; }
375
377
378private:
379
380}; // EpetraCrsGraphT class
381
382// specialization on GO=int and Node=EpetraNode
383#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
384template<>
386: public virtual CrsGraph<int, int, EpetraNode>
387{
388 typedef int LocalOrdinal;
389 typedef int GlobalOrdinal;
391
394
395#ifdef HAVE_XPETRA_TPETRA
398 typedef typename node_type::execution_space execution_space;
399#endif
400
401public:
402
404
405
408: graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), 0, false))) { }
409
411 EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null)
412: graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), maxNumEntriesPerRow, true))) { }
413
414
416 // Definition not in cpp, so comment out
417 //EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null);
418
420 EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &/* plist */=null)
421 : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), maxNumEntriesPerRow, true))) {}
422
424 // Definition not in cpp, so comment out
425 EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &/* params */=null) {
426 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end()); // convert array of "size_t" to array of "int"
427 graph_ = Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(), true));
428 }
429
430 // Constructor for fused import
433 const RCP<const Map< LocalOrdinal, GlobalOrdinal, Node >>& domainMap = Teuchos::null,
434 const RCP<const Map< LocalOrdinal, GlobalOrdinal, Node > >& rangeMap = Teuchos::null,
435 const RCP<Teuchos::ParameterList>& params = Teuchos::null) {
436
437 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, *sourceGraph, tSourceGraph, "Xpetra::EpetraCrsGraphT() only accepts Xpetra::EpetraCrsGraphT as input arguments.");
438 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
439 RCP< const Epetra_CrsGraph> eSourceGraph = tSourceGraph.getEpetra_CrsGraph();
440
441 // NOTE: Unlike Tpetra, Epetra does not have a FusedTransfer for Graphs. So we do this the slow way
442 graph_ = Teuchos::rcp(new Epetra_CrsGraph(Copy,eSourceGraph->RowMap(),0,false));
443 graph_->Import(*eSourceGraph,*tImporter.getEpetra_Import(),Insert);
444
445 const Epetra_BlockMap & myDomainMap = domainMap!=Teuchos::null ? toEpetra<GlobalOrdinal,Node>(domainMap) : eSourceGraph->ColMap();
446 const Epetra_BlockMap & myRangeMap = rangeMap!=Teuchos::null ? toEpetra<GlobalOrdinal,Node>(rangeMap) : toEpetra<LocalOrdinal,Node>(importer.getTargetMap());
447
448 graph_->FillComplete(myDomainMap,myRangeMap);
449
450 }
451
452
453
454#ifdef HAVE_XPETRA_TPETRA
457 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* colMap */,
458 const typename local_graph_type::row_map_type& /* rowPointers */,
459 const typename local_graph_type::entries_type::non_const_type& /* columnIndices */,
460 const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null) {
462 "Epetra does not support CrsGraph constructors using Kokkos Views!");
463 }
464
467 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* colMap */,
468 const local_graph_type& /* lclGraph */,
469 const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null) {
471 "Epetra does not support CrsGraph constructors using a local graph!");
472 }
473
475 EpetraCrsGraphT(const local_graph_type& /* lclGraph */,
476 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* rowMap */,
477 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* colMap */,
478 const Teuchos::RCP<const map_type>& /* domainMap */ = Teuchos::null,
479 const Teuchos::RCP<const map_type>& /* rangeMap */ = Teuchos::null,
480 const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null) {
482 "Epetra does not support CrsGraph constructors using a local graph!");
483 }
484#endif
485
487 virtual ~EpetraCrsGraphT() { }
488
490
492
493
496 XPETRA_MONITOR("EpetraCrsGraphT::insertGlobalIndices");
497
498 GlobalOrdinal* indices_rawPtr = const_cast<GlobalOrdinal*>(indices.getRawPtr()); // there is no const in the Epetra interface :(
499 XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
500 }
501
504 XPETRA_MONITOR("EpetraCrsGraphT::insertLocalIndices");
505
506 int* indices_rawPtr = const_cast<int*>(indices.getRawPtr()); // there is no const in the Epetra interface :(
507 XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
508 }
509
511 void removeLocalIndices(LocalOrdinal localRow) { XPETRA_MONITOR("EpetraCrsGraphT::removeLocalIndices"); graph_->RemoveMyIndices(localRow); }
512
514 //** \warning This is an expert-only routine and should not be called from user code. */
515 void allocateAllIndices(size_t numNonZeros, ArrayRCP<size_t>& rowptr, ArrayRCP<LocalOrdinal>& colind) {
516 XPETRA_MONITOR("EpetraCrsGraphT::allocateAllIndies");
517
518 // Row offsets
519 // Unfortunately, we cannot do this in the same manner as column indices
520 // and values (see below). The problem is that Tpetra insists on using
521 // size_t, and Epetra uses int internally. So we only resize here, and
522 // will need to copy in setAllValues
523 rowptr.resize(getLocalNumRows()+1);
524
525 int lowerOffset = 0;
526 bool ownMemory = false;
527
528 // Column indices
529 // Extract, resize, set colind
530 Epetra_IntSerialDenseVector& myColind = graph_->ExpertExtractIndices();
531 myColind.Resize(numNonZeros);
532 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
533 }
534
536 void setAllIndices(const ArrayRCP<size_t>& rowptr, const ArrayRCP<LocalOrdinal>& colind) {
537 XPETRA_MONITOR("EpetraCrsGraphT::setAllIndices");
538
539 // Check sizes
541 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
542 if (colind.size() > 0) {
543 TEUCHOS_TEST_FOR_EXCEPTION(colind.getRawPtr() != graph_->ExpertExtractIndices().Values(), Xpetra::Exceptions::RuntimeError,
544 "An exception is thrown to let you know that you mismatched your pointers.");
545 }
546
547 // We have to make a copy here, it is unavoidable
548 // See comments in allocateAllIndices
549 const size_t N = getLocalNumRows();
550
551 Epetra_IntSerialDenseVector& myRowptr = graph_->ExpertExtractIndexOffset();
552 myRowptr.Resize(N+1);
553 for (size_t i = 0; i < N+1; i++)
554 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
555 }
556
557
560 XPETRA_MONITOR("EpetraCrsGraphT::getAllIndices");
561
562 int lowerOffset = 0;
563 bool ownMemory = false;
564
565 const size_t n = getLocalNumRows();
566 const size_t nnz = getLocalNumEntries();
567
568 // Row offsets
569 // We have to make a copy here, it is unavoidable (see comments in allocateAllValues)
570 Epetra_IntSerialDenseVector& myRowptr = graph_->ExpertExtractIndexOffset();
571 rowptr.resize(n+1);
572 for (size_t i = 0; i < n+1; i++)
573 (*const_cast<size_t*>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
574
575 // Column indices
576 colind = Teuchos::arcp(graph_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
577 }
578
579
580
582
584
585
587 void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null){
588 XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
589
590 graph_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap));
591 bool doOptimizeStorage = true;
592 if (params != null && params->get("Optimize Storage",true) == false) doOptimizeStorage = false;
593 if (doOptimizeStorage) graph_->OptimizeStorage();
594 }
595
597 void fillComplete(const RCP< ParameterList > &params=null) {
598 XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
599
600 graph_->FillComplete();
601 bool doOptimizeStorage = true;
602 if (params != null && params->get("Optimize Storage",true) == false) doOptimizeStorage = false;
603 if (doOptimizeStorage) graph_->OptimizeStorage();
604 }
605
607 void
608 expertStaticFillComplete (const Teuchos::RCP<const Map < LocalOrdinal, GlobalOrdinal, Node > >& domainMap,
609 const Teuchos::RCP<const Map < LocalOrdinal, GlobalOrdinal, Node > >& rangeMap,
611 Teuchos::null,
613 Teuchos::null,
615 Teuchos::null) {
616 // Not optimized
617 graph_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap));
618 graph_->OptimizeStorage();
619 }
620
622
624
625
628 XPETRA_MONITOR("EpetraCrsGraphT::getComm");
629 return toXpetra (graph_->Comm ());
630 }
631
633 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getRowMap"); return toXpetra<GlobalOrdinal,Node>(graph_->RowMap()); }
634
636 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getColMap"); return toXpetra<GlobalOrdinal,Node>(graph_->ColMap()); }
637
639 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getDomainMap"); return toXpetra<GlobalOrdinal,Node>(graph_->DomainMap()); }
640
642 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getRangeMap"); return toXpetra<GlobalOrdinal,Node>(graph_->RangeMap()); }
643
645 RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const { XPETRA_MONITOR("EpetraCrsGraphT::getImporter"); return toXpetra<GlobalOrdinal,Node>(graph_->Importer()); }
646
648 RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const { XPETRA_MONITOR("EpetraCrsGraphT::getExporter"); return toXpetra<GlobalOrdinal,Node>(graph_->Exporter()); }
649
651 global_size_t getGlobalNumRows() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumRows"); return graph_->NumGlobalRows64(); }
652
654 global_size_t getGlobalNumCols() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumCols"); return graph_->NumGlobalCols64(); }
655
657 size_t getLocalNumRows() const { XPETRA_MONITOR("EpetraCrsGraphT::getLocalNumRows"); return graph_->NumMyRows(); }
658
660 size_t getLocalNumCols() const { XPETRA_MONITOR("EpetraCrsGraphT::getLocalNumCols"); return graph_->NumMyCols(); }
661
663 GlobalOrdinal getIndexBase() const { XPETRA_MONITOR("EpetraCrsGraphT::getIndexBase"); return (GlobalOrdinal) graph_->IndexBase64(); }
664
666 global_size_t getGlobalNumEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumEntries"); return graph_->NumGlobalEntries64(); }
667
669 size_t getLocalNumEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getLocalNumEntries"); return graph_->NumMyEntries(); }
670
672 size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInGlobalRow"); return graph_->NumGlobalIndices(globalRow); }
673
675 size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInLocalRow"); return graph_->NumMyIndices(localRow); }
676
678 size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow"); return graph_->NumAllocatedGlobalIndices(globalRow); }
679
681 size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow"); return graph_->NumAllocatedMyIndices(localRow); }
682
684 size_t getGlobalMaxNumRowEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalMaxNumRowEntries"); return graph_->GlobalMaxNumIndices(); }
685
687 size_t getLocalMaxNumRowEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getLocalMaxNumRowEntries"); return graph_->MaxNumIndices(); }
688
690 bool hasColMap() const { XPETRA_MONITOR("EpetraCrsGraphT::hasColMap"); return graph_->HaveColMap(); }
691
693 bool isLocallyIndexed() const { XPETRA_MONITOR("EpetraCrsGraphT::isLocallyIndexed"); return graph_->IndicesAreLocal(); }
694
696 bool isGloballyIndexed() const { XPETRA_MONITOR("EpetraCrsGraphT::isGloballyIndexed"); return graph_->IndicesAreGlobal(); }
697
699 bool isFillComplete() const { XPETRA_MONITOR("EpetraCrsGraphT::isFillComplete"); return graph_->Filled(); }
700
702 bool isStorageOptimized() const { XPETRA_MONITOR("EpetraCrsGraphT::isStorageOptimized"); return graph_->StorageOptimized(); }
703
706 XPETRA_MONITOR("EpetraCrsGraphT::getGlobalRowView");
707
708 int numEntries;
709 GlobalOrdinal * eIndices;
710
711 XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
712 if (numEntries == 0) { eIndices = NULL; } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
713
714 Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
715 }
716
719 XPETRA_MONITOR("EpetraCrsGraphT::getLocalRowView");
720
721 int numEntries;
722 int * eIndices;
723
724 XPETRA_ERR_CHECK(graph_->ExtractMyRowView(LocalRow, numEntries, eIndices));
725 if (numEntries == 0) { eIndices = NULL; } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
726
727 indices = ArrayView<const int>(eIndices, numEntries);
728 }
729
730#ifdef HAVE_XPETRA_TPETRA
731 typename local_graph_type::HostMirror getLocalGraphHost () const {
733 "Epetra does not support Kokkos::StaticCrsGraph!");
734 TEUCHOS_UNREACHABLE_RETURN((typename local_graph_type::HostMirror()));
735 }
736#else
737#ifdef __GNUC__
738#warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
739#endif
740#endif
741
742#ifdef HAVE_XPETRA_TPETRA
745 "Epetra does not support Kokkos::StaticCrsGraph!");
747 }
748#else
749#ifdef __GNUC__
750#warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
751#endif
752#endif
753
756
757
759
760
761
763
764
766 std::string description() const { XPETRA_MONITOR("EpetraCrsGraphT::description"); return "NotImplemented"; }
767
770 XPETRA_MONITOR("EpetraCrsGraphT::describe");
771
772 out << "EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
773 const Epetra_BlockMap rowmap = graph_->RowMap();
774 if (rowmap.Comm().MyPID() == 0) out << "** EpetraCrsGraphT **\n\nrowmap" << std::endl;
775 rowmap.Print(out);
776 graph_->Print(out);
777 }
778
780
782 //{@
783
785 Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getMap"); return toXpetra<GlobalOrdinal,Node>(graph_->Map()); }
786
790 XPETRA_MONITOR("EpetraCrsGraphT::doImport");
791
792 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
793 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
794
795 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
796 int err = graph_->Import(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
797 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
798 }
799
803 XPETRA_MONITOR("EpetraCrsGraphT::doExport");
804
805 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
806 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
807
808 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
809 int err = graph_->Export(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
810 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
811 }
812
816 XPETRA_MONITOR("EpetraCrsGraphT::doImport");
817
818 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
819 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
820
821 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
822 int err = graph_->Import(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
823 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
824
825 }
826
830 XPETRA_MONITOR("EpetraCrsGraphT::doExport");
831
832 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
833 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
834
835 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
836 int err = graph_->Export(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
837 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
838 }
840
842
843
845 EpetraCrsGraphT(const Teuchos::RCP<Epetra_CrsGraph> &graph) : graph_(graph) {
846 TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<GlobalOrdinal>(), std::runtime_error, "Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
847 }
848
851
853
854private:
855
857
858
859};
860
861#endif // specialization on Node=EpetraNode and GO=int
862
863// specialization on GO=long long and Node=EpetraNode
864#ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
865template<>
867: public virtual CrsGraph<int, long long, EpetraNode>
868{
869 typedef int LocalOrdinal;
870 typedef long long GlobalOrdinal;
872
875
876#ifdef HAVE_XPETRA_TPETRA
879 typedef typename node_type::execution_space execution_space;
880#endif
881
882public:
883
885
886
889: graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), 0, false))) { }
890
892 EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null)
893: graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), maxNumEntriesPerRow, true))) { }
894
895
897 // Definition not in cpp, so comment out
898 //EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null);
899
901 EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &/* plist */=null)
902 : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), maxNumEntriesPerRow, true))) { }
903
905 // Definition not in cpp, so comment out
906 EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &/* params */=null) {
907 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end()); // convert array of "size_t" to array of "int"
908 graph_ = Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(), true));
909 }
910
911#ifdef HAVE_XPETRA_TPETRA
914 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* colMap */,
915 const typename local_graph_type::row_map_type& /* rowPointers */,
916 const typename local_graph_type::entries_type::non_const_type& /* columnIndices */,
917 const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null) {
919 "Epetra does not support CrsGraph constructors using Kokkos Views!");
920 }
921
924 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* colMap */,
925 const local_graph_type& /* lclGraph */,
926 const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null) {
928 "Epetra does not support CrsGraph constructors using a local graph!");
929 }
930
932 EpetraCrsGraphT(const local_graph_type& /* lclGraph */,
933 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* rowMap */,
934 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* colMap */,
935 const Teuchos::RCP<const map_type>& /* domainMap */ = Teuchos::null,
936 const Teuchos::RCP<const map_type>& /* rangeMap */ = Teuchos::null,
937 const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null) {
939 "Epetra does not support CrsGraph constructors using a local graph!");
940 }
941#endif
942
944 virtual ~EpetraCrsGraphT() { }
945
947
949
950
953 XPETRA_MONITOR("EpetraCrsGraphT::insertGlobalIndices");
954
955 GlobalOrdinal* indices_rawPtr = const_cast<GlobalOrdinal*>(indices.getRawPtr()); // there is no const in the Epetra interface :(
956 XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
957 }
958
961 XPETRA_MONITOR("EpetraCrsGraphT::insertLocalIndices");
962
963 int* indices_rawPtr = const_cast<int*>(indices.getRawPtr()); // there is no const in the Epetra interface :(
964 XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
965 }
966
968 void removeLocalIndices(LocalOrdinal localRow) { XPETRA_MONITOR("EpetraCrsGraphT::removeLocalIndices"); graph_->RemoveMyIndices(localRow); }
969
971 //** \warning This is an expert-only routine and should not be called from user code. */
972 void allocateAllIndices(size_t numNonZeros, ArrayRCP<size_t>& rowptr, ArrayRCP<LocalOrdinal>& colind) {
973 XPETRA_MONITOR("EpetraCrsGraphT::allocateAllIndies");
974
975 // Row offsets
976 // Unfortunately, we cannot do this in the same manner as column indices
977 // and values (see below). The problem is that Tpetra insists on using
978 // size_t, and Epetra uses int internally. So we only resize here, and
979 // will need to copy in setAllValues
980 rowptr.resize(getLocalNumRows()+1);
981
982 int lowerOffset = 0;
983 bool ownMemory = false;
984
985 // Column indices
986 // Extract, resize, set colind
987 Epetra_IntSerialDenseVector& myColind = graph_->ExpertExtractIndices();
988 myColind.Resize(numNonZeros);
989 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
990 }
991
993 void setAllIndices(const ArrayRCP<size_t>& rowptr, const ArrayRCP<LocalOrdinal>& colind) {
994 XPETRA_MONITOR("EpetraCrsGraphT::setAllIndices");
995
996 // Check sizes
998 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
999 if (colind.size() > 0) {
1000 TEUCHOS_TEST_FOR_EXCEPTION(colind.getRawPtr() != graph_->ExpertExtractIndices().Values(), Xpetra::Exceptions::RuntimeError,
1001 "An exception is thrown to let you know that you mismatched your pointers.");
1002 }
1003
1004 // We have to make a copy here, it is unavoidable
1005 // See comments in allocateAllIndices
1006 const size_t N = getLocalNumRows();
1007
1008 Epetra_IntSerialDenseVector& myRowptr = graph_->ExpertExtractIndexOffset();
1009 myRowptr.Resize(N+1);
1010 for (size_t i = 0; i < N+1; i++)
1011 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
1012 }
1013
1014
1017 XPETRA_MONITOR("EpetraCrsGraphT::getAllIndices");
1018
1019 int lowerOffset = 0;
1020 bool ownMemory = false;
1021
1022 const size_t n = getLocalNumRows();
1023 const size_t nnz = getLocalNumEntries();
1024
1025 // Row offsets
1026 // We have to make a copy here, it is unavoidable (see comments in allocateAllValues)
1027 Epetra_IntSerialDenseVector& myRowptr = graph_->ExpertExtractIndexOffset();
1028 rowptr.resize(n+1);
1029 for (size_t i = 0; i < n+1; i++)
1030 (*const_cast<size_t*>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
1031
1032 // Column indices
1033 colind = Teuchos::arcp(graph_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
1034 }
1035
1036
1037
1039
1041
1042
1044 void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null){
1045 XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
1046
1047 graph_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap));
1048 bool doOptimizeStorage = true;
1049 if (params != null && params->get("Optimize Storage",true) == false) doOptimizeStorage = false;
1050 if (doOptimizeStorage) graph_->OptimizeStorage();
1051 }
1052
1054 void fillComplete(const RCP< ParameterList > &params=null) {
1055 XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
1056
1057 graph_->FillComplete();
1058 bool doOptimizeStorage = true;
1059 if (params != null && params->get("Optimize Storage",true) == false) doOptimizeStorage = false;
1060 if (doOptimizeStorage) graph_->OptimizeStorage();
1061 }
1062
1064 void
1065 expertStaticFillComplete (const Teuchos::RCP<const Map < LocalOrdinal, GlobalOrdinal, Node > >& domainMap,
1066 const Teuchos::RCP<const Map < LocalOrdinal, GlobalOrdinal, Node > >& rangeMap,
1068 Teuchos::null,
1070 Teuchos::null,
1072 Teuchos::null) {
1073 // Not optimized
1074 graph_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap));
1075 graph_->OptimizeStorage();
1076 }
1077
1079
1081
1082
1085 XPETRA_MONITOR("EpetraCrsGraphT::getComm");
1086 return toXpetra (graph_->Comm ());
1087 }
1088
1090 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getRowMap"); return toXpetra<GlobalOrdinal,Node>(graph_->RowMap()); }
1091
1093 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getColMap"); return toXpetra<GlobalOrdinal,Node>(graph_->ColMap()); }
1094
1096 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getDomainMap"); return toXpetra<GlobalOrdinal,Node>(graph_->DomainMap()); }
1097
1099 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getRangeMap"); return toXpetra<GlobalOrdinal,Node>(graph_->RangeMap()); }
1100
1102 RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const { XPETRA_MONITOR("EpetraCrsGraphT::getImporter"); return toXpetra<GlobalOrdinal,Node>(graph_->Importer()); }
1103
1105 RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const { XPETRA_MONITOR("EpetraCrsGraphT::getExporter"); return toXpetra<GlobalOrdinal,Node>(graph_->Exporter()); }
1106
1108 global_size_t getGlobalNumRows() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumRows"); return graph_->NumGlobalRows64(); }
1109
1111 global_size_t getGlobalNumCols() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumCols"); return graph_->NumGlobalCols64(); }
1112
1114 size_t getLocalNumRows() const { XPETRA_MONITOR("EpetraCrsGraphT::getLocalNumRows"); return graph_->NumMyRows(); }
1115
1117 size_t getLocalNumCols() const { XPETRA_MONITOR("EpetraCrsGraphT::getLocalNumCols"); return graph_->NumMyCols(); }
1118
1120 GlobalOrdinal getIndexBase() const { XPETRA_MONITOR("EpetraCrsGraphT::getIndexBase"); return (GlobalOrdinal) graph_->IndexBase64(); }
1121
1123 global_size_t getGlobalNumEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumEntries"); return graph_->NumGlobalEntries64(); }
1124
1126 size_t getLocalNumEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getLocalNumEntries"); return graph_->NumMyEntries(); }
1127
1129 size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInGlobalRow"); return graph_->NumGlobalIndices(globalRow); }
1130
1132 size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInLocalRow"); return graph_->NumMyIndices(localRow); }
1133
1135 size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow"); return graph_->NumAllocatedGlobalIndices(globalRow); }
1136
1138 size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow"); return graph_->NumAllocatedMyIndices(localRow); }
1139
1141 size_t getGlobalMaxNumRowEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalMaxNumRowEntries"); return graph_->GlobalMaxNumIndices(); }
1142
1144 size_t getLocalMaxNumRowEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getLocalMaxNumRowEntries"); return graph_->MaxNumIndices(); }
1145
1147 bool hasColMap() const { XPETRA_MONITOR("EpetraCrsGraphT::hasColMap"); return graph_->HaveColMap(); }
1148
1150 bool isLocallyIndexed() const { XPETRA_MONITOR("EpetraCrsGraphT::isLocallyIndexed"); return graph_->IndicesAreLocal(); }
1151
1153 bool isGloballyIndexed() const { XPETRA_MONITOR("EpetraCrsGraphT::isGloballyIndexed"); return graph_->IndicesAreGlobal(); }
1154
1156 bool isFillComplete() const { XPETRA_MONITOR("EpetraCrsGraphT::isFillComplete"); return graph_->Filled(); }
1157
1159 bool isStorageOptimized() const { XPETRA_MONITOR("EpetraCrsGraphT::isStorageOptimized"); return graph_->StorageOptimized(); }
1160
1163 XPETRA_MONITOR("EpetraCrsGraphT::getGlobalRowView");
1164
1165 int numEntries;
1166 GlobalOrdinal * eIndices;
1167
1168 XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
1169 if (numEntries == 0) { eIndices = NULL; } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
1170
1171 Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
1172 }
1173
1176 XPETRA_MONITOR("EpetraCrsGraphT::getLocalRowView");
1177
1178 int numEntries;
1179 int * eIndices;
1180
1181 XPETRA_ERR_CHECK(graph_->ExtractMyRowView(LocalRow, numEntries, eIndices));
1182 if (numEntries == 0) { eIndices = NULL; } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
1183
1184 indices = ArrayView<const int>(eIndices, numEntries);
1185 }
1186
1187#ifdef HAVE_XPETRA_TPETRA
1188 typename local_graph_type::HostMirror getLocalGraphHost () const {
1190 "Epetra does not support Kokkos::StaticCrsGraph!");
1191 TEUCHOS_UNREACHABLE_RETURN((typename local_graph_type::HostMirror()));
1192 }
1193#else
1194#ifdef __GNUC__
1195#warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
1196#endif
1197#endif
1198#ifdef HAVE_XPETRA_TPETRA
1201 "Epetra does not support Kokkos::StaticCrsGraph!");
1203 }
1204#else
1205#ifdef __GNUC__
1206#warning "Xpetra Kokkos interface for CrsGraph is enabled (HAVE_XPETRA_KOKKOS_REFACTOR) but Tpetra is disabled. The Kokkos interface needs Tpetra to be enabled, too."
1207#endif
1208#endif
1209
1212
1213
1215
1217
1218
1220 std::string description() const { XPETRA_MONITOR("EpetraCrsGraphT::description"); return "NotImplemented"; }
1221
1224 XPETRA_MONITOR("EpetraCrsGraphT::describe");
1225
1226 out << "EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
1227 const Epetra_BlockMap rowmap = graph_->RowMap();
1228 if (rowmap.Comm().MyPID() == 0) out << "** EpetraCrsGraphT **\n\nrowmap" << std::endl;
1229 rowmap.Print(out);
1230 graph_->Print(out);
1231 }
1232
1234
1236 //{@
1237
1239 Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getMap"); return toXpetra<GlobalOrdinal,Node>(graph_->Map()); }
1240
1244 XPETRA_MONITOR("EpetraCrsGraphT::doImport");
1245
1246 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
1247 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1248
1249 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
1250 int err = graph_->Import(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
1251 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1252 }
1253
1257 XPETRA_MONITOR("EpetraCrsGraphT::doExport");
1258
1259 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
1260 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1261
1262 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
1263 int err = graph_->Export(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
1264 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1265 }
1266
1270 XPETRA_MONITOR("EpetraCrsGraphT::doImport");
1271
1272 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
1273 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1274
1275 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
1276 int err = graph_->Import(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
1277 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1278
1279 }
1280
1284 XPETRA_MONITOR("EpetraCrsGraphT::doExport");
1285
1286 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
1287 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1288
1289 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
1290 int err = graph_->Export(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
1291 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1292 }
1294
1296
1297
1299 EpetraCrsGraphT(const Teuchos::RCP<Epetra_CrsGraph> &graph) : graph_(graph) {
1300 TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<GlobalOrdinal>(), std::runtime_error, "Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
1301 }
1302
1305
1307
1308private:
1309
1311
1312
1313};
1314#endif // specialization on Node=EpetraNode and GO=int
1315
1316} // Xpetra namespace
1317
1318#endif // XPETRA_EPETRACRSGRAPH_HPP
Insert
#define XPETRA_MONITOR(funcName)
#define XPETRA_ERR_CHECK(arg)
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
virtual void Print(std::ostream &os) const
const Epetra_Comm & Comm() const
virtual int MyPID() const=0
int Resize(int Length_in)
size_type size() const
T * getRawPtr() const
void resize(const size_type n, const T &val=T())
iterator begin() const
iterator end() const
size_type size() const
T * getRawPtr() const
static const EVerbosityLevel verbLevel_default
Kokkos::StaticCrsGraph< LocalOrdinal, Kokkos::LayoutLeft, device_type, void, size_t > local_graph_type
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &=null)
Constructor specifying column Map and fixed number of entries for each row.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
EpetraCrsGraphT(const Teuchos::RCP< Epetra_CrsGraph > &graph)
EpetraCrsGraphT constructor to wrap a Epetra_CrsGraph object.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this graph.
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
RCP< const Epetra_CrsGraph > getEpetra_CrsGraph() const
Get the underlying Epetra graph.
EpetraCrsGraphT(const local_graph_type &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const Teuchos::RCP< const map_type > &=Teuchos::null, const Teuchos::RCP< const map_type > &=Teuchos::null, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
size_t getLocalNumEntries() const
Returns the local number of entries in the graph.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type local_graph_type
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::node_type node_type
void allocateAllIndices(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind)
Allocates and returns ArrayRCPs of the Crs arrays — This is an Xpetra-only routine.
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &=null)
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row.
EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying fixed number of entries for each row.
size_t getLocalMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
void setAllIndices(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind)
Sets the 1D pointer arrays of the graph.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
void computeGlobalConstants()
Force the computation of global constants if we don't have them.
EpetraCrsGraphT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap)
Constructor for empty DynamicProfile graph (no space is preallocated).
std::string description() const
Return a simple one-line description of this object.
RCP< const Comm< int > > getComm() const
Returns the communicator.
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
bool hasColMap() const
Whether the graph has a column Map.
void getAllIndices(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind) const
Gets the 1D pointer arrays of the graph.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
EpetraCrsGraphT(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)
local_graph_type::HostMirror getLocalGraphHost() const
Get the local graph.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const local_graph_type &, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row.
size_t getLocalNumRows() const
Returns the number of graph rows owned on the calling node.
bool isStorageOptimized() const
Returns true if storage has been optimized.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const typename local_graph_type::row_map_type &, const typename local_graph_type::entries_type::non_const_type &, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this graph.
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
void expertStaticFillComplete(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=Teuchos::null, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Expert version of fillComplete.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row .
size_t getLocalNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row.
bool isStorageOptimized() const
Returns true if storage has been optimized.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
void computeGlobalConstants()
Force the computation of global constants if we don't have them.
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.
EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying fixed number of entries for each row.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
size_t getLocalNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
EpetraCrsGraphT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap)
Constructor for empty DynamicProfile graph (no space is preallocated).
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
void getAllIndices(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind) const
Gets the 1D pointer arrays of the graph.
void setAllIndices(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind)
Sets the 1D pointer arrays of the graph.
RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this graph.
void expertStaticFillComplete(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=Teuchos::null, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Expert version of fillComplete.
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
local_graph_type::HostMirror getLocalGraphHost() const
Get the local graph.
RCP< const Epetra_CrsGraph > getEpetra_CrsGraph() const
Get the underlying Epetra graph.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const typename local_graph_type::row_map_type &, const typename local_graph_type::entries_type::non_const_type &, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row.
EpetraCrsGraphT(const Teuchos::RCP< Epetra_CrsGraph > &graph)
EpetraCrsGraphT constructor to wrap a Epetra_CrsGraph object.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this graph.
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
size_t getLocalMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
size_t getLocalNumEntries() const
Returns the local number of entries in the graph.
std::string description() const
Return a simple one-line description of this object.
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &=null)
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
RCP< const Comm< int > > getComm() const
Returns the communicator.
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
bool hasColMap() const
Whether the graph has a column Map.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &=null)
Constructor specifying column Map and fixed number of entries for each row.
size_t getLocalNumRows() const
Returns the number of graph rows owned on the calling node.
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type local_graph_type
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
void allocateAllIndices(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind)
Allocates and returns ArrayRCPs of the Crs arrays — This is an Xpetra-only routine.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row .
EpetraCrsGraphT(const local_graph_type &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const Teuchos::RCP< const map_type > &=Teuchos::null, const Teuchos::RCP< const map_type > &=Teuchos::null, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::node_type node_type
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &, const local_graph_type &, const RCP< Teuchos::ParameterList > &=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
size_t getLocalNumRows() const
Returns the number of graph rows owned on the calling node.
EpetraCrsGraphT(const Teuchos::RCP< Epetra_CrsGraph > &graph)
EpetraCrsGraphT constructor to wrap a Epetra_CrsGraph object.
void setAllIndices(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind)
Sets the 1D pointer arrays of the graph.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
size_t getLocalNumEntries() const
Returns the local number of entries in the graph.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type local_graph_type
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const local_graph_type &lclGraph, const RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row .
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with some verbosity level to an FancyOStream object.
EpetraCrsGraphT(const RCP< const map_type > &rowMap, const RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor for empty DynamicProfile graph (no space is preallocated).
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
void allocateAllIndices(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind)
Allocates the 1D pointer arrays of the graph.
void expertStaticFillComplete(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=Teuchos::null, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Expert version of fillComplete.
bool hasColMap() const
Whether the graph has a column Map.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const Teuchos::RCP< Teuchos::ParameterList > &plist=null)
Constructor specifying column Map and fixed number of entries for each row.
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
EpetraCrsGraphT(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)
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this graph.
local_graph_type::HostMirror getLocalGraphHost() const
Get the local graph.
void computeGlobalConstants()
Force the computation of global constants if we don't have them.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
RCP< const Comm< int > > getComm() const
Returns the communicator.
node_type::execution_space execution_space
RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
EpetraCrsGraphT(const local_graph_type &lclGraph, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const Teuchos::RCP< const map_type > &domainMap=Teuchos::null, const Teuchos::RCP< const map_type > &rangeMap=Teuchos::null, const RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row.
std::string description() const
Return a simple one-line description of this object.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null)
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
local_graph_type getLocalGraphDevice() const
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
RCP< const Epetra_CrsGraph > getEpetra_CrsGraph() const
Get the underlying Epetra graph.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
size_t getLocalMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::node_type node_type
EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying fixed number of entries for each row.
size_t getLocalNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
virtual ~EpetraCrsGraphT()
Destructor.
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
void getAllIndices(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind) const
Gets the 1D pointer arrays of the graph.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this graph.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const typename local_graph_type::row_map_type &rowPointers, const typename local_graph_type::entries_type::non_const_type &columnIndices, const RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying column Map, number of entries in each row and column indices in each row.
bool isStorageOptimized() const
Returns true if storage has been optimized.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
Exception throws when you call an unimplemented method of Xpetra.
Exception throws to report errors in the internal logical of the program.
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getTargetMap() const =0
The Target Map used to construct this Import object.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Copy
Xpetra namespace
size_t global_size_t
Global size_t object.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
CombineMode
Xpetra::Combine Mode enumerable type.