Xpetra Version of the Day
Loading...
Searching...
No Matches
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"
60#include "Xpetra_Utils.hpp"
61
62namespace Xpetra {
63
64
65 template <class LocalOrdinal,
66 class GlobalOrdinal,
69 : public CrsGraph<LocalOrdinal,GlobalOrdinal,Node>
70 {
71 #undef XPETRA_TPETRACRSGRAPH_SHORT
73 // The following typedef is used by the XPETRA_DYNAMIC_CAST() macro.
77 typedef Map map_type;
78
80
81 public:
82
84
85
87 TpetraCrsGraph(const RCP< const Map > &rowMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null);
88
90 TpetraCrsGraph(const RCP< const Map > &rowMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null);
91
93 TpetraCrsGraph(const RCP< const Map > &rowMap, const RCP< const Map > &colMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null);
94
96 TpetraCrsGraph(const RCP< const Map > &rowMap, const RCP< const Map > &colMap, const ArrayRCP< const size_t > &NumEntriesPerRowToAlloc, const RCP< ParameterList > &params=null);
97
98 // Constructor for fused import
99 TpetraCrsGraph(const RCP<const CrsGraph >& sourceGraph,
100 const Import & importer,
101 const RCP<const Map>& domainMap = Teuchos::null,
102 const RCP<const Map>& rangeMap = Teuchos::null,
103 const RCP<Teuchos::ParameterList>& params = Teuchos::null);
104
105
106
127 const Teuchos::RCP< const Map > &colMap,
128 const typename local_graph_type::row_map_type& rowPointers,
129 const typename local_graph_type::entries_type::non_const_type& columnIndices,
130 const Teuchos::RCP< Teuchos::ParameterList > &plist=Teuchos::null);
131
156 TpetraCrsGraph(const local_graph_type& lclGraph,
157 const Teuchos::RCP<const map_type>& rowMap,
158 const Teuchos::RCP<const map_type>& colMap,
159 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
160 const Teuchos::RCP<const map_type>& rangeMap = Teuchos::null,
161 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
162
182 const Teuchos::RCP<const Map>& colMap,
183 const local_graph_type& lclGraph,
185
186
187
188
189
191 const Teuchos::RCP<const Map>& colMap,
192 const Teuchos::ArrayRCP<size_t>& rowPointers,
193 const Teuchos::ArrayRCP<LocalOrdinal>& columnIndices,
194 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
195
197 virtual ~TpetraCrsGraph();
198
200
201
203 void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices);
204
206 void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices);
207
209 void removeLocalIndices(LocalOrdinal localRow);
210
212 void allocateAllIndices(size_t numNonZeros,ArrayRCP<size_t> & rowptr, ArrayRCP<LocalOrdinal> & colind);
213
215 void setAllIndices(const ArrayRCP<size_t> & rowptr, const ArrayRCP<LocalOrdinal> & colind);
216
219
221
223
224
226 void fillComplete(const RCP< const Map > &domainMap, const RCP< const Map > &rangeMap, const RCP< ParameterList > &params=null);
227
229 void fillComplete(const RCP< ParameterList > &params=null);
230
232 void
234 const Teuchos::RCP<const map_type>& rangeMap,
235 const Teuchos::RCP<const Import>& importer =
236 Teuchos::null,
237 const Teuchos::RCP<const Export>& exporter =
238 Teuchos::null,
240 Teuchos::null);
242
244
246
247
250
253
256
259
262
265
268
271
274
276 size_t getLocalNumRows() const;
277
279 size_t getLocalNumCols() const;
280
282 GlobalOrdinal getIndexBase() const;
283
286
288 size_t getLocalNumEntries() const;
289
291 size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const;
292
294 size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const;
295
297 size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const;
298
300 size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const;
301
303 size_t getGlobalMaxNumRowEntries() const;
304
306 size_t getLocalMaxNumRowEntries() const;
307
309 bool hasColMap() const;
310
312 bool isLocallyIndexed() const;
313
315 bool isGloballyIndexed() const;
316
318 bool isFillComplete() const;
319
321 bool isStorageOptimized() const;
322
324 void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const;
325
327 void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const;
328
330 typename local_graph_type::HostMirror getLocalGraphHost () const;
331
334
335
338
340
342
343
345 std::string description() const;
346
349
351
353
354
357
359
361 //{@
362
365
368 const Import &importer, CombineMode CM);
369
372 const Import& importer, CombineMode CM);
373
376 const Export& exporter, CombineMode CM);
377
380 const Export& exporter, CombineMode CM);
381
382 // @}
383
385
386
388 TpetraCrsGraph(const Teuchos::RCP<Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > &graph);
389
392
394
395 private:
397 }; // TpetraCrsGraph class
398
399
400 // TODO: move that elsewhere
401 template <class LocalOrdinal, class GlobalOrdinal, class Node>
403 toXpetra (RCP<const Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > graph)
404 { //TODO: return TpetraCrsGraph instead of CrsGraph
405 // typedef TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node> TpetraCrsGraphClass;
406 // XPETRA_RCP_DYNAMIC_CAST(const TpetraCrsGraphClass, graph, tGraph, "toTpetra");
407 if (graph.is_null ()) {
408 return Teuchos::null;
409 }
411 Teuchos::rcp_const_cast<Tpetra::CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > (graph);
413 }
414
415 template <class LocalOrdinal, class GlobalOrdinal, class Node>
416 RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > >
418 {
419 typedef TpetraCrsGraph<LocalOrdinal, GlobalOrdinal, Node> TpetraCrsGraphClass;
420 XPETRA_RCP_DYNAMIC_CAST(const TpetraCrsGraphClass, graph, tpetraCrsGraph, "toTpetra");
421 return tpetraCrsGraph->getTpetra_CrsGraph ();
422 }
423
424} // Xpetra namespace
425
426#endif // XPETRA_TPETRACRSGRAPH_DECL_HPP
427
#define XPETRA_RCP_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
static const EVerbosityLevel verbLevel_default
Kokkos::StaticCrsGraph< LocalOrdinal, Kokkos::LayoutLeft, device_type, void, size_t > local_graph_type
void setAllIndices(const ArrayRCP< size_t > &rowptr, const ArrayRCP< LocalOrdinal > &colind)
Sets the 1D pointer arrays of 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.
RCP< const Comm< int > > getComm() const
Returns the communicator.
size_t getLocalMaxNumRowEntries() const
Maximum number of entries in all rows owned by the calling process.
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > getTpetra_CrsGraph() const
Get the underlying Tpetra graph.
void insertLocalIndices(const LocalOrdinal localRow, const ArrayView< const LocalOrdinal > &indices)
Insert local indices into the graph.
void allocateAllIndices(size_t numNonZeros, ArrayRCP< size_t > &rowptr, ArrayRCP< LocalOrdinal > &colind)
Allocates the 1D pointer arrays of the graph.
void insertGlobalIndices(GlobalOrdinal globalRow, const ArrayView< const GlobalOrdinal > &indices)
Insert global indices into the graph.
global_size_t getGlobalNumCols() const
Returns the number of global columns in the graph.
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.
TpetraCrsGraph(const RCP< const Map > &rowMap, size_t maxNumEntriesPerRow, const RCP< ParameterList > &params=null)
Constructor specifying fixed number of entries for each row.
TpetraImport< LocalOrdinal, GlobalOrdinal, Node > TpetraImportClass
size_t getNumEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of entries on this node in the specified global row.
RCP< const Import > getImporter() const
Returns the importer associated with this graph.
TpetraCrsGraph(const Teuchos::RCP< const Map > &rowMap, const Teuchos::RCP< const Map > &colMap, const local_graph_type &lclGraph, const Teuchos::RCP< Teuchos::ParameterList > &params)
Constructor specifying column Map and a local (sorted) graph, which the resulting CrsGraph views.
void removeLocalIndices(LocalOrdinal localRow)
Remove all graph indices from the specified local row.
bool isLocallyIndexed() const
Whether column indices are stored using local indices on the calling process.
size_t getNumAllocatedEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of allocated entries on this node in the specified local row.
virtual ~TpetraCrsGraph()
Destructor.
size_t getGlobalMaxNumRowEntries() const
Maximum number of entries in all rows over all processes.
TpetraExport< LocalOrdinal, GlobalOrdinal, Node > TpetraExportClass
size_t getLocalNumCols() const
Returns the number of columns connected to the locally owned rows of this graph.
size_t getNumEntriesInLocalRow(LocalOrdinal localRow) const
Returns the current number of entries on this node in the specified local row.
bool isFillComplete() const
Whether fillComplete() has been called and the graph is in compute mode.
local_graph_type getLocalGraphDevice() const
Access the local KokkosSparse::StaticCrsGraph data for device use.
size_t getNumAllocatedEntriesInGlobalRow(GlobalOrdinal globalRow) const
Returns the current number of allocated entries for this node in the specified global row .
size_t getLocalNumRows() const
Returns the number of graph rows owned on the calling node.
void computeGlobalConstants()
Force the computation of global constants if we don't have them.
bool hasColMap() const
Whether the graph has a column Map.
void doExport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import &importer, CombineMode CM)
Export.
void getGlobalRowView(GlobalOrdinal GlobalRow, ArrayView< const GlobalOrdinal > &Indices) const
Return a const, nonpersisting view of global indices in the given row.
RCP< const Map > getRowMap() const
Returns the Map that describes the row distribution in this graph.
RCP< const Map > getRangeMap() const
Returns the Map associated with the domain of this graph.
size_t getLocalNumEntries() const
Returns the local number of entries in the graph.
bool isStorageOptimized() const
Returns true if storage has been optimized.
void getAllIndices(ArrayRCP< const size_t > &rowptr, ArrayRCP< const LocalOrdinal > &colind) const
Gets the 1D pointer arrays of the graph.
local_graph_type::HostMirror getLocalGraphHost() const
Access the local KokkosSparse::StaticCrsGraph data for host use.
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.
void doImport(const DistObject< GlobalOrdinal, LocalOrdinal, GlobalOrdinal, Node > &source, const Import &importer, CombineMode CM)
Import.
Xpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_type local_graph_type
TpetraCrsGraph< LocalOrdinal, GlobalOrdinal, Node > TpetraCrsGraphClass
Teuchos::RCP< const Map > getMap() const
Implements DistObject interface.
bool isGloballyIndexed() const
Whether column indices are stored using global indices on the calling process.
std::string description() const
Return a simple one-line description of this object.
GlobalOrdinal getIndexBase() const
Returns the index base for global indices for this graph.
RCP< const Export > getExporter() const
Returns the exporter associated with this graph.
RCP< Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > graph_
ArrayRCP< const size_t > getNodeRowPtrs() const
Get an ArrayRCP of the row-offsets.
RCP< const Map > getDomainMap() const
Returns the Map associated with the domain of this graph.
void getLocalRowView(LocalOrdinal LocalRow, ArrayView< const LocalOrdinal > &indices) const
Return a const, nonpersisting view of local indices in the given row.
global_size_t getGlobalNumEntries() const
Returns the global number of entries in the graph.
global_size_t getGlobalNumRows() const
Returns the number of global rows in the graph.
RCP< const Map > getColMap() const
Returns the Map that describes the column distribution in this graph.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Xpetra namespace
size_t global_size_t
Global size_t object.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
CombineMode
Xpetra::Combine Mode enumerable type.