58 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
68 const int* numIndicesPerRow,
bool staticProfile)
72 Allocate(numIndicesPerRow, 1, staticProfile);
78 int numIndicesPerRow,
bool staticProfile)
82 Allocate(&numIndicesPerRow, 0, staticProfile);
89 const int* numIndicesPerRow,
bool staticProfile)
94 throw ReportError(
"Epetra_CrsGraph::Epetra_CrsGraph: cannot be called with different indices types for rowMap and colMap", -1);
96 Allocate(numIndicesPerRow, 1, staticProfile);
103 int numIndicesPerRow,
bool staticProfile)
108 throw ReportError(
"Epetra_CrsGraph::Epetra_CrsGraph: cannot be called with different indices types for rowMap and colMap", -1);
110 Allocate(&numIndicesPerRow, 0, staticProfile);
116 CrsGraphData_(Graph.CrsGraphData_)
122 template<
typename int_type>
135 throw ReportError(
"Error with NumIndicesPerRow_ allocation.", -99);
139 throw ReportError(
"Error with NumAllocatedIndicesPerRow_ allocation.", -99);
143 if (numIndicesPerRow != 0) {
144 for(i = 0; i < numMyBlockRows; i++) {
145 int nnzr = numIndicesPerRow[i*Inc];
159 if (staticProfile) Data.All_Indices_.Size(nnz);
160 int_type * all_indices = Data.All_Indices_.Values();
161 for(i = 0; i < numMyBlockRows; i++) {
162 const int NumIndices = numIndicesPerRow==0 ? 0 :numIndicesPerRow[i*Inc];
163 const int_type indexBaseMinusOne = (int_type)
IndexBase64() - 1;
167 Data.Indices_[i] = all_indices;
168 all_indices += NumIndices;
169 int_type* ColIndices = Data.Indices_[i];
170 for(
int j = 0; j < NumIndices; j++)
171 ColIndices[j] = indexBaseMinusOne;
177 Data.SortedEntries_[i].entries_.resize(NumIndices,
180 Data.SortedEntries_[i].entries_.resize(0);
184 Data.Indices_[i] = NULL;
189 if (staticProfile) assert(Data.All_Indices_.Values()+nnz==all_indices);
192 for(i = 0; i < numMyBlockRows; i++) {
193 Data.Indices_[i] = 0;
204 if(
RowMap().GlobalIndicesInt()) {
205 return TAllocate<int>(numIndicesPerRow, Inc, staticProfile);
209 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
210 TAllocate<int>(numIndicesPerRow, Inc, staticProfile);
211 TAllocate<long long>(numIndicesPerRow, Inc, staticProfile);
214 throw ReportError(
"Epetra_CrsGraph::Allocate: ERROR, GlobalIndicesLongLong but no API for it.",-1);
218 throw ReportError(
"Epetra_CrsGraph::Allocate: Internal error.", -1);
253 template<
typename int_type>
260 int locRow =
LRID(Row);
271 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
274 if(
RowMap().GlobalIndicesInt())
275 return InsertGlobalIndices<int>(Row, NumIndices, indices);
277 throw ReportError(
"Epetra_CrsGraph::InsertGlobalIndices int version called for a graph that is not int.", -1);
281 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
284 if(
RowMap().GlobalIndicesLongLong())
285 return InsertGlobalIndices<long long>(Row, NumIndices, indices);
287 throw ReportError(
"Epetra_CrsGraph::InsertGlobalIndices long long version called for a graph that is not long long.", -1);
308 #if !defined(EPETRA_NO_32BIT_GLOBAL_INDICES) || !defined(EPETRA_NO_64BIT_GLOBAL_INDICES)
311 throw ReportError(
"Epetra_CrsGraph::InsertIndicesIntoSorted: Failure because neither 32 bit nor 64 bit indices insertable.", -1);
321 template<
typename int_type>
324 int_type* UserIndices)
344 if(Data.Indices_[Row] != 0)
346 Data.Indices_[Row] = UserIndices;
347 current_numAllocIndices = NumIndices;
348 current_numIndices = NumIndices;
358 delete [] Data.TempColIndices_;
359 Data.TempColIndices_ =
new int_type[NumIndices];
362 int_type * tempIndices = Data.TempColIndices_;
365 for(j = 0; j < NumIndices; ++j)
367 tempIndices[loc++] = UserIndices[j];
370 for(j = 0; j < NumIndices; ++j) {
373 tempIndices[loc++] = UserIndices[j];
377 if(loc != NumIndices)
380 UserIndices = tempIndices;
383 int start = current_numIndices;
384 int stop = start + NumIndices;
386 if(stop > current_numAllocIndices)
390 if (current_numAllocIndices > 0 && stop > current_numAllocIndices)
392 Data.SortedEntries_[Row].entries_.resize(stop,
IndexBase64() - 1);
393 Data.Indices_[Row] = stop>0 ? &Data.SortedEntries_[Row].entries_[0] : NULL;
395 current_numAllocIndices = (int) Data.SortedEntries_[Row].entries_.capacity();
398 current_numIndices = stop;
399 int_type* RowIndices = Data.Indices_[Row]+start;
400 for(j = 0; j < NumIndices; j++) {
401 RowIndices[j] = UserIndices[j];
422 if(
RowMap().GlobalIndicesTypeValid())
423 return TInsertIndices<int>(Row, NumIndices, UserIndices);
425 throw ReportError(
"Epetra_CrsGraph::InsertIndices global index type unknown.", -1);
431 long long* UserIndices)
433 if(
RowMap().GlobalIndicesLongLong())
434 return TInsertIndices<long long>(Row, NumIndices, UserIndices);
436 throw ReportError(
"Epetra_CrsGraph::InsertIndices long long version called for a graph that is not long long.", -1);
440 template<
typename int_type>
443 int_type* UserIndices)
472 delete [] Data.TempColIndices_;
473 Data.TempColIndices_ =
new int_type[NumIndices];
476 int_type * tempIndices = Data.TempColIndices_;
479 for(
int j = 0; j < NumIndices; ++j)
481 tempIndices[loc++] = UserIndices[j];
484 for(
int j = 0; j < NumIndices; ++j) {
486 tempIndices[loc++] = UserIndices[j];
490 if(loc != NumIndices)
493 UserIndices = tempIndices;
498 Data.SortedEntries_[Row].AddEntries(NumIndices, UserIndices);
499 current_numIndices = (int) Data.SortedEntries_[Row].entries_.size();
500 current_numAllocIndices = (int) Data.SortedEntries_[Row].entries_.capacity();
502 Data.Indices_[Row] = current_numIndices > 0 ? &Data.SortedEntries_[Row].entries_[0] : NULL;
520 if(
RowMap().GlobalIndicesTypeValid())
521 return TInsertIndicesIntoSorted<int>(Row, NumIndices, UserIndices);
523 throw ReportError(
"Epetra_CrsGraph::InsertIndicesIntoSorted global index type unknown.", -1);
529 long long* UserIndices)
531 if(
RowMap().GlobalIndicesLongLong())
532 return TInsertIndicesIntoSorted<long long>(Row, NumIndices, UserIndices);
534 throw ReportError(
"Epetra_CrsGraph::InsertIndicesIntoSorted long long version called for a graph that is not long long.", -1);
538 template<
typename int_type>
554 int locRow =
LRID(Row);
563 for(j = 0; j < NumIndices; j++) {
564 int_type Index = indices[j];
566 for(k = Loc+1; k < NumCurrentIndices; k++)
567 Data.Indices_[locRow][k-1] = Data.Indices_[locRow][k];
571 Data.SortedEntries_[locRow].entries_.pop_back();
573 Data.Indices_[locRow][NumCurrentIndices-1] =
IndexBase64() - 1;
587 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
590 if(
RowMap().GlobalIndicesInt())
591 return RemoveGlobalIndices<int>(Row, NumIndices, indices);
593 throw ReportError(
"Epetra_CrsGraph::RemoveGlobalIndices int version called for a graph that is not int.", -1);
597 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
600 if(
RowMap().GlobalIndicesLongLong())
601 return RemoveGlobalIndices<long long>(Row, NumIndices, indices);
603 throw ReportError(
"Epetra_CrsGraph::RemoveGlobalIndices long long version called for a graph that is not long long.", -1);
630 for(j = 0; j < NumIndices; j++) {
631 int Index = indices[j];
633 for(k = Loc + 1; k < NumCurrentIndices; k++)
654 template<
typename int_type>
668 #ifdef EPETRA_NO_64BIT_GLOBAL_INDICES
669 int locRow =
LRID((
int) Row);
671 int locRow =
LRID(Row);
682 const int_type indexBaseMinusOne = (int_type)
IndexBase64() - 1;
683 for(j = 0; j < NumIndices; j++)
684 Data.Indices_[locRow][j] = indexBaseMinusOne;
687 Data.SortedEntries_[locRow].entries_.resize(0);
703 if(
RowMap().GlobalIndicesLongLong())
704 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
705 return TRemoveGlobalIndices<long long>(Row);
707 throw ReportError(
"Epetra_CrsGraph::RemoveGlobalIndices: ERROR, GlobalIndicesLongLong but no API for it.",-1);
710 if(
RowMap().GlobalIndicesInt())
711 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
712 return TRemoveGlobalIndices<int>(Row);
714 throw ReportError(
"Epetra_CrsGraph::RemoveGlobalIndices: ERROR, GlobalIndicesInt but no API for it.",-1);
717 throw ReportError(
"Epetra_CrsGraph::RemoveGlobalIndices: Internal error.", -1);
741 for(
int j = 0; j < NumIndices; j++)
759 template<
typename int_type>
769 int* locIndices =
Indices(LocalRow);
770 int locIndex =
LCID(Index);
778 for(j = 0; j < NumIndices; j++) {
781 if(locIndices[j0] == locIndex) {
790 int_type* locIndices = TIndices<int_type>(LocalRow);
798 for(j = 0; j < NumIndices; j++) {
801 if(locIndices[j0] == Index) {
813 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
819 if(
RowMap().GlobalIndicesInt())
820 return FindGlobalIndexLoc<int>(LocalRow, Index, Start, Loc);
822 throw ReportError(
"Epetra_CrsGraph::FindGlobalIndexLoc int version called for a graph that is not int.", -1);
825 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
831 if(
RowMap().GlobalIndicesLongLong())
832 return FindGlobalIndexLoc<long long>(LocalRow, Index, Start, Loc);
834 throw ReportError(
"Epetra_CrsGraph::FindGlobalIndexLoc long long version called for a graph that is not long long.", -1);
839 template<
typename int_type>
841 const int_type* indices,
858 for(j = 0; j < NumIndices; j++) {
861 if(indices[j0] == Index) {
871 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
878 if(
RowMap().GlobalIndicesInt())
879 return FindGlobalIndexLoc<int>(NumIndices, indices, Index, Start, Loc);
881 throw ReportError(
"Epetra_CrsGraph::FindGlobalIndexLoc int version called for a graph that is not int.", -1);
884 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
886 const long long* indices,
891 if(
RowMap().GlobalIndicesLongLong())
892 return FindGlobalIndexLoc<long long>(NumIndices, indices, Index, Start, Loc);
894 throw ReportError(
"Epetra_CrsGraph::FindGlobalIndexLoc long long version called for a graph that is not long long.", -1);
905 int* locIndices =
Indices(LocalRow);
908 throw ReportError(
"Epetra_CrsGraph::FindMyIndexLoc", -1);
918 for(j = 0; j < NumIndices; j++) {
921 if(locIndices[j0] == Index) {
939 throw ReportError(
"Epetra_CrsGraph::FindMyIndexLoc", -1);
949 for(j = 0; j < NumIndices; j++) {
952 if(indices[j0] == Index) {
971 throw ReportError(
"Epetra_CrsGraph::FillComplete: cannot be called with different indices types for domainMap and rangeMap", -1);
974 throw ReportError(
"Epetra_CrsGraph::FillComplete: cannot be called with different indices types for row map and incoming rangeMap", -1);
1009 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1020 {
for(
int i = 0; i < numMyBlockRows; i++) {
1026 if(
RowMap().ConstantElementSize() &&
ColMap().ConstantElementSize() &&
RowMap().ElementSize() ==
ColMap().ElementSize()) {
1043 int ColElementSize = RowElementSize;
1056 int* ColElementSizeList = RowElementSizeList;
1059 for(
int i = 0; i < numMyBlockRows; i++){
1061 int* indices = intData.
Indices_[i];
1062 if(NumEntries > 0) {
1063 int CurNumNonzeros = 0;
1064 int RowDim = RowElementSizeList[i];
1065 for(
int j = 0; j < NumEntries; j++) {
1066 int ColDim = ColElementSizeList[indices[j]];
1067 CurNumNonzeros += RowDim*ColDim;
1108 int i, j, j2, temp, istep;
1114 for (i=step; i < length; i++)
1120 if (list[j2] > temp) {
1121 while ((j >= istep) && (list[j2] > temp))
1134 step = (int) (step / 2.2);
1150 for(
int i = 0; i < numMyBlockRows; i++){
1152 int*
const list = intData.
Indices_[i];
1200 if (len < 2)
return;
1202 int* ptr0 = &list[0];
1203 int* ptr1 = &list[1];
1205 int* ptr_end = &list[len-1];
1207 while(*ptr0 != *ptr1 && ptr1 < ptr_end) {
1212 if (ptr1 < ptr_end) {
1218 while(*ptr0 == *ptr1 && ptr1 < ptr_end) ++ptr1;
1220 while(ptr1 < ptr_end) {
1224 while(val == *ptr1 && ptr1 < ptr_end) {
1231 if (*(ptr0-1) != *ptr1) *ptr0++ = *ptr1;
1233 int num_removed = (int)(ptr_end - ptr0 + 1);
1234 newlen = len - num_removed;
1237 if (*ptr0 == *ptr1) newlen = len - 1;
1254 bool found_redundancies =
false;
1259 for(
int i=0; i<numMyBlockRows; ++i) {
1260 int NumIndices = numIndicesPerRow[i];
1261 int* col_indices = this->
Indices(i);
1263 if(NumIndices > 1) {
1265 numIndicesPerRow[i]);
1267 if (NumIndices != numIndicesPerRow[i]) {
1268 found_redundancies =
true;
1273 for(
int i=0; i<numMyBlockRows; ++i) {
1274 int* col_indices = this->
Indices(i);
1277 intData.
SortedEntries_[i].entries_.assign(col_indices, col_indices+numIndicesPerRow[i]);
1278 if (numIndicesPerRow[i] > 0) {
1310 for(
int i = 0; i < numMyBlockRows; i++) {
1312 if(NumIndices > 0) {
1313 #if defined(EPETRA_NO_64BIT_GLOBAL_INDICES) && !defined(EPETRA_NO_32BIT_GLOBAL_INDICES)
1314 int ig = rowMap.
GID(i);
1316 long long ig = rowMap.
GID64(i);
1318 int* col_indices = this->
Indices(i);
1320 int jl_0 = col_indices[0];
1321 int jl_n = col_indices[NumIndices-1];
1328 int jl = colMap.
LID(ig);
1330 int insertPoint = -1;
1347 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1366 bool * LocalGIDs = 0;
1367 if (numDomainElements>0) LocalGIDs =
new bool[numDomainElements];
1368 for (i=0; i<numDomainElements; i++) LocalGIDs[i] =
false;
1374 int hashsize = numMyBlockRows;
if (hashsize < 100) hashsize = 100;
1379 int NumLocalColGIDs = 0;
1380 int NumRemoteColGIDs = 0;
1382 for(i = 0; i < numMyBlockRows; i++) {
1384 int* ColIndices = intData.
Indices_[i];
1385 for(j = 0; j < NumIndices; j++) {
1386 int GID = ColIndices[j];
1388 int LID = domainMap.
LID(GID);
1390 bool alreadyFound = LocalGIDs[LID];
1391 if (!alreadyFound) {
1392 LocalGIDs[LID] =
true;
1397 if(RemoteGIDs.
Get(GID) == -1) {
1398 RemoteGIDs.
Add(GID, NumRemoteColGIDs);
1399 RemoteGIDList.
Add(NumRemoteColGIDs++, GID);
1408 if (NumRemoteColGIDs!=0) {
1409 throw ReportError(
"Some column IDs are not in domainMap. If matrix is rectangular, you must pass in domainMap to FillComplete",-1);
1411 if (NumLocalColGIDs==numDomainElements) {
1414 if (LocalGIDs!=0)
delete [] LocalGIDs;
1421 int numMyBlockCols = NumLocalColGIDs + NumRemoteColGIDs;
1423 if(numMyBlockCols > 0)
1424 ColIndices.
Size(numMyBlockCols);
1426 int* RemoteColIndices = ColIndices.
Values() + NumLocalColGIDs;
1428 for(i = 0; i < NumRemoteColGIDs; i++)
1429 RemoteColIndices[i] = RemoteGIDList.
Get(i);
1434 int* RemoteSizeList = 0;
1437 if(NumRemoteColGIDs > 0)
1438 PIDList.
Size(NumRemoteColGIDs);
1441 if(numMyBlockCols > 0)
1442 SizeList.
Size(numMyBlockCols);
1443 RemoteSizeList = SizeList.
Values() + NumLocalColGIDs;
1452 SortLists[0] = RemoteColIndices;
1453 SortLists[1] = RemoteSizeList;
1454 Util.
Sort(
true, NumRemoteColGIDs, PIDList.
Values(), 0, 0, NLists, SortLists, 0, 0);
1461 int StartCurrent, StartNext;
1462 StartCurrent = 0; StartNext = 1;
1463 while ( StartNext < NumRemoteColGIDs ) {
1464 if ((PIDList.
Values())[StartNext]==(PIDList.
Values())[StartNext-1]) StartNext++;
1466 if(DoSizes) SortLists[0] = &(RemoteSizeList[StartCurrent]);
1467 Util.
Sort(
true,StartNext-StartCurrent, &(RemoteColIndices[StartCurrent]),0,0,NLists,SortLists, 0, 0);
1468 StartCurrent = StartNext; StartNext++;
1471 if(DoSizes) SortLists[0] = &(RemoteSizeList[StartCurrent]);
1472 Util.
Sort(
true, StartNext-StartCurrent, &(RemoteColIndices[StartCurrent]), 0, 0, NLists, SortLists, 0, 0);
1489 int* ElementSizeList = 0;
1492 int NumLocalAgain = 0;
1493 for(i = 0; i < NumMyElements; i++) {
1496 SizeList[NumLocalAgain] = ElementSizeList[i];
1497 ColIndices[NumLocalAgain++] = MyGlobalElements[i];
1500 assert(NumLocalAgain==NumLocalColGIDs);
1504 if (LocalGIDs!=0)
delete [] LocalGIDs;
1527 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1546 bool * LocalGIDs = 0;
1547 if (numDomainElements>0) LocalGIDs =
new bool[numDomainElements];
1548 for (i=0; i<numDomainElements; i++) LocalGIDs[i] =
false;
1554 int hashsize = numMyBlockRows;
if (hashsize < 100) hashsize = 100;
1559 int NumLocalColGIDs = 0;
1560 int NumRemoteColGIDs = 0;
1566 for(i = 0; i < numMyBlockRows; i++) {
1568 int* ColIndices = intData.
Indices_[i];
1569 for(j = 0; j < NumIndices; j++) {
1570 int GID = ColIndices[j];
1572 int LID = domainMap.
LID(GID);
1574 bool alreadyFound = LocalGIDs[LID];
1575 if (!alreadyFound) {
1576 LocalGIDs[LID] =
true;
1581 if(RemoteGIDs.
Get(GID) == -1) {
1582 RemoteGIDs.
Add(GID, NumRemoteColGIDs);
1583 RemoteGIDList.
Add(NumRemoteColGIDs++, GID);
1593 for(i = 0; i < numMyBlockRows; i++) {
1595 long long* ColIndices = LLData.
Indices_[i];
1596 for(j = 0; j < NumIndices; j++) {
1597 long long GID = ColIndices[j];
1599 int LID = domainMap.
LID(GID);
1601 bool alreadyFound = LocalGIDs[LID];
1602 if (!alreadyFound) {
1603 LocalGIDs[LID] =
true;
1608 if(RemoteGIDs.
Get(GID) == -1) {
1609 RemoteGIDs.
Add(GID, NumRemoteColGIDs);
1610 RemoteGIDList.
Add(NumRemoteColGIDs++, GID);
1620 if (NumRemoteColGIDs!=0) {
1621 throw ReportError(
"Some column IDs are not in domainMap. If matrix is rectangular, you must pass in domainMap to FillComplete",-1);
1623 if (NumLocalColGIDs==numDomainElements) {
1626 if (LocalGIDs!=0)
delete [] LocalGIDs;
1633 int numMyBlockCols = NumLocalColGIDs + NumRemoteColGIDs;
1635 if(numMyBlockCols > 0)
1636 ColIndices.
Size(numMyBlockCols);
1638 long long* RemoteColIndices = ColIndices.
Values() + NumLocalColGIDs;
1640 for(i = 0; i < NumRemoteColGIDs; i++)
1641 RemoteColIndices[i] = RemoteGIDList.
Get(i);
1646 int* RemoteSizeList = 0;
1649 if(NumRemoteColGIDs > 0)
1650 PIDList.
Size(NumRemoteColGIDs);
1653 if(numMyBlockCols > 0)
1654 SizeList.
Size(numMyBlockCols);
1655 RemoteSizeList = SizeList.
Values() + NumLocalColGIDs;
1666 Util.
Sort(
true, NumRemoteColGIDs, PIDList.
Values(), 0, 0, NLists, &RemoteSizeList, 1, &RemoteColIndices);
1672 int* SortLists[1] = {0};
1674 int StartCurrent, StartNext;
1675 StartCurrent = 0; StartNext = 1;
1676 while ( StartNext < NumRemoteColGIDs ) {
1677 if ((PIDList.
Values())[StartNext]==(PIDList.
Values())[StartNext-1]) StartNext++;
1679 if(DoSizes) SortLists[0] = &(RemoteSizeList[StartCurrent]);
1680 Util.
Sort(
true,StartNext-StartCurrent, &(RemoteColIndices[StartCurrent]),0,0,NLists,SortLists, 0, 0);
1681 StartCurrent = StartNext; StartNext++;
1684 if(DoSizes) SortLists[0] = &(RemoteSizeList[StartCurrent]);
1685 Util.
Sort(
true, StartNext-StartCurrent, &(RemoteColIndices[StartCurrent]), 0, 0, NLists, SortLists, 0, 0);
1702 int* ElementSizeList = 0;
1705 int NumLocalAgain = 0;
1706 for(i = 0; i < NumMyElements; i++) {
1709 SizeList[NumLocalAgain] = ElementSizeList[i];
1710 ColIndices[NumLocalAgain++] = MyGlobalElements[i];
1713 assert(NumLocalAgain==NumLocalColGIDs);
1717 if (LocalGIDs!=0)
delete [] LocalGIDs;
1744 throw ReportError(
"Epetra_CrsGraph::MakeColMap: cannot be called with different indices types for domainMap and rangeMap", -1);
1747 throw ReportError(
"Epetra_CrsGraph::MakeColMap: cannot be called with different indices types for row map and incoming rangeMap", -1);
1750 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1753 throw ReportError(
"Epetra_CrsGraph::MakeColMap: ERROR, GlobalIndicesInt but no API for it.",-1);
1756 if(
RowMap().GlobalIndicesLongLong())
1757 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1760 throw ReportError(
"Epetra_CrsGraph::MakeColMap: ERROR, GlobalIndicesLongLong but no API for it.",-1);
1763 throw ReportError(
"Epetra_CrsGraph::MakeColMap: Internal error, unable to determine global index type of maps", -1);
1769 throw ReportError(
"Epetra_CrsGraph::MakeIndicesLocal: cannot be called with different indices types for domainMap and rangeMap", -1);
1772 throw ReportError(
"Epetra_CrsGraph::MakeIndicesLocal: cannot be called with different indices types for row map and incoming rangeMap", -1);
1790 bool mapMonotone =
true;
1792 long long oldGID = colmap.
GID64(0);
1794 if (oldGID > colmap.
GID64(i)) {
1795 mapMonotone =
false;
1798 oldGID = colmap.
GID64(i);
1814 for(
int i = 0; i < numMyBlockRows; i++) {
1816 int* ColIndices = intData.
Indices_[i];
1817 for(
int j = 0; j < NumIndices; j++) {
1818 int GID = ColIndices[j];
1819 int LID = colmap.
LID(GID);
1821 ColIndices[j] = LID;
1823 throw ReportError(
"Internal error in FillComplete ",-1);
1827 else if(
RowMap().GlobalIndicesLongLong())
1829 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
1834 const long long indexBaseMinusOne =
IndexBase64() - 1;
1835 for(
int i = 0; i < numMyBlockRows; i++) {
1837 intData.
SortedEntries_[i].entries_.resize(NumIndices, indexBaseMinusOne);
1844 for(
int i = 0; i < numMyBlockRows; i++) {
1846 long long* ColIndices = LL_Data.
Indices_[i];
1847 int* intColIndices = intData.
Indices_[i];
1848 for(
int j = 0; j < NumIndices; j++) {
1849 long long GID = ColIndices[j];
1850 int LID = colmap.
LID(GID);
1852 intColIndices[j] = LID;
1854 throw ReportError(
"Internal error in FillComplete ",-1);
1860 throw ReportError(
"Epetra_CrsGraph::MakeIndicesLocal: GlobalIndicesLongLong but no long long API", -1);
1886 bool Contiguous =
true;
1887 for(
int i = 1; i < numMyBlockRows; i++) {
1893 if((NumIndices != NumAllocateIndices) ||
1915 int curNumIndices = numIndicesPerRow[0];
1916 numIndicesPerRow[0] = 0;
1917 for (
int i=0; i<numMyBlockRows; ++i) {
1918 int nextNumIndices = numIndicesPerRow[i+1];
1919 numIndicesPerRow[i+1] = numIndicesPerRow[i]+curNumIndices;
1920 curNumIndices = nextNumIndices;
1931 if(errorcode != 0)
throw ReportError(
"Error with All_Indices_ allocation.", -99);
1940 #ifdef EPETRA_HAVE_OMP
1941 #pragma omp parallel for default(none) shared(indexOffset,all_indices,indices)
1943 for(
int i = 0; i < numMyBlockRows; i++) {
1944 int numColIndices = indexOffset[i+1] - indexOffset[i];
1945 int* ColIndices = indices[i];
1946 int *newColIndices = all_indices+indexOffset[i];
1947 for(
int j = 0; j < numColIndices; j++) newColIndices[j] = ColIndices[j];
1949 for(
int i = 0; i < numMyBlockRows; i++) {
1950 if (indices[i]!=0) {
1958 for(
int i = 0; i < numMyBlockRows; i++) {
1959 int numColIndices = indexOffset[i+1] - indexOffset[i];
1960 int* ColIndices = indices[i];
1961 int *newColIndices = all_indices+indexOffset[i];
1962 if (ColIndices!=newColIndices)
1963 for(
int j = 0; j < numColIndices; j++) newColIndices[j] = ColIndices[j];
1975 if(errorcode != 0)
throw ReportError(
"Error with All_Indices_ allocation.", -99);
1977 int* old_all_indices = Data.
Indices_[0];
1980 #ifdef EPETRA_HAVE_OMP
1981 #pragma omp parallel for default(none) shared(indexOffset,old_all_indices,new_all_indices)
1983 for(
int i = 0; i < numMyBlockRows; i++) {
1984 int numColIndices = indexOffset[i+1] - indexOffset[i];
1985 int *oldColIndices = old_all_indices+indexOffset[i];
1986 int *newColIndices = new_all_indices+indexOffset[i];
1987 for(
int j = 0; j < numColIndices; j++) newColIndices[j] = oldColIndices[j];
2017 template<
typename int_type>
2022 int locRow =
LRID(Row);
2028 if(LenOfIndices < NumIndices)
2033 int * srcIndices = TIndices<int>(locRow);
2035 for(j = 0; j < NumIndices; j++)
2036 targIndices[j] = static_cast<int_type>(
GCID64(srcIndices[j]));
2040 int_type * srcIndices = TIndices<int_type>(locRow);
2041 for(j = 0; j < NumIndices; j++)
2042 targIndices[j] = srcIndices[j];
2048 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
2051 if(
RowMap().GlobalIndicesInt())
2052 return ExtractGlobalRowCopy<int>(Row, LenOfIndices, NumIndices, targIndices);
2054 throw ReportError(
"Epetra_CrsGraph::ExtractGlobalRowCopy int version called for a graph that is not int.", -1);
2058 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
2061 if(
RowMap().GlobalIndicesLongLong())
2062 return ExtractGlobalRowCopy<long long>(Row, LenOfIndices, NumIndices, targIndices);
2064 throw ReportError(
"Epetra_CrsGraph::ExtractGlobalRowCopy long long version called for a graph that is not long long.", -1);
2069 template<
typename int_type>
2078 if(LenOfIndices < NumIndices)
2084 int * srcIndices = TIndices<int>(Row);
2085 for(j = 0; j < NumIndices; j++)
2086 targIndices[j] = srcIndices[j];
2093 if(
RowMap().GlobalIndicesTypeValid())
2094 return ExtractMyRowCopy<int>(Row, LenOfIndices, NumIndices, targIndices);
2096 throw ReportError(
"Epetra_CrsGraph::ExtractMyRowCopy graph global index type unknown.", -1);
2100 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
2103 if(!
RowMap().GlobalIndicesInt())
2104 throw ReportError(
"Epetra_CrsGraph::ExtractGlobalRowView int version called for a graph that is not int.", -1);
2106 int locRow =
LRID(Row);
2116 targIndices = TIndices<int>(locRow);
2122 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
2125 if(!
RowMap().GlobalIndicesLongLong())
2126 throw ReportError(
"Epetra_CrsGraph::ExtractGlobalRowView long long version called for a graph that is not long long.", -1);
2128 int locRow =
LRID(Row);
2138 targIndices = TIndices<long long>(locRow);
2154 targIndices = TIndices<int>(Row);
2161 #ifdef EPETRA_NO_64BIT_GLOBAL_INDICES
2162 int locRow =
LRID((
int) Row);
2164 int locRow =
LRID(Row);
2174 #ifdef EPETRA_NO_64BIT_GLOBAL_INDICES
2175 int locRow =
LRID((
int) Row);
2177 int locRow =
LRID(Row);
2188 if (
RowMap().PointSameAs(newmap)) {
2213 if(
ColMap().PointSameAs(newmap)) {
2226 if( !NewImporter &&
ColMap().SameAs(NewDomainMap)) {
2254 newDomainMap = newMap;
2264 newRangeMap = newMap;
2285 throw ReportError(
"Epetra_CrsGraph::RemoveEmptyProcessesInPlace does not work for shared CrsGraphData_",-2);
2288 #if defined(EPETRA_NO_32BIT_GLOBAL_INDICES) && defined(EPETRA_NO_64BIT_GLOBAL_INDICES)
2313 if(newColMap != newMap)
delete newColMap;
2314 if(newDomainMap != newMap)
delete newDomainMap;
2315 if(newRangeMap != newMap)
delete newRangeMap;
2338 int* PermuteFromLIDs,
2343 throw ReportError(
"Epetra_CrsGraph::CopyAndPermute: Incoming global index type does not match the one for *this",-1);
2348 PermuteFromLIDs,Indexor,CombineMode));
2354 PermuteFromLIDs,Indexor,CombineMode));
2365 template<
typename int_type>
2370 int* PermuteFromLIDs,
2383 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
2388 int* local_indices = 0;
2389 int_type* global_indices = 0;
2391 if(maxNumIndices > 0) {
2392 local_indices_vec.
Size(maxNumIndices);
2393 local_indices = local_indices_vec.
Values();
2397 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
2398 global_indices_vec.
Size(maxNumIndices);
2399 global_indices =
reinterpret_cast<int_type*
>(global_indices_vec.
Values());
2401 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteRowMatrix: GlobalIndicesLongLong but no API for long long",-1);
2406 global_indices =
reinterpret_cast<int_type*
>(local_indices);
2409 Values.
Size(maxNumIndices);
2416 for(i = 0; i < NumSameIDs; i++) {
2417 ToRow = (int) rowMap.
GID64(i);
2419 for(j = 0; j < NumIndices; j++)
2420 global_indices[j] = (int_type) colMap.
GID64(local_indices[j]);
2427 for(i = 0; i < NumPermuteIDs; i++) {
2428 FromRow = PermuteFromLIDs[i];
2429 ToRow = (int_type)
GRID64(PermuteToLIDs[i]);
2431 for(j = 0; j < NumIndices; j++)
2432 global_indices[j] = (int_type) colMap.
GID64(local_indices[j]);
2444 int* PermuteFromLIDs,
2449 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteRowMatrix: Incoming global index type does not match the one for *this",-1);
2451 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
2453 return CopyAndPermuteRowMatrix<int>(A, NumSameIDs, NumPermuteIDs, PermuteToLIDs, PermuteFromLIDs, Indexor,CombineMode);
2456 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
2458 return CopyAndPermuteRowMatrix<long long>(A, NumSameIDs, NumPermuteIDs, PermuteToLIDs, PermuteFromLIDs, Indexor,CombineMode);
2461 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteRowMatrix: Unable to determine global index type of map", -1);
2465 template<
typename int_type>
2470 int* PermuteFromLIDs,
2479 int_type* indices = 0;
2480 int_type FromRow, ToRow;
2483 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
2490 int_IndicesVector.
Size(maxNumIndices);
2491 indices =
reinterpret_cast<int_type*
>(int_IndicesVector.
Values());
2495 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
2496 LL_IndicesVector.
Size(maxNumIndices);
2497 indices =
reinterpret_cast<int_type*
>(LL_IndicesVector.
Values());
2499 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteCrsGraph: ERROR, GlobalIndicesLongLong but no API for it.",-1);
2505 if(NumSameIDs > 0) {
2507 for(i = 0; i < NumSameIDs; i++) {
2508 Row = (int_type)
GRID64(i);
2516 for(i = 0; i < NumSameIDs; i++) {
2517 Row = (int_type)
GRID64(i);
2527 if(NumPermuteIDs > 0) {
2529 for(i = 0; i < NumPermuteIDs; i++) {
2530 FromRow = (int_type) A.
GRID64(PermuteFromLIDs[i]);
2531 ToRow = (int_type)
GRID64(PermuteToLIDs[i]);
2539 for(i = 0; i < NumPermuteIDs; i++) {
2540 FromRow = (int_type) A.
GRID64(PermuteFromLIDs[i]);
2541 ToRow = (int_type)
GRID64(PermuteToLIDs[i]);
2557 int* PermuteFromLIDs,
2562 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteCrsGraph: Incoming global index type does not match the one for *this",-1);
2565 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
2566 return CopyAndPermuteCrsGraph<int>(A, NumSameIDs, NumPermuteIDs, PermuteToLIDs, PermuteFromLIDs, Indexor, CombineMode);
2568 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteCrsGraph: ERROR, GlobalIndicesInt but no API for it.",-1);
2572 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
2573 return CopyAndPermuteCrsGraph<long long>(A, NumSameIDs, NumPermuteIDs, PermuteToLIDs, PermuteFromLIDs, Indexor, CombineMode);
2575 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteCrsGraph: ERROR, GlobalIndicesLongLong but no API for it.",-1);
2578 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteCrsGraph: Unable to determine global index type of map", -1);
2593 throw ReportError(
"Epetra_CrsGraph::PackAndPrepare: Incoming global index type does not match the one for *this",-1);
2595 int globalMaxNumIndices = 0;
2596 int TotalSendSize = 0;
2601 SizeOfPacket = (
int)
sizeof(int);
2603 SizeOfPacket = (
int)
sizeof(
long long);
2605 throw ReportError(
"Epetra_CrsGraph::PackAndPrepare: Unable to determine source global index type",-1);
2607 if(NumExportIDs <= 0)
return(0);
2612 for(
int i = 0; i < NumExportIDs; ++i )
2615 TotalSendSize += Sizes[i];
2622 A.
Comm().
MaxAll(&maxNumIndices, &globalMaxNumIndices, 1);
2623 for(
int i = 0; i < NumExportIDs; ++i )
2627 Sizes[i] = (NumEntries + 2);
2628 TotalSendSize += Sizes[i];
2641 SizeOfPacket, Sizes, VarSizes, Distor));
2646 SizeOfPacket, Sizes, VarSizes, Distor));
2663 throw ReportError(
"Epetra_CrsGraph::PackAndPrepareCrsGraph: Incoming global index type does not match the one for *this",-1);
2684 int* intptr = (
int*) Exports;
2686 for(i = 0; i < NumExportIDs; i++) {
2687 FromRow = (int) A.
GRID64(ExportLIDs[i]);
2689 indices = intptr + 2;
2691 intptr[1] = NumIndices;
2692 intptr += (NumIndices+2);
2696 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
2697 long long* indices = 0;
2698 long long* LLptr = (
long long*) Exports;
2700 for(i = 0; i < NumExportIDs; i++) {
2701 FromRow = A.
GRID64(ExportLIDs[i]);
2703 indices = LLptr + 2;
2705 LLptr[1] = NumIndices;
2706 LLptr += (NumIndices+2);
2709 throw ReportError(
"Epetra_CrsGraph::PackAndPrepareCrsGraph: ERROR, GlobalIndicesLongLong but no API for it.",-1);
2713 throw ReportError(
"Epetra_CrsGraph::PackAndPrepareCrsGraph: Unable to determine source global index type",-1);
2732 throw ReportError(
"Epetra_CrsGraph::PackAndPrepareRowMatrix: Incoming global index type does not match the one for *this",-1);
2751 if(maxNumIndices > 0) {
2752 Values.
Size(maxNumIndices);
2761 int* intptr = (
int*) Exports;
2762 for(i = 0; i < NumExportIDs; i++) {
2763 FromRow = (int) rowMap.
GID64(ExportLIDs[i]);
2765 indices = intptr + 2;
2767 for(j = 0; j < NumIndices; j++) indices[j] = (
int) colMap.
GID64(indices[j]);
2768 intptr[1] = NumIndices;
2769 intptr += (NumIndices+2);
2778 long long* LL_indices = 0;
2780 long long* LLptr = (
long long*) Exports;
2781 for(i = 0; i < NumExportIDs; i++) {
2782 FromRow = rowMap.
GID64(ExportLIDs[i]);
2784 LL_indices = LLptr + 2;
2785 int* int_indices =
reinterpret_cast<int*
>(LL_indices);
2789 for(j = NumIndices; j > 0;) {
2791 LL_indices[j] = colMap.
GID64(int_indices[j]);
2794 LLptr[1] = NumIndices;
2795 LLptr += (NumIndices+2);
2799 throw ReportError(
"Epetra_CrsGraph::PackAndPrepareRowMatrix: Unable to determine source global index type",-1);
2819 throw ReportError(
"Epetra_CrsGraph::UnpackAndCombine: Incoming global index type does not match the one for *this",-1);
2827 if(NumImportIDs <= 0)
2837 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
2843 int* intptr = (
int*) Imports;
2844 for(i = 0; i < NumImportIDs; i++) {
2845 ToRow = (int)
GRID64(ImportLIDs[i]);
2846 assert((intptr[0])==ToRow);
2847 NumIndices = intptr[1];
2848 indices = intptr + 2;
2853 intptr += (NumIndices+2);
2858 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
2864 long long* LLptr = (
long long*) Imports;
2865 for(i = 0; i < NumImportIDs; i++) {
2866 ToRow =
GRID64(ImportLIDs[i]);
2867 assert((LLptr[0])==ToRow);
2868 NumIndices = (int) LLptr[1];
2869 indices = LLptr + 2;
2874 LLptr += (NumIndices+2);
2879 throw ReportError(
"Epetra_CrsGraph::UnpackAndCombine: Unable to determine source global index type",-1);
2898 int mineComputed = 0;
2904 return(allComputed==1);
2909 int myIndicesAreLocal = 0;
2910 int myIndicesAreGlobal = 0;
2912 myIndicesAreLocal = 1;
2914 myIndicesAreGlobal = 1;
2915 int allIndicesAreLocal;
2916 int allIndicesAreGlobal;
2924 #if defined(Epetra_ENABLE_MKL_SPARSE) && !defined(Epetra_DISABLE_MKL_SPARSE_MM)
2925 int *Epetra_CrsGraph::All_IndicesPlus1()
const {
2934 throw ReportError(
"Epetra_CrsGraph: int *All_IndicesPlus1() cannot be called when StorageOptimized()==false", -1);
2944 ptr[i] = indices[i] + 1;
2952 #endif // defined(Epetra_ENABLE_MKL_SPARSE) && !defined(Epetra_DISABLE_MKL_SPARSE_MM)
2959 for(
int iproc = 0; iproc < NumProc; iproc++) {
2960 if(MyPID == iproc) {
2970 os <<
"\nGlobal Maximum Block Row Dim = " <<
GlobalMaxRowDim() << std::endl;
2971 os <<
"Global Maximum Block Col Dim = " <<
GlobalMaxColDim() << std::endl;
2973 if(
LowerTriangular()) os <<
" ** Matrix is Lower Triangular **" << std::endl;
2974 if(
UpperTriangular()) os <<
" ** Matrix is Upper Triangular **" << std::endl;
2975 if(
NoDiagonal()) os <<
" ** Matrix has no diagonal **" << std::endl << std::endl;
2977 os <<
"\nNumber of My Block Rows = " <<
NumMyBlockRows() << std::endl;
2978 os <<
"Number of My Block Cols = " <<
NumMyBlockCols() << std::endl;
2980 os <<
"Number of My Entries = " <<
NumMyEntries() << std::endl;
2981 os <<
"\nNumber of My Rows = " <<
NumMyRows() << std::endl;
2982 os <<
"Number of My Cols = " <<
NumMyCols() << std::endl;
2983 os <<
"Number of My Diagonals = " <<
NumMyDiagonals() << std::endl;
2984 os <<
"Number of My Nonzeros = " <<
NumMyNonzeros() << std::endl;
2985 os <<
"\nMy Maximum Block Row Dim = " <<
MaxRowDim() << std::endl;
2986 os <<
"My Maximum Block Col Dim = " <<
MaxColDim() << std::endl;
2987 os <<
"My Maximum Num Indices = " <<
MaxNumIndices() << std::endl << std::endl;
2992 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
2996 if(
RowMap().GlobalIndicesInt()) {
2997 Indices1_int.
Resize(MaxNumIndices1);
2999 else if(
RowMap().GlobalIndicesLongLong()) {
3000 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
3001 Indices1_LL.
Resize(MaxNumIndices1);
3003 throw ReportError(
"Epetra_CrsGraph::Print: GlobalIndicesLongLong but no long long API",-1);
3007 throw ReportError(
"Epetra_CrsGraph::Print: Unable to determine source global index type",-1);
3014 os <<
" Row Index "; os <<
" ";
3017 os <<
"Col Index"; os <<
" ";
3020 for(i = 0; i < NumMyBlockRows1; i++) {
3021 if(
RowMap().GlobalIndicesInt()) {
3022 int Row = (int)
GRID64(i);
3025 os << Row ; os <<
" ";
3026 for(j = 0; j < NumIndices1 ; j++) {
3028 os << Indices1_int[j]; os <<
" ";
3032 else if(
RowMap().GlobalIndicesLongLong()) {
3033 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
3034 long long Row =
GRID64(i);
3037 os << Row ; os <<
" ";
3038 for(j = 0; j < NumIndices1 ; j++) {
3040 os << Indices1_LL[j]; os <<
" ";
3044 throw ReportError(
"Epetra_CrsGraph::Print: Unable to determine source global index type",-1);
bool GlobalConstantsComputed_
void SetFilled(bool Flag)
int MakeViewOf(const Epetra_IntSerialDenseVector &Source)
Reset an existing IntSerialDenseVector to point to another Vector.
int PackAndPrepare(const Epetra_SrcDistObject &Source, int NumExportIDs, int *ExportLIDs, int &LenExports, char *&Exports, int &SizeOfPacket, int *Sizes, bool &VarSizes, Epetra_Distributor &Distor)
Perform any packing or preparation required for call to DoTransfer().
const Epetra_Export * Exporter_
const Epetra_BlockMap & RangeMap() const
Returns the RangeMap associated with this graph.
int MakeImportExport()
called by FillComplete (and TransformToLocal)
bool HaveColMap() const
Returns true if we have a well-defined ColMap, and returns false otherwise.
int GlobalMaxNumIndices() const
Returns the maximun number of nonzero entries across all rows across all processors.
Epetra_Map: A class for partitioning vectors and matrices.
virtual ~Epetra_CrsGraph()
Epetra_CrsGraph Destructor.
int Size(int Length_in)
Set length of a Epetra_SerialDenseVector object; init values to zero.
Epetra_IntSerialDenseVector: A class for constructing and using dense vectors.
Epetra_BlockMap RangeMap_
long long NumGlobalRows64() const
int NumMyBlockRows() const
Returns the number of block matrix rows on this processor.
long long NumGlobalBlockCols_
int ComputeGlobalConstants()
Epetra_IntSerialDenseVector NumIndicesPerRow_
int FillComplete()
Tranform to local index space. Perform other operations to allow optimal matrix operations.
int DetermineTriangular()
int GlobalMaxNumNonzeros_
int ElementSize() const
Returns the size of elements in the map; only valid if map has constant element size.
long long GCID64(int LCID_in) const
virtual const Epetra_Map & RowMatrixRowMap() const =0
Returns the Epetra_Map object associated with the rows of this matrix.
int SortIndices()
Sort column indices, row-by-row, in ascending order.
int Allocate(const int *NumIndicesPerRow, int Inc, bool StaticProfile)
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this graph.
int Resize(int Length_in)
Resize a Epetra_IntSerialDenseVector object.
int Length() const
Returns length of vector.
int NumGlobalIndices(long long Row) const
Returns the current number of nonzero entries in specified global row on this processor.
bool GlobalIndicesLongLong() const
Returns true if map create with long long NumGlobalElements.
Epetra_CrsGraph & operator=(const Epetra_CrsGraph &Source)
Assignment operator.
Epetra_Distributor: The Epetra Gather/Scatter Setup Base Class.
bool SameAs(const Epetra_BlockMap &Map) const
Returns true if this and Map are identical maps.
Epetra_OffsetIndex: This class builds index for efficient mapping of data from one Epetra_CrsGraph ba...
long long * Values()
Returns pointer to the values in vector.
int MaxColDim() const
Returns the max column dimension of block entries on the processor.
long long IndexBase64() const
int TRemoveGlobalIndices(long long Row)
void DecrementReferenceCount()
Decrement reference count.
int MyGlobalElements(int *MyGlobalElementList) const
Puts list of global elements on this processor into the user-provided array.
long long NumGlobalEntries_
int ReAllocateAndCast(char *&UserPtr, int &Length, const int IntPacketSizeTimesNumTrans)
called by PackAndPrepare
int PackAndPrepareCrsGraph(const Epetra_CrsGraph &A, int NumExportIDs, int *ExportLIDs, int &LenExports, char *&Exports, int &SizeOfPacket, int *Sizes, bool &VarSizes, Epetra_Distributor &Distor)
long long NumGlobalElements64() const
long long NumGlobalNonzeros_
long long NumGlobalCols64() const
value_type Get(const long long key)
int Size(int Length_in)
Set length of a Epetra_IntSerialDenseVector object; init values to zero.
int InsertMyIndices(int LocalRow, int NumIndices, int *Indices)
Enter a list of elements in a specified local row of the graph.
int NumMyEntries() const
Returns the number of entries on this processor.
const Epetra_Import * Importer() const
Returns the Importer associated with this graph.
virtual void Print(std::ostream &os) const
Print method.
bool SortGhostsAssociatedWithEachProcessor_
bool Filled() const
If FillComplete() has been called, this query returns true, otherwise it returns false.
bool ConstantElementSize() const
Returns true if map has constant element size.
long long NumGlobalDiagonals64() const
int NumMyBlockCols() const
Returns the number of Block matrix columns on this processor.
T * Epetra_Util_data_ptr(std::vector< T > &vec)
Function that returns either a pointer to the first entry in the vector or, if the vector is empty...
Epetra_BlockMap DomainMap_
#define EPETRA_CHK_ERR(a)
int NumMyBlockDiagonals() const
Returns the number of Block diagonal entries in the local graph, based on global row/column index com...
int NumMyRows() const
Returns the number of matrix rows on this processor.
int * ElementSizeList() const
List of the element sizes corresponding to the array MyGlobalElements().
int MakeColMap_LL(const Epetra_BlockMap &DomainMap, const Epetra_BlockMap &RangeMap)
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements...
int MakeIndicesLocal(const Epetra_BlockMap &DomainMap, const Epetra_BlockMap &RangeMap)
int ReplaceRowMap(const Epetra_BlockMap &newmap)
Replaces the current RowMap with the user-specified map object, but only if currentmap->PointSameAs(n...
const Epetra_BlockMap & ColMap() const
Returns the Column Map associated with this graph.
void SetAllocated(bool Flag)
bool GlobalIndicesInt() const
Returns true if map create with int NumGlobalElements.
int RemoveEmptyProcessesInPlace(const Epetra_BlockMap *NewMap)
Remove processes owning zero rows from the Maps and their communicator.
const Epetra_BlockMap & DomainMap() const
Returns the DomainMap associated with this graph.
long long NumGlobalPoints64() const
virtual int MinAll(double *PartialMins, double *GlobalMins, int Count) const =0
Epetra_Comm Global Min function.
bool GlobalConstantsComputed() const
Epetra_Import: This class builds an import object for efficient importing of off-processor elements...
virtual void Barrier() const =0
Epetra_Comm Barrier function.
int ReplaceDomainMapAndImporter(const Epetra_BlockMap &NewDomainMap, const Epetra_Import *NewImporter)
Replaces the current DomainMap & Importer with the user-specified map object.
long long NumGlobalBlockDiagonals64() const
bool StaticProfile() const
Epetra_CrsGraphData * CrsGraphData_
bool FindGlobalIndexLoc(int LocalRow, int Index, int Start, int &Loc) const
virtual int MyPID() const =0
Return my process ID.
int RemoveRedundantIndices()
Removes any redundant column indices in the rows of the graph.
int NumMyCols() const
Returns the number of entries in the set of column-indices that appear on this processor.
virtual int MaxAll(double *PartialMaxs, double *GlobalMaxs, int Count) const =0
Epetra_Comm Global Max function.
int Size(int Length_in)
Set length of a Epetra_LongLongSerialDenseVector object; init values to zero.
Epetra_CrsGraphData: The Epetra CrsGraph Data Class.
bool NoRedundancies() const
If RemoveRedundantIndices() has been called, this query returns true, otherwise it returns false...
int LRID(int GRID_in) const
Returns the local row index for given global row index, returns -1 if no local row for this global ro...
int RemoveGlobalIndices(int GlobalRow, int NumIndices, int *Indices)
Remove a list of elements from a specified global row of the graph.
IndexData< int_type > & Data()
Epetra_Util: The Epetra Util Wrapper Class.
long long NumGlobalNonzeros64() const
Epetra_SerialDenseVector: A class for constructing and using dense vectors.
virtual int SumAll(double *PartialSums, double *GlobalSums, int Count) const =0
Epetra_Comm Global Sum function.
int NumMyElements() const
Number of elements on the calling processor.
virtual int NumMyRowEntries(int MyRow, int &NumEntries) const =0
Returns the number of nonzero entries in MyRow.
const Epetra_CrsGraphData * DataPtr() const
Returns a pointer to the CrsGraphData instance this CrsGraph uses.
virtual int MaxNumEntries() const =0
Returns the maximum of NumMyRowEntries() over all rows.
long long GID64(int LID) const
std::vector< EntriesInOneRow< int > > SortedEntries_
int LCID(int GCID_in) const
Returns the local column index for given global column index, returns -1 if no local column for this ...
int InsertIndices(int Row, int NumIndices, int *Indices)
virtual const Epetra_Comm & Comm() const =0
Returns a pointer to the Epetra_Comm communicator associated with this operator.
int TInsertIndices(int Row, int NumIndices, int_type *Indices)
bool Sorted() const
If SortIndices() has been called, this query returns true, otherwise it returns false.
Epetra_CrsGraph(Epetra_DataAccess CV, const Epetra_BlockMap &RowMap, const int *NumIndicesPerRow, bool StaticProfile=false)
Epetra_CrsGraph constuctor with variable number of indices per row.
int CheckSizes(const Epetra_SrcDistObject &A)
Allows the source and target (this) objects to be compared for compatibility, return nonzero if not...
Epetra_Comm: The Epetra Communication Abstract Base Class.
int MaxRowDim() const
Returns the max row dimension of block entries on the processor.
void SetIndicesAreGlobal(bool Flag)
Epetra_IntSerialDenseVector NumAllocatedIndicesPerRow_
void SetIndicesAreLocal(bool Flag)
const Epetra_BlockMap & TargetMap() const
Returns the TargetMap used to construct this importer.
void SetNoRedundancies(bool Flag)
const Epetra_Comm * Comm_
int CopyAndPermuteCrsGraph(const Epetra_CrsGraph &A, int NumSameIDs, int NumPermuteIDs, int *PermuteToLIDs, int *PermuteFromLIDs, const Epetra_OffsetIndex *Indexor, Epetra_CombineMode CombineMode)
int MakeColMap(const Epetra_BlockMap &DomainMap, const Epetra_BlockMap &RangeMap)
void SetIndicesAreContiguous(bool Flag)
int OptimizeStorage()
Make consecutive row index sections contiguous, minimize internal storage used for constructing graph...
long long NumGlobalBlockRows64() const
int GID(int LID) const
Returns global ID of local ID, return IndexBase-1 if not found on this processor. ...
virtual const Epetra_BlockMap & Map() const =0
Returns a reference to the Epetra_BlockMap for this object.
void epetra_shellsort(int *list, int length)
int PackAndPrepareRowMatrix(const Epetra_RowMatrix &A, int NumExportIDs, int *ExportLIDs, int &LenExports, char *&Exports, int &SizeOfPacket, int *Sizes, bool &VarSizes, Epetra_Distributor &Distor)
int TransformToLocal()
Use FillComplete() instead.
int ExtractMyRowCopy(int LocalRow, int LenOfIndices, int &NumIndices, int *Indices) const
Extract a list of elements in a specified local row of the graph. Put into storage allocated by calli...
int NumAllocatedGlobalIndices(long long Row) const
Returns the allocated number of nonzero entries in specified global row on this processor.
long long NumGlobalBlockCols64() const
bool IndicesAreGlobal() const
If column indices are in global range, this query returns true, otherwise it returns false...
int ReferenceCount() const
Get reference count.
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
Epetra_LongLongSerialDenseVector: A class for constructing and using dense vectors.
const Epetra_BlockMap & SourceMap() const
Returns the SourceMap used to construct this importer.
long long GRID64(int LRID_in) const
const Epetra_BlockMap & RowMap() const
Returns the RowMap associated with this graph.
int NumAllocatedMyIndices(int Row) const
Returns the allocated number of nonzero entries in specified local row on this processor.
int LID(int GID) const
Returns local ID of global ID, return -1 if not found on this processor.
bool MyGID(int GID_in) const
Returns true if the GID passed in belongs to the calling processor in this map, otherwise returns fal...
int ExtractGlobalRowCopy(int GlobalRow, int LenOfIndices, int &NumIndices, int *Indices) const
Extract a list of elements in a specified global row of the graph. Put into storage allocated by call...
int * All_Indices() const
void SetGlobalConstantsComputed(bool Flag)
int Epetra_Util_binary_search(T item, const T *list, int len, int &insertPoint)
Utility function to perform a binary-search on a list of data.
Epetra_BlockMap * ReplaceCommWithSubset(const Epetra_Comm *Comm) const
Replace this BlockMap's communicator with a subset communicator.
int InsertGlobalIndices(int GlobalRow, int NumIndices, int *Indices)
Enter a list of elements in a specified global row of the graph.
void IncrementReferenceCount()
Increment reference count.
Epetra_IntSerialDenseVector All_Indices_
const Epetra_Comm & Comm() const
Access function for Epetra_Comm communicator.
int ExtractMyRowView(int LocalRow, int &NumIndices, int *&Indices) const
Get a view of the elements in a specified local row of the graph.
int GlobalMaxColDim() const
Returns the max column dimension of block entries across all processors.
Epetra_SerialComm: The Epetra Serial Communication Class.
bool FindMyIndexLoc(int LocalRow, int Index, int Start, int &Loc) const
Epetra_IntSerialDenseVector All_IndicesPlus1_
int TInsertIndicesIntoSorted(int Row, int NumIndices, int_type *Indices)
int NumMyIndices(int Row) const
Returns the current number of nonzero entries in specified local row on this processor.
void SetSorted(bool Flag)
int GlobalMaxRowDim() const
Returns the max row dimension of block entries across all processors.
int ReplaceColMap(const Epetra_BlockMap &newmap)
Replaces the current ColMap with the user-specified map object, but only if no entries have been inse...
bool UpperTriangular() const
If graph is upper triangular in local index space, this query returns true, otherwise it returns fals...
bool StorageOptimized() const
If OptimizeStorage() has been called, this query returns true, otherwise it returns false...
virtual int NumProc() const =0
Returns total number of processes.
int RemoveMyIndices(int LocalRow, int NumIndices, int *Indices)
Remove a list of elements from a specified local row of the graph.
Epetra_IntSerialDenseVector IndexOffset_
long long NumGlobalBlockDiagonals_
bool IndicesAreContiguous() const
int MaxNumIndices() const
Returns the maximum number of nonzero entries across all rows on this processor.
int CopyAndPermuteRowMatrix(const Epetra_RowMatrix &A, int NumSameIDs, int NumPermuteIDs, int *PermuteToLIDs, int *PermuteFromLIDs, const Epetra_OffsetIndex *Indexor, Epetra_CombineMode CombineMode)
int MaxElementSize() const
Maximum element size across all processors.
virtual int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const =0
Returns a copy of the specified local row in user-provided arrays.
int CopyAndPermute(const Epetra_SrcDistObject &Source, int NumSameIDs, int NumPermuteIDs, int *PermuteToLIDs, int *PermuteFromLIDs, const Epetra_OffsetIndex *Indexor, Epetra_CombineMode CombineMode=Zero)
Perform ID copies and permutations that are on processor.
static void Sort(bool SortAscending, int NumKeys, T *Keys, int NumDoubleCompanions, double **DoubleCompanions, int NumIntCompanions, int **IntCompanions, int NumLongLongCompanions, long long **LongLongCompanions)
Epetra_Util Sort Routine (Shell sort)
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
virtual const Epetra_Map & RowMatrixColMap() const =0
Returns the Epetra_Map object associated with the columns of this matrix.
int NumMyDiagonals() const
Returns the number of diagonal entries in the local graph, based on global row/column index compariso...
long long IndexBase64() const
bool MyLID(int lid) const
Returns true if the LID passed in belongs to the calling processor in this map, otherwise returns fal...
bool NoDiagonal() const
If graph has no diagonal entries in global index space, this query returns true, otherwise it returns...
const Epetra_Import * Importer_
int NumMyPoints() const
Number of local points for this map; equals the sum of all element sizes on the calling processor...
Epetra_SrcDistObject: A class for supporting flexible source distributed objects for import/export op...
double * Values() const
Returns pointer to the values in vector.
long long * MyGlobalElements64() const
Epetra_RowMatrix: A pure virtual class for using real-valued double-precision row matrices...
int * Values()
Returns pointer to the values in vector.
int NumMyNonzeros() const
Returns the number of indices in the local graph.
int InsertIndicesIntoSorted(int Row, int NumIndices, int *Indices)
int ExtractGlobalRowView(int GlobalRow, int &NumIndices, int *&Indices) const
Get a view of the elements in a specified global row of the graph.
bool LowerTriangular() const
If graph is lower triangular in local index space, this query returns true, otherwise it returns fals...
int MakeColMap_int(const Epetra_BlockMap &DomainMap, const Epetra_BlockMap &RangeMap)
int TAllocate(const int *numIndicesPerRow, int Inc, bool staticProfile)
int Resize(int Length_in)
Resize a Epetra_LongLongSerialDenseVector object.
void Add(const long long key, const value_type value)
int UnpackAndCombine(const Epetra_SrcDistObject &Source, int NumImportIDs, int *ImportLIDs, int LenImports, char *Imports, int &SizeOfPacket, Epetra_Distributor &Distor, Epetra_CombineMode CombineMode, const Epetra_OffsetIndex *Indexor)
Perform any unpacking and combining after call to DoTransfer().
long long NumGlobalEntries64() const
void epetra_crsgraph_compress_out_duplicates(int len, int *list, int &newlen)
long long NumGlobalDiagonals_
Epetra_CrsGraph: A class for constructing and using sparse compressed row graphs. ...
Epetra_DistObject: A class for constructing and using dense multi-vectors, vectors and matrices in pa...
int RemoteIDList(int NumIDs, const int *GIDList, int *PIDList, int *LIDList) const
Returns the processor IDs and corresponding local index value for a given list of global indices...
bool IndicesAreLocal() const
If column indices are in local range, this query returns true, otherwise it returns false...
bool GlobalIndicesTypeMatch(const Epetra_BlockMap &other) const