Xpetra_TpetraCrsGraph_decl.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_DECL_HPP
47 #define XPETRA_TPETRACRSGRAPH_DECL_HPP
48 
49 /* this file is automatically generated - do not edit (see script/tpetra.py) */
50 
52 #include "Xpetra_Exceptions.hpp"
53 
54 #include "Tpetra_CrsGraph.hpp"
55 
56 #include "Xpetra_CrsGraph.hpp"
57 #include "Xpetra_Utils.hpp"
58 #include "Xpetra_TpetraMap.hpp"
59 #include "Xpetra_TpetraImport.hpp"
60 #include "Xpetra_TpetraExport.hpp"
61 
62 namespace Xpetra {
63 
64 
65  template <class LocalOrdinal,
66  class GlobalOrdinal,
69  : public CrsGraph<LocalOrdinal,GlobalOrdinal,Node>
70  {
71 
72  // The following typedef is used by the XPETRA_DYNAMIC_CAST() macro.
75 
76 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
78 #endif
79 
80  public:
81 
83 
84 
86  TpetraCrsGraph(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const RCP< ParameterList > &params=null);
87 
89  TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, ProfileType pftype=DynamicProfile, const RCP< ParameterList > &params=null);
90 
92  TpetraCrsGraph(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rowMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &colMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const RCP< ParameterList > &params=null);
93 
95  TpetraCrsGraph(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);
96 
97 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
119  const typename local_graph_type::row_map_type& rowPointers,
120  const typename local_graph_type::entries_type::non_const_type& columnIndices,
121  const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null);
122 
147  TpetraCrsGraph(const local_graph_type& lclGraph,
148  const Teuchos::RCP<const map_type>& rowMap,
149  const Teuchos::RCP<const map_type>& colMap,
150  const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
151  const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
152  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
153 
173  const Teuchos::RCP<const map_type>& colMap,
174  const local_graph_type& lclGraph,
176 
177 #endif
178 
180  virtual ~TpetraCrsGraph();
181 
183 
184 
186  void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices);
187 
189  void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices);
190 
192  void removeLocalIndices(LocalOrdinal localRow);
193 
195 
197 
198 
200  void fillComplete(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap, const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap, const RCP< ParameterList > &params=null);
201 
203  void fillComplete(const RCP< ParameterList > &params=null);
204 
206 
208 
209 
212 
215 
218 
221 
224 
227 
230 
233 
236 
238  size_t getNodeNumRows() const;
239 
241  size_t getNodeNumCols() const;
242 
244  GlobalOrdinal getIndexBase() const;
245 
248 
250  size_t getNodeNumEntries() const;
251 
253  size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const;
254 
256  size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const;
257 
259  size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const;
260 
262  size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const;
263 
265  size_t getGlobalMaxNumRowEntries() const;
266 
268  size_t getNodeMaxNumRowEntries() const;
269 
271  bool hasColMap() const;
272 
274  bool isLocallyIndexed() const;
275 
277  bool isGloballyIndexed() const;
278 
280  bool isFillComplete() const;
281 
283  bool isStorageOptimized() const;
284 
286  void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const;
287 
289  void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const;
290 
291 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
292  local_graph_type getLocalGraph () const;
294 #endif
295 
296 
298  void computeGlobalConstants();
299 
301 
303 
304 
306  std::string description() const;
307 
310 
312 
314 
315 
318 
320 
322  //{@
323 
326 
330 
334 
338 
342 
343  // @}
344 
346 
347 
349  TpetraCrsGraph(const Teuchos::RCP<Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > &graph);
350 
353 
355 
356  private:
358  }; // TpetraCrsGraph class
359 
360 
361  // TODO: move that elsewhere
362  template <class LocalOrdinal, class GlobalOrdinal, class Node>
364  toXpetra (RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > graph)
365  { //TODO: return TpetraCrsGraph instead of CrsGraph
366  // typedef TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node> TpetraCrsGraphClass;
367  // XPETRA_RCP_DYNAMIC_CAST(const TpetraCrsGraphClass, graph, tGraph, "toTpetra");
368  if (graph.is_null ()) {
369  return Teuchos::null;
370  }
372  Teuchos::rcp_const_cast<Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > (graph);
374  }
375 
376  template <class LocalOrdinal, class GlobalOrdinal, class Node>
377  RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > >
379  {
380  typedef TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node> TpetraCrsGraphClass;
381  XPETRA_RCP_DYNAMIC_CAST(const TpetraCrsGraphClass, graph, tpetraCrsGraph, "toTpetra");
382  return tpetraCrsGraph->getTpetra_CrsGraph ();
383  }
384 
385 } // Xpetra namespace
386 
387 #endif // XPETRA_TPETRACRSGRAPH_DECL_HPP
388 
Xpetra::TpetraCrsGraph::doImport
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
Definition: Xpetra_TpetraCrsGraph_def.hpp:273
Xpetra::TpetraCrsGraph::getColMap
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getColMap() const
Returns the Map that describes the column distribution in this graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:143
XPETRA_RCP_DYNAMIC_CAST
#define XPETRA_RCP_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
Definition: Xpetra_Exceptions.hpp:65
Kokkos::Compat::KokkosSerialWrapperNode
Definition: Kokkos_SerialNode.hpp:57
Xpetra::TpetraCrsGraph::getGlobalNumEntries
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:183
Xpetra::TpetraCrsGraph::getGlobalNumCols
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:167
Xpetra::TpetraCrsGraph::getDomainMap
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getDomainMap() const
Returns the Map associated with the domain of this graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:147
Xpetra
Xpetra namespace
Definition: Xpetra_BlockedCrsMatrix.hpp:88
Xpetra::TpetraCrsGraph::getRowMap
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRowMap() const
Returns the Map that describes the row distribution in this graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:139
Xpetra::TpetraCrsGraph::getLocalRowView
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
Definition: Xpetra_TpetraCrsGraph_def.hpp:239
Xpetra::global_size_t
size_t global_size_t
Global size_t object.
Definition: Xpetra_ConfigDefs.hpp:174
Xpetra_CrsGraph.hpp
Xpetra::TpetraCrsGraph::getRangeMap
RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getRangeMap() const
Returns the Map associated with the domain of this graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:151
Xpetra::TpetraCrsGraph::getNumEntriesInGlobalRow
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
Definition: Xpetra_TpetraCrsGraph_def.hpp:191
Xpetra::TpetraCrsGraph::TpetraCrsGraph
TpetraCrsGraph(const RCP< const map_type > &rowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile, const RCP< ParameterList > &params=null)
Constructor specifying fixed number of entries for each row.
Definition: Xpetra_TpetraCrsGraph_def.hpp:66
Xpetra::TpetraCrsGraph::isGloballyIndexed
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
Definition: Xpetra_TpetraCrsGraph_def.hpp:223
Xpetra::TpetraCrsGraph::isStorageOptimized
bool isStorageOptimized() const
Returns true if storage has been optimized.
Definition: Xpetra_TpetraCrsGraph_def.hpp:231
Xpetra::toTpetra
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
Definition: Xpetra_TpetraCrsGraph_decl.hpp:378
Xpetra::DistObject
Definition: Xpetra_DistObject.hpp:66
Xpetra::DynamicProfile
@ DynamicProfile
Definition: Xpetra_ConfigDefs.hpp:191
Xpetra::TpetraCrsGraph::getGlobalMaxNumRowEntries
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
Definition: Xpetra_TpetraCrsGraph_def.hpp:207
Xpetra::TpetraCrsGraph::getMap
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
Definition: Xpetra_TpetraCrsGraph_def.hpp:269
Xpetra::TpetraCrsGraph::getNodeMaxNumRowEntries
size_t getNodeMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
Definition: Xpetra_TpetraCrsGraph_def.hpp:211
Xpetra::Export
Definition: Xpetra_Export.hpp:64
Xpetra::TpetraCrsGraph::fillComplete
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.
Definition: Xpetra_TpetraCrsGraph_def.hpp:127
Xpetra::TpetraCrsGraph::map_type
Map< LocalOrdinal, GlobalOrdinal, Node > map_type
Definition: Xpetra_TpetraCrsGraph_decl.hpp:74
Xpetra::toXpetra
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
Definition: Xpetra_EpetraCrsGraph.cpp:168
rcp
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::EVerbosityLevel
EVerbosityLevel
Xpetra_Utils.hpp
Xpetra::TpetraCrsGraph::TpetraCrsGraphClass
TpetraCrsGraph< LocalOrdinal, GlobalOrdinal, Node > TpetraCrsGraphClass
Definition: Xpetra_TpetraCrsGraph_decl.hpp:73
Teuchos::ArrayView
Xpetra::Map
Definition: Xpetra_Map_decl.hpp:91
Xpetra::Import
Definition: Xpetra_Import.hpp:64
Xpetra::CombineMode
CombineMode
Xpetra::Combine Mode enumerable type.
Definition: Xpetra_ConfigDefs.hpp:218
Xpetra::TpetraCrsGraph::getNodeNumRows
size_t getNodeNumRows() const
Returns the number of graph rows owned on the calling node.
Definition: Xpetra_TpetraCrsGraph_def.hpp:171
Xpetra::TpetraCrsGraph::getGlobalRowView
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
Definition: Xpetra_TpetraCrsGraph_def.hpp:235
Teuchos::RCP
Xpetra::TpetraCrsGraph::getNumAllocatedEntriesInGlobalRow
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row .
Definition: Xpetra_TpetraCrsGraph_def.hpp:199
Xpetra::TpetraCrsGraph::~TpetraCrsGraph
virtual ~TpetraCrsGraph()
Destructor.
Definition: Xpetra_TpetraCrsGraph_def.hpp:112
Xpetra::TpetraCrsGraph::computeGlobalConstants
void computeGlobalConstants()
Force the computation of global constants if we don't have them.
Definition: Xpetra_TpetraCrsGraph_def.hpp:250
Xpetra::TpetraCrsGraph::getImporter
RCP< const Import< LocalOrdinal, GlobalOrdinal, Node > > getImporter() const
Returns the importer associated with this graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:155
Teuchos::ArrayRCP
Xpetra::TpetraCrsGraph::getNodeNumCols
size_t getNodeNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:175
Xpetra::TpetraCrsGraph::insertGlobalIndices
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:115
Teuchos::basic_FancyOStream
Xpetra::CrsGraph
Definition: Xpetra_CrsGraph.hpp:86
Xpetra::TpetraCrsGraph::hasColMap
bool hasColMap() const
Whether the graph has a column Map.
Definition: Xpetra_TpetraCrsGraph_def.hpp:215
Xpetra::TpetraCrsGraph::getExporter
RCP< const Export< LocalOrdinal, GlobalOrdinal, Node > > getExporter() const
Returns the exporter associated with this graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:159
Xpetra::TpetraCrsGraph::getGlobalNumRows
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:163
Xpetra::TpetraCrsGraph::removeLocalIndices
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
Definition: Xpetra_TpetraCrsGraph_def.hpp:123
Xpetra::TpetraCrsGraph::getTpetra_CrsGraph
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsGraph() const
Get the underlying Tpetra graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:324
Xpetra::TpetraCrsGraph::description
std::string description() const
Return a simple one-line description of this object.
Definition: Xpetra_TpetraCrsGraph_def.hpp:257
Xpetra_TpetraConfigDefs.hpp
Xpetra::TpetraCrsGraph::isLocallyIndexed
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
Definition: Xpetra_TpetraCrsGraph_def.hpp:219
Xpetra::TpetraCrsGraph::doExport
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
Definition: Xpetra_TpetraCrsGraph_def.hpp:285
Xpetra::TpetraCrsGraph::getNumEntriesInLocalRow
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
Definition: Xpetra_TpetraCrsGraph_def.hpp:195
Xpetra_Exceptions.hpp
Xpetra::TpetraCrsGraph::graph_
RCP< Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > graph_
Definition: Xpetra_TpetraCrsGraph_decl.hpp:357
Xpetra::TpetraCrsGraph::insertLocalIndices
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:119
Xpetra::TpetraCrsGraph::getComm
RCP< const Comm< int > > getComm() const
Returns the communicator.
Definition: Xpetra_TpetraCrsGraph_def.hpp:135
Xpetra::TpetraCrsGraph::isFillComplete
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
Definition: Xpetra_TpetraCrsGraph_def.hpp:227
Xpetra::TpetraCrsGraph::getNumAllocatedEntriesInLocalRow
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row.
Definition: Xpetra_TpetraCrsGraph_def.hpp:203
Xpetra::TpetraCrsGraph::getIndexBase
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:179
Teuchos::Describable::verbLevel_default
static const EVerbosityLevel verbLevel_default
Xpetra::TpetraCrsGraph::getNodeRowPtrs
ArrayRCP< const size_t > getNodeRowPtrs() const
Get an ArrayRCP of the row-offsets.
Definition: Xpetra_TpetraCrsGraph_def.hpp:265
Xpetra::TpetraCrsGraph::describe
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.
Definition: Xpetra_TpetraCrsGraph_def.hpp:261
Xpetra::TpetraCrsGraph
Definition: Xpetra_TpetraCrsGraph_decl.hpp:70
Xpetra::TpetraCrsGraph::getNodeNumEntries
size_t getNodeNumEntries() const
Returns the local number of entries in the graph.
Definition: Xpetra_TpetraCrsGraph_def.hpp:187
Xpetra::ProfileType
ProfileType
Definition: Xpetra_ConfigDefs.hpp:189