------------------------------------------------------------------------------
| 62 | |
| 63 | //------------------------------------------------------------------------------ |
| 64 | int vtkExtractGrid::RequestUpdateExtent(vtkInformation* vtkNotUsed(request), |
| 65 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 66 | { |
| 67 | // get the info objects |
| 68 | auto inInfo = inputVector[0]->GetInformationObject(0); |
| 69 | |
| 70 | // Re-init helper to full whole extent. This is needed since `RequestData` |
| 71 | // modifies the helper to limit to the input extents rather than whole |
| 72 | // extents. |
| 73 | int wholeExtent[6]; |
| 74 | inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), wholeExtent); |
| 75 | this->Internal->Initialize( |
| 76 | this->VOI, wholeExtent, this->SampleRate, (this->IncludeBoundary == 1)); |
| 77 | if (!this->Internal->IsValid()) |
| 78 | { |
| 79 | return 0; |
| 80 | } |
| 81 | |
| 82 | bool emptyExtent = false; |
| 83 | int uExt[6]; |
| 84 | for (int i = 0; i < 3; i++) |
| 85 | { |
| 86 | if (this->Internal->GetSize(i) < 1) |
| 87 | { |
| 88 | uExt[0] = uExt[2] = uExt[4] = 0; |
| 89 | uExt[1] = uExt[3] = uExt[5] = -1; |
| 90 | emptyExtent = true; |
| 91 | break; |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | vtkLogScopeF(TRACE, "RequestUpdateExtent"); |
| 96 | if (!emptyExtent) |
| 97 | { |
| 98 | // Find input update extent based on requested output |
| 99 | // extent |
| 100 | int oUExt[6]; |
| 101 | outputVector->GetInformationObject(0)->Get( |
| 102 | vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), oUExt); |
| 103 | vtkLogF(TRACE, "oUExt: %d,%d %d,%d %d,%d", oUExt[0], oUExt[1], oUExt[2], oUExt[3], oUExt[4], |
| 104 | oUExt[5]); |
| 105 | |
| 106 | int oWExt[6]; // For parallel partition this will be different. |
| 107 | this->Internal->GetOutputWholeExtent(oWExt); |
| 108 | vtkLogF(TRACE, "oWExt: %d,%d %d,%d %d,%d", oWExt[0], oWExt[1], oWExt[2], oWExt[3], oWExt[4], |
| 109 | oWExt[5]); |
| 110 | for (int i = 0; i < 3; i++) |
| 111 | { |
| 112 | int idx = oUExt[2 * i] - oWExt[2 * i]; // Extent value to index |
| 113 | if (idx < 0 || idx >= this->Internal->GetSize(i)) |
| 114 | { |
| 115 | vtkErrorMacro("Requested extent outside whole extent."); |
| 116 | idx = 0; |
| 117 | } |
| 118 | uExt[2 * i] = this->Internal->GetMappedExtentValueFromIndex(i, idx); |
| 119 | int jdx = oUExt[2 * i + 1] - oWExt[2 * i]; // Extent value to index |
| 120 | if (jdx < idx || jdx >= this->Internal->GetSize(i)) |
| 121 | { |
nothing calls this directly
no test coverage detected