111#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
116 throw "Epetra_CrsGraphData::Epetra_CrsGraphData: cannot be called without any index type for RowMap";
119#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
185#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
190 throw "Epetra_CrsGraphData::Epetra_CrsGraphData: cannot be called without any index type for RowMap";
193 throw "Epetra_CrsGraphData::Epetra_CrsGraphData: cannot be called with different indices types for RowMap and ColMap";
196#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
207 data->Indices_[i] = 0;
209 delete[]
data->Indices_;
213#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
223 if (
data->TempColIndices_ != 0) {
224 delete []
data->TempColIndices_;
225 data->TempColIndices_ = 0;
228#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
229 if (
LL_data->TempColIndices_ != 0) {
230 delete []
LL_data->TempColIndices_;
236#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
282 if(IntPacketSizeTimesNumTrans > Length) {
285 Length = IntPacketSizeTimesNumTrans;
286 int* newPtr =
new int[Length];
287 UserPtr =
reinterpret_cast<char*
> (newPtr);
294 bool four_bit = (level >= 4);
295 bool two_bit = ((level % 4) >= 2);
296 bool one_bit = ((level % 2) == 1);
298 os <<
"\n***** CrsGraphData (output level " << level <<
") *****" << std::endl;
301 os <<
"RowMap_:\n" <<
RowMap_ << std::endl;
302 os <<
"ColMap_:\n" <<
ColMap_ << std::endl;
303 os <<
"DomainMap_:\n" <<
DomainMap_ << std::endl;
304 os <<
"RangeMap_:\n" <<
RangeMap_ << std::endl;
308 os.width(26); os <<
"HaveColMap_: " <<
HaveColMap_;
309 os.width(25); os <<
"Filled_: " <<
Filled_;
310 os.width(25); os <<
"Allocated_: " <<
Allocated_;
311 os.width(25); os <<
"Sorted_: " <<
Sorted_ << std::endl;
320 os.width(25); os <<
"NoDiagonal_: " <<
NoDiagonal_ << std::endl;
322 os.width(25); os <<
"StaticProfile_: " <<
StaticProfile_ << std::endl << std::endl;
332 os.width(10); os <<
"IB_: " <<
IndexBase_ << std::endl;
341 os.width(10); os <<
"CV_: " <<
CV_ << std::endl;
350 os.width(11); os <<
"RC: " <<
ReferenceCount() << std::endl << std::endl;
356 os <<
"All_Indices_: " <<
data->All_Indices_ << std::endl;
359#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
360 os <<
"All_Indices_: " <<
LL_data->All_Indices_ << std::endl;
362 throw "Epetra_CrsGraphData::Print: GlobalIndicesLongLong but no long long API";
369 os <<
"Indices_: " <<
data->Indices_ << std::endl;
370 if(
data->Indices_ != 0) {
372 os <<
"Indices_[" << i <<
"]: (" <<
data->Indices_[i] <<
") ";
373 if(
data->Indices_[i] != 0) {
375 os <<
data->Indices_[i][j] <<
" ";
384#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
385 os <<
"Indices_: " <<
LL_data->Indices_ << std::endl;
388 os <<
"Indices_[" << i <<
"]: (" <<
LL_data->Indices_[i] <<
") ";
389 if(
LL_data->Indices_[i] != 0) {
391 os <<
LL_data->Indices_[i][j] <<
" ";
397 throw "Epetra_CrsGraphData::Print: GlobalIndicesLongLong but no long long API";
402 os <<
"***** End CrsGraphData *****" << std::endl;
407template<
typename int_type>
419 typename std::vector<int_type>::iterator it = std::lower_bound(
entries_.begin(),
434template<
typename int_type>
437 const int_type *Indices)
443 bool indicesAreSorted =
true;
444 for (
int i=1; i<numCols; ++i)
445 if (Indices[i] <= Indices[i-1]) {
446 indicesAreSorted =
false;
450 if (indicesAreSorted && numCols > 3) {
451 const int_type * curInput = &Indices[0];
452 int_type col = *curInput;
453 const int_type * endInput = &Indices[numCols];
465 typename std::vector<int_type>::iterator it =
469 if (curInput == endInput)
484 it = std::lower_bound(it,
entries_.end(), col);
490 if (curInput == endInput)
497 const int pos1 = (int) (it -
entries_.begin());
498 entries_.insert (it, curInput, endInput);
502 typename std::vector<int_type>::iterator it2 = it + (endInput - curInput);
506 while (curInput != endInput && it2 !=
entries_.end())
508 if (*curInput < *it2)
510 else if (*curInput == *it2)
521 while (curInput != endInput)
528 const int new_size = (int) (it -
entries_.begin());
535 for (
int i=0; i<numCols; ++i)
543#ifndef EPETRA_NO_64BIT_GLOBAL_INDICES
Epetra_BlockMap: A class for partitioning block element vectors and matrices.
bool GlobalIndicesTypeMatch(const Epetra_BlockMap &other) const
bool GlobalIndicesInt() const
Returns true if map create with int NumGlobalElements.
bool GlobalIndicesLongLong() const
Returns true if map create with long long NumGlobalElements.
IndexData< long long > * LL_data
long long NumGlobalBlockRows_
long long NumGlobalDiagonals_
int ReAllocateAndCast(char *&UserPtr, int &Length, const int IntPacketSizeTimesNumTrans)
called by PackAndPrepare
void Print(std::ostream &os, int level=3) const
Outputs state of almost all data members. (primarily used for testing purposes).
bool GlobalConstantsComputed_
long long NumGlobalBlockCols_
bool IndicesAreContiguous_
long long NumGlobalEntries_
long long NumGlobalBlockDiagonals_
const Epetra_Import * Importer_
Epetra_IntSerialDenseVector NumIndicesPerRow_
Epetra_IntSerialDenseVector NumAllocatedIndicesPerRow_
Epetra_BlockMap DomainMap_
int MakeImportExport()
called by FillComplete (and TransformToLocal)
Epetra_CrsGraphData(Epetra_DataAccess CV, const Epetra_BlockMap &RowMap, bool StaticProfile)
Epetra_CrsGraphData Default Constructor.
int GlobalMaxNumNonzeros_
const Epetra_Export * Exporter_
long long NumGlobalNonzeros_
Epetra_IntSerialDenseVector IndexOffset_
~Epetra_CrsGraphData()
Epetra_CrsGraphData Destructor.
Epetra_BlockMap RangeMap_
bool SortGhostsAssociatedWithEachProcessor_
int ReferenceCount() const
Get reference count.
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements.
Epetra_Import: This class builds an import object for efficient importing of off-processor elements.
void AddEntry(const int_type col_num)
Add the given column number to this line.
void AddEntries(const int n_cols, const int_type *col_nums)
Add many entries to one row.
std::vector< int_type > entries_
Storage for the column indices of this row.