Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_FECrsGraph.h
Go to the documentation of this file.
1 /*
2 //@HEADER
3 // ************************************************************************
4 //
5 // Epetra: Linear Algebra Services Package
6 // Copyright 2011 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 Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 */
43 
44 #ifndef EPETRA_FECRSGRAPH_H
45 #define EPETRA_FECRSGRAPH_H
46 
47 #include "Epetra_ConfigDefs.h"
48 #include "Epetra_Map.h"
49 #include "Epetra_CrsGraph.h"
50 
51 #include <map>
52 
65 class EPETRA_LIB_DLL_EXPORT Epetra_FECrsGraph : public Epetra_CrsGraph {
66  friend class Epetra_FECrsMatrix;
67 
68  public:
69 
72  const Epetra_BlockMap& RowMap,
73  int* NumIndicesPerRow,
74  bool ignoreNonLocalEntries=false,
75  bool buildNonlocalGraph=false);
76 
79  const Epetra_BlockMap& RowMap,
80  int NumIndicesPerRow,
81  bool ignoreNonLocalEntries=false,
82  bool buildNonlocalGraph=false);
83 
86  const Epetra_BlockMap& RowMap,
87  const Epetra_BlockMap& ColMap,
88  int* NumIndicesPerRow,
89  bool ignoreNonLocalEntries=false,
90  bool buildNonlocalGraph=false);
91 
94  const Epetra_BlockMap& RowMap,
95  const Epetra_BlockMap& ColMap,
96  int NumIndicesPerRow,
97  bool ignoreNonLocalEntries=false,
98  bool buildNonlocalGraph=false);
99 
101  // Using default copy constructor because there is no def in cpp file
102  // Epetra_FECrsGraph(const Epetra_FECrsGraph& Graph);
103 
105  virtual ~Epetra_FECrsGraph();
106 
107  //Let the compiler know we intend to overload the base-class function
108  //InsertGlobalIndices rather than hide it.
110 
120 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
121  int InsertGlobalIndices(int numRows, const int* rows,
122  int numCols, const int* cols);
123 #endif
124 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
125  int InsertGlobalIndices(int numRows, const long long* rows,
126  int numCols, const long long* cols);
127 #endif
128 
150  int GlobalAssemble(bool callFillComplete=true);
151 
177  int GlobalAssemble(const Epetra_Map& domain_map,
178  const Epetra_Map& range_map,
179  bool callFillComplete=true);
180 
181  bool UseNonlocalGraph () const {return buildNonlocalGraph_; };
182 
183  private:
184  void DeleteMemory();
185  int InsertNonlocalRow(int row, int offset);
186  int InputNonlocalIndices(int row,
187  int numCols,
188  const int* cols);
189  int InputNonlocalIndex(int rowoffset,
190  int col);
191 
192  long long myFirstRow_;
195 
200 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
201  std::map<int,Epetra_CrsGraphData::EntriesInOneRow<int> > nonlocalRowData_int_;
202 #endif
203 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
204  std::map<long long,Epetra_CrsGraphData::EntriesInOneRow<long long> > nonlocalRowData_LL_;
205 #endif
206 
207  template<typename int_type>
208  std::map<int_type,Epetra_CrsGraphData::EntriesInOneRow<int_type> >& nonlocalRowData();
209 
216 
218 
219  template<typename int_type>
220  int InsertGlobalIndices(int numRows, const int_type* rows, int numCols, const int_type* cols);
221 
222  template<typename int_type>
223  int GlobalAssemble(const Epetra_Map& domain_map, const Epetra_Map& range_map, bool callFillComplete);
224 
225 };//class Epetra_FECrsGraph
226 
227 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
228 template<> inline std::map<int,Epetra_CrsGraphData::EntriesInOneRow<int> >& Epetra_FECrsGraph::nonlocalRowData()
229 {
230  return nonlocalRowData_int_;
231 }
232 #endif
233 
234 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
235 template<> inline std::map<long long,Epetra_CrsGraphData::EntriesInOneRow<long long> >& Epetra_FECrsGraph::nonlocalRowData()
236 {
237  return nonlocalRowData_LL_;
238 }
239 #endif
240 
241 #endif
Epetra_Map: A class for partitioning vectors and matrices.
Definition: Epetra_Map.h:119
Epetra_CrsGraph * nonlocalGraph_
A CrsGraph holding non-local data in case the respective flag is set in the constructor.
Epetra_CrsGraph & operator=(const Epetra_CrsGraph &Source)
Assignment operator.
int InsertNonlocalRow(int_type row, typename std::vector< int_type >::iterator offset)
Epetra Finite-Element CrsGraph.
const Epetra_Map & ColMap() const
Returns the Epetra_Map object that describes the set of column-indices that appear in each processor&#39;...
std::map< int, Epetra_CrsGraphData::EntriesInOneRow< int > > nonlocalRowData_int_
This STL map holds all non-local data in format of Entries in the individual rows together with the r...
const Epetra_Map & RowMap() const
Returns the Epetra_Map object associated with the rows of this matrix.
Epetra Finite-Element CrsMatrix.
bool UseNonlocalGraph() const
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
int GlobalAssemble(bool callFillComplete=true, Epetra_CombineMode combineMode=Add, bool save_off_and_reuse_map_exporter=false)
Gather any overlapping/shared data into the non-overlapping partitioning defined by the Map that was ...
std::map< long long, Epetra_CrsGraphData::EntriesInOneRow< long long > > nonlocalRowData_LL_
int InsertGlobalIndices(int GlobalRow, int NumIndices, int *Indices)
Enter a list of elements in a specified global row of the graph.
const Epetra_CrsGraph & Graph() const
Returns a reference to the Epetra_CrsGraph object associated with this matrix.
Epetra_DataAccess
std::map< int_type, Epetra_CrsGraphData::EntriesInOneRow< int_type > > & nonlocalRowData()
friend class Epetra_FECrsGraph
Epetra_CrsGraph: A class for constructing and using sparse compressed row graphs. ...