------------------------------------------------------------------------------
| 43 | |
| 44 | //------------------------------------------------------------------------------ |
| 45 | vtkIdType vtkDistributedGraphHelper::GetVertexOwner(vtkIdType v) const |
| 46 | { |
| 47 | vtkIdType owner = v; |
| 48 | int numProcs = this->Graph->GetInformation()->Get(vtkDataObject::DATA_NUMBER_OF_PIECES()); |
| 49 | |
| 50 | if (numProcs > 1) |
| 51 | { |
| 52 | // An alternative to this obfuscated code is to provide |
| 53 | // an 'unsigned' equivalent to vtkIdType. Could then safely |
| 54 | // do a logical right-shift of bits, e.g.: |
| 55 | // owner = (vtkIdTypeUnsigned) v >> this->indexBits; |
| 56 | if (v & this->signBitMask) |
| 57 | { |
| 58 | owner ^= this->signBitMask; // remove sign bit |
| 59 | vtkIdType tmp = owner >> this->indexBits; // so can right-shift |
| 60 | owner = tmp | this->highBitShiftMask; // and append sign bit back |
| 61 | } |
| 62 | else |
| 63 | { |
| 64 | owner = v >> this->indexBits; |
| 65 | } |
| 66 | } |
| 67 | else // numProcs = 1 |
| 68 | { |
| 69 | owner = 0; |
| 70 | } |
| 71 | |
| 72 | return owner; |
| 73 | } |
| 74 | |
| 75 | //------------------------------------------------------------------------------ |
| 76 | vtkIdType vtkDistributedGraphHelper::GetVertexIndex(vtkIdType v) const |
no test coverage detected