61 int* numIndicesPerRow,
62 bool ignoreNonLocalEntries,
63 bool buildNonlocalGraph)
67 ignoreNonLocalEntries_(ignoreNonLocalEntries),
68 nonlocalGraph_ (NULL),
69 buildNonlocalGraph_ (buildNonlocalGraph)
77 bool ignoreNonLocalEntries,
78 bool buildNonlocalGraph)
82 ignoreNonLocalEntries_(ignoreNonLocalEntries),
83 nonlocalGraph_ (NULL),
84 buildNonlocalGraph_ (buildNonlocalGraph)
94 int* numIndicesPerRow,
95 bool ignoreNonLocalEntries,
96 bool buildNonlocalGraph)
100 ignoreNonLocalEntries_(ignoreNonLocalEntries),
101 nonlocalGraph_ (NULL),
102 buildNonlocalGraph_ (buildNonlocalGraph)
112 int numIndicesPerRow,
113 bool ignoreNonLocalEntries,
114 bool buildNonlocalGraph)
118 ignoreNonLocalEntries_(ignoreNonLocalEntries),
119 nonlocalGraph_ (NULL),
120 buildNonlocalGraph_ (buildNonlocalGraph)
142 template<
typename int_type>
144 int numCols,
const int_type* cols)
151 for(
int i=0; i<numRows; ++i) {
152 const int LID = thisgraph->
LRID(rows[i]);
156 const_cast<int_type*>(cols));
159 nonlocalRowData<int_type>()[rows[i]].AddEntries(numCols,cols);
162 if (err < 0)
return (err);
163 if (err > 0) returncode = err;
168 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
171 if(
RowMap().GlobalIndicesInt())
172 return InsertGlobalIndices<int>(numRows, rows, numCols, cols);
174 throw ReportError(
"Epetra_FECrsGraph::InsertGlobalIndices int version called for a matrix that is not int.", -1);
177 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
180 if(
RowMap().GlobalIndicesLongLong())
181 return InsertGlobalIndices<long long>(numRows, rows, numCols, cols);
183 throw ReportError(
"Epetra_FECrsGraph::InsertGlobalIndices long long version called for a matrix that is not long long.", -1);
191 static_cast<Epetra_Map&>(this->CrsGraphData_->RowMap_),
196 template<
typename int_type>
199 bool callFillComplete)
202 if (callFillComplete) {
217 std::map<int_type,Epetra_CrsGraphData::EntriesInOneRow<int_type> >& nonlocalRowData_var = nonlocalRowData<int_type>();
219 const int numRows = (int) nonlocalRowData_var.size();
220 int_type * presentRowIndices =
new int_type[numRows];
221 typename std::map<int_type,Epetra_CrsGraphData::EntriesInOneRow<int_type> >::iterator nonlocalRows
222 = nonlocalRowData<int_type>().begin();
223 for (
int i=0 ; nonlocalRows != nonlocalRowData_var.end(); ++nonlocalRows, ++i)
224 presentRowIndices[i] = (int_type) nonlocalRows->first;
233 if (callFillComplete) {
236 delete [] presentRowIndices;
246 for (nonlocalRows = nonlocalRowData_var.begin();
247 nonlocalRows != nonlocalRowData_var.end(); ++nonlocalRows)
248 allColumns.
AddEntries((
int) nonlocalRows->second.entries_.size(),
258 int * rowLengths =
new int[numRows];
261 for (nonlocalRows = nonlocalRowData_var.begin();
262 nonlocalRows != nonlocalRowData_var.end() ; ++nonlocalRows, ++i)
263 rowLengths[i] = (
int) nonlocalRows->second.entries_.size();
280 for (nonlocalRows = nonlocalRowData_var.begin();
281 nonlocalRows != nonlocalRowData_var.end(); ++nonlocalRows)
283 (
int) nonlocalRows->second.entries_.size(),
299 if(callFillComplete) {
304 for (nonlocalRows = nonlocalRowData_var.begin();
305 nonlocalRows != nonlocalRowData_var.end(); ++nonlocalRows)
306 nonlocalRows->second.entries_.clear();
307 nonlocalRowData_var.clear();
309 delete [] rowLengths;
310 delete [] presentRowIndices;
322 bool callFillComplete)
325 throw ReportError(
"Epetra_FECrsGraph::GlobalAssemble: cannot be called with different indices types for domainMap and rangeMap", -1);
328 throw ReportError(
"Epetra_FECrsGraph::GlobalAssemble: cannot be called with different indices types for row map and incoming rangeMap", -1);
331 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
332 return GlobalAssemble<int>(domain_map, range_map, callFillComplete);
334 throw ReportError(
"Epetra_FECrsGraph::GlobalAssemble: ERROR, GlobalIndicesInt but no API for it.",-1);
337 if(
RowMap().GlobalIndicesLongLong())
338 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
339 return GlobalAssemble<long long>(domain_map, range_map, callFillComplete);
341 throw ReportError(
"Epetra_FECrsGraph::GlobalAssemble: ERROR, GlobalIndicesLongLong but no API for it.",-1);
344 throw ReportError(
"Epetra_FECrsGraph::GlobalAssemble: cannot determine global index type", -1);