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 #if defined(Epetra_SHOW_DEPRECATED_WARNINGS)
48 #ifdef __GNUC__
49 #warning "The Epetra package is deprecated"
50 #endif
51 #endif
52 
53 
54 
55 #include "Epetra_ConfigDefs.h"
56 #include "Epetra_Map.h"
57 #include "Epetra_CrsGraph.h"
58 
59 #include <map>
60 
73 class EPETRA_LIB_DLL_EXPORT Epetra_FECrsGraph : public Epetra_CrsGraph {
74  friend class Epetra_FECrsMatrix;
75 
76  public:
77 
80  const Epetra_BlockMap& RowMap,
81  int* NumIndicesPerRow,
82  bool ignoreNonLocalEntries=false,
83  bool buildNonlocalGraph=false);
84 
87  const Epetra_BlockMap& RowMap,
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 
102  const Epetra_BlockMap& RowMap,
103  const Epetra_BlockMap& ColMap,
104  int NumIndicesPerRow,
105  bool ignoreNonLocalEntries=false,
106  bool buildNonlocalGraph=false);
107 
109  // Using default copy constructor because there is no def in cpp file
110  // Epetra_FECrsGraph(const Epetra_FECrsGraph& Graph);
111 
113  virtual ~Epetra_FECrsGraph();
114 
115  //Let the compiler know we intend to overload the base-class function
116  //InsertGlobalIndices rather than hide it.
118 
128 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
129  int InsertGlobalIndices(int numRows, const int* rows,
130  int numCols, const int* cols);
131 #endif
132 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
133  int InsertGlobalIndices(int numRows, const long long* rows,
134  int numCols, const long long* cols);
135 #endif
136 
158  int GlobalAssemble(bool callFillComplete=true);
159 
185  int GlobalAssemble(const Epetra_Map& domain_map,
186  const Epetra_Map& range_map,
187  bool callFillComplete=true);
188 
189  bool UseNonlocalGraph () const {return buildNonlocalGraph_; };
190 
191  private:
192  void DeleteMemory();
193  int InsertNonlocalRow(int row, int offset);
194  int InputNonlocalIndices(int row,
195  int numCols,
196  const int* cols);
197  int InputNonlocalIndex(int rowoffset,
198  int col);
199 
200  long long myFirstRow_;
203 
208 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
209  std::map<int,Epetra_CrsGraphData::EntriesInOneRow<int> > nonlocalRowData_int_;
210 #endif
211 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
212  std::map<long long,Epetra_CrsGraphData::EntriesInOneRow<long long> > nonlocalRowData_LL_;
213 #endif
214 
215  template<typename int_type>
216  std::map<int_type,Epetra_CrsGraphData::EntriesInOneRow<int_type> >& nonlocalRowData();
217 
224 
226 
227  template<typename int_type>
228  int InsertGlobalIndices(int numRows, const int_type* rows, int numCols, const int_type* cols);
229 
230  template<typename int_type>
231  int GlobalAssemble(const Epetra_Map& domain_map, const Epetra_Map& range_map, bool callFillComplete);
232 
233 };//class Epetra_FECrsGraph
234 
235 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
236 template<> inline std::map<int,Epetra_CrsGraphData::EntriesInOneRow<int> >& Epetra_FECrsGraph::nonlocalRowData()
237 {
238  return nonlocalRowData_int_;
239 }
240 #endif
241 
242 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
243 template<> inline std::map<long long,Epetra_CrsGraphData::EntriesInOneRow<long long> >& Epetra_FECrsGraph::nonlocalRowData()
244 {
245  return nonlocalRowData_LL_;
246 }
247 #endif
248 
249 #endif
Epetra_Map: A class for partitioning vectors and matrices.
Definition: Epetra_Map.h:127
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. ...