Tpetra parallel linear algebra Version of the Day
Loading...
Searching...
No Matches
Tpetra_FECrsGraph_decl.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Tpetra: Templated Linear Algebra Services Package
4//
5// Copyright 2008 NTESS and the Tpetra contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef TPETRA_FECRSGRAPH_DECL_HPP
11#define TPETRA_FECRSGRAPH_DECL_HPP
12
15
16#include "Tpetra_ConfigDefs.hpp"
19
20namespace Tpetra {
88
89template <class LocalOrdinal,
90 class GlobalOrdinal,
91 class Node>
92class FECrsGraph : public CrsGraph<LocalOrdinal, GlobalOrdinal, Node> {
95
96 template <class S, class LO, class GO, class N>
97 friend class FECrsMatrix;
98
99 public:
102
108 typedef Node node_type;
109
114
117
124
126
127
151 FECrsGraph(const Teuchos::RCP<const map_type>& ownedRowMap,
152 const Teuchos::RCP<const map_type>& ownedPlusSharedRowMap,
153 const size_t maxNumEntriesPerRow,
154 const Teuchos::RCP<const import_type>& ownedPlusSharedToOwnedimporter = Teuchos::null,
155 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
156 const Teuchos::RCP<const map_type>& ownedRangeMap = Teuchos::null,
157 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
158
185 FECrsGraph(const Teuchos::RCP<const map_type>& ownedRowMap,
186 const Teuchos::RCP<const map_type>& ownedPlusSharedRowMap,
187 const size_t maxNumEntriesPerRow,
188 const Teuchos::RCP<const map_type>& ownedPlusSharedDomainMap,
189 const Teuchos::RCP<const import_type>& ownedPlusSharedToOwnedimporter = Teuchos::null,
190 const Teuchos::RCP<const map_type>& ownedDomainMap = Teuchos::null,
191 const Teuchos::RCP<const map_type>& ownedRangeMap = Teuchos::null,
192 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
193
217 FECrsGraph(const Teuchos::RCP<const map_type>& ownedRowMap,
218 const Teuchos::RCP<const map_type>& ownedPlusSharedRowMap,
219 const Kokkos::DualView<const size_t*, device_type>& numEntPerRow,
220 const Teuchos::RCP<const import_type>& ownedPlusSharedToOwnedimporter = Teuchos::null,
221 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
222 const Teuchos::RCP<const map_type>& ownedRangeMap = Teuchos::null,
223 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
224
251 FECrsGraph(const Teuchos::RCP<const map_type>& ownedRowMap,
252 const Teuchos::RCP<const map_type>& ownedPlusSharedRowMap,
253 const Kokkos::DualView<const size_t*, device_type>& numEntPerRow,
254 const Teuchos::RCP<const map_type>& ownedPlusSharedDomainMap,
255 const Teuchos::RCP<const import_type>& ownedPlusSharedToOwnedimporter = Teuchos::null,
256 const Teuchos::RCP<const map_type>& ownedDomainMap = Teuchos::null,
257 const Teuchos::RCP<const map_type>& ownedRangeMap = Teuchos::null,
258 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
259
285 FECrsGraph(const Teuchos::RCP<const map_type>& ownedRowMap,
286 const Teuchos::RCP<const map_type>& ownedPlusSharedRowMap,
287 const Teuchos::RCP<const map_type>& ownedPlusSharedColMap,
288 const size_t maxNumEntriesPerRow,
289 const Teuchos::RCP<const import_type>& ownedPlusSharedToOwnedimporter = Teuchos::null,
290 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
291 const Teuchos::RCP<const map_type>& ownedRangeMap = Teuchos::null,
292 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
293
321 FECrsGraph(const Teuchos::RCP<const map_type>& ownedRowMap,
322 const Teuchos::RCP<const map_type>& ownedPlusSharedRowMap,
323 const Teuchos::RCP<const map_type>& ownedPlusSharedColMap,
324 const size_t maxNumEntriesPerRow,
325 const Teuchos::RCP<const map_type>& ownedPlusSharedDomainMap,
326 const Teuchos::RCP<const import_type>& ownedPlusSharedToOwnedimporter = Teuchos::null,
327 const Teuchos::RCP<const map_type>& ownedDomainMap = Teuchos::null,
328 const Teuchos::RCP<const map_type>& ownedRangeMap = Teuchos::null,
329 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
330
356 FECrsGraph(const Teuchos::RCP<const map_type>& ownedRowMap,
357 const Teuchos::RCP<const map_type>& ownedPlusSharedRowMap,
358 const Teuchos::RCP<const map_type>& ownedPlusSharedColMap,
359 const Kokkos::DualView<const size_t*, device_type>& numEntPerRow,
360 const Teuchos::RCP<const import_type>& ownedPlusSharedToOwnedimporter = Teuchos::null,
361 const Teuchos::RCP<const map_type>& domainMap = Teuchos::null,
362 const Teuchos::RCP<const map_type>& ownedRangeMap = Teuchos::null,
363 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
364
391 FECrsGraph(const Teuchos::RCP<const map_type>& ownedRowMap,
392 const Teuchos::RCP<const map_type>& ownedPlusSharedRowMap,
393 const Teuchos::RCP<const map_type>& ownedPlusSharedColMap,
394 const Kokkos::DualView<const size_t*, device_type>& numEntPerRow,
395 const Teuchos::RCP<const map_type>& ownedPlusSharedDomainMap,
396 const Teuchos::RCP<const import_type>& ownedPlusSharedToOwnedimporter = Teuchos::null,
397 const Teuchos::RCP<const map_type>& ownedDomainMap = Teuchos::null,
398 const Teuchos::RCP<const map_type>& ownedRangeMap = Teuchos::null,
399 const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
400
403
406
410
414
424 virtual ~FECrsGraph() = default;
425
427
429
430 Teuchos::RCP<const Teuchos::ParameterList>
431 getValidParameters() const override;
432
434
436
438 void endAssembly();
439 void endAssembly(const Teuchos::RCP<const map_type>& domainMap, const Teuchos::RCP<const map_type>& rangeMap);
440
442 void beginAssembly();
443
481 void
482 fillComplete(const Teuchos::RCP<const map_type>& ownedDomainMap,
483 const Teuchos::RCP<const map_type>& ownedRangeMap,
484 const Teuchos::RCP<Teuchos::ParameterList>& /* params */ = Teuchos::null) {
485 ownedDomainMap_ = ownedDomainMap;
486 ownedRangeMap_ = ownedRangeMap;
487 endFill();
488 }
489
517 void
518 fillComplete(const Teuchos::RCP<Teuchos::ParameterList>& /* params */ = Teuchos::null) { endFill(); }
519
520 private:
522 void endFill();
523 void endFill(const Teuchos::RCP<const map_type>& domainMap, const Teuchos::RCP<const map_type>& rangeMap);
524
526 void beginFill();
527
531 void doOwnedPlusSharedToOwned(const CombineMode CM = Tpetra::ADD);
532
535 void doOwnedToOwnedPlusShared(const CombineMode CM = Tpetra::ADD);
536
537 public:
541
542 private:
543 // Common core guts of the constructor (the colMap argument is Teuchos::null if we're globally-indexed)
544 void setup(const Teuchos::RCP<const map_type>& ownedRowMap, const Teuchos::RCP<const map_type>& ownedPlusSharedRowMap, const Teuchos::RCP<const map_type>& ownedPlusSharedColMap, const Teuchos::RCP<Teuchos::ParameterList>& params);
545
546 // Template to avoid long type names...lazy.
547 // template<typename ViewType>
548 // Teuchos::RCP<const map_type> makeOwnedColMap (ViewType ownedGraphIndices);
549
550 Teuchos::RCP<FE::FillState> fillState_;
551
552 // This is whichever graph isn't currently active
553 Teuchos::RCP<CrsGraph<LocalOrdinal, GlobalOrdinal, Node> > inactiveCrsGraph_;
554
555 // This is in RCP to make shallow copies of the FECrsGraph work correctly
556 Teuchos::RCP<FE::WhichActive> activeCrsGraph_;
557
558 // The importer between the rowmaps of the two graphs
559 Teuchos::RCP<const import_type> ownedRowsImporter_;
560
561 // The domainMap to use in endFill() for the owned graph
562 Teuchos::RCP<const map_type> ownedDomainMap_;
563
564 // The rangeMap to use in endFill() for the owned graph
565 Teuchos::RCP<const map_type> ownedRangeMap_;
566
567 protected:
575 size_t
578 const size_t numInputInds);
579
589 size_t
592 const size_t numInputInds,
593 std::function<void(const size_t, const size_t, const size_t)> fun =
594 std::function<void(const size_t, const size_t, const size_t)>());
595
596 void
597 insertLocalIndicesImpl(const local_ordinal_type lclRow,
598 const Teuchos::ArrayView<const local_ordinal_type>& gblColInds,
599 std::function<void(const size_t, const size_t, const size_t)> fun =
600 std::function<void(const size_t, const size_t, const size_t)>());
601
602}; // class FECrsGraph
603
604} // namespace Tpetra
605
606#endif // TPETRA_FECRSGRAPH_DECL_HPP
Declaration of the Tpetra::CrsGraph class.
Forward declaration of Tpetra::FECrsGraph.
A distributed graph accessed by rows (adjacency lists) and stored sparsely.
typename Node::device_type device_type
This class' Kokkos device type.
KokkosSparse::StaticCrsGraph< local_ordinal_type, Kokkos::LayoutLeft, device_type, void, size_t > local_graph_device_type
The type of the part of the sparse graph on each MPI process.
typename device_type::execution_space execution_space
This class' Kokkos execution space.
Struct that holds views of the contents of a CrsMatrix.
Communication plan for data redistribution from a (possibly) multiply-owned to a uniquely-owned distr...
A distributed graph accessed by rows (adjacency lists) and stored sparsely.
CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::device_type device_type
The Kokkos device type.
void endAssembly()
Migrates data to the owned mode.
CrsGraph< LocalOrdinal, GlobalOrdinal, Node > crs_graph_type
Parent class.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Default parameter list suitable for validation.
FECrsGraph(const FECrsGraph< LocalOrdinal, GlobalOrdinal, Node > &)=delete
Copy constructor (forbidden).
void beginAssembly()
Activates the owned+shared mode for assembly.
FECrsGraph & operator=(const FECrsGraph< LocalOrdinal, GlobalOrdinal, Node > &)=delete
Copy assignment (forbidden).
void switchActiveCrsGraph()
Switches which CrsGraph is active (without migrating data)
void fillComplete(const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Tell the graph that you are done changing its structure; set default domain and range Maps.
LocalOrdinal local_ordinal_type
This class' first template parameter; the type of local indices.
size_t insertGlobalIndicesImpl(const local_ordinal_type lclRow, const global_ordinal_type inputGblColInds[], const size_t numInputInds)
Insert global indices, using an input local row index.
CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::local_graph_device_type local_graph_device_type
The type of the part of the sparse graph on each MPI process.
FECrsGraph(FECrsGraph< LocalOrdinal, GlobalOrdinal, Node > &&)=delete
Move constructor (forbidden).
void fillComplete(const Teuchos::RCP< const map_type > &ownedDomainMap, const Teuchos::RCP< const map_type > &ownedRangeMap, const Teuchos::RCP< Teuchos::ParameterList > &=Teuchos::null)
Tell the graph that you are done changing its structure.
virtual ~FECrsGraph()=default
Destructor (virtual for memory safety of derived classes).
Node node_type
This class' Kokkos Node type.
FECrsGraph & operator=(FECrsGraph< LocalOrdinal, GlobalOrdinal, Node > &&)=delete
Move assignment (forbidden).
CrsGraph< LocalOrdinal, GlobalOrdinal, Node >::execution_space execution_space
The Kokkos execution space.
GlobalOrdinal global_ordinal_type
This class' second template parameter; the type of global indices.
Sparse matrix that presents a row-oriented interface that lets users read or modify entries.
Communication plan for data redistribution from a uniquely-owned to a (possibly) multiply-owned distr...
A parallel distribution of indices over processes.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
CombineMode
Rule for combining data in an Import or Export.
@ ADD
Sum new values.
Allocation information for a locally owned row in a CrsGraph or CrsMatrix.