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 
53 #include "Xpetra_CrsGraph.hpp"
54 
55 #include "Xpetra_EpetraExport.hpp"
56 #include "Xpetra_EpetraImport.hpp"
57 #include "Xpetra_EpetraMap.hpp"
58 #include "Xpetra_EpetraUtils.hpp"
59 
60 #include <Epetra_CrsGraph.h>
61 
62 namespace Xpetra {
63 
64 // TODO: move that elsewhere
65 template<class GlobalOrdinal, class Node>
66 RCP< const CrsGraph<int, GlobalOrdinal, Node> >
67 toXpetra (const Epetra_CrsGraph& graph);
68 
69 template<class GlobalOrdinal, class Node>
70 const Epetra_CrsGraph&
71 toEpetra (const RCP<const CrsGraph<int, GlobalOrdinal, Node> > &graph);
72 
73 template<class GlobalOrdinal, class Node>
75  : public CrsGraph<int, GlobalOrdinal, Node>
76 {
77  typedef int LocalOrdinal;
78 
81 
82 public:
83 
85 
86  EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
89  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
90  }
91 
93  EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=null) {
95  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
96  }
97 
99  // Definition not in cpp, so comment out
100  //EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const RCP< ParameterList > &params=null);
101 
103  virtual ~EpetraCrsGraphT() { }
104 
106 
108 
109 
111  void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) { }
112 
114  void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal> &indices) { }
115 
117  void removeLocalIndices(LocalOrdinal localRow) { }
118 
120 
122 
123 
125  void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null){ }
126 
128  void fillComplete(const RCP< ParameterList > &params=null) { }
130 
132 
133 
136  return Teuchos::null;
137  }
138 
141 
144 
147 
150 
153 
156 
158  global_size_t getGlobalNumRows() const { return 0; }
159 
161  global_size_t getGlobalNumCols() const { return 0; }
162 
164  size_t getNodeNumRows() const { return 0; }
165 
167  size_t getNodeNumCols() const { return 0; }
168 
170  GlobalOrdinal getIndexBase() const { return 0; }
171 
173  global_size_t getGlobalNumEntries() const { return 0; }
174 
176  size_t getNodeNumEntries() const { return 0; }
177 
179  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
180 
182  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
183 
185  size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
186 
188  size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
189 
191  global_size_t getGlobalNumDiags() const { return 0; }
192 
194  size_t getNodeNumDiags() const { return 0; }
195 
197  size_t getGlobalMaxNumRowEntries() const { return 0; }
198 
200  size_t getNodeMaxNumRowEntries() const { return 0; }
201 
203  bool hasColMap() const { return false; }
204 
206  bool isLowerTriangular() const { return false; }
207 
209  bool isUpperTriangular() const { return false; }
210 
212  bool isLocallyIndexed() const { return false; }
213 
215  bool isGloballyIndexed() const { return false; }
216 
218  bool isFillComplete() const { return false; }
219 
221  bool isStorageOptimized() const { return false; }
222 
224  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const { }
225 
227  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices) const { }
229 
231 
232 
234  std::string description() const { return std::string(""); }
235 
238 
240 
242  //{@
243 
246 
250 
254 
258 
263 
265 
266 
270  "Xpetra::EpetraCrsGraph only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
271  }
272 
274  RCP< const Epetra_CrsGraph> getEpetra_CrsGraph() const { return Teuchos::null; }
275 
277 
278 private:
279 
280 }; // EpetraCrsGraphT class
281 
282 // specialization on GO=int and Node=EpetraNode
283 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
284 template<>
286 : public virtual CrsGraph<int, int, EpetraNode>
287 {
288  typedef int LocalOrdinal;
289  typedef int GlobalOrdinal;
290  typedef EpetraNode Node;
291 
294 
295 public:
296 
298 
299  EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const RCP< Teuchos::ParameterList > &plist=Teuchos::null)
301 : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), maxNumEntriesPerRow, toEpetra(pftype)))) { }
302 
303 
305  // Definition not in cpp, so comment out
306  //EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const RCP< ParameterList > &params=null);
307 
309  EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=null)
310  : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), maxNumEntriesPerRow, toEpetra(pftype)))) { }
311 
313  // Definition not in cpp, so comment out
314  //EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const RCP< ParameterList > &params=null);
315 
317  virtual ~EpetraCrsGraphT() { }
318 
320 
322 
323 
325  void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) {
326  XPETRA_MONITOR("EpetraCrsGraphT::insertGlobalIndices");
327 
328  GlobalOrdinal* indices_rawPtr = const_cast<GlobalOrdinal*>(indices.getRawPtr()); // there is no const in the Epetra interface :(
329  XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
330  }
331 
333  void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal> &indices) {
334  XPETRA_MONITOR("EpetraCrsGraphT::insertLocalIndices");
335 
336  int* indices_rawPtr = const_cast<int*>(indices.getRawPtr()); // there is no const in the Epetra interface :(
337  XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
338  }
339 
341  void removeLocalIndices(LocalOrdinal localRow) { XPETRA_MONITOR("EpetraCrsGraphT::removeLocalIndices"); graph_->RemoveMyIndices(localRow); }
342 
344 
346 
347 
349  void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null){
350  XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
351 
352  graph_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap));
353  bool doOptimizeStorage = true;
354  if (params != null && params->get("Optimize Storage",true) == false) doOptimizeStorage = false;
355  if (doOptimizeStorage) graph_->OptimizeStorage();
356  }
357 
359  void fillComplete(const RCP< ParameterList > &params=null) {
360  XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
361 
362  graph_->FillComplete();
363  bool doOptimizeStorage = true;
364  if (params != null && params->get("Optimize Storage",true) == false) doOptimizeStorage = false;
365  if (doOptimizeStorage) graph_->OptimizeStorage();
366  }
368 
370 
371 
374  XPETRA_MONITOR("EpetraCrsGraphT::getComm");
375  return toXpetra (graph_->Comm ());
376  }
377 
379  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getRowMap"); return toXpetra<GlobalOrdinal,Node>(graph_->RowMap()); }
380 
382  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getColMap"); return toXpetra<GlobalOrdinal,Node>(graph_->ColMap()); }
383 
385  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getDomainMap"); return toXpetra<GlobalOrdinal,Node>(graph_->DomainMap()); }
386 
388  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getRangeMap"); return toXpetra<GlobalOrdinal,Node>(graph_->RangeMap()); }
389 
391  RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const { XPETRA_MONITOR("EpetraCrsGraphT::getImporter"); return toXpetra<GlobalOrdinal,Node>(graph_->Importer()); }
392 
394  RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const { XPETRA_MONITOR("EpetraCrsGraphT::getExporter"); return toXpetra<GlobalOrdinal,Node>(graph_->Exporter()); }
395 
397  global_size_t getGlobalNumRows() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumRows"); return graph_->NumGlobalRows64(); }
398 
400  global_size_t getGlobalNumCols() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumCols"); return graph_->NumGlobalCols64(); }
401 
403  size_t getNodeNumRows() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumRows"); return graph_->NumMyRows(); }
404 
406  size_t getNodeNumCols() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumCols"); return graph_->NumMyCols(); }
407 
409  GlobalOrdinal getIndexBase() const { XPETRA_MONITOR("EpetraCrsGraphT::getIndexBase"); return (GlobalOrdinal) graph_->IndexBase64(); }
410 
412  global_size_t getGlobalNumEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumEntries"); return graph_->NumGlobalEntries64(); }
413 
415  size_t getNodeNumEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumEntries"); return graph_->NumMyEntries(); }
416 
418  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInGlobalRow"); return graph_->NumGlobalIndices(globalRow); }
419 
421  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInLocalRow"); return graph_->NumMyIndices(localRow); }
422 
424  size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow"); return graph_->NumAllocatedGlobalIndices(globalRow); }
425 
427  size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow"); return graph_->NumAllocatedMyIndices(localRow); }
428 
430  global_size_t getGlobalNumDiags() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumDiags"); return graph_->NumGlobalDiagonals64(); }
431 
433  size_t getNodeNumDiags() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumDiags"); return graph_->NumMyDiagonals(); }
434 
436  size_t getGlobalMaxNumRowEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalMaxNumRowEntries"); return graph_->GlobalMaxNumIndices(); }
437 
439  size_t getNodeMaxNumRowEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeMaxNumRowEntries"); return graph_->MaxNumIndices(); }
440 
442  bool hasColMap() const { XPETRA_MONITOR("EpetraCrsGraphT::hasColMap"); return graph_->HaveColMap(); }
443 
445  bool isLowerTriangular() const { XPETRA_MONITOR("EpetraCrsGraphT::isLowerTriangular"); return graph_->LowerTriangular(); }
446 
448  bool isUpperTriangular() const { XPETRA_MONITOR("EpetraCrsGraphT::isUpperTriangular"); return graph_->UpperTriangular(); }
449 
451  bool isLocallyIndexed() const { XPETRA_MONITOR("EpetraCrsGraphT::isLocallyIndexed"); return graph_->IndicesAreLocal(); }
452 
454  bool isGloballyIndexed() const { XPETRA_MONITOR("EpetraCrsGraphT::isGloballyIndexed"); return graph_->IndicesAreGlobal(); }
455 
457  bool isFillComplete() const { XPETRA_MONITOR("EpetraCrsGraphT::isFillComplete"); return graph_->Filled(); }
458 
460  bool isStorageOptimized() const { XPETRA_MONITOR("EpetraCrsGraphT::isStorageOptimized"); return graph_->StorageOptimized(); }
461 
463  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const {
464  XPETRA_MONITOR("EpetraCrsGraphT::getGlobalRowView");
465 
466  int numEntries;
467  GlobalOrdinal * eIndices;
468 
469  XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
470  if (numEntries == 0) { eIndices = NULL; } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
471 
472  Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
473  }
474 
476  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices) const {
477  XPETRA_MONITOR("EpetraCrsGraphT::getLocalRowView");
478 
479  int numEntries;
480  int * eIndices;
481 
482  XPETRA_ERR_CHECK(graph_->ExtractMyRowView(LocalRow, numEntries, eIndices));
483  if (numEntries == 0) { eIndices = NULL; } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
484 
485  indices = ArrayView<const int>(eIndices, numEntries);
486  }
488 
490 
491 
493  std::string description() const { XPETRA_MONITOR("EpetraCrsGraphT::description"); return "NotImplemented"; }
494 
497  XPETRA_MONITOR("EpetraCrsGraphT::describe");
498 
499  out << "EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
500  const Epetra_BlockMap rowmap = graph_->RowMap();
501  if (rowmap.Comm().MyPID() == 0) out << "** EpetraCrsGraphT **\n\nrowmap" << std::endl;
502  rowmap.Print(out);
503  graph_->Print(out);
504  }
505 
507 
509  //{@
510 
512  Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getMap"); return toXpetra<GlobalOrdinal,Node>(graph_->Map()); }
513 
517  XPETRA_MONITOR("EpetraCrsGraphT::doImport");
518 
519  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
520  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
521 
522  RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
523  int err = graph_->Import(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
524  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
525  }
526 
530  XPETRA_MONITOR("EpetraCrsGraphT::doExport");
531 
532  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
533  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
534 
535  RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
536  int err = graph_->Export(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
537  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
538  }
539 
543  XPETRA_MONITOR("EpetraCrsGraphT::doImport");
544 
545  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
546  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
547 
548  RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
549  int err = graph_->Import(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
550  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
551 
552  }
553 
557  XPETRA_MONITOR("EpetraCrsGraphT::doExport");
558 
559  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
560  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
561 
562  RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
563  int err = graph_->Export(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
564  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
565  }
567 
569 
570 
572  EpetraCrsGraphT(const Teuchos::RCP<Epetra_CrsGraph> &graph) : graph_(graph) {
573  TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<GlobalOrdinal>(), std::runtime_error, "Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
574  }
575 
578 
580 
581 private:
582 
584 
585 
586 };
587 
588 #endif // specialization on Node=EpetraNode and GO=int
589 
590 // specialization on GO=long long and Node=EpetraNode
591 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
592 template<>
593 class EpetraCrsGraphT<long long, EpetraNode>
594 : public virtual CrsGraph<int, long long, EpetraNode>
595 {
596  typedef int LocalOrdinal;
597  typedef long long GlobalOrdinal;
598  typedef EpetraNode Node;
599 
602 
603 public:
604 
606 
607  EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const RCP< Teuchos::ParameterList > &plist=Teuchos::null)
609 : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), maxNumEntriesPerRow, toEpetra(pftype)))) { }
610 
611 
613  // Definition not in cpp, so comment out
614  //EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const RCP< ParameterList > &params=null);
615 
617  EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=null)
618  : graph_(Teuchos::rcp(new Epetra_CrsGraph(Copy, toEpetra<GlobalOrdinal,Node>(rowMap), toEpetra<GlobalOrdinal,Node>(colMap), maxNumEntriesPerRow, toEpetra(pftype)))) { }
619 
621  // Definition not in cpp, so comment out
622  //EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const RCP< ParameterList > &params=null);
623 
625  virtual ~EpetraCrsGraphT() { }
626 
628 
630 
631 
633  void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView<const GlobalOrdinal> &indices) {
634  XPETRA_MONITOR("EpetraCrsGraphT::insertGlobalIndices");
635 
636  GlobalOrdinal* indices_rawPtr = const_cast<GlobalOrdinal*>(indices.getRawPtr()); // there is no const in the Epetra interface :(
637  XPETRA_ERR_CHECK(graph_->InsertGlobalIndices(globalRow, indices.size(), indices_rawPtr));
638  }
639 
641  void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal> &indices) {
642  XPETRA_MONITOR("EpetraCrsGraphT::insertLocalIndices");
643 
644  int* indices_rawPtr = const_cast<int*>(indices.getRawPtr()); // there is no const in the Epetra interface :(
645  XPETRA_ERR_CHECK(graph_->InsertMyIndices(localRow, indices.size(), indices_rawPtr));
646  }
647 
649  void removeLocalIndices(LocalOrdinal localRow) { XPETRA_MONITOR("EpetraCrsGraphT::removeLocalIndices"); graph_->RemoveMyIndices(localRow); }
650 
652 
654 
655 
657  void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null){
658  XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
659 
660  graph_->FillComplete(toEpetra<GlobalOrdinal,Node>(domainMap), toEpetra<GlobalOrdinal,Node>(rangeMap));
661  bool doOptimizeStorage = true;
662  if (params != null && params->get("Optimize Storage",true) == false) doOptimizeStorage = false;
663  if (doOptimizeStorage) graph_->OptimizeStorage();
664  }
665 
667  void fillComplete(const RCP< ParameterList > &params=null) {
668  XPETRA_MONITOR("EpetraCrsGraphT::fillComplete");
669 
670  graph_->FillComplete();
671  bool doOptimizeStorage = true;
672  if (params != null && params->get("Optimize Storage",true) == false) doOptimizeStorage = false;
673  if (doOptimizeStorage) graph_->OptimizeStorage();
674  }
676 
678 
679 
682  XPETRA_MONITOR("EpetraCrsGraphT::getComm");
683  return toXpetra (graph_->Comm ());
684  }
685 
687  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getRowMap"); return toXpetra<GlobalOrdinal,Node>(graph_->RowMap()); }
688 
690  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getColMap"); return toXpetra<GlobalOrdinal,Node>(graph_->ColMap()); }
691 
693  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getDomainMap"); return toXpetra<GlobalOrdinal,Node>(graph_->DomainMap()); }
694 
696  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getRangeMap"); return toXpetra<GlobalOrdinal,Node>(graph_->RangeMap()); }
697 
699  RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const { XPETRA_MONITOR("EpetraCrsGraphT::getImporter"); return toXpetra<GlobalOrdinal,Node>(graph_->Importer()); }
700 
702  RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const { XPETRA_MONITOR("EpetraCrsGraphT::getExporter"); return toXpetra<GlobalOrdinal,Node>(graph_->Exporter()); }
703 
705  global_size_t getGlobalNumRows() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumRows"); return graph_->NumGlobalRows64(); }
706 
708  global_size_t getGlobalNumCols() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumCols"); return graph_->NumGlobalCols64(); }
709 
711  size_t getNodeNumRows() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumRows"); return graph_->NumMyRows(); }
712 
714  size_t getNodeNumCols() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumCols"); return graph_->NumMyCols(); }
715 
717  GlobalOrdinal getIndexBase() const { XPETRA_MONITOR("EpetraCrsGraphT::getIndexBase"); return (GlobalOrdinal) graph_->IndexBase64(); }
718 
720  global_size_t getGlobalNumEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumEntries"); return graph_->NumGlobalEntries64(); }
721 
723  size_t getNodeNumEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumEntries"); return graph_->NumMyEntries(); }
724 
726  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInGlobalRow"); return graph_->NumGlobalIndices(globalRow); }
727 
729  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumEntriesInLocalRow"); return graph_->NumMyIndices(localRow); }
730 
732  size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInGlobalRow"); return graph_->NumAllocatedGlobalIndices(globalRow); }
733 
735  size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { XPETRA_MONITOR("EpetraCrsGraphT::getNumAllocatedEntriesInLocalRow"); return graph_->NumAllocatedMyIndices(localRow); }
736 
738  global_size_t getGlobalNumDiags() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalNumDiags"); return graph_->NumGlobalDiagonals64(); }
739 
741  size_t getNodeNumDiags() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeNumDiags"); return graph_->NumMyDiagonals(); }
742 
744  size_t getGlobalMaxNumRowEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getGlobalMaxNumRowEntries"); return graph_->GlobalMaxNumIndices(); }
745 
747  size_t getNodeMaxNumRowEntries() const { XPETRA_MONITOR("EpetraCrsGraphT::getNodeMaxNumRowEntries"); return graph_->MaxNumIndices(); }
748 
750  bool hasColMap() const { XPETRA_MONITOR("EpetraCrsGraphT::hasColMap"); return graph_->HaveColMap(); }
751 
753  bool isLowerTriangular() const { XPETRA_MONITOR("EpetraCrsGraphT::isLowerTriangular"); return graph_->LowerTriangular(); }
754 
756  bool isUpperTriangular() const { XPETRA_MONITOR("EpetraCrsGraphT::isUpperTriangular"); return graph_->UpperTriangular(); }
757 
759  bool isLocallyIndexed() const { XPETRA_MONITOR("EpetraCrsGraphT::isLocallyIndexed"); return graph_->IndicesAreLocal(); }
760 
762  bool isGloballyIndexed() const { XPETRA_MONITOR("EpetraCrsGraphT::isGloballyIndexed"); return graph_->IndicesAreGlobal(); }
763 
765  bool isFillComplete() const { XPETRA_MONITOR("EpetraCrsGraphT::isFillComplete"); return graph_->Filled(); }
766 
768  bool isStorageOptimized() const { XPETRA_MONITOR("EpetraCrsGraphT::isStorageOptimized"); return graph_->StorageOptimized(); }
769 
771  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView<const GlobalOrdinal> &Indices) const {
772  XPETRA_MONITOR("EpetraCrsGraphT::getGlobalRowView");
773 
774  int numEntries;
775  GlobalOrdinal * eIndices;
776 
777  XPETRA_ERR_CHECK(graph_->ExtractGlobalRowView(GlobalRow, numEntries, eIndices));
778  if (numEntries == 0) { eIndices = NULL; } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
779 
780  Indices = ArrayView<const GlobalOrdinal>(eIndices, numEntries);
781  }
782 
784  void getLocalRowView(LocalOrdinal LocalRow, ArrayView<const LocalOrdinal> &indices) const {
785  XPETRA_MONITOR("EpetraCrsGraphT::getLocalRowView");
786 
787  int numEntries;
788  int * eIndices;
789 
790  XPETRA_ERR_CHECK(graph_->ExtractMyRowView(LocalRow, numEntries, eIndices));
791  if (numEntries == 0) { eIndices = NULL; } // Cf. TEUCHOS_TEST_FOR_EXCEPT( p == 0 && size_in != 0 ) in Teuchos ArrayView constructor.
792 
793  indices = ArrayView<const int>(eIndices, numEntries);
794  }
796 
798 
799 
801  std::string description() const { XPETRA_MONITOR("EpetraCrsGraphT::description"); return "NotImplemented"; }
802 
805  XPETRA_MONITOR("EpetraCrsGraphT::describe");
806 
807  out << "EpetraCrsGraphT::describe : Warning, verbosity level is ignored by this method." << std::endl;
808  const Epetra_BlockMap rowmap = graph_->RowMap();
809  if (rowmap.Comm().MyPID() == 0) out << "** EpetraCrsGraphT **\n\nrowmap" << std::endl;
810  rowmap.Print(out);
811  graph_->Print(out);
812  }
813 
815 
817  //{@
818 
820  Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { XPETRA_MONITOR("EpetraCrsGraphT::getMap"); return toXpetra<GlobalOrdinal,Node>(graph_->Map()); }
821 
825  XPETRA_MONITOR("EpetraCrsGraphT::doImport");
826 
827  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
828  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
829 
830  RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
831  int err = graph_->Import(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
832  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
833  }
834 
838  XPETRA_MONITOR("EpetraCrsGraphT::doExport");
839 
840  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
841  XPETRA_DYNAMIC_CAST(const EpetraImportT<GlobalOrdinal COMMA Node>, importer, tImporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
842 
843  RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
844  int err = graph_->Export(*v, *tImporter.getEpetra_Import(), toEpetra(CM));
845  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
846  }
847 
851  XPETRA_MONITOR("EpetraCrsGraphT::doImport");
852 
853  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal COMMA Node>, source, tSource, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
854  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
855 
856  RCP<const Epetra_CrsGraph> v = tSource.getEpetra_CrsGraph();
857  int err = graph_->Import(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
858  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
859 
860  }
861 
865  XPETRA_MONITOR("EpetraCrsGraphT::doExport");
866 
867  XPETRA_DYNAMIC_CAST(const EpetraCrsGraphT<GlobalOrdinal COMMA Node>, dest, tDest, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraCrsGraphT as input arguments.");
868  XPETRA_DYNAMIC_CAST(const EpetraExportT<GlobalOrdinal COMMA Node>, exporter, tExporter, "Xpetra::EpetraCrsGraphT::doImport only accept Xpetra::EpetraImportT as input arguments.");
869 
870  RCP<const Epetra_CrsGraph> v = tDest.getEpetra_CrsGraph();
871  int err = graph_->Export(*v, *tExporter.getEpetra_Export(), toEpetra(CM));
872  TEUCHOS_TEST_FOR_EXCEPTION(err != 0, std::runtime_error, "Catch error code returned by Epetra.");
873  }
875 
877 
878 
880  EpetraCrsGraphT(const Teuchos::RCP<Epetra_CrsGraph> &graph) : graph_(graph) {
881  TEUCHOS_TEST_FOR_EXCEPTION(!graph->RowMap().GlobalIndicesIsType<GlobalOrdinal>(), std::runtime_error, "Xpetra::EpetraCrsGraphT: GlobalOrdinal mismatch.");
882  }
883 
886 
888 
889 private:
890 
892 
893 
894 };
895 #endif // specialization on Node=EpetraNode and GO=int
896 
897 } // Xpetra namespace
898 
899 #endif // XPETRA_EPETRACRSGRAPH_HPP
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=null)
Constructor specifying column Map and fixed number of entries for each row.
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
size_t getNodeNumRows() const
Returns the number of graph rows owned on the calling node.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
size_t getNodeNumRows() const
Returns the number of graph rows owned on the calling node.
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row ...
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
EpetraCrsGraphT(const Teuchos::RCP< Epetra_CrsGraph > &graph)
EpetraCrsGraphT constructor to wrap a Epetra_CrsGraph object.
RCP< const Epetra_CrsGraph > getEpetra_CrsGraph() const
Get the underlying Epetra graph.
size_t getNodeMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this 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< ParameterList > &params=null)
Signal that data entry is complete.
size_t getNodeNumEntries() const
Returns the local number of entries in the graph.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
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, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=null)
Constructor specifying column Map and fixed number of entries for each row.
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
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.
Xpetra namespace
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
size_type size() const
RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
bool hasColMap() const
Whether the graph has a column Map.
Exception throws to report errors in the internal logical of the program.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this graph.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
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 getNodeNumEntries() const
Returns the local number of entries in the graph.
bool isUpperTriangular() const
Whether the graph is locally upper triangular.
RCP< const Comm< int > > getComm() const
Returns the communicator.
EpetraCrsGraphT(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const Teuchos::RCP< Teuchos::ParameterList > &plist=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.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global 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 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.
bool isUpperTriangular() const
Whether the graph is locally upper triangular.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row ...
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
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.
bool isLowerTriangular() const
Whether the graph is locally lower triangular.
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
EpetraCrsGraphT(const Teuchos::RCP< Epetra_CrsGraph > &graph)
EpetraCrsGraphT constructor to wrap a Epetra_CrsGraph object.
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
RCP< const Comm< int > > getComm() const
Returns the communicator.
global_size_t getGlobalNumDiags() const
Returns the number of global diagonal entries, based on global row/column index comparisons.
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row...
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
#define XPETRA_ERR_CHECK(arg)
global_size_t getGlobalNumDiags() const
Returns the number of global diagonal entries, based on global row/column index comparisons.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
bool hasColMap() const
Whether the graph has a column Map.
RCP< const Epetra_CrsGraph > getEpetra_CrsGraph() const
Get the underlying Epetra graph.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
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.
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
std::string description() const
Return a simple one-line description of this object.
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.
global_size_t getGlobalNumDiags() const
Returns the number of global diagonal entries, based on global row/column index comparisons.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
size_t getNodeNumDiags() const
Returns the number of local diagonal entries, based on global row/column index comparisons.
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
bool isStorageOptimized() const
Returns true if storage has been optimized.
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.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
RCP< const Comm< int > > getComm() const
Returns the communicator.
T * getRawPtr() const
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
size_t global_size_t
Global size_t object.
std::string description() const
Return a simple one-line description of this object.
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.
size_t getNodeNumDiags() const
Returns the number of local diagonal entries, based on global row/column index comparisons.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
static const EVerbosityLevel verbLevel_default
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
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 > > getDomainMap() const
Returns the Map associated with the domain of this graph.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
size_t getNodeMaxNumRowEntries() 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.
bool isLowerTriangular() const
Whether the graph is locally lower triangular.
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
std::string description() const
Return a simple one-line description of this object.
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
size_t getNodeMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
EpetraCrsGraphT(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const RCP< Teuchos::ParameterList > &plist=Teuchos::null)
Constructor specifying fixed number of entries for each row.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
RCP< const Epetra_CrsGraph > getEpetra_CrsGraph() const
Get the underlying Epetra graph.
bool isLowerTriangular() const
Whether the graph is locally lower triangular.
virtual ~EpetraCrsGraphT()
Destructor.
Copy
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row...
RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
bool hasColMap() const
Whether the graph has a column Map.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
The specialization of Map used by this class.
CombineMode
Xpetra::Combine Mode enumerable type.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
#define XPETRA_MONITOR(funcName)
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this graph.
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 Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
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.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this graph.
bool isStorageOptimized() const
Returns true if storage has been optimized.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
bool isUpperTriangular() const
Whether the graph is locally upper triangular.
EpetraCrsGraphT(const Teuchos::RCP< Epetra_CrsGraph > &graph)
EpetraCrsGraphT constructor to wrap a Epetra_CrsGraph object.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row...
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 Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
size_t getNodeNumDiags() const
Returns the number of local diagonal entries, based on global row/column index comparisons.
size_t getNodeNumEntries() const
Returns the local number of entries in the graph.
bool isStorageOptimized() const
Returns true if storage has been optimized.