Xpetra Version of the Day
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_KOKKOS_REFACTOR
84#ifdef HAVE_XPETRA_TPETRA
87 typedef typename node_type::execution_space execution_space;
88#endif
89#endif
90
91public:
92
94
95
96 EpetraCrsGraphT(const RCP< const map_type > &rowMap, const RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
98 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
99 }
100
102 EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
104 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
105 }
106
108 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) {
110 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
111 }
112
114 // Definition not in cpp, so comment out
115 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) {
117 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
118 }
119
120 // Constructor for fused import
123 const RCP<const Map< LocalOrdinal, GlobalOrdinal, Node >>& domainMap = Teuchos::null,
124 const RCP<const Map< LocalOrdinal, GlobalOrdinal, Node > >& rangeMap = Teuchos::null,
125 const RCP<Teuchos::ParameterList>& params = Teuchos::null) {
127 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
128 }
129
130
131
132#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
133#ifdef HAVE_XPETRA_TPETRA
136 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
137 const typename local_graph_type::row_map_type& rowPointers,
138 const typename local_graph_type::entries_type::non_const_type& columnIndices,
139 const RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
141 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
142 }
143
145 EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap,
146 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
147 const local_graph_type& lclGraph,
148 const RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
150 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
151 }
152
154 EpetraCrsGraphT(const local_graph_type& lclGraph,
155 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap,
156 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
157 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
158 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
159 const RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
161 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
162 }
163#endif
164#endif
165
167 virtual ~EpetraCrsGraphT() { }
168
170
172
173
175 void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) { }
176
178 void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal> &indices) { }
179
182
184 void allocateAllIndices(size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind) { }
185
187 void setAllIndices(const ArrayRCP<size_t> & rowptr, const ArrayRCP<LocalOrdinal> & colind){ }
188
191
192
194
196
197
199 void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null){ }
200
202 void fillComplete(const RCP< ParameterList > &params=null) { }
203
205 void
209 Teuchos::null,
211 Teuchos::null,
213 Teuchos::null) { }
214
216
218
219
222 return Teuchos::null;
223 }
224
227
230
233
236
239
242
244 global_size_t getGlobalNumRows() const { return 0; }
245
247 global_size_t getGlobalNumCols() const { return 0; }
248
250 size_t getNodeNumRows() const { return 0; }
251
253 size_t getNodeNumCols() const { return 0; }
254
256 GlobalOrdinal getIndexBase() const { return 0; }
257
259 global_size_t getGlobalNumEntries() const { return 0; }
260
262 size_t getNodeNumEntries() const { return 0; }
263
265 size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
266
268 size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
269
271 size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
272
274 size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
275
277 size_t getGlobalMaxNumRowEntries() const { return 0; }
278
280 size_t getNodeMaxNumRowEntries() const { return 0; }
281
283 bool hasColMap() const { return false; }
284
286 bool isLocallyIndexed() const { return false; }
287
289 bool isGloballyIndexed() const { return false; }
290
292 bool isFillComplete() const { return false; }
293
295 bool isStorageOptimized() const { return false; }
296
298 void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const { }
299
302
303#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
304#ifdef HAVE_XPETRA_TPETRA
305 typename local_graph_type::HostMirror getLocalGraphHost () const {
307 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
308 TEUCHOS_UNREACHABLE_RETURN((local_graph_type()));
309 }
310#else
311#ifdef __GNUC__
312#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."
313#endif
314#endif
315
316#ifdef HAVE_XPETRA_TPETRA
317 local_graph_type getLocalGraphDevice () const {
319 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
320 TEUCHOS_UNREACHABLE_RETURN((local_graph_type()));
321 }
322#else
323#ifdef __GNUC__
324#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."
325#endif
326
327#endif
328#endif
329
330
333
335
337
338
340 std::string description() const { return std::string(""); }
341
344
346
348 //{@
349
352
356
360
364
369
371
372
376 "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
377 }
378
380 RCP< const Epetra_CrsGraph> getEpetra_CrsGraph() const { return Teuchos::null; }
381
383
384private:
385
386}; // EpetraCrsGraphT class
387
388// specialization on GO=int and Node=EpetraNode
389#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
390template<>
392: public virtual CrsGraph<int, int, EpetraNode>
393{
394 typedef int LocalOrdinal;
395 typedef int GlobalOrdinal;
397
400
401#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
402#ifdef HAVE_XPETRA_TPETRA
405 typedef typename node_type::execution_space execution_space;
406#endif
407#endif
408
409public:
410
412
413
416: graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), 0, false))) { }
417
419 EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null)
420: graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), maxNumEntriesPerRow, true))) { }
421
422
424 // Definition not in cpp, so comment out
425 //EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null);
426
428 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)
429 : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), maxNumEntriesPerRow, true))) {}
430
432 // Definition not in cpp, so comment out
433 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) {
434 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end()); // convert array of "size_t" to array of "int"
435 graph_ = Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(), true));
436 }
437
438 // Constructor for fused import
441 const RCP<const Map< LocalOrdinal, GlobalOrdinal, Node >>& domainMap = Teuchos::null,
442 const RCP<const Map< LocalOrdinal, GlobalOrdinal, Node > >& rangeMap = Teuchos::null,
443 const RCP<Teuchos::ParameterList>& params = Teuchos::null) {
444
445 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, *sourceGraph, tSourceGraph, "Xpetra::EpetraCrsGraphT() only accepts Xpetra::EpetraCrsGraphT as input arguments.");
446 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
447 RCP< const Epetra_CrsGraph> eSourceGraph = tSourceGraph.getEpetra_CrsGraph();
448
449 // NOTE: Unlike Tpetra, Epetra does not have a FusedTransfer for Graphs. So we do this the slow way
450 graph_ = Teuchos::rcp(new Epetra_CrsGraph(Copy,eSourceGraph->RowMap(),0,false));
451 graph_->Import(*eSourceGraph,*tImporter.getEpetra_Import(),Insert);
452
453 const Epetra_BlockMap & myDomainMap = domainMap!=Teuchos::null ? toEpetra<GlobalOrdinal,Node>(domainMap) : eSourceGraph->ColMap();
454 const Epetra_BlockMap & myRangeMap = rangeMap!=Teuchos::null ? toEpetra<GlobalOrdinal,Node>(rangeMap) : toEpetra<LocalOrdinal,Node>(importer.getTargetMap());
455
456 graph_->FillComplete(myDomainMap,myRangeMap);
457
458 }
459
460
461
462#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
463#ifdef HAVE_XPETRA_TPETRA
466 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* colMap */,
467 const typename local_graph_type::row_map_type& /* rowPointers */,
468 const typename local_graph_type::entries_type::non_const_type& /* columnIndices */,
469 const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null) {
471 "Epetra does not support CrsGraph constructors using Kokkos Views!");
472 }
473
475 EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* rowMap */,
476 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* colMap */,
477 const local_graph_type& /* lclGraph */,
478 const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null) {
480 "Epetra does not support CrsGraph constructors using a local graph!");
481 }
482
484 EpetraCrsGraphT(const local_graph_type& /* lclGraph */,
485 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* rowMap */,
486 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* colMap */,
487 const Teuchos::RCP<const map_type>& /* domainMap */ = Teuchos::null,
488 const Teuchos::RCP<const map_type>& /* rangeMap */ = Teuchos::null,
489 const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null) {
491 "Epetra does not support CrsGraph constructors using a local graph!");
492 }
493#endif
494#endif
495
497 virtual ~EpetraCrsGraphT() { }
498
500
502
503
506 XPETRA_MONITOR("EpetraCrsGraphT::insertGlobalIndices");
507
508 GlobalOrdinal* indices_rawPtr = const_cast<GlobalOrdinal*>(indices.getRawPtr()); // there is no const in the Epetra interface :(
509 XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
510 }
511
514 XPETRA_MONITOR("EpetraCrsGraphT::insertLocalIndices");
515
516 int* indices_rawPtr = const_cast<int*>(indices.getRawPtr()); // there is no const in the Epetra interface :(
517 XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
518 }
519
521 void removeLocalIndices(LocalOrdinal localRow) { XPETRA_MONITOR("EpetraCrsGraphT::removeLocalIndices"); graph_->RemoveMyIndices(localRow); }
522
524 //** \warning This is an expert-only routine and should not be called from user code. */
525 void allocateAllIndices(size_t numNonZeros, ArrayRCP<size_t>& rowptr, ArrayRCP<LocalOrdinal>& colind) {
526 XPETRA_MONITOR("EpetraCrsGraphT::allocateAllIndies");
527
528 // Row offsets
529 // Unfortunately, we cannot do this in the same manner as column indices
530 // and values (see below). The problem is that Tpetra insists on using
531 // size_t, and Epetra uses int internally. So we only resize here, and
532 // will need to copy in setAllValues
533 rowptr.resize(getNodeNumRows()+1);
534
535 int lowerOffset = 0;
536 bool ownMemory = false;
537
538 // Column indices
539 // Extract, resize, set colind
540 Epetra_IntSerialDenseVector& myColind = graph_->ExpertExtractIndices();
541 myColind.Resize(numNonZeros);
542 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
543 }
544
546 void setAllIndices(const ArrayRCP<size_t>& rowptr, const ArrayRCP<LocalOrdinal>& colind) {
547 XPETRA_MONITOR("EpetraCrsGraphT::setAllIndices");
548
549 // Check sizes
551 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
552 if (colind.size() > 0) {
553 TEUCHOS_TEST_FOR_EXCEPTION(colind.getRawPtr() != graph_->ExpertExtractIndices().Values(), Xpetra::Exceptions::RuntimeError,
554 "An exception is thrown to let you know that you mismatched your pointers.");
555 }
556
557 // We have to make a copy here, it is unavoidable
558 // See comments in allocateAllIndices
559 const size_t N = getNodeNumRows();
560
561 Epetra_IntSerialDenseVector& myRowptr = graph_->ExpertExtractIndexOffset();
562 myRowptr.Resize(N+1);
563 for (size_t i = 0; i < N+1; i++)
564 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
565 }
566
567
570 XPETRA_MONITOR("EpetraCrsGraphT::getAllIndices");
571
572 int lowerOffset = 0;
573 bool ownMemory = false;
574
575 const size_t n = getNodeNumRows();
576 const size_t nnz = getNodeNumEntries();
577
578 // Row offsets
579 // We have to make a copy here, it is unavoidable (see comments in allocateAllValues)
580 Epetra_IntSerialDenseVector& myRowptr = graph_->ExpertExtractIndexOffset();
581 rowptr.resize(n+1);
582 for (size_t i = 0; i < n+1; i++)
583 (*const_cast<size_t*>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
584
585 // Column indices
586 colind = Teuchos::arcp(graph_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
587 }
588
589
590
592
594
595
597 void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null){
598 XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
599
600 graph_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap));
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 fillComplete(const RCP< ParameterList > &params=null) {
608 XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
609
610 graph_->FillComplete();
611 bool doOptimizeStorage = true;
612 if (params != null && params->get("Optimize Storage",true) == false) doOptimizeStorage = false;
613 if (doOptimizeStorage) graph_->OptimizeStorage();
614 }
615
617 void
621 Teuchos::null,
623 Teuchos::null,
625 Teuchos::null) {
626 // Not optimized
627 graph_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap));
628 graph_->OptimizeStorage();
629 }
630
632
634
635
638 XPETRA_MONITOR("EpetraCrsGraphT::getComm");
639 return toXpetra (graph_->Comm ());
640 }
641
643 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getRowMap"); return toXpetra<GlobalOrdinal,Node>(graph_->RowMap()); }
644
646 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getColMap"); return toXpetra<GlobalOrdinal,Node>(graph_->ColMap()); }
647
649 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getDomainMap"); return toXpetra<GlobalOrdinal,Node>(graph_->DomainMap()); }
650
652 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getRangeMap"); return toXpetra<GlobalOrdinal,Node>(graph_->RangeMap()); }
653
655 RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const { XPETRA_MONITOR("EpetraCrsGraphT::getImporter"); return toXpetra<GlobalOrdinal,Node>(graph_->Importer()); }
656
658 RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const { XPETRA_MONITOR("EpetraCrsGraphT::getExporter"); return toXpetra<GlobalOrdinal,Node>(graph_->Exporter()); }
659
661 global_size_t getGlobalNumRows() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumRows"); return graph_->NumGlobalRows64(); }
662
664 global_size_t getGlobalNumCols() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumCols"); return graph_->NumGlobalCols64(); }
665
667 size_t getNodeNumRows() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumRows"); return graph_->NumMyRows(); }
668
670 size_t getNodeNumCols() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumCols"); return graph_->NumMyCols(); }
671
673 GlobalOrdinal getIndexBase() const { XPETRA_MONITOR("EpetraCrsGraphT::getIndexBase"); return (GlobalOrdinal) graph_->IndexBase64(); }
674
676 global_size_t getGlobalNumEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumEntries"); return graph_->NumGlobalEntries64(); }
677
679 size_t getNodeNumEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumEntries"); return graph_->NumMyEntries(); }
680
682 size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInGlobalRow"); return graph_->NumGlobalIndices(globalRow); }
683
685 size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInLocalRow"); return graph_->NumMyIndices(localRow); }
686
688 size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow"); return graph_->NumAllocatedGlobalIndices(globalRow); }
689
691 size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow"); return graph_->NumAllocatedMyIndices(localRow); }
692
694 size_t getGlobalMaxNumRowEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalMaxNumRowEntries"); return graph_->GlobalMaxNumIndices(); }
695
697 size_t getNodeMaxNumRowEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeMaxNumRowEntries"); return graph_->MaxNumIndices(); }
698
700 bool hasColMap() const { XPETRA_MONITOR("EpetraCrsGraphT::hasColMap"); return graph_->HaveColMap(); }
701
703 bool isLocallyIndexed() const { XPETRA_MONITOR("EpetraCrsGraphT::isLocallyIndexed"); return graph_->IndicesAreLocal(); }
704
706 bool isGloballyIndexed() const { XPETRA_MONITOR("EpetraCrsGraphT::isGloballyIndexed"); return graph_->IndicesAreGlobal(); }
707
709 bool isFillComplete() const { XPETRA_MONITOR("EpetraCrsGraphT::isFillComplete"); return graph_->Filled(); }
710
712 bool isStorageOptimized() const { XPETRA_MONITOR("EpetraCrsGraphT::isStorageOptimized"); return graph_->StorageOptimized(); }
713
716 XPETRA_MONITOR("EpetraCrsGraphT::getGlobalRowView");
717
718 int numEntries;
719 GlobalOrdinal * eIndices;
720
721 XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
722 if (numEntries == 0) { eIndices = NULL; } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
723
724 Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
725 }
726
729 XPETRA_MONITOR("EpetraCrsGraphT::getLocalRowView");
730
731 int numEntries;
732 int * eIndices;
733
734 XPETRA_ERR_CHECK(graph_->ExtractMyRowView(LocalRow, numEntries, eIndices));
735 if (numEntries == 0) { eIndices = NULL; } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
736
737 indices = ArrayView<const int>(eIndices, numEntries);
738 }
739
740#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
741#ifdef HAVE_XPETRA_TPETRA
742 typename local_graph_type::HostMirror getLocalGraphHost () const {
744 "Epetra does not support Kokkos::StaticCrsGraph!");
745 TEUCHOS_UNREACHABLE_RETURN((local_graph_type::HostMirror()));
746 }
747#else
748#ifdef __GNUC__
749#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."
750#endif
751#endif
752
753#ifdef HAVE_XPETRA_TPETRA
754 local_graph_type getLocalGraphDevice () const {
756 "Epetra does not support Kokkos::StaticCrsGraph!");
757 TEUCHOS_UNREACHABLE_RETURN((local_graph_type()));
758 }
759#else
760#ifdef __GNUC__
761#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."
762#endif
763#endif
764
765#endif
766
769
770
772
773
774
776
777
779 std::string description() const { XPETRA_MONITOR("EpetraCrsGraphT::description"); return "NotImplemented"; }
780
783 XPETRA_MONITOR("EpetraCrsGraphT::describe");
784
785 out << "EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
786 const Epetra_BlockMap rowmap = graph_->RowMap();
787 if (rowmap.Comm().MyPID() == 0) out << "** EpetraCrsGraphT **\n\nrowmap" << std::endl;
788 rowmap.Print(out);
789 graph_->Print(out);
790 }
791
793
795 //{@
796
798 Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getMap"); return toXpetra<GlobalOrdinal,Node>(graph_->Map()); }
799
803 XPETRA_MONITOR("EpetraCrsGraphT::doImport");
804
805 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "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 = tSource.getEpetra_CrsGraph();
809 int err = graph_->Import(*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::doExport");
817
818 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
819 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
820
821 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
822 int err = graph_->Export(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
823 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
824 }
825
829 XPETRA_MONITOR("EpetraCrsGraphT::doImport");
830
831 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
832 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
833
834 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
835 int err = graph_->Import(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
836 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
837
838 }
839
843 XPETRA_MONITOR("EpetraCrsGraphT::doExport");
844
845 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
846 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
847
848 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
849 int err = graph_->Export(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
850 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
851 }
853
855
856
858 EpetraCrsGraphT(const Teuchos::RCP<Epetra_CrsGraph> &graph) : graph_(graph) {
859 TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<GlobalOrdinal>(), std::runtime_error, "Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
860 }
861
864
866
867private:
868
870
871
872};
873
874#endif // specialization on Node=EpetraNode and GO=int
875
876// specialization on GO=long long and Node=EpetraNode
877#ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
878template<>
880: public virtual CrsGraph<int, long long, EpetraNode>
881{
882 typedef int LocalOrdinal;
883 typedef long long GlobalOrdinal;
885
888
889#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
890#ifdef HAVE_XPETRA_TPETRA
893 typedef typename node_type::execution_space execution_space;
894#endif
895#endif
896
897public:
898
900
901
904: graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), 0, false))) { }
905
907 EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null)
908: graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), maxNumEntriesPerRow, true))) { }
909
910
912 // Definition not in cpp, so comment out
913 //EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null);
914
916 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)
917 : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), maxNumEntriesPerRow, true))) { }
918
920 // Definition not in cpp, so comment out
921 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) {
922 Teuchos::Array<int> numEntriesPerRowToAlloc(NumEntriesPerRowToAlloc.begin(), NumEntriesPerRowToAlloc.end()); // convert array of "size_t" to array of "int"
923 graph_ = Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), numEntriesPerRowToAlloc.getRawPtr(), true));
924 }
925
926#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
927#ifdef HAVE_XPETRA_TPETRA
930 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* colMap */,
931 const typename local_graph_type::row_map_type& /* rowPointers */,
932 const typename local_graph_type::entries_type::non_const_type& /* columnIndices */,
933 const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null) {
935 "Epetra does not support CrsGraph constructors using Kokkos Views!");
936 }
937
939 EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* rowMap */,
940 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* colMap */,
941 const local_graph_type& /* lclGraph */,
942 const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null) {
944 "Epetra does not support CrsGraph constructors using a local graph!");
945 }
946
948 EpetraCrsGraphT(const local_graph_type& /* lclGraph */,
949 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* rowMap */,
950 const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &/* colMap */,
951 const Teuchos::RCP<const map_type>& /* domainMap */ = Teuchos::null,
952 const Teuchos::RCP<const map_type>& /* rangeMap */ = Teuchos::null,
953 const RCP< Teuchos::ParameterList > &/* plist */=Teuchos::null) {
955 "Epetra does not support CrsGraph constructors using a local graph!");
956 }
957#endif
958#endif
959
961 virtual ~EpetraCrsGraphT() { }
962
964
966
967
970 XPETRA_MONITOR("EpetraCrsGraphT::insertGlobalIndices");
971
972 GlobalOrdinal* indices_rawPtr = const_cast<GlobalOrdinal*>(indices.getRawPtr()); // there is no const in the Epetra interface :(
973 XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
974 }
975
978 XPETRA_MONITOR("EpetraCrsGraphT::insertLocalIndices");
979
980 int* indices_rawPtr = const_cast<int*>(indices.getRawPtr()); // there is no const in the Epetra interface :(
981 XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
982 }
983
985 void removeLocalIndices(LocalOrdinal localRow) { XPETRA_MONITOR("EpetraCrsGraphT::removeLocalIndices"); graph_->RemoveMyIndices(localRow); }
986
988 //** \warning This is an expert-only routine and should not be called from user code. */
989 void allocateAllIndices(size_t numNonZeros, ArrayRCP<size_t>& rowptr, ArrayRCP<LocalOrdinal>& colind) {
990 XPETRA_MONITOR("EpetraCrsGraphT::allocateAllIndies");
991
992 // Row offsets
993 // Unfortunately, we cannot do this in the same manner as column indices
994 // and values (see below). The problem is that Tpetra insists on using
995 // size_t, and Epetra uses int internally. So we only resize here, and
996 // will need to copy in setAllValues
997 rowptr.resize(getNodeNumRows()+1);
998
999 int lowerOffset = 0;
1000 bool ownMemory = false;
1001
1002 // Column indices
1003 // Extract, resize, set colind
1004 Epetra_IntSerialDenseVector& myColind = graph_->ExpertExtractIndices();
1005 myColind.Resize(numNonZeros);
1006 colind = Teuchos::arcp(myColind.Values(), lowerOffset, numNonZeros, ownMemory);
1007 }
1008
1010 void setAllIndices(const ArrayRCP<size_t>& rowptr, const ArrayRCP<LocalOrdinal>& colind) {
1011 XPETRA_MONITOR("EpetraCrsGraphT::setAllIndices");
1012
1013 // Check sizes
1015 "An exception is thrown to let you know that the size of your rowptr array is incorrect.");
1016 if (colind.size() > 0) {
1017 TEUCHOS_TEST_FOR_EXCEPTION(colind.getRawPtr() != graph_->ExpertExtractIndices().Values(), Xpetra::Exceptions::RuntimeError,
1018 "An exception is thrown to let you know that you mismatched your pointers.");
1019 }
1020
1021 // We have to make a copy here, it is unavoidable
1022 // See comments in allocateAllIndices
1023 const size_t N = getNodeNumRows();
1024
1025 Epetra_IntSerialDenseVector& myRowptr = graph_->ExpertExtractIndexOffset();
1026 myRowptr.Resize(N+1);
1027 for (size_t i = 0; i < N+1; i++)
1028 myRowptr[i] = Teuchos::as<int>(rowptr[i]);
1029 }
1030
1031
1034 XPETRA_MONITOR("EpetraCrsGraphT::getAllIndices");
1035
1036 int lowerOffset = 0;
1037 bool ownMemory = false;
1038
1039 const size_t n = getNodeNumRows();
1040 const size_t nnz = getNodeNumEntries();
1041
1042 // Row offsets
1043 // We have to make a copy here, it is unavoidable (see comments in allocateAllValues)
1044 Epetra_IntSerialDenseVector& myRowptr = graph_->ExpertExtractIndexOffset();
1045 rowptr.resize(n+1);
1046 for (size_t i = 0; i < n+1; i++)
1047 (*const_cast<size_t*>(&rowptr[i])) = Teuchos::as<size_t>(myRowptr[i]);
1048
1049 // Column indices
1050 colind = Teuchos::arcp(graph_->ExpertExtractIndices().Values(), lowerOffset, nnz, ownMemory);
1051 }
1052
1053
1054
1056
1058
1059
1061 void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null){
1062 XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
1063
1064 graph_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap));
1065 bool doOptimizeStorage = true;
1066 if (params != null && params->get("Optimize Storage",true) == false) doOptimizeStorage = false;
1067 if (doOptimizeStorage) graph_->OptimizeStorage();
1068 }
1069
1071 void fillComplete(const RCP< ParameterList > &params=null) {
1072 XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
1073
1074 graph_->FillComplete();
1075 bool doOptimizeStorage = true;
1076 if (params != null && params->get("Optimize Storage",true) == false) doOptimizeStorage = false;
1077 if (doOptimizeStorage) graph_->OptimizeStorage();
1078 }
1079
1081 void
1085 Teuchos::null,
1087 Teuchos::null,
1089 Teuchos::null) {
1090 // Not optimized
1091 graph_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap));
1092 graph_->OptimizeStorage();
1093 }
1094
1096
1098
1099
1102 XPETRA_MONITOR("EpetraCrsGraphT::getComm");
1103 return toXpetra (graph_->Comm ());
1104 }
1105
1107 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getRowMap"); return toXpetra<GlobalOrdinal,Node>(graph_->RowMap()); }
1108
1110 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getColMap"); return toXpetra<GlobalOrdinal,Node>(graph_->ColMap()); }
1111
1113 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getDomainMap"); return toXpetra<GlobalOrdinal,Node>(graph_->DomainMap()); }
1114
1116 RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getRangeMap"); return toXpetra<GlobalOrdinal,Node>(graph_->RangeMap()); }
1117
1119 RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const { XPETRA_MONITOR("EpetraCrsGraphT::getImporter"); return toXpetra<GlobalOrdinal,Node>(graph_->Importer()); }
1120
1122 RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const { XPETRA_MONITOR("EpetraCrsGraphT::getExporter"); return toXpetra<GlobalOrdinal,Node>(graph_->Exporter()); }
1123
1125 global_size_t getGlobalNumRows() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumRows"); return graph_->NumGlobalRows64(); }
1126
1128 global_size_t getGlobalNumCols() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumCols"); return graph_->NumGlobalCols64(); }
1129
1131 size_t getNodeNumRows() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumRows"); return graph_->NumMyRows(); }
1132
1134 size_t getNodeNumCols() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumCols"); return graph_->NumMyCols(); }
1135
1137 GlobalOrdinal getIndexBase() const { XPETRA_MONITOR("EpetraCrsGraphT::getIndexBase"); return (GlobalOrdinal) graph_->IndexBase64(); }
1138
1140 global_size_t getGlobalNumEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumEntries"); return graph_->NumGlobalEntries64(); }
1141
1143 size_t getNodeNumEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumEntries"); return graph_->NumMyEntries(); }
1144
1146 size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInGlobalRow"); return graph_->NumGlobalIndices(globalRow); }
1147
1149 size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInLocalRow"); return graph_->NumMyIndices(localRow); }
1150
1152 size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow"); return graph_->NumAllocatedGlobalIndices(globalRow); }
1153
1155 size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow"); return graph_->NumAllocatedMyIndices(localRow); }
1156
1158 size_t getGlobalMaxNumRowEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalMaxNumRowEntries"); return graph_->GlobalMaxNumIndices(); }
1159
1161 size_t getNodeMaxNumRowEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeMaxNumRowEntries"); return graph_->MaxNumIndices(); }
1162
1164 bool hasColMap() const { XPETRA_MONITOR("EpetraCrsGraphT::hasColMap"); return graph_->HaveColMap(); }
1165
1167 bool isLocallyIndexed() const { XPETRA_MONITOR("EpetraCrsGraphT::isLocallyIndexed"); return graph_->IndicesAreLocal(); }
1168
1170 bool isGloballyIndexed() const { XPETRA_MONITOR("EpetraCrsGraphT::isGloballyIndexed"); return graph_->IndicesAreGlobal(); }
1171
1173 bool isFillComplete() const { XPETRA_MONITOR("EpetraCrsGraphT::isFillComplete"); return graph_->Filled(); }
1174
1176 bool isStorageOptimized() const { XPETRA_MONITOR("EpetraCrsGraphT::isStorageOptimized"); return graph_->StorageOptimized(); }
1177
1180 XPETRA_MONITOR("EpetraCrsGraphT::getGlobalRowView");
1181
1182 int numEntries;
1183 GlobalOrdinal * eIndices;
1184
1185 XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
1186 if (numEntries == 0) { eIndices = NULL; } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
1187
1188 Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
1189 }
1190
1193 XPETRA_MONITOR("EpetraCrsGraphT::getLocalRowView");
1194
1195 int numEntries;
1196 int * eIndices;
1197
1198 XPETRA_ERR_CHECK(graph_->ExtractMyRowView(LocalRow, numEntries, eIndices));
1199 if (numEntries == 0) { eIndices = NULL; } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
1200
1201 indices = ArrayView<const int>(eIndices, numEntries);
1202 }
1203
1204#ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1205#ifdef HAVE_XPETRA_TPETRA
1206 local_graph_type getLocalGraphHost () const {
1208 "Epetra does not support Kokkos::StaticCrsGraph!");
1209 TEUCHOS_UNREACHABLE_RETURN((local_graph_type()));
1210 }
1211#else
1212#ifdef __GNUC__
1213#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."
1214#endif
1215#endif
1216#ifdef HAVE_XPETRA_TPETRA
1217 local_graph_type getLocalGraphDevice () const {
1219 "Epetra does not support Kokkos::StaticCrsGraph!");
1220 TEUCHOS_UNREACHABLE_RETURN((local_graph_type()));
1221 }
1222#else
1223#ifdef __GNUC__
1224#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."
1225#endif
1226#endif
1227#endif
1228
1231
1232
1234
1236
1237
1239 std::string description() const { XPETRA_MONITOR("EpetraCrsGraphT::description"); return "NotImplemented"; }
1240
1243 XPETRA_MONITOR("EpetraCrsGraphT::describe");
1244
1245 out << "EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
1246 const Epetra_BlockMap rowmap = graph_->RowMap();
1247 if (rowmap.Comm().MyPID() == 0) out << "** EpetraCrsGraphT **\n\nrowmap" << std::endl;
1248 rowmap.Print(out);
1249 graph_->Print(out);
1250 }
1251
1253
1255 //{@
1256
1258 Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getMap"); return toXpetra<GlobalOrdinal,Node>(graph_->Map()); }
1259
1263 XPETRA_MONITOR("EpetraCrsGraphT::doImport");
1264
1265 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
1266 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1267
1268 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
1269 int err = graph_->Import(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
1270 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1271 }
1272
1276 XPETRA_MONITOR("EpetraCrsGraphT::doExport");
1277
1278 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
1279 XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal XPETRA_COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1280
1281 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
1282 int err = graph_->Export(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
1283 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1284 }
1285
1289 XPETRA_MONITOR("EpetraCrsGraphT::doImport");
1290
1291 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
1292 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1293
1294 RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
1295 int err = graph_->Import(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
1296 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1297
1298 }
1299
1303 XPETRA_MONITOR("EpetraCrsGraphT::doExport");
1304
1305 XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal XPETRA_COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
1306 XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal XPETRA_COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
1307
1308 RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
1309 int err = graph_->Export(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
1310 TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
1311 }
1313
1315
1316
1318 EpetraCrsGraphT(const Teuchos::RCP<Epetra_CrsGraph> &graph) : graph_(graph) {
1319 TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<GlobalOrdinal>(), std::runtime_error, "Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
1320 }
1321
1324
1326
1327private:
1328
1330
1331
1332};
1333#endif // specialization on Node=EpetraNode and GO=int
1334
1335} // Xpetra namespace
1336
1337#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
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.
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.
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.
size_t getNodeNumEntries() const
Returns the local number of entries in the graph.
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).
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of 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 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.
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.
size_t getNodeMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
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)
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.
size_t getNodeNumRows() const
Returns the number of graph rows owned on the calling node.
bool isStorageOptimized() const
Returns true if storage has been optimized.
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 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.
size_t getNodeNumRows() const
Returns the number of graph rows owned on the calling node.
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the 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.
RCP< const Epetra_CrsGraph > getEpetra_CrsGraph() const
Get the underlying Epetra graph.
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.
size_t getNodeNumEntries() const
Returns the local number of entries in the graph.
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 getNodeMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
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.
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.
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 .
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.
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 getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global 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.
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.
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.
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.
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 getNodeNumEntries() const
Returns the local number of entries in the graph.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
size_t getNodeMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
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.
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.
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.
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.
size_t getNodeNumRows() const
Returns the number of graph rows owned on the calling node.
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.