66 Sorted_(!StaticProfile),
67 StorageOptimized_(false),
68 NoRedundancies_(!StaticProfile),
69 IndicesAreGlobal_(false),
70 IndicesAreLocal_(false),
71 IndicesAreContiguous_(false),
72 LowerTriangular_(true),
73 UpperTriangular_(true),
75 GlobalConstantsComputed_(false),
76 StaticProfile_(StaticProfile),
77 SortGhostsAssociatedWithEachProcessor_(false),
80 IndexBase_(RowMap.IndexBase64()),
82 NumGlobalBlockRows_(RowMap.NumGlobalElements64()),
83 NumGlobalBlockCols_(NumGlobalBlockRows_),
84 NumGlobalBlockDiagonals_(0),
86 NumMyBlockRows_(RowMap.NumMyElements()),
87 NumMyBlockCols_(NumMyBlockRows_),
88 NumMyBlockDiagonals_(0),
89 MaxRowDim_(RowMap.MaxElementSize()),
90 MaxColDim_(MaxRowDim_),
91 GlobalMaxRowDim_(RowMap.MaxElementSize()),
92 GlobalMaxColDim_(GlobalMaxRowDim_),
94 GlobalMaxNumNonzeros_(0),
95 NumGlobalNonzeros_(0),
96 NumGlobalRows_(RowMap.NumGlobalPoints64()),
97 NumGlobalCols_(NumGlobalRows_),
98 NumGlobalDiagonals_(0),
100 NumMyRows_(RowMap.NumMyPoints()),
101 NumMyCols_(NumMyRows_),
104 GlobalMaxNumIndices_(0),
105 NumTempColIndices_(0),
106 NumAllocatedIndicesPerRow_(0),
107 NumIndicesPerRow_(0),
111#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
116 throw "Epetra_CrsGraphData::Epetra_CrsGraphData: cannot be called without any index type for RowMap";
119#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
141 Sorted_(!StaticProfile),
142 StorageOptimized_(false),
143 NoRedundancies_(!StaticProfile),
144 IndicesAreGlobal_(false),
145 IndicesAreLocal_(false),
146 IndicesAreContiguous_(false),
147 LowerTriangular_(true),
148 UpperTriangular_(true),
150 GlobalConstantsComputed_(false),
151 StaticProfile_(StaticProfile),
152 SortGhostsAssociatedWithEachProcessor_(false),
154 IndexBase_(RowMap.IndexBase64()),
155 NumGlobalEntries_(0),
156 NumGlobalBlockRows_(RowMap.NumGlobalElements64()),
157 NumGlobalBlockCols_(ColMap.NumGlobalElements64()),
158 NumGlobalBlockDiagonals_(0),
160 NumMyBlockRows_(RowMap.NumMyElements()),
161 NumMyBlockCols_(ColMap.NumMyElements()),
162 NumMyBlockDiagonals_(0),
163 MaxRowDim_(RowMap.MaxElementSize()),
164 MaxColDim_(ColMap.MaxElementSize()),
165 GlobalMaxRowDim_(RowMap.MaxElementSize()),
166 GlobalMaxColDim_(ColMap.MaxElementSize()),
168 GlobalMaxNumNonzeros_(0),
169 NumGlobalNonzeros_(0),
170 NumGlobalRows_(RowMap.NumGlobalPoints64()),
171 NumGlobalCols_(ColMap.NumGlobalPoints64()),
172 NumGlobalDiagonals_(0),
174 NumMyRows_(RowMap.NumMyPoints()),
175 NumMyCols_(ColMap.NumMyPoints()),
178 GlobalMaxNumIndices_(0),
179 NumTempColIndices_(0),
180 NumAllocatedIndicesPerRow_(0),
181 NumIndicesPerRow_(0),
185#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
190 throw "Epetra_CrsGraphData::Epetra_CrsGraphData: cannot be called without any index type for RowMap";
193 throw "Epetra_CrsGraphData::Epetra_CrsGraphData: cannot be called with different indices types for RowMap and ColMap";
196#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
437 const int_type *Indices)
443 bool indicesAreSorted =
true;
444 for (
int i=1; i<numCols; ++i)
445 if (Indices[i] <= Indices[i-1]) {
446 indicesAreSorted =
false;
450 if (indicesAreSorted && numCols > 3) {
451 const int_type * curInput = &Indices[0];
452 int_type col = *curInput;
453 const int_type * endInput = &Indices[numCols];
457 if (entries_.size() == 0 || entries_.back() < col)
459 entries_.insert(entries_.end(), &Indices[0], &Indices[numCols]);
465 typename std::vector<int_type>::iterator it =
466 std::lower_bound(entries_.begin(), entries_.end(), col);
469 if (curInput == endInput)
475 if (it == entries_.end())
484 it = std::lower_bound(it, entries_.end(), col);
485 if (it == entries_.end())
490 if (curInput == endInput)
497 const int pos1 = (int) (it - entries_.begin());
498 entries_.insert (it, curInput, endInput);
499 it = entries_.begin() + pos1;
502 typename std::vector<int_type>::iterator it2 = it + (endInput - curInput);
506 while (curInput != endInput && it2 != entries_.end())
508 if (*curInput < *it2)
510 else if (*curInput == *it2)
521 while (curInput != endInput)
524 while (it2 != entries_.end())
528 const int new_size = (int) (it - entries_.begin());
529 entries_.resize (new_size);
535 for (
int i=0; i<numCols; ++i)
536 AddEntry(Indices[i]);