Tpetra Matrix/Vector Services  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Tpetra_BlockCrsGraph_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Tpetra: Templated Linear Algebra Services Package
5 // Copyright (2008) Sandia Corporation
6 //
7 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
8 // the U.S. Government retains certain rights in this software.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ************************************************************************
40 // @HEADER
41 
42 #ifndef TPETRA_BLOCKCRSGRAPH_DECL_HPP
43 #define TPETRA_BLOCKCRSGRAPH_DECL_HPP
44 
45 #include "Tpetra_CrsGraph.hpp"
46 #include "Tpetra_BlockMap.hpp"
47 
52 namespace Tpetra {
53 
64 template <class LocalOrdinal, class GlobalOrdinal = LocalOrdinal, class Node = Kokkos::DefaultNode::DefaultNodeType>
65 class BlockCrsGraph : public Teuchos::Describable {
66  public:
67  typedef LocalOrdinal local_ordinal_type;
68  typedef GlobalOrdinal global_ordinal_type;
69  typedef Node node_type;
70 
72 
73 
76  BlockCrsGraph(const Teuchos::RCP<const BlockMap<LocalOrdinal,GlobalOrdinal,Node> >& blkRowMap, size_t maxNumEntriesPerRow, ProfileType pftype = DynamicProfile);
77 
80 
82 
84 
85 
87  void insertGlobalIndices(GlobalOrdinal row, const Teuchos::ArrayView<const GlobalOrdinal> &indices);
88 
90 
92  Teuchos::ArrayRCP<const size_t> getNodeRowOffsets() const;
93 
95 
97  Teuchos::ArrayRCP<const LocalOrdinal> getNodePackedIndices() const;
99 
101 
102 
104  void globalAssemble();
105 
110  void fillComplete(const Teuchos::RCP<const BlockMap<LocalOrdinal,GlobalOrdinal,Node> > &blkDomainMap, const Teuchos::RCP<const BlockMap<LocalOrdinal,GlobalOrdinal,Node> > &blkRangeMap, OptimizeOption os = DoOptimizeStorage);
111 
118 
120  void optimizeStorage();
121 
123 
125 
126 
128  bool isFillComplete() const;
129 
131  bool isLocallyIndexed() const;
132 
134  bool isUpperTriangular() const;
135 
137  bool isLowerTriangular() const;
138 
140  size_t getNodeNumBlockRows() const;
141 
143  size_t getGlobalNumBlockRows() const;
144 
146  size_t getNodeNumBlockDiags() const;
147 
149  size_t getNodeNumBlockEntries() const;
150 
152  size_t getGlobalBlockRowLength(GlobalOrdinal row) const;
153 
155  void getGlobalBlockRowView(GlobalOrdinal row,
156  Teuchos::ArrayView<const GlobalOrdinal>& blockCols) const;
157 
159  void getLocalBlockRowView(LocalOrdinal row,
160  Teuchos::ArrayView<const LocalOrdinal>& blockCols) const;
161 
163  const Teuchos::RCP<const BlockMap<LocalOrdinal,GlobalOrdinal,Node> > & getBlockRowMap() const;
164 
166  const Teuchos::RCP<const BlockMap<LocalOrdinal,GlobalOrdinal,Node> > & getBlockColMap() const;
167 
169  const Teuchos::RCP<const BlockMap<LocalOrdinal,GlobalOrdinal,Node> > & getBlockDomainMap() const;
170 
172  const Teuchos::RCP<const BlockMap<LocalOrdinal,GlobalOrdinal,Node> > & getBlockRangeMap() const;
173 
175 
176  private:
177  Teuchos::RCP<CrsGraph<LocalOrdinal,GlobalOrdinal,Node> > ptGraph_;
178 
179  Teuchos::RCP<const BlockMap<LocalOrdinal,GlobalOrdinal,Node> > blkRowMap_;
180  Teuchos::RCP<const BlockMap<LocalOrdinal,GlobalOrdinal,Node> > blkColMap_;
181  Teuchos::RCP<const BlockMap<LocalOrdinal,GlobalOrdinal,Node> > blkDomainMap_;
182  Teuchos::RCP<const BlockMap<LocalOrdinal,GlobalOrdinal,Node> > blkRangeMap_;
183 };//class BlockCrsGraph
184 }//namespace Tpetra
185 
186 #endif
187 
Block-entry counterpart to Tpetra::Map.
size_t getNodeNumBlockRows() const
Returns the number of block rows owned on the calling node.
size_t getGlobalBlockRowLength(GlobalOrdinal row) const
Returns the number of block-columns in the specified global block row.
~BlockCrsGraph()
BlockCrsGraph destructor.
size_t getNodeNumBlockDiags() const
Returns the number of diagonal entries on the calling node.
Block-entry counterpart to Tpetra::CrsGraph.
size_t getNodeNumBlockEntries() const
Returns the local number of entries in the graph.
void getGlobalBlockRowView(GlobalOrdinal row, Teuchos::ArrayView< const GlobalOrdinal > &blockCols) const
Returns a read-only view of the block-column-indices for the specified global block row...
void fillComplete(const Teuchos::RCP< const BlockMap< LocalOrdinal, GlobalOrdinal, Node > > &blkDomainMap, const Teuchos::RCP< const BlockMap< LocalOrdinal, GlobalOrdinal, Node > > &blkRangeMap, OptimizeOption os=DoOptimizeStorage)
Signal that data entry is complete, specifying domain and range maps. Off-node entries are distribute...
bool isUpperTriangular() const
true if graph is upper-triangular.
const Teuchos::RCP< const BlockMap< LocalOrdinal, GlobalOrdinal, Node > > & getBlockColMap() const
Returns the block-column map.
size_t getGlobalNumBlockRows() const
Returns the global number of block rows.
void insertGlobalIndices(GlobalOrdinal row, const Teuchos::ArrayView< const GlobalOrdinal > &indices)
Submit graph indices, using global IDs.
Teuchos::ArrayRCP< const size_t > getNodeRowOffsets() const
Get row-offsets. (This is the bptr array in VBR terminology.)
const Teuchos::RCP< const BlockMap< LocalOrdinal, GlobalOrdinal, Node > > & getBlockRowMap() const
Returns the block-row map.
const Teuchos::RCP< const BlockMap< LocalOrdinal, GlobalOrdinal, Node > > & getBlockDomainMap() const
Returns the block-domain map.
bool isLocallyIndexed() const
If graph indices are in the local range, this function returns true. Otherwise, this function returns...
Teuchos::ArrayRCP< const LocalOrdinal > getNodePackedIndices() const
Get packed-col-indices. (This is the bindx array in VBR terminology.)
BlockCrsGraph(const Teuchos::RCP< const BlockMap< LocalOrdinal, GlobalOrdinal, Node > > &blkRowMap, size_t maxNumEntriesPerRow, ProfileType pftype=DynamicProfile)
BlockCrsGraph constructor specifying a block-row-map and max-num-block-entries-per-row.
void optimizeStorage()
Re-allocate the data into contiguous storage.
bool isFillComplete() const
Returns true if fillComplete() has been called.
bool isLowerTriangular() const
true if graph is lower-triangular.
void globalAssemble()
Communicate non-local contributions to other nodes.
const Teuchos::RCP< const BlockMap< LocalOrdinal, GlobalOrdinal, Node > > & getBlockRangeMap() const
Returns the block-range map.
void getLocalBlockRowView(LocalOrdinal row, Teuchos::ArrayView< const LocalOrdinal > &blockCols) const
Returns a read-only view of the block-column-indices for the specified local block row...