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,
179 Data.Indices_[i] = NumIndices > 0 ? &Data.SortedEntries_[i].entries_[0]: NULL;
180 Data.SortedEntries_[i].entries_.resize(0);
184 Data.Indices_[i] = 0;
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];
418 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 423 if(
RowMap().GlobalIndicesTypeValid())
424 return InsertIndices<int>(Row, NumIndices, UserIndices);
426 throw ReportError(
"Epetra_CrsGraph::InsertIndices global index type unknown.", -1);
430 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 433 long long* UserIndices)
435 if(
RowMap().GlobalIndicesLongLong())
436 return InsertIndices<long long>(Row, NumIndices, UserIndices);
438 throw ReportError(
"Epetra_CrsGraph::InsertIndices long long version called for a graph that is not long long.", -1);
443 template<
typename int_type>
446 int_type* UserIndices)
475 delete [] Data.TempColIndices_;
476 Data.TempColIndices_ =
new int_type[NumIndices];
479 int_type * tempIndices = Data.TempColIndices_;
482 for(
int j = 0; j < NumIndices; ++j)
484 tempIndices[loc++] = UserIndices[j];
487 for(
int j = 0; j < NumIndices; ++j) {
489 tempIndices[loc++] = UserIndices[j];
493 if(loc != NumIndices)
496 UserIndices = tempIndices;
501 Data.SortedEntries_[Row].AddEntries(NumIndices, UserIndices);
502 current_numIndices = (int) Data.SortedEntries_[Row].entries_.size();
503 current_numAllocIndices = (int) Data.SortedEntries_[Row].entries_.capacity();
505 Data.Indices_[Row] = current_numIndices > 0 ? &Data.SortedEntries_[Row].entries_[0] : NULL;
519 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 524 if(
RowMap().GlobalIndicesTypeValid())
525 return InsertIndicesIntoSorted<int>(Row, NumIndices, UserIndices);
527 throw ReportError(
"Epetra_CrsGraph::InsertIndicesIntoSorted global index type unknown.", -1);
531 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 534 long long* UserIndices)
536 if(
RowMap().GlobalIndicesLongLong())
537 return InsertIndicesIntoSorted<long long>(Row, NumIndices, UserIndices);
539 throw ReportError(
"Epetra_CrsGraph::InsertIndicesIntoSorted long long version called for a graph that is not long long.", -1);
543 template<
typename int_type>
559 int locRow =
LRID(Row);
568 for(j = 0; j < NumIndices; j++) {
569 int_type Index = indices[j];
571 for(k = Loc+1; k < NumCurrentIndices; k++)
572 Data.Indices_[locRow][k-1] = Data.Indices_[locRow][k];
576 Data.SortedEntries_[locRow].entries_.pop_back();
578 Data.Indices_[locRow][NumCurrentIndices-1] =
IndexBase64() - 1;
592 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 595 if(
RowMap().GlobalIndicesInt())
596 return RemoveGlobalIndices<int>(Row, NumIndices, indices);
598 throw ReportError(
"Epetra_CrsGraph::RemoveGlobalIndices int version called for a graph that is not int.", -1);
602 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 605 if(
RowMap().GlobalIndicesLongLong())
606 return RemoveGlobalIndices<long long>(Row, NumIndices, indices);
608 throw ReportError(
"Epetra_CrsGraph::RemoveGlobalIndices long long version called for a graph that is not long long.", -1);
635 for(j = 0; j < NumIndices; j++) {
636 int Index = indices[j];
638 for(k = Loc + 1; k < NumCurrentIndices; k++)
659 template<
typename int_type>
673 #ifdef EPETRA_NO_64BIT_GLOBAL_INDICES 674 int locRow =
LRID((
int) Row);
676 int locRow =
LRID(Row);
687 const int_type indexBaseMinusOne = (int_type)
IndexBase64() - 1;
688 for(j = 0; j < NumIndices; j++)
689 Data.Indices_[locRow][j] = indexBaseMinusOne;
692 Data.SortedEntries_[locRow].entries_.resize(0);
708 if(
RowMap().GlobalIndicesLongLong())
709 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 710 return TRemoveGlobalIndices<long long>(Row);
712 throw ReportError(
"Epetra_CrsGraph::RemoveGlobalIndices: ERROR, GlobalIndicesLongLong but no API for it.",-1);
715 if(
RowMap().GlobalIndicesInt())
716 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 717 return TRemoveGlobalIndices<int>(Row);
719 throw ReportError(
"Epetra_CrsGraph::RemoveGlobalIndices: ERROR, GlobalIndicesInt but no API for it.",-1);
722 throw ReportError(
"Epetra_CrsGraph::RemoveGlobalIndices: Internal error.", -1);
746 for(
int j = 0; j < NumIndices; j++)
764 template<
typename int_type>
774 int* locIndices =
Indices(LocalRow);
775 int locIndex =
LCID(Index);
783 for(j = 0; j < NumIndices; j++) {
786 if(locIndices[j0] == locIndex) {
795 int_type* locIndices = TIndices<int_type>(LocalRow);
803 for(j = 0; j < NumIndices; j++) {
806 if(locIndices[j0] == Index) {
818 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 824 if(
RowMap().GlobalIndicesInt())
825 return FindGlobalIndexLoc<int>(LocalRow, Index, Start, Loc);
827 throw ReportError(
"Epetra_CrsGraph::FindGlobalIndexLoc int version called for a graph that is not int.", -1);
830 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 836 if(
RowMap().GlobalIndicesLongLong())
837 return FindGlobalIndexLoc<long long>(LocalRow, Index, Start, Loc);
839 throw ReportError(
"Epetra_CrsGraph::FindGlobalIndexLoc long long version called for a graph that is not long long.", -1);
844 template<
typename int_type>
846 const int_type* indices,
863 for(j = 0; j < NumIndices; j++) {
866 if(indices[j0] == Index) {
876 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 883 if(
RowMap().GlobalIndicesInt())
884 return FindGlobalIndexLoc<int>(NumIndices, indices, Index, Start, Loc);
886 throw ReportError(
"Epetra_CrsGraph::FindGlobalIndexLoc int version called for a graph that is not int.", -1);
889 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 891 const long long* indices,
896 if(
RowMap().GlobalIndicesLongLong())
897 return FindGlobalIndexLoc<long long>(NumIndices, indices, Index, Start, Loc);
899 throw ReportError(
"Epetra_CrsGraph::FindGlobalIndexLoc long long version called for a graph that is not long long.", -1);
910 int* locIndices =
Indices(LocalRow);
913 throw ReportError(
"Epetra_CrsGraph::FindMyIndexLoc", -1);
923 for(j = 0; j < NumIndices; j++) {
926 if(locIndices[j0] == Index) {
944 throw ReportError(
"Epetra_CrsGraph::FindMyIndexLoc", -1);
954 for(j = 0; j < NumIndices; j++) {
957 if(indices[j0] == Index) {
976 throw ReportError(
"Epetra_CrsGraph::FillComplete: cannot be called with different indices types for domainMap and rangeMap", -1);
979 throw ReportError(
"Epetra_CrsGraph::FillComplete: cannot be called with different indices types for row map and incoming rangeMap", -1);
1014 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 1025 {
for(
int i = 0; i < numMyBlockRows; i++) {
1031 if(
RowMap().ConstantElementSize() &&
ColMap().ConstantElementSize() &&
RowMap().ElementSize() ==
ColMap().ElementSize()) {
1048 int ColElementSize = RowElementSize;
1061 int* ColElementSizeList = RowElementSizeList;
1065 for(
int i = 0; i < numMyBlockRows; i++){
1067 int* indices = intData.
Indices_[i];
1068 if(NumEntries > 0) {
1069 int CurNumNonzeros = 0;
1070 int RowDim = RowElementSizeList[i];
1071 for(
int j = 0; j < NumEntries; j++) {
1072 int ColDim = ColElementSizeList[indices[j]];
1073 CurNumNonzeros += RowDim*ColDim;
1114 int i, j, j2, temp, istep;
1120 for (i=step; i < length; i++)
1126 if (list[j2] > temp) {
1127 while ((j >= istep) && (list[j2] > temp))
1140 step = (int) (step / 2.2);
1156 for(
int i = 0; i < numMyBlockRows; i++){
1158 int*
const list = intData.
Indices_[i];
1206 if (len < 2)
return;
1208 int* ptr0 = &list[0];
1209 int* ptr1 = &list[1];
1211 int* ptr_end = &list[len-1];
1213 while(*ptr0 != *ptr1 && ptr1 < ptr_end) {
1218 if (ptr1 < ptr_end) {
1224 while(*ptr0 == *ptr1 && ptr1 < ptr_end) ++ptr1;
1226 while(ptr1 < ptr_end) {
1230 while(val == *ptr1 && ptr1 < ptr_end) {
1237 if (*(ptr0-1) != *ptr1) *ptr0++ = *ptr1;
1239 int num_removed = (int)(ptr_end - ptr0 + 1);
1240 newlen = len - num_removed;
1243 if (*ptr0 == *ptr1) newlen = len - 1;
1260 bool found_redundancies =
false;
1265 for(
int i=0; i<numMyBlockRows; ++i) {
1266 int NumIndices = numIndicesPerRow[i];
1267 int* col_indices = this->
Indices(i);
1269 if(NumIndices > 1) {
1271 numIndicesPerRow[i]);
1273 if (NumIndices != numIndicesPerRow[i]) {
1274 found_redundancies =
true;
1279 for(
int i=0; i<numMyBlockRows; ++i) {
1280 int* col_indices = this->
Indices(i);
1283 intData.
SortedEntries_[i].entries_.assign(col_indices, col_indices+numIndicesPerRow[i]);
1284 if (numIndicesPerRow[i] > 0) {
1316 for(
int i = 0; i < numMyBlockRows; i++) {
1318 if(NumIndices > 0) {
1319 #if defined(EPETRA_NO_64BIT_GLOBAL_INDICES) && !defined(EPETRA_NO_32BIT_GLOBAL_INDICES) 1320 int ig = rowMap.
GID(i);
1322 long long ig = rowMap.
GID64(i);
1324 int* col_indices = this->
Indices(i);
1326 int jl_0 = col_indices[0];
1327 int jl_n = col_indices[NumIndices-1];
1334 int jl = colMap.
LID(ig);
1336 int insertPoint = -1;
1353 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 1372 bool * LocalGIDs = 0;
1373 if (numDomainElements>0) LocalGIDs =
new bool[numDomainElements];
1374 for (i=0; i<numDomainElements; i++) LocalGIDs[i] =
false;
1380 int hashsize = numMyBlockRows;
if (hashsize < 100) hashsize = 100;
1385 int NumLocalColGIDs = 0;
1386 int NumRemoteColGIDs = 0;
1388 for(i = 0; i < numMyBlockRows; i++) {
1390 int* ColIndices = intData.
Indices_[i];
1391 for(j = 0; j < NumIndices; j++) {
1392 int GID = ColIndices[j];
1394 int LID = domainMap.
LID(GID);
1396 bool alreadyFound = LocalGIDs[LID];
1397 if (!alreadyFound) {
1398 LocalGIDs[LID] =
true;
1403 if(RemoteGIDs.
Get(GID) == -1) {
1404 RemoteGIDs.
Add(GID, NumRemoteColGIDs);
1405 RemoteGIDList.
Add(NumRemoteColGIDs++, GID);
1414 if (NumRemoteColGIDs!=0) {
1415 throw ReportError(
"Some column IDs are not in domainMap. If matrix is rectangular, you must pass in domainMap to FillComplete",-1);
1417 if (NumLocalColGIDs==numDomainElements) {
1420 if (LocalGIDs!=0)
delete [] LocalGIDs;
1427 int numMyBlockCols = NumLocalColGIDs + NumRemoteColGIDs;
1429 if(numMyBlockCols > 0)
1430 ColIndices.
Size(numMyBlockCols);
1432 int* RemoteColIndices = ColIndices.
Values() + NumLocalColGIDs;
1434 for(i = 0; i < NumRemoteColGIDs; i++)
1435 RemoteColIndices[i] = RemoteGIDList.
Get(i);
1440 int* RemoteSizeList = 0;
1443 if(NumRemoteColGIDs > 0)
1444 PIDList.
Size(NumRemoteColGIDs);
1447 if(numMyBlockCols > 0)
1448 SizeList.
Size(numMyBlockCols);
1449 RemoteSizeList = SizeList.
Values() + NumLocalColGIDs;
1458 SortLists[0] = RemoteColIndices;
1459 SortLists[1] = RemoteSizeList;
1460 Util.
Sort(
true, NumRemoteColGIDs, PIDList.
Values(), 0, 0, NLists, SortLists, 0, 0);
1467 int StartCurrent, StartNext;
1468 StartCurrent = 0; StartNext = 1;
1469 while ( StartNext < NumRemoteColGIDs ) {
1470 if ((PIDList.
Values())[StartNext]==(PIDList.
Values())[StartNext-1]) StartNext++;
1472 if(DoSizes) SortLists[0] = &(RemoteSizeList[StartCurrent]);
1473 Util.
Sort(
true,StartNext-StartCurrent, &(RemoteColIndices[StartCurrent]),0,0,NLists,SortLists, 0, 0);
1474 StartCurrent = StartNext; StartNext++;
1477 if(DoSizes) SortLists[0] = &(RemoteSizeList[StartCurrent]);
1478 Util.
Sort(
true, StartNext-StartCurrent, &(RemoteColIndices[StartCurrent]), 0, 0, NLists, SortLists, 0, 0);
1495 int* ElementSizeList = 0;
1498 int NumLocalAgain = 0;
1499 for(i = 0; i < NumMyElements; i++) {
1502 SizeList[NumLocalAgain] = ElementSizeList[i];
1503 ColIndices[NumLocalAgain++] = MyGlobalElements[i];
1506 assert(NumLocalAgain==NumLocalColGIDs);
1510 if (LocalGIDs!=0)
delete [] LocalGIDs;
1533 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 1552 bool * LocalGIDs = 0;
1553 if (numDomainElements>0) LocalGIDs =
new bool[numDomainElements];
1554 for (i=0; i<numDomainElements; i++) LocalGIDs[i] =
false;
1560 int hashsize = numMyBlockRows;
if (hashsize < 100) hashsize = 100;
1565 int NumLocalColGIDs = 0;
1566 int NumRemoteColGIDs = 0;
1572 for(i = 0; i < numMyBlockRows; i++) {
1574 int* ColIndices = intData.
Indices_[i];
1575 for(j = 0; j < NumIndices; j++) {
1576 int GID = ColIndices[j];
1578 int LID = domainMap.
LID(GID);
1580 bool alreadyFound = LocalGIDs[LID];
1581 if (!alreadyFound) {
1582 LocalGIDs[LID] =
true;
1587 if(RemoteGIDs.
Get(GID) == -1) {
1588 RemoteGIDs.
Add(GID, NumRemoteColGIDs);
1589 RemoteGIDList.
Add(NumRemoteColGIDs++, GID);
1599 for(i = 0; i < numMyBlockRows; i++) {
1601 long long* ColIndices = LLData.
Indices_[i];
1602 for(j = 0; j < NumIndices; j++) {
1603 long long GID = ColIndices[j];
1605 int LID = domainMap.
LID(GID);
1607 bool alreadyFound = LocalGIDs[LID];
1608 if (!alreadyFound) {
1609 LocalGIDs[LID] =
true;
1614 if(RemoteGIDs.
Get(GID) == -1) {
1615 RemoteGIDs.
Add(GID, NumRemoteColGIDs);
1616 RemoteGIDList.
Add(NumRemoteColGIDs++, GID);
1626 if (NumRemoteColGIDs!=0) {
1627 throw ReportError(
"Some column IDs are not in domainMap. If matrix is rectangular, you must pass in domainMap to FillComplete",-1);
1629 if (NumLocalColGIDs==numDomainElements) {
1632 if (LocalGIDs!=0)
delete [] LocalGIDs;
1639 int numMyBlockCols = NumLocalColGIDs + NumRemoteColGIDs;
1641 if(numMyBlockCols > 0)
1642 ColIndices.
Size(numMyBlockCols);
1644 long long* RemoteColIndices = ColIndices.
Values() + NumLocalColGIDs;
1646 for(i = 0; i < NumRemoteColGIDs; i++)
1647 RemoteColIndices[i] = RemoteGIDList.
Get(i);
1652 int* RemoteSizeList = 0;
1655 if(NumRemoteColGIDs > 0)
1656 PIDList.
Size(NumRemoteColGIDs);
1659 if(numMyBlockCols > 0)
1660 SizeList.
Size(numMyBlockCols);
1661 RemoteSizeList = SizeList.
Values() + NumLocalColGIDs;
1672 Util.
Sort(
true, NumRemoteColGIDs, PIDList.
Values(), 0, 0, NLists, &RemoteSizeList, 1, &RemoteColIndices);
1678 int* SortLists[1] = {0};
1680 int StartCurrent, StartNext;
1681 StartCurrent = 0; StartNext = 1;
1682 while ( StartNext < NumRemoteColGIDs ) {
1683 if ((PIDList.
Values())[StartNext]==(PIDList.
Values())[StartNext-1]) StartNext++;
1685 if(DoSizes) SortLists[0] = &(RemoteSizeList[StartCurrent]);
1686 Util.
Sort(
true,StartNext-StartCurrent, &(RemoteColIndices[StartCurrent]),0,0,NLists,SortLists, 0, 0);
1687 StartCurrent = StartNext; StartNext++;
1690 if(DoSizes) SortLists[0] = &(RemoteSizeList[StartCurrent]);
1691 Util.
Sort(
true, StartNext-StartCurrent, &(RemoteColIndices[StartCurrent]), 0, 0, NLists, SortLists, 0, 0);
1708 int* ElementSizeList = 0;
1711 int NumLocalAgain = 0;
1712 for(i = 0; i < NumMyElements; i++) {
1715 SizeList[NumLocalAgain] = ElementSizeList[i];
1716 ColIndices[NumLocalAgain++] = MyGlobalElements[i];
1719 assert(NumLocalAgain==NumLocalColGIDs);
1723 if (LocalGIDs!=0)
delete [] LocalGIDs;
1750 throw ReportError(
"Epetra_CrsGraph::MakeColMap: cannot be called with different indices types for domainMap and rangeMap", -1);
1753 throw ReportError(
"Epetra_CrsGraph::MakeColMap: cannot be called with different indices types for row map and incoming rangeMap", -1);
1756 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
1759 throw ReportError(
"Epetra_CrsGraph::MakeColMap: ERROR, GlobalIndicesInt but no API for it.",-1);
1762 if(
RowMap().GlobalIndicesLongLong())
1763 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 1766 throw ReportError(
"Epetra_CrsGraph::MakeColMap: ERROR, GlobalIndicesLongLong but no API for it.",-1);
1769 throw ReportError(
"Epetra_CrsGraph::MakeColMap: Internal error, unable to determine global index type of maps", -1);
1775 throw ReportError(
"Epetra_CrsGraph::MakeIndicesLocal: cannot be called with different indices types for domainMap and rangeMap", -1);
1778 throw ReportError(
"Epetra_CrsGraph::MakeIndicesLocal: cannot be called with different indices types for row map and incoming rangeMap", -1);
1796 bool mapMonotone =
true;
1798 long long oldGID = colmap.
GID64(0);
1800 if (oldGID > colmap.
GID64(i)) {
1801 mapMonotone =
false;
1804 oldGID = colmap.
GID64(i);
1820 for(
int i = 0; i < numMyBlockRows; i++) {
1822 int* ColIndices = intData.
Indices_[i];
1823 for(
int j = 0; j < NumIndices; j++) {
1824 int GID = ColIndices[j];
1825 int LID = colmap.
LID(GID);
1827 ColIndices[j] = LID;
1829 throw ReportError(
"Internal error in FillComplete ",-1);
1833 else if(
RowMap().GlobalIndicesLongLong())
1835 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 1840 const long long indexBaseMinusOne =
IndexBase64() - 1;
1841 for(
int i = 0; i < numMyBlockRows; i++) {
1843 intData.
SortedEntries_[i].entries_.resize(NumIndices, indexBaseMinusOne);
1850 for(
int i = 0; i < numMyBlockRows; i++) {
1852 long long* ColIndices = LL_Data.
Indices_[i];
1853 int* intColIndices = intData.
Indices_[i];
1854 for(
int j = 0; j < NumIndices; j++) {
1855 long long GID = ColIndices[j];
1856 int LID = colmap.
LID(GID);
1858 intColIndices[j] = LID;
1860 throw ReportError(
"Internal error in FillComplete ",-1);
1866 throw ReportError(
"Epetra_CrsGraph::MakeIndicesLocal: GlobalIndicesLongLong but no long long API", -1);
1892 bool Contiguous =
true;
1893 for(
int i = 1; i < numMyBlockRows; i++) {
1899 if((NumIndices != NumAllocateIndices) ||
1921 int curNumIndices = numIndicesPerRow[0];
1922 numIndicesPerRow[0] = 0;
1923 for (
int i=0; i<numMyBlockRows; ++i) {
1924 int nextNumIndices = numIndicesPerRow[i+1];
1925 numIndicesPerRow[i+1] = numIndicesPerRow[i]+curNumIndices;
1926 curNumIndices = nextNumIndices;
1937 if(errorcode != 0)
throw ReportError(
"Error with All_Indices_ allocation.", -99);
1946 #ifdef EPETRA_HAVE_OMP 1947 #pragma omp parallel for default(none) shared(indexOffset,all_indices,indices) 1949 for(
int i = 0; i < numMyBlockRows; i++) {
1950 int numColIndices = indexOffset[i+1] - indexOffset[i];
1951 int* ColIndices = indices[i];
1952 int *newColIndices = all_indices+indexOffset[i];
1953 for(
int j = 0; j < numColIndices; j++) newColIndices[j] = ColIndices[j];
1955 for(
int i = 0; i < numMyBlockRows; i++) {
1956 if (indices[i]!=0) {
1964 for(
int i = 0; i < numMyBlockRows; i++) {
1965 int numColIndices = indexOffset[i+1] - indexOffset[i];
1966 int* ColIndices = indices[i];
1967 int *newColIndices = all_indices+indexOffset[i];
1968 if (ColIndices!=newColIndices)
1969 for(
int j = 0; j < numColIndices; j++) newColIndices[j] = ColIndices[j];
1981 if(errorcode != 0)
throw ReportError(
"Error with All_Indices_ allocation.", -99);
1983 int* old_all_indices = Data.
Indices_[0];
1986 #ifdef EPETRA_HAVE_OMP 1987 #pragma omp parallel for default(none) shared(indexOffset,old_all_indices,new_all_indices) 1989 for(
int i = 0; i < numMyBlockRows; i++) {
1990 int numColIndices = indexOffset[i+1] - indexOffset[i];
1991 int *oldColIndices = old_all_indices+indexOffset[i];
1992 int *newColIndices = new_all_indices+indexOffset[i];
1993 for(
int j = 0; j < numColIndices; j++) newColIndices[j] = oldColIndices[j];
2023 template<
typename int_type>
2028 int locRow =
LRID(Row);
2034 if(LenOfIndices < NumIndices)
2039 int * srcIndices = TIndices<int>(locRow);
2041 for(j = 0; j < NumIndices; j++)
2042 targIndices[j] = static_cast<int_type>(
GCID64(srcIndices[j]));
2046 int_type * srcIndices = TIndices<int_type>(locRow);
2047 for(j = 0; j < NumIndices; j++)
2048 targIndices[j] = srcIndices[j];
2054 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 2057 if(
RowMap().GlobalIndicesInt())
2058 return ExtractGlobalRowCopy<int>(Row, LenOfIndices, NumIndices, targIndices);
2060 throw ReportError(
"Epetra_CrsGraph::ExtractGlobalRowCopy int version called for a graph that is not int.", -1);
2064 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 2067 if(
RowMap().GlobalIndicesLongLong())
2068 return ExtractGlobalRowCopy<long long>(Row, LenOfIndices, NumIndices, targIndices);
2070 throw ReportError(
"Epetra_CrsGraph::ExtractGlobalRowCopy long long version called for a graph that is not long long.", -1);
2075 template<
typename int_type>
2084 if(LenOfIndices < NumIndices)
2090 int * srcIndices = TIndices<int>(Row);
2091 for(j = 0; j < NumIndices; j++)
2092 targIndices[j] = srcIndices[j];
2099 if(
RowMap().GlobalIndicesTypeValid())
2100 return ExtractMyRowCopy<int>(Row, LenOfIndices, NumIndices, targIndices);
2102 throw ReportError(
"Epetra_CrsGraph::ExtractMyRowCopy graph global index type unknown.", -1);
2106 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 2109 if(!
RowMap().GlobalIndicesInt())
2110 throw ReportError(
"Epetra_CrsGraph::ExtractGlobalRowView int version called for a graph that is not int.", -1);
2112 int locRow =
LRID(Row);
2122 targIndices = TIndices<int>(locRow);
2128 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 2131 if(!
RowMap().GlobalIndicesLongLong())
2132 throw ReportError(
"Epetra_CrsGraph::ExtractGlobalRowView long long version called for a graph that is not long long.", -1);
2134 int locRow =
LRID(Row);
2144 targIndices = TIndices<long long>(locRow);
2160 targIndices = TIndices<int>(Row);
2167 #ifdef EPETRA_NO_64BIT_GLOBAL_INDICES 2168 int locRow =
LRID((
int) Row);
2170 int locRow =
LRID(Row);
2180 #ifdef EPETRA_NO_64BIT_GLOBAL_INDICES 2181 int locRow =
LRID((
int) Row);
2183 int locRow =
LRID(Row);
2194 if (
RowMap().PointSameAs(newmap)) {
2219 if(
ColMap().PointSameAs(newmap)) {
2232 if( !NewImporter &&
ColMap().SameAs(NewDomainMap)) {
2260 newDomainMap = newMap;
2270 newRangeMap = newMap;
2291 throw ReportError(
"Epetra_CrsGraph::RemoveEmptyProcessesInPlace does not work for shared CrsGraphData_",-2);
2294 #if defined(EPETRA_NO_32BIT_GLOBAL_INDICES) && defined(EPETRA_NO_64BIT_GLOBAL_INDICES) 2319 if(newColMap != newMap)
delete newColMap;
2320 if(newDomainMap != newMap)
delete newDomainMap;
2321 if(newRangeMap != newMap)
delete newRangeMap;
2344 int* PermuteFromLIDs,
2349 throw ReportError(
"Epetra_CrsGraph::CopyAndPermute: Incoming global index type does not match the one for *this",-1);
2354 PermuteFromLIDs,Indexor,CombineMode));
2360 PermuteFromLIDs,Indexor,CombineMode));
2371 template<
typename int_type>
2376 int* PermuteFromLIDs,
2389 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 2394 int* local_indices = 0;
2395 int_type* global_indices = 0;
2397 if(maxNumIndices > 0) {
2398 local_indices_vec.
Size(maxNumIndices);
2399 local_indices = local_indices_vec.
Values();
2403 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 2404 global_indices_vec.
Size(maxNumIndices);
2405 global_indices =
reinterpret_cast<int_type*
>(global_indices_vec.
Values());
2407 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteRowMatrix: GlobalIndicesLongLong but no API for long long",-1);
2412 global_indices =
reinterpret_cast<int_type*
>(local_indices);
2415 Values.
Size(maxNumIndices);
2422 for(i = 0; i < NumSameIDs; i++) {
2423 ToRow = (int) rowMap.
GID64(i);
2425 for(j = 0; j < NumIndices; j++)
2426 global_indices[j] = (int_type) colMap.
GID64(local_indices[j]);
2433 for(i = 0; i < NumPermuteIDs; i++) {
2434 FromRow = PermuteFromLIDs[i];
2435 ToRow = (int_type)
GRID64(PermuteToLIDs[i]);
2437 for(j = 0; j < NumIndices; j++)
2438 global_indices[j] = (int_type) colMap.
GID64(local_indices[j]);
2450 int* PermuteFromLIDs,
2455 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteRowMatrix: Incoming global index type does not match the one for *this",-1);
2457 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 2459 return CopyAndPermuteRowMatrix<int>(A, NumSameIDs, NumPermuteIDs, PermuteToLIDs, PermuteFromLIDs, Indexor,CombineMode);
2462 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 2464 return CopyAndPermuteRowMatrix<long long>(A, NumSameIDs, NumPermuteIDs, PermuteToLIDs, PermuteFromLIDs, Indexor,CombineMode);
2467 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteRowMatrix: Unable to determine global index type of map", -1);
2471 template<
typename int_type>
2476 int* PermuteFromLIDs,
2485 int_type* indices = 0;
2486 int_type FromRow, ToRow;
2489 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 2496 int_IndicesVector.
Size(maxNumIndices);
2497 indices =
reinterpret_cast<int_type*
>(int_IndicesVector.
Values());
2501 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 2502 LL_IndicesVector.
Size(maxNumIndices);
2503 indices =
reinterpret_cast<int_type*
>(LL_IndicesVector.
Values());
2505 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteCrsGraph: ERROR, GlobalIndicesLongLong but no API for it.",-1);
2511 if(NumSameIDs > 0) {
2513 for(i = 0; i < NumSameIDs; i++) {
2514 Row = (int_type)
GRID64(i);
2522 for(i = 0; i < NumSameIDs; i++) {
2523 Row = (int_type)
GRID64(i);
2533 if(NumPermuteIDs > 0) {
2535 for(i = 0; i < NumPermuteIDs; i++) {
2536 FromRow = (int_type) A.
GRID64(PermuteFromLIDs[i]);
2537 ToRow = (int_type)
GRID64(PermuteToLIDs[i]);
2545 for(i = 0; i < NumPermuteIDs; i++) {
2546 FromRow = (int_type) A.
GRID64(PermuteFromLIDs[i]);
2547 ToRow = (int_type)
GRID64(PermuteToLIDs[i]);
2563 int* PermuteFromLIDs,
2568 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteCrsGraph: Incoming global index type does not match the one for *this",-1);
2571 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
2572 return CopyAndPermuteCrsGraph<int>(A, NumSameIDs, NumPermuteIDs, PermuteToLIDs, PermuteFromLIDs, Indexor, CombineMode);
2574 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteCrsGraph: ERROR, GlobalIndicesInt but no API for it.",-1);
2578 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
2579 return CopyAndPermuteCrsGraph<long long>(A, NumSameIDs, NumPermuteIDs, PermuteToLIDs, PermuteFromLIDs, Indexor, CombineMode);
2581 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteCrsGraph: ERROR, GlobalIndicesLongLong but no API for it.",-1);
2584 throw ReportError(
"Epetra_CrsGraph::CopyAndPermuteCrsGraph: Unable to determine global index type of map", -1);
2599 throw ReportError(
"Epetra_CrsGraph::PackAndPrepare: Incoming global index type does not match the one for *this",-1);
2601 int globalMaxNumIndices = 0;
2602 int TotalSendSize = 0;
2607 SizeOfPacket = (
int)
sizeof(int);
2609 SizeOfPacket = (
int)
sizeof(
long long);
2611 throw ReportError(
"Epetra_CrsGraph::PackAndPrepare: Unable to determine source global index type",-1);
2613 if(NumExportIDs <= 0)
return(0);
2618 for(
int i = 0; i < NumExportIDs; ++i )
2621 TotalSendSize += Sizes[i];
2628 A.
Comm().
MaxAll(&maxNumIndices, &globalMaxNumIndices, 1);
2629 for(
int i = 0; i < NumExportIDs; ++i )
2633 Sizes[i] = (NumEntries + 2);
2634 TotalSendSize += Sizes[i];
2647 SizeOfPacket, Sizes, VarSizes, Distor));
2652 SizeOfPacket, Sizes, VarSizes, Distor));
2669 throw ReportError(
"Epetra_CrsGraph::PackAndPrepareCrsGraph: Incoming global index type does not match the one for *this",-1);
2690 int* intptr = (
int*) Exports;
2692 for(i = 0; i < NumExportIDs; i++) {
2693 FromRow = (int) A.
GRID64(ExportLIDs[i]);
2695 indices = intptr + 2;
2697 intptr[1] = NumIndices;
2698 intptr += (NumIndices+2);
2702 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 2703 long long* indices = 0;
2704 long long* LLptr = (
long long*) Exports;
2706 for(i = 0; i < NumExportIDs; i++) {
2707 FromRow = A.
GRID64(ExportLIDs[i]);
2709 indices = LLptr + 2;
2711 LLptr[1] = NumIndices;
2712 LLptr += (NumIndices+2);
2715 throw ReportError(
"Epetra_CrsGraph::PackAndPrepareCrsGraph: ERROR, GlobalIndicesLongLong but no API for it.",-1);
2719 throw ReportError(
"Epetra_CrsGraph::PackAndPrepareCrsGraph: Unable to determine source global index type",-1);
2738 throw ReportError(
"Epetra_CrsGraph::PackAndPrepareRowMatrix: Incoming global index type does not match the one for *this",-1);
2757 if(maxNumIndices > 0) {
2758 Values.
Size(maxNumIndices);
2767 int* intptr = (
int*) Exports;
2768 for(i = 0; i < NumExportIDs; i++) {
2769 FromRow = (int) rowMap.
GID64(ExportLIDs[i]);
2771 indices = intptr + 2;
2773 for(j = 0; j < NumIndices; j++) indices[j] = (
int) colMap.
GID64(indices[j]);
2774 intptr[1] = NumIndices;
2775 intptr += (NumIndices+2);
2784 long long* LL_indices = 0;
2786 long long* LLptr = (
long long*) Exports;
2787 for(i = 0; i < NumExportIDs; i++) {
2788 FromRow = rowMap.
GID64(ExportLIDs[i]);
2790 LL_indices = LLptr + 2;
2791 int* int_indices =
reinterpret_cast<int*
>(LL_indices);
2795 for(j = NumIndices; j > 0;) {
2797 LL_indices[j] = colMap.
GID64(int_indices[j]);
2800 LLptr[1] = NumIndices;
2801 LLptr += (NumIndices+2);
2805 throw ReportError(
"Epetra_CrsGraph::PackAndPrepareRowMatrix: Unable to determine source global index type",-1);
2825 throw ReportError(
"Epetra_CrsGraph::UnpackAndCombine: Incoming global index type does not match the one for *this",-1);
2833 if(NumImportIDs <= 0)
2843 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES 2849 int* intptr = (
int*) Imports;
2850 for(i = 0; i < NumImportIDs; i++) {
2851 ToRow = (int)
GRID64(ImportLIDs[i]);
2852 assert((intptr[0])==ToRow);
2853 NumIndices = intptr[1];
2854 indices = intptr + 2;
2859 intptr += (NumIndices+2);
2864 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 2870 long long* LLptr = (
long long*) Imports;
2871 for(i = 0; i < NumImportIDs; i++) {
2872 ToRow =
GRID64(ImportLIDs[i]);
2873 assert((LLptr[0])==ToRow);
2874 NumIndices = (int) LLptr[1];
2875 indices = LLptr + 2;
2880 LLptr += (NumIndices+2);
2885 throw ReportError(
"Epetra_CrsGraph::UnpackAndCombine: Unable to determine source global index type",-1);
2904 int mineComputed = 0;
2910 return(allComputed==1);
2915 int myIndicesAreLocal = 0;
2916 int myIndicesAreGlobal = 0;
2918 myIndicesAreLocal = 1;
2920 myIndicesAreGlobal = 1;
2921 int allIndicesAreLocal;
2922 int allIndicesAreGlobal;
2930 #if defined(Epetra_ENABLE_MKL_SPARSE) && !defined(Epetra_DISABLE_MKL_SPARSE_MM) 2931 int *Epetra_CrsGraph::All_IndicesPlus1()
const {
2940 throw ReportError(
"Epetra_CrsGraph: int *All_IndicesPlus1() cannot be called when StorageOptimized()==false", -1);
2950 ptr[i] = indices[i] + 1;
2958 #endif // defined(Epetra_ENABLE_MKL_SPARSE) && !defined(Epetra_DISABLE_MKL_SPARSE_MM) 2965 for(
int iproc = 0; iproc < NumProc; iproc++) {
2966 if(MyPID == iproc) {
2976 os <<
"\nGlobal Maximum Block Row Dim = " <<
GlobalMaxRowDim() << std::endl;
2977 os <<
"Global Maximum Block Col Dim = " <<
GlobalMaxColDim() << std::endl;
2979 if(
LowerTriangular()) os <<
" ** Matrix is Lower Triangular **" << std::endl;
2980 if(
UpperTriangular()) os <<
" ** Matrix is Upper Triangular **" << std::endl;
2981 if(
NoDiagonal()) os <<
" ** Matrix has no diagonal **" << std::endl << std::endl;
2983 os <<
"\nNumber of My Block Rows = " <<
NumMyBlockRows() << std::endl;
2984 os <<
"Number of My Block Cols = " <<
NumMyBlockCols() << std::endl;
2986 os <<
"Number of My Entries = " <<
NumMyEntries() << std::endl;
2987 os <<
"\nNumber of My Rows = " <<
NumMyRows() << std::endl;
2988 os <<
"Number of My Cols = " <<
NumMyCols() << std::endl;
2989 os <<
"Number of My Diagonals = " <<
NumMyDiagonals() << std::endl;
2990 os <<
"Number of My Nonzeros = " <<
NumMyNonzeros() << std::endl;
2991 os <<
"\nMy Maximum Block Row Dim = " <<
MaxRowDim() << std::endl;
2992 os <<
"My Maximum Block Col Dim = " <<
MaxColDim() << std::endl;
2993 os <<
"My Maximum Num Indices = " <<
MaxNumIndices() << std::endl << std::endl;
2998 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 3002 if(
RowMap().GlobalIndicesInt()) {
3003 Indices1_int.
Resize(MaxNumIndices1);
3005 else if(
RowMap().GlobalIndicesLongLong()) {
3006 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 3007 Indices1_LL.
Resize(MaxNumIndices1);
3009 throw ReportError(
"Epetra_CrsGraph::Print: GlobalIndicesLongLong but no long long API",-1);
3013 throw ReportError(
"Epetra_CrsGraph::Print: Unable to determine source global index type",-1);
3020 os <<
" Row Index "; os <<
" ";
3023 os <<
"Col Index"; os <<
" ";
3026 for(i = 0; i < NumMyBlockRows1; i++) {
3027 if(
RowMap().GlobalIndicesInt()) {
3028 int Row = (int)
GRID64(i);
3031 os << Row ; os <<
" ";
3032 for(j = 0; j < NumIndices1 ; j++) {
3034 os << Indices1_int[j]; os <<
" ";
3038 else if(
RowMap().GlobalIndicesLongLong()) {
3039 #ifndef EPETRA_NO_64BIT_GLOBAL_INDICES 3040 long long Row =
GRID64(i);
3043 os << Row ; os <<
" ";
3044 for(j = 0; j < NumIndices1 ; j++) {
3046 os << Indices1_LL[j]; os <<
" ";
3050 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_Import * Importer() const
Returns the Importer associated with this graph.
long long NumGlobalEntries64() const
bool FindMyIndexLoc(int LocalRow, int Index, int Start, int &Loc) const
bool HaveColMap() const
Returns true if we have a well-defined ColMap, and returns false otherwise.
int MakeImportExport()
called by FillComplete (and TransformToLocal)
int MyGlobalElements(int *MyGlobalElementList) const
Puts list of global elements on this processor into the user-provided array.
Epetra_Map: A class for partitioning vectors and matrices.
bool MyLID(int lid) const
Returns true if the LID passed in belongs to the calling processor in this map, otherwise returns fal...
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 NumGlobalBlockCols64() const
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_
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)
int Resize(int Length_in)
Resize a Epetra_IntSerialDenseVector object.
int ReferenceCount() const
Get reference count.
bool FindGlobalIndexLoc(int LocalRow, int Index, int Start, int &Loc) const
Epetra_CrsGraph & operator=(const Epetra_CrsGraph &Source)
Assignment operator.
Epetra_Distributor: The Epetra Gather/Scatter Setup Base Class.
bool ConstantElementSize() const
Returns true if map has constant element size.
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 TRemoveGlobalIndices(long long Row)
void DecrementReferenceCount()
Decrement reference count.
bool SameAs(const Epetra_BlockMap &Map) const
Returns true if this and Map are identical maps.
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)
int NumMyDiagonals() const
Returns the number of diagonal entries in the local graph, based on global row/column index compariso...
int NumAllocatedGlobalIndices(long long Row) const
Returns the allocated number of nonzero entries in specified global row on this processor.
long long NumGlobalNonzeros_
value_type Get(const long long key)
int NumMyNonzeros() const
Returns the number of indices in the local graph.
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this graph.
int Size(int Length_in)
Set length of a Epetra_IntSerialDenseVector object; init values to zero.
const Epetra_BlockMap & SourceMap() const
Returns the SourceMap used to construct this importer.
int InsertMyIndices(int LocalRow, int NumIndices, int *Indices)
Enter a list of elements in a specified local row of the graph.
int NumAllocatedMyIndices(int Row) const
Returns the allocated number of nonzero entries in specified local row on this processor.
const Epetra_CrsGraphData * DataPtr() const
Returns a pointer to the CrsGraphData instance this CrsGraph uses.
bool SortGhostsAssociatedWithEachProcessor_
double * Values() const
Returns pointer to the values in vector.
long long IndexBase64() const
Epetra_BlockMap DomainMap_
#define EPETRA_CHK_ERR(a)
int GlobalMaxColDim() const
Returns the max column dimension of block entries across all processors.
int MakeColMap_LL(const Epetra_BlockMap &DomainMap, const Epetra_BlockMap &RangeMap)
const Epetra_BlockMap & TargetMap() const
Returns the TargetMap used to construct this importer.
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...
void SetAllocated(bool Flag)
long long NumGlobalBlockDiagonals64() const
int RemoveEmptyProcessesInPlace(const Epetra_BlockMap *NewMap)
Remove processes owning zero rows from the Maps and their communicator.
bool NoRedundancies() const
If RemoveRedundantIndices() has been called, this query returns true, otherwise it returns false...
virtual int ReportError(const std::string Message, int ErrorCode) const
Error reporting method.
virtual int MinAll(double *PartialMins, double *GlobalMins, int Count) const =0
Epetra_Comm Global Min function.
long long NumGlobalElements64() const
int ExtractGlobalRowView(int GlobalRow, int &NumIndices, int *&Indices) const
Get a view of the elements in a specified global row of the graph.
Epetra_Import: This class builds an import object for efficient importing of off-processor elements...
virtual void Barrier() const =0
Epetra_Comm Barrier function.
const Epetra_BlockMap & RowMap() const
Returns the RowMap associated with this graph.
int ReplaceDomainMapAndImporter(const Epetra_BlockMap &NewDomainMap, const Epetra_Import *NewImporter)
Replaces the current DomainMap & Importer with the user-specified map object.
int Length() const
Returns length of vector.
long long * MyGlobalElements64() const
Epetra_CrsGraphData * CrsGraphData_
virtual int MyPID() const =0
Return my process ID.
int RemoveRedundantIndices()
Removes any redundant column indices in the rows of the graph.
int * ElementSizeList() const
List of the element sizes corresponding to the array MyGlobalElements().
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.
int NumMyBlockDiagonals() const
Returns the number of Block diagonal entries in the local graph, based on global row/column index com...
int RemoveGlobalIndices(int GlobalRow, int NumIndices, int *Indices)
Remove a list of elements from a specified global row of the graph.
int NumMyRows() const
Returns the number of matrix rows on this processor.
IndexData< int_type > & Data()
int LCID(int GCID_in) const
Returns the local column index for given global column index, returns -1 if no local column for this ...
const Epetra_BlockMap & ColMap() const
Returns the Column Map associated with this graph.
bool LowerTriangular() const
If graph is lower triangular in local index space, this query returns true, otherwise it returns fals...
Epetra_Util: The Epetra Util Wrapper Class.
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.
bool StorageOptimized() const
If OptimizeStorage() has been called, this query returns true, otherwise it returns false...
virtual int NumMyRowEntries(int MyRow, int &NumEntries) const =0
Returns the number of nonzero entries in MyRow.
int NumMyBlockRows() const
Returns the number of block matrix rows on this processor.
virtual int MaxNumEntries() const =0
Returns the maximum of NumMyRowEntries() over all rows.
long long NumGlobalPoints64() const
std::vector< EntriesInOneRow< int > > SortedEntries_
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 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.
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.
long long GID64(int LID) const
void SetIndicesAreGlobal(bool Flag)
Epetra_IntSerialDenseVector NumAllocatedIndicesPerRow_
int NumMyBlockCols() const
Returns the number of Block matrix columns on this processor.
void SetIndicesAreLocal(bool Flag)
const Epetra_BlockMap & RangeMap() const
Returns the RangeMap associated with this graph.
bool IndicesAreContiguous() const
void SetNoRedundancies(bool Flag)
const Epetra_Comm * Comm_
int MaxRowDim() const
Returns the max row dimension of block entries on the processor.
int CopyAndPermuteCrsGraph(const Epetra_CrsGraph &A, int NumSameIDs, int NumPermuteIDs, int *PermuteToLIDs, int *PermuteFromLIDs, const Epetra_OffsetIndex *Indexor, Epetra_CombineMode CombineMode)
int * All_Indices() const
int MakeColMap(const Epetra_BlockMap &DomainMap, const Epetra_BlockMap &RangeMap)
void SetIndicesAreContiguous(bool Flag)
int MaxColDim() const
Returns the max column dimension of block entries on the processor.
int OptimizeStorage()
Make consecutive row index sections contiguous, minimize internal storage used for constructing graph...
bool GlobalIndicesInt() const
Returns true if map create with int NumGlobalElements.
virtual const Epetra_BlockMap & Map() const =0
Returns a reference to the Epetra_BlockMap for this object.
int NumMyElements() const
Number of elements on the calling processor.
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 ElementSize() const
Returns the size of elements in the map; only valid if map has constant element size.
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
bool UpperTriangular() const
If graph is upper triangular in local index space, this query returns true, otherwise it returns fals...
Epetra_LongLongSerialDenseVector: A class for constructing and using dense vectors.
const Epetra_Comm & Comm() const
Access function for Epetra_Comm communicator.
bool IndicesAreLocal() const
If column indices are in local range, this query returns true, otherwise it returns false...
int GlobalMaxNumIndices() const
Returns the maximun number of nonzero entries across all rows across all processors.
void SetGlobalConstantsComputed(bool Flag)
bool NoDiagonal() const
If graph has no diagonal entries in global index space, this query returns true, otherwise it returns...
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...
int NumGlobalIndices(long long Row) const
Returns the current number of nonzero entries in specified global row on this processor.
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.
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_
Epetra_SerialComm: The Epetra Serial Communication Class.
int LID(int GID) const
Returns local ID of global ID, return -1 if not found on this processor.
Epetra_IntSerialDenseVector All_IndicesPlus1_
long long IndexBase64() const
void SetSorted(bool Flag)
int ReplaceColMap(const Epetra_BlockMap &newmap)
Replaces the current ColMap with the user-specified map object, but only if no entries have been inse...
long long NumGlobalNonzeros64() const
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.
const Epetra_BlockMap & DomainMap() const
Returns the DomainMap associated with this graph.
Epetra_IntSerialDenseVector IndexOffset_
bool GlobalIndicesTypeMatch(const Epetra_BlockMap &other) const
bool StaticProfile() const
long long NumGlobalBlockDiagonals_
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...
long long GCID64(int LCID_in) const
int NumMyIndices(int Row) const
Returns the current number of nonzero entries in specified local row on this processor.
int MaxNumIndices() const
Returns the maximum number of nonzero entries across all rows on this processor.
int MaxElementSize() const
Maximum element size across all processors.
long long GRID64(int LRID_in) const
int CopyAndPermuteRowMatrix(const Epetra_RowMatrix &A, int NumSameIDs, int NumPermuteIDs, int *PermuteToLIDs, int *PermuteFromLIDs, const Epetra_OffsetIndex *Indexor, Epetra_CombineMode CombineMode)
int NumMyEntries() const
Returns the number of entries on this processor.
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 ExtractMyRowView(int LocalRow, int &NumIndices, int *&Indices) const
Get a view of the elements in a specified local row of the graph.
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)
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...
virtual const Epetra_Map & RowMatrixColMap() const =0
Returns the Epetra_Map object associated with the columns of this matrix.
const Epetra_Import * Importer_
Epetra_SrcDistObject: A class for supporting flexible source distributed objects for import/export op...
int NumMyPoints() const
Number of local points for this map; equals the sum of all element sizes on the calling processor...
Epetra_RowMatrix: A pure virtual class for using real-valued double-precision row matrices...
long long NumGlobalBlockRows64() const
int * Values()
Returns pointer to the values in vector.
int NumMyCols() const
Returns the number of entries in the set of column-indices that appear on this processor.
long long NumGlobalCols64() const
int InsertIndicesIntoSorted(int Row, int NumIndices, int *Indices)
bool GlobalIndicesLongLong() const
Returns true if map create with long long NumGlobalElements.
long long NumGlobalDiagonals64() const
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.
int GID(int LID) const
Returns global ID of local ID, return IndexBase-1 if not found on this processor. ...
virtual void Print(std::ostream &os) const
Print method.
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().
bool Filled() const
If FillComplete() has been called, this query returns true, otherwise it returns false.
bool GlobalConstantsComputed() const
void epetra_crsgraph_compress_out_duplicates(int len, int *list, int &newlen)
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...
long long NumGlobalDiagonals_
Epetra_CrsGraph: A class for constructing and using sparse compressed row graphs. ...
Epetra_BlockMap * ReplaceCommWithSubset(const Epetra_Comm *Comm) const
Replace this BlockMap's communicator with a subset communicator.
Epetra_DistObject: A class for constructing and using dense multi-vectors, vectors and matrices in pa...
bool IndicesAreGlobal() const
If column indices are in global range, this query returns true, otherwise it returns false...
long long NumGlobalRows64() const
int GlobalMaxRowDim() const
Returns the max row dimension of block entries across all processors.
bool Sorted() const
If SortIndices() has been called, this query returns true, otherwise it returns false.