Xpetra  Version of the Day
Xpetra_TpetraCrsGraph_def.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_TPETRACRSGRAPH_DEF_HPP
47 #define XPETRA_TPETRACRSGRAPH_DEF_HPP
49 #include "Xpetra_Exceptions.hpp"
50 
51 #include "Tpetra_CrsGraph.hpp"
52 
53 #include "Xpetra_CrsGraph.hpp"
55 #include "Xpetra_Utils.hpp"
56 #include "Xpetra_TpetraMap.hpp"
57 #include "Xpetra_TpetraImport.hpp"
58 #include "Xpetra_TpetraExport.hpp"
59 
60 
61 namespace Xpetra {
62 
63 
64 template<class LocalOrdinal, class GlobalOrdinal, class Node>
65 TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::TpetraCrsGraph(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params)
66 : graph_(Teuchos::rcp(new Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >(toTpetra(rowMap), maxNumEntriesPerRow, Tpetra::StaticProfile, params))) { }
67 
68 template<class LocalOrdinal, class GlobalOrdinal, class Node>
69 TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::TpetraCrsGraph(const RCP< const Map > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params)
70 : graph_(Teuchos::rcp(new Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >(toTpetra(rowMap), NumEntriesPerRowToAlloc(), Tpetra::StaticProfile, params))) { }
71 
72 template<class LocalOrdinal, class GlobalOrdinal, class Node>
73 TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::TpetraCrsGraph(const RCP< const Map>&rowMap, const RCP< const Map > &colMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params)
74 : graph_(Teuchos::rcp(new Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >(toTpetra(rowMap), toTpetra(colMap), maxNumEntriesPerRow, Tpetra::StaticProfile, params))) { }
75 
76 template<class LocalOrdinal, class GlobalOrdinal, class Node>
77 TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::TpetraCrsGraph(const RCP< const Map > &rowMap, const RCP< const Map > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params)
78 : graph_(Teuchos::rcp(new Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >(toTpetra(rowMap), toTpetra(colMap), NumEntriesPerRowToAlloc(), Tpetra::StaticProfile, params))) { }
79 
80 
81 template <class LocalOrdinal, class GlobalOrdinal, class Node>
83 TpetraCrsGraph(const Teuchos::RCP<const CrsGraph >& sourceGraph,
84  const Import & importer,
85  const Teuchos::RCP<const Map >& domainMap,
86  const Teuchos::RCP<const Map >& rangeMap,
87  const Teuchos::RCP<Teuchos::ParameterList>& params)
88 {
89  typedef Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node> MyTpetraCrsGraph;
90  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, *sourceGraph, tSourceGraph, "Xpetra::TpetraCrsMatrix constructor only accepts Xpetra::TpetraCrsMatrix as the input argument.");//TODO: remove and use toTpetra()
91  RCP< const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tSourceGraph.getTpetra_CrsGraph();
92 
93  RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myDomainMap = domainMap!=Teuchos::null ? toTpetra(domainMap) : Teuchos::null;
94  RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > myRangeMap = rangeMap!=Teuchos::null ? toTpetra(rangeMap) : Teuchos::null;
95  graph_=Tpetra::importAndFillCompleteCrsGraph<MyTpetraCrsGraph>(v,toTpetra(importer),myDomainMap,myRangeMap,params);
96  bool restrictComm=false;
97  if(!params.is_null()) restrictComm = params->get("Restrict Communicator",restrictComm);
98  if(restrictComm && graph_->getRowMap().is_null()) graph_=Teuchos::null;
99 
100 }
101 
102 
103 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
104 template<class LocalOrdinal, class GlobalOrdinal, class Node>
106 TpetraCrsGraph(const Teuchos::RCP< const Map > &rowMap,
107  const Teuchos::RCP< const Map > &colMap,
108  const typename local_graph_type::row_map_type& rowPointers,
109  const typename local_graph_type::entries_type::non_const_type& columnIndices,
110  const Teuchos::RCP< Teuchos::ParameterList > &plist)
111  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), rowPointers, columnIndices, plist))) { }
112 
113 
114 template<class LocalOrdinal, class GlobalOrdinal, class Node>
116 TpetraCrsGraph(const Teuchos::RCP<const map_type>& rowMap,
117  const Teuchos::RCP<const map_type>& colMap,
118  const local_graph_type& lclGraph,
119  const Teuchos::RCP<Teuchos::ParameterList>& params)
120  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), lclGraph, params))) { }
121 
122 template<class LocalOrdinal, class GlobalOrdinal, class Node>
124 TpetraCrsGraph(const local_graph_type& lclGraph,
125  const Teuchos::RCP<const map_type>& rowMap,
126  const Teuchos::RCP<const map_type>& colMap,
127  const Teuchos::RCP<const map_type>& domainMap,
128  const Teuchos::RCP<const map_type>& rangeMap,
129  const Teuchos::RCP<Teuchos::ParameterList>& params)
130  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(lclGraph, toTpetra(rowMap), toTpetra(colMap), toTpetra(domainMap), toTpetra(rangeMap), params))) { }
131 #endif
132 
133 template<class LocalOrdinal, class GlobalOrdinal, class Node>
135 TpetraCrsGraph(const Teuchos::RCP< const Map > &rowMap,
136  const Teuchos::RCP< const Map > &colMap,
137  const Teuchos::ArrayRCP<size_t>& rowPointers,
138  const Teuchos::ArrayRCP<LocalOrdinal>& columnIndices,
139  const Teuchos::RCP<Teuchos::ParameterList>& params)
140  : graph_(Teuchos::rcp(new Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node>(toTpetra(rowMap), toTpetra(colMap), rowPointers, columnIndices, params))) { }
141 
142 
143 template<class LocalOrdinal, class GlobalOrdinal, class Node>
145 
146 template<class LocalOrdinal, class GlobalOrdinal, class Node>
147 void TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
148 { XPETRA_MONITOR("TpetraCrsGraph::insertGlobalIndices"); graph_->insertGlobalIndices(globalRow, indices); }
149 
150 template<class LocalOrdinal, class GlobalOrdinal, class Node>
151 void TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
152 { XPETRA_MONITOR("TpetraCrsGraph::insertLocalIndices"); graph_->insertLocalIndices(localRow, indices); }
153 
154 template<class LocalOrdinal, class GlobalOrdinal, class Node>
156 { XPETRA_MONITOR("TpetraCrsGraph::removeLocalIndices"); graph_->removeLocalIndices(localRow); }
157 
158 template<class LocalOrdinal, class GlobalOrdinal, class Node>
160 allocateAllIndices(size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind) {
161  rowptr.resize(getNodeNumRows()+1); colind.resize(numNonZeros);
162 }
163 
164 template<class LocalOrdinal, class GlobalOrdinal, class Node>
166 setAllIndices(const ArrayRCP<size_t> & rowptr, const ArrayRCP<LocalOrdinal> & colind) {
167  graph_->setAllIndices(rowptr,colind);
168 }
169 
170 template<class LocalOrdinal, class GlobalOrdinal, class Node>
172 getAllIndices(ArrayRCP<const size_t>& rowptr, ArrayRCP<const LocalOrdinal>& colind) const {
173  rowptr = graph_->getNodeRowPtrs();
174  colind = graph_->getNodePackedIndices();
175 }
176 
177 template<class LocalOrdinal, class GlobalOrdinal, class Node>
178 void TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::fillComplete(const RCP< const Map > &domainMap, const RCP< const Map > &rangeMap, const RCP< ParameterList > &params)
179 { XPETRA_MONITOR("TpetraCrsGraph::fillComplete"); graph_->fillComplete(toTpetra(domainMap), toTpetra(rangeMap), params); }
180 
181 template<class LocalOrdinal, class GlobalOrdinal, class Node>
183 { XPETRA_MONITOR("TpetraCrsGraph::fillComplete"); graph_->fillComplete(params); }
184 
185 template<class LocalOrdinal, class GlobalOrdinal, class Node>
187 expertStaticFillComplete (const Teuchos::RCP<const map_type>& domainMap,
188  const Teuchos::RCP<const map_type>& rangeMap,
189  const Teuchos::RCP<const Import>& importer,
190  const Teuchos::RCP<const Export>& exporter,
191  const Teuchos::RCP<Teuchos::ParameterList>& params) {
192  XPETRA_MONITOR("TpetraCrsGraph::expertStaticFillComplete");
193  RCP<const Tpetra::Import<LocalOrdinal,GlobalOrdinal,Node> > myImport;
194  RCP<const Tpetra::Export<LocalOrdinal,GlobalOrdinal,Node> > myExport;
195 
196  if(importer!=Teuchos::null) {
197  XPETRA_DYNAMIC_CAST( const TpetraImportClass , *importer, tImporter, "Xpetra::TpetraCrsGraph::expertStaticFillComplete only accepts Xpetra::TpetraImport.");
198  myImport = tImporter.getTpetra_Import();
199  }
200  if(exporter!=Teuchos::null) {
201  XPETRA_DYNAMIC_CAST( const TpetraExportClass , *exporter, tExporter, "Xpetra::TpetraCrsGraph::expertStaticFillComplete only accepts Xpetra::TpetraExport.");
202  myExport = tExporter.getTpetra_Export();
203  }
204 
205  graph_->expertStaticFillComplete(toTpetra(domainMap),toTpetra(rangeMap),myImport,myExport,params);
206 }
207 
208 
209 template<class LocalOrdinal, class GlobalOrdinal, class Node>
211 { XPETRA_MONITOR("TpetraCrsGraph::getComm"); return graph_->getComm(); }
212 
213 template<class LocalOrdinal, class GlobalOrdinal, class Node>
214 RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::getRowMap() const
215 { XPETRA_MONITOR("TpetraCrsGraph::getRowMap"); return toXpetra(graph_->getRowMap()); }
216 
217 template<class LocalOrdinal, class GlobalOrdinal, class Node>
218 RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::getColMap() const
219 { XPETRA_MONITOR("TpetraCrsGraph::getColMap"); return toXpetra(graph_->getColMap()); }
220 
221 template<class LocalOrdinal, class GlobalOrdinal, class Node>
222 RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::getDomainMap() const
223 { XPETRA_MONITOR("TpetraCrsGraph::getDomainMap"); return toXpetra(graph_->getDomainMap()); }
224 
225 template<class LocalOrdinal, class GlobalOrdinal, class Node>
226 RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::getRangeMap() const
227 { XPETRA_MONITOR("TpetraCrsGraph::getRangeMap"); return toXpetra(graph_->getRangeMap()); }
228 
229 template<class LocalOrdinal, class GlobalOrdinal, class Node>
230 RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::getImporter() const
231 { XPETRA_MONITOR("TpetraCrsGraph::getImporter"); return toXpetra(graph_->getImporter()); }
232 
233 template<class LocalOrdinal, class GlobalOrdinal, class Node>
234 RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::getExporter() const
235 { XPETRA_MONITOR("TpetraCrsGraph::getExporter"); return toXpetra(graph_->getExporter()); }
236 
237 template<class LocalOrdinal, class GlobalOrdinal, class Node>
239 { XPETRA_MONITOR("TpetraCrsGraph::getGlobalNumRows"); return graph_->getGlobalNumRows(); }
240 
241 template<class LocalOrdinal, class GlobalOrdinal, class Node>
243 { XPETRA_MONITOR("TpetraCrsGraph::getGlobalNumCols"); return graph_->getGlobalNumCols(); }
244 
245 template<class LocalOrdinal, class GlobalOrdinal, class Node>
247 { XPETRA_MONITOR("TpetraCrsGraph::getNodeNumRows"); return graph_->getNodeNumRows(); }
248 
249 template<class LocalOrdinal, class GlobalOrdinal, class Node>
251 { XPETRA_MONITOR("TpetraCrsGraph::getNodeNumCols"); return graph_->getNodeNumCols(); }
252 
253 template<class LocalOrdinal, class GlobalOrdinal, class Node>
255 { XPETRA_MONITOR("TpetraCrsGraph::getIndexBase"); return graph_->getIndexBase(); }
256 
257 template<class LocalOrdinal, class GlobalOrdinal, class Node>
259 { XPETRA_MONITOR("TpetraCrsGraph::getGlobalNumEntries"); return graph_->getGlobalNumEntries(); }
260 
261 template<class LocalOrdinal, class GlobalOrdinal, class Node>
263 { XPETRA_MONITOR("TpetraCrsGraph::getNodeNumEntries"); return graph_->getNodeNumEntries(); }
264 
265 template<class LocalOrdinal, class GlobalOrdinal, class Node>
267 { XPETRA_MONITOR("TpetraCrsGraph::getNumEntriesInGlobalRow"); return graph_->getNumEntriesInGlobalRow(globalRow); }
268 
269 template<class LocalOrdinal, class GlobalOrdinal, class Node>
271 { XPETRA_MONITOR("TpetraCrsGraph::getNumEntriesInLocalRow"); return graph_->getNumEntriesInLocalRow(localRow); }
272 
273 template<class LocalOrdinal, class GlobalOrdinal, class Node>
275 { XPETRA_MONITOR("TpetraCrsGraph::getNumAllocatedEntriesInGlobalRow"); return graph_->getNumAllocatedEntriesInGlobalRow(globalRow); }
276 
277 template<class LocalOrdinal, class GlobalOrdinal, class Node>
279 { XPETRA_MONITOR("TpetraCrsGraph::getNumAllocatedEntriesInLocalRow"); return graph_->getNumAllocatedEntriesInLocalRow(localRow); }
280 
281 template<class LocalOrdinal, class GlobalOrdinal, class Node>
283 { XPETRA_MONITOR("TpetraCrsGraph::getGlobalMaxNumRowEntries"); return graph_->getGlobalMaxNumRowEntries(); }
284 
285 template<class LocalOrdinal, class GlobalOrdinal, class Node>
287 { XPETRA_MONITOR("TpetraCrsGraph::getNodeMaxNumRowEntries"); return graph_->getNodeMaxNumRowEntries(); }
288 
289 template<class LocalOrdinal, class GlobalOrdinal, class Node>
291 { XPETRA_MONITOR("TpetraCrsGraph::hasColMap"); return graph_->hasColMap(); }
292 
293 template<class LocalOrdinal, class GlobalOrdinal, class Node>
295 { XPETRA_MONITOR("TpetraCrsGraph::isLocallyIndexed"); return graph_->isLocallyIndexed(); }
296 
297 template<class LocalOrdinal, class GlobalOrdinal, class Node>
299 { XPETRA_MONITOR("TpetraCrsGraph::isGloballyIndexed"); return graph_->isGloballyIndexed(); }
300 
301 template<class LocalOrdinal, class GlobalOrdinal, class Node>
303 { XPETRA_MONITOR("TpetraCrsGraph::isFillComplete"); return graph_->isFillComplete(); }
304 
305 template<class LocalOrdinal, class GlobalOrdinal, class Node>
307 { XPETRA_MONITOR("TpetraCrsGraph::isStorageOptimized"); return graph_->isStorageOptimized(); }
308 
309 template<class LocalOrdinal, class GlobalOrdinal, class Node>
310 void TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
311 {
312  XPETRA_MONITOR("TpetraCrsGraph::getGlobalRowView");
313  typename Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node>::global_inds_host_view_type indices;
314  graph_->getGlobalRowView(GlobalRow, indices);
315  Indices = ArrayView<const GlobalOrdinal> (indices.data(), indices.extent(0));
316 }
317 
318 template<class LocalOrdinal, class GlobalOrdinal, class Node>
319 void TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &Indices) const
320 {
321  XPETRA_MONITOR("TpetraCrsGraph::getLocalRowView");
322  typename Tpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node>::local_inds_host_view_type indices;
323  graph_->getLocalRowView(LocalRow, indices);
324  Indices = ArrayView<const LocalOrdinal> (indices.data(), indices.extent(0));
325 }
326 
327 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
328 template<class LocalOrdinal, class GlobalOrdinal, class Node>
330  return getTpetra_CrsGraph()->getLocalGraphHost();
331 }
332 
333 template<class LocalOrdinal, class GlobalOrdinal, class Node>
334 typename Xpetra::CrsGraph<LocalOrdinal,GlobalOrdinal,Node>::local_graph_type TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::getLocalGraphDevice () const {
335  return getTpetra_CrsGraph()->getLocalGraphDevice();
336 }
337 #endif
338 
339 template<class LocalOrdinal, class GlobalOrdinal, class Node>
341  // mfh 07 May 2018: See GitHub Issue #2565.
342  graph_->computeGlobalConstants();
343  }
344 
345 template<class LocalOrdinal, class GlobalOrdinal, class Node>
347 { XPETRA_MONITOR("TpetraCrsGraph::description"); return graph_->description(); }
348 
349 template<class LocalOrdinal, class GlobalOrdinal, class Node>
350 void TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
351 { XPETRA_MONITOR("TpetraCrsGraph::describe"); graph_->describe(out, verbLevel); }
352 
353 template<class LocalOrdinal, class GlobalOrdinal, class Node>
355 { XPETRA_MONITOR("TpetraCrsGraph::getNodeRowPtrs"); return graph_->getNodeRowPtrs(); }
356 
357 template<class LocalOrdinal, class GlobalOrdinal, class Node>
358 Teuchos::RCP< const Map<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::getMap() const
359 { XPETRA_MONITOR("TpetraCrsGraph::getMap"); return rcp( new TpetraMap(graph_->getMap()) ); }
360 
361 template<class LocalOrdinal, class GlobalOrdinal, class Node>
363  const Import &importer, CombineMode CM){
364  XPETRA_MONITOR("TpetraCrsGraph::doImport");
365 
366  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, source, tSource, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments.");//TODO: remove and use toTpetra()
367  RCP< const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_CrsGraph();
368  //graph_->doImport(toTpetraCrsGraph(source), *tImporter.getTpetra_Import(), toTpetra(CM));
369 
370  graph_->doImport(*v, toTpetra(importer), toTpetra(CM));
371 }
372 
373 template<class LocalOrdinal, class GlobalOrdinal, class Node>
375  const Import& importer, CombineMode CM) {
376  XPETRA_MONITOR("TpetraCrsGraph::doExport");
377 
378  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, dest, tDest, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments.");//TODO: remove and use toTpetra()
379  RCP< const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_CrsGraph();
380  graph_->doExport(*v, toTpetra(importer), toTpetra(CM));
381 
382 }
383 
384 template<class LocalOrdinal, class GlobalOrdinal, class Node>
386  const Export& exporter, CombineMode CM){
387  XPETRA_MONITOR("TpetraCrsGraph::doImport");
388 
389  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, source, tSource, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments.");//TODO: remove and use toTpetra()
390  RCP< const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_CrsGraph();
391 
392  graph_->doImport(*v, toTpetra(exporter), toTpetra(CM));
393 
394 }
395 
396 template<class LocalOrdinal, class GlobalOrdinal, class Node>
398  const Export& exporter, CombineMode CM) {
399  XPETRA_MONITOR("TpetraCrsGraph::doExport");
400 
401  XPETRA_DYNAMIC_CAST(const TpetraCrsGraphClass, dest, tDest, "Xpetra::TpetraCrsGraph::doImport only accept Xpetra::TpetraCrsGraph as input arguments.");//TODO: remove and use toTpetra()
402  RCP< const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_CrsGraph();
403 
404  graph_->doExport(*v, toTpetra(exporter), toTpetra(CM));
405 
406 }
407 
408 template<class LocalOrdinal, class GlobalOrdinal, class Node>
409 TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::TpetraCrsGraph(const Teuchos::RCP<Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > &graph) : graph_(graph)
410 { }
411 
412 template<class LocalOrdinal, class GlobalOrdinal, class Node>
413 RCP< const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,Node>::getTpetra_CrsGraph() const
414 { return graph_; }
415 
416 
417 
418 
419 #ifdef HAVE_XPETRA_EPETRA
420 
421 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
422  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
423 
424  // specialization of TpetraCrsGraph for GO=LO=int
425  template <>
426  class TpetraCrsGraph<int,int,EpetraNode>
427  : public CrsGraph<int,int,EpetraNode>
428  {
429  typedef int LocalOrdinal;
430  typedef int GlobalOrdinal;
431  typedef EpetraNode Node;
432 
433  // The following typedef is used by the XPETRA_DYNAMIC_CAST() macro.
436 
437  public:
438 
440 
441 
443  TpetraCrsGraph(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null) {
445  }
446 
448  TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null) {
450  }
451 
453  TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null) {
455  }
456 
458  TpetraCrsGraph(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) {
460  }
461 
462 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
463  TpetraCrsGraph(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap,
483  const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
484  const typename local_graph_type::row_map_type& rowPointers,
485  const typename local_graph_type::entries_type::non_const_type& columnIndices,
486  const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
489  "int",
490  typeid(EpetraNode).name());
491  }
492 
511  TpetraCrsGraph(const Teuchos::RCP<const map_type>& rowMap,
512  const Teuchos::RCP<const map_type>& colMap,
513  const local_graph_type& lclGraph,
514  const Teuchos::RCP<Teuchos::ParameterList>& params) {
515  XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(),
516  typeid(TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(),
517  "int",
518  typeid(EpetraNode).name());
519  }
520 
545  TpetraCrsGraph(const local_graph_type& lclGraph,
546  const Teuchos::RCP<const map_type>& rowMap,
547  const Teuchos::RCP<const map_type>& colMap,
548  const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
549  const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
550  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
551  XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(),
552  typeid(TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(),
553  "int",
554  typeid(EpetraNode).name());
555  }
556 #endif
557 
559  virtual ~TpetraCrsGraph() { }
560 
562 
564 
565 
567  void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices) { }
568 
570  void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices) { }
571 
573  void removeLocalIndices(LocalOrdinal localRow) { }
574 
576  void allocateAllIndices(size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind){ }
577 
579  void setAllIndices(const ArrayRCP<size_t> & rowptr, const ArrayRCP<LocalOrdinal> & colind){ }
580 
582  void getAllIndices(ArrayRCP<const size_t>& rowptr, ArrayRCP<const LocalOrdinal>& colind) const{ }
583 
584 
586 
588 
589 
591  void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null) { }
592 
594  void fillComplete(const RCP< ParameterList > &params=null) { }
595 
597  void expertStaticFillComplete (const Teuchos::RCP<const map_type>& domainMap,
598  const Teuchos::RCP<const map_type>& rangeMap,
599  const Teuchos::RCP<const Import< LocalOrdinal, GlobalOrdinal, Node > >& importer = null,
600  const Teuchos::RCP<const Export< LocalOrdinal, GlobalOrdinal, Node > >& exporter = null,
601  const Teuchos::RCP<Teuchos::ParameterList>& params=null){ }
602 
604 
606 
607 
609  RCP< const Comm< int > > getComm() const { return Teuchos::null; }
610 
612  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { return Teuchos::null; }
613 
615  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { return Teuchos::null; }
616 
618  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const { return Teuchos::null; }
619 
621  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const { return Teuchos::null; }
622 
624  RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const { return Teuchos::null; }
625 
627  RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const { return Teuchos::null; }
628 
630  global_size_t getGlobalNumRows() const { return 0; }
631 
633  global_size_t getGlobalNumCols() const { return 0; }
634 
636  size_t getNodeNumRows() const { return 0; }
637 
639  size_t getNodeNumCols() const { return 0; }
640 
642  GlobalOrdinal getIndexBase() const { return 0; }
643 
645  global_size_t getGlobalNumEntries() const { return 0; }
646 
648  size_t getNodeNumEntries() const { return 0; }
649 
651  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
652 
654  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
655 
657  size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
658 
660  size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
661 
663  size_t getGlobalMaxNumRowEntries() const { return 0; }
664 
666  size_t getNodeMaxNumRowEntries() const { return 0; }
667 
669  bool hasColMap() const { return false; }
670 
672  bool isLocallyIndexed() const { return false; }
673 
675  bool isGloballyIndexed() const { return false; }
676 
678  bool isFillComplete() const { return false; }
679 
681  bool isStorageOptimized() const { return false; }
682 
684  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const { }
685 
687  void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const { }
688 
689 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
690  local_graph_type getLocalGraph () const {
692  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
693  "Epetra does not support Kokkos::StaticCrsGraph!");
694  TEUCHOS_UNREACHABLE_RETURN((local_graph_type()));
695  }
696 #endif
697 
700 
702 
704 
705 
707  std::string description() const { return std::string(""); }
708 
710  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const { }
711 
713 
715 
716 
718  ArrayRCP< const size_t > getNodeRowPtrs() const { return Teuchos::ArrayRCP< const size_t>(); }
719 
721 
723  //{@
724 
726  Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { return Teuchos::null; }
727 
731 
735 
739 
743 
744  // @}
745 
747 
748 
750  TpetraCrsGraph(const Teuchos::RCP<Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > &graph) {
752  }
753 
755  RCP< const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > getTpetra_CrsGraph() const { return Teuchos::null; }
756 
758  }; // TpetraCrsGraph class (specialization for LO=GO=int and NO=EpetraNode)
759 #endif
760 
761 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
762  (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
763 
764  // specialization of TpetraCrsGraph for GO=long long and NO=EpetraNode
765  template <>
766  class TpetraCrsGraph<int,long long,EpetraNode>
767  : public CrsGraph<int,long long,EpetraNode>
768  {
769  typedef int LocalOrdinal;
770  typedef long long GlobalOrdinal;
771  typedef EpetraNode Node;
772 
773  // The following typedef is used by the XPETRA_DYNAMIC_CAST() macro.
776 
777  public:
778 
780 
781 
783  TpetraCrsGraph(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null) {
785  }
786 
788  TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null) {
790  }
791 
793  TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null) {
795  }
796 
798  TpetraCrsGraph(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) {
800  }
801 
802 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
803  TpetraCrsGraph(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap,
823  const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap,
824  const typename local_graph_type::row_map_type& rowPointers,
825  const typename local_graph_type::entries_type::non_const_type& columnIndices,
826  const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null) {
829  "int",
830  typeid(EpetraNode).name());
831  }
832 
851  TpetraCrsGraph(const Teuchos::RCP<const map_type>& rowMap,
852  const Teuchos::RCP<const map_type>& colMap,
853  const local_graph_type& lclGraph,
854  const Teuchos::RCP<Teuchos::ParameterList>& params) {
855  XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(),
856  typeid(TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(),
857  "int",
858  typeid(EpetraNode).name());
859  }
860 
885  TpetraCrsGraph(const local_graph_type& lclGraph,
886  const Teuchos::RCP<const map_type>& rowMap,
887  const Teuchos::RCP<const map_type>& colMap,
888  const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
889  const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
890  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null) {
891  XPETRA_TPETRA_ETI_EXCEPTION( typeid(TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(),
892  typeid(TpetraCrsGraph<LocalOrdinal,GlobalOrdinal,EpetraNode>).name(),
893  "int",
894  typeid(EpetraNode).name());
895  }
896 #endif
897 
917  TpetraCrsGraph(const Teuchos::RCP< const map_type > &rowMap,
918  const Teuchos::RCP< const map_type > &colMap,
919  const Teuchos::ArrayRCP<size_t>& rowPointers,
920  const Teuchos::ArrayRCP<LocalOrdinal>& columnIndices,
921  const Teuchos::RCP<Teuchos::ParameterList>& params) {
924  "int",
925  typeid(EpetraNode).name())
926  }
927 
928 
930  virtual ~TpetraCrsGraph() { }
931 
933 
935 
936 
938  void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices) { }
939 
941  void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices) { }
942 
944  void removeLocalIndices(LocalOrdinal localRow) { }
945 
946 
948  void allocateAllIndices(size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind){ }
949 
951  void setAllIndices(const ArrayRCP<size_t> & rowptr, const ArrayRCP<LocalOrdinal> & colind){ }
952 
954  void getAllIndices(ArrayRCP<const size_t>& rowptr, ArrayRCP<const LocalOrdinal>& colind) const { }
955 
956 
958 
960 
961 
963  void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null) { }
964 
966  void fillComplete(const RCP< ParameterList > &params=null) { }
967 
969  void expertStaticFillComplete (const Teuchos::RCP<const map_type>& domainMap,
970  const Teuchos::RCP<const map_type>& rangeMap,
971  const Teuchos::RCP<const Import< LocalOrdinal, GlobalOrdinal, Node > >& importer = null,
972  const Teuchos::RCP<const Export< LocalOrdinal, GlobalOrdinal, Node > >& exporter = null,
973  const Teuchos::RCP<Teuchos::ParameterList>& params=null){ }
974 
976 
978 
979 
981  RCP< const Comm< int > > getComm() const { return Teuchos::null; }
982 
984  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const { return Teuchos::null; }
985 
987  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const { return Teuchos::null; }
988 
990  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const { return Teuchos::null; }
991 
993  RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const { return Teuchos::null; }
994 
996  RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const { return Teuchos::null; }
997 
999  RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const { return Teuchos::null; }
1000 
1002  global_size_t getGlobalNumRows() const { return 0; }
1003 
1005  global_size_t getGlobalNumCols() const { return 0; }
1006 
1008  size_t getNodeNumRows() const { return 0; }
1009 
1011  size_t getNodeNumCols() const { return 0; }
1012 
1014  GlobalOrdinal getIndexBase() const { return 0; }
1015 
1017  global_size_t getGlobalNumEntries() const { return 0; }
1018 
1020  size_t getNodeNumEntries() const { return 0; }
1021 
1023  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
1024 
1026  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
1027 
1029  size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const { return 0; }
1030 
1032  size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const { return 0; }
1033 
1035  size_t getGlobalMaxNumRowEntries() const { return 0; }
1036 
1038  size_t getNodeMaxNumRowEntries() const { return 0; }
1039 
1041  bool hasColMap() const { return false; }
1042 
1044  bool isLocallyIndexed() const { return false; }
1045 
1047  bool isGloballyIndexed() const { return false; }
1048 
1050  bool isFillComplete() const { return false; }
1051 
1053  bool isStorageOptimized() const { return false; }
1054 
1056  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const { }
1057 
1059  void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const { }
1060 
1061 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
1062 #ifdef TPETRA_ENABLE_DEPRECATED_CODE
1063  typename local_graph_type::HostMirror getLocalGraph () const {
1065  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
1066  "Epetra does not support Kokkos::StaticCrsGraph!");
1067  TEUCHOS_UNREACHABLE_RETURN((local_graph_type::HostMirror()));
1068  }
1069 #endif
1070  local_graph_type getLocalGraphDevice () const {
1071  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
1072  "Epetra does not support Kokkos::StaticCrsGraph!");
1073  TEUCHOS_UNREACHABLE_RETURN((local_graph_type()));
1074  }
1075 
1076  typename local_graph_type::HostMirror getLocalGraphHost () const {
1077  TEUCHOS_TEST_FOR_EXCEPTION(true, Xpetra::Exceptions::RuntimeError,
1078  "Epetra does not support Kokkos::StaticCrsGraph!");
1079  TEUCHOS_UNREACHABLE_RETURN((local_graph_type::HostMirror()));
1080  }
1081 
1082 #endif
1083 
1086 
1088 
1090 
1091 
1093  std::string description() const { return std::string(""); }
1094 
1096  void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const { }
1097 
1099 
1101 
1102 
1104  ArrayRCP< const size_t > getNodeRowPtrs() const { return Teuchos::ArrayRCP< const size_t>(); }
1105 
1107 
1109  //{@
1110 
1112  Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const { return Teuchos::null; }
1113 
1117 
1121 
1125 
1129 
1130  // @}
1131 
1133 
1134 
1136  TpetraCrsGraph(const Teuchos::RCP<Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > &graph) {
1138  }
1139 
1141  RCP< const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > getTpetra_CrsGraph() const { return Teuchos::null; }
1142 
1144  }; // TpetraCrsGraph class (specialization for GO=long long and NO=EpetraNode)
1145 #endif
1146 
1147 #endif // HAVE_XPETRA_EPETRA
1148 
1149 
1150 } // Xpetra namespace
1151 #endif //XPETRA_TPETRACRSGRAPH_DEF_HPP
1152 
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
bool isStorageOptimized() const
Returns true if storage has been optimized.
TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null)
Constructor specifying column Map and fixed number of entries for each row.
RCP< const Comm< int > > getComm() const
Returns the communicator.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this 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 getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row...
Teuchos::RCP< const Map > getMap() const
Implements DistObject interface.
void getAllIndices(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind) const
Gets the 1D pointer arrays of the graph.
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.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null)
Constructor specifying (possibly different) number of entries in each row.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import &importer, CombineMode CM)
Export.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this graph.
TpetraCrsGraph< LocalOrdinal, GlobalOrdinal, Node > TpetraCrsGraphClass
std::string description() const
Return a simple one-line description of this object.
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
size_t getNodeNumEntries() const
Returns the local number of entries in the graph.
void setAllIndices(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind)
Sets the 1D pointer arrays of the graph.
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
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.
ArrayRCP< const size_t > getNodeRowPtrs() const
Get an ArrayRCP of the row-offsets.
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 isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
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 Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.
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 getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row...
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
Xpetra namespace
TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null)
Constructor specifying (possibly different) number of entries in each row.
RCP< const Map > getColMap() const
Returns the Map that describes the column distribution in this graph.
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
TpetraCrsGraph(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)
Constructor specifying column Map and number of entries in each row.
void expertStaticFillComplete(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< const Import > &importer=Teuchos::null, const Teuchos::RCP< const Export > &exporter=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Expert version of fillComplete.
size_t getNodeNumEntries() const
Returns the local number of entries in the graph.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void computeGlobalConstants()
Force the computation of global constants if we don&#39;t have them.
Exception throws to report errors in the internal logical of the program.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
size_t getNodeNumRows() const
Returns the number of graph rows owned on the calling node.
RCP< const Import > getImporter() const
Returns the importer associated with this graph.
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.
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
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.
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
TpetraCrsGraph(const RCP< const Map > &rowMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null)
Constructor specifying fixed number of entries for each row.
TpetraCrsGraph(const Teuchos::RCP< Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
TpetraCrsGraph constructor to wrap a Tpetra::CrsGraph object.
ArrayRCP< const size_t > getNodeRowPtrs() const
Get an ArrayRCP of the row-offsets.
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
size_t getNodeMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
global_size_t getGlobalNumRows() const
Returns the number of global rows 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.
RCP< const Comm< int > > getComm() const
Returns the communicator.
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 expertStaticFillComplete(const Teuchos::RCP< const map_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &importer=null, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=null, const Teuchos::RCP< Teuchos::ParameterList > &params=null)
Expert version of fillComplete.
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import &importer, CombineMode CM)
Import.
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
std::string description() const
Return a simple one-line description of this object.
size_t getNodeNumRows() const
Returns the number of graph rows owned on the calling node.
bool isLocallyIndexed() const
Whether column indices are stored using local 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.
TpetraCrsGraph(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null)
Constructor specifying fixed number of entries for each row.
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_type > &domainMap, const Teuchos::RCP< const map_type > &rangeMap, const Teuchos::RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > &importer=null, const Teuchos::RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > &exporter=null, const Teuchos::RCP< Teuchos::ParameterList > &params=null)
Expert version of fillComplete.
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row ...
virtual ~TpetraCrsGraph()
Destructor.
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
bool hasColMap() const
Whether the graph has a column Map.
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.
size_t global_size_t
Global size_t object.
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row ...
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsGraph() const
Get the underlying Tpetra graph.
void getAllIndices(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind) const
Gets the 1D pointer arrays of the graph.
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row...
TpetraCrsGraph(const Teuchos::RCP< Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
TpetraCrsGraph constructor to wrap a Tpetra::CrsGraph object.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row ...
ArrayRCP< const size_t > getNodeRowPtrs() const
Get an ArrayRCP of the row-offsets.
size_t getNodeNumRows() const
Returns the number of graph rows owned on the calling node.
std::string description() const
Return a simple one-line description of this object.
size_t getNodeNumEntries() const
Returns the local number of entries in the graph.
void fillComplete(const RCP< const Map > &domainMap, const RCP< const Map > &rangeMap, const RCP< ParameterList > &params=null)
Signal that data entry is complete, specifying domain and range maps.
TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null)
Constructor specifying column Map and fixed number of entries for each row.
TpetraCrsGraph< LocalOrdinal, GlobalOrdinal, Node > TpetraCrsGraphClass
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
size_t getNodeMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
bool hasColMap() const
Whether the graph has a column Map.
void allocateAllIndices(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind)
Allocates the 1D pointer arrays of the graph.
bool hasColMap() const
Whether the graph has a column Map.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
RCP< const Export > getExporter() const
Returns the exporter associated with this graph.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
void computeGlobalConstants()
Dummy implementation for computeGlobalConstants.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsGraph() const
Get the underlying Tpetra 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.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this graph.
CombineMode
Xpetra::Combine Mode enumerable type.
#define XPETRA_MONITOR(funcName)
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.
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
TpetraCrsGraph(const Teuchos::RCP< const map_type > &rowMap, const Teuchos::RCP< const map_type > &colMap, const Teuchos::ArrayRCP< size_t > &rowPointers, const Teuchos::ArrayRCP< LocalOrdinal > &columnIndices, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor specifying column Map and arrays containing the graph in sorted, local ids...
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this graph.
RCP< const Map > getRowMap() const
Returns the Map that describes the row distribution in this graph.
void fillComplete(const RCP< ParameterList > &params=null)
Signal that data entry is complete.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
void setAllIndices(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind)
Sets the 1D pointer arrays of the graph.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsGraph() const
Get the underlying Tpetra graph.
size_t getNodeMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
bool isStorageOptimized() const
Returns true if storage has been optimized.
TpetraCrsGraph(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)
Constructor specifying column Map and number of entries in each row.
RCP< const Map > getDomainMap() const
Returns the Map associated with the domain of this graph.
void setAllIndices(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind)
Sets the 1D pointer arrays of the graph.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this graph.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
RCP< const Map > getRangeMap() const
Returns the Map associated with the domain of this graph.
void allocateAllIndices(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind)
Allocates the 1D pointer arrays of the graph.
RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
TpetraCrsGraph(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null)
Constructor specifying fixed number of entries for each row.
RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
bool isStorageOptimized() const
Returns true if storage has been optimized.
void computeGlobalConstants()
Dummy implementation for computeGlobalConstants.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.