------------------------------------------------------------------------------
| 68 | |
| 69 | //------------------------------------------------------------------------------ |
| 70 | void vtkXMLPStructuredDataReader::ReadXMLData() |
| 71 | { |
| 72 | // Get the requested Update Extent. |
| 73 | vtkInformation* outInfo = this->GetCurrentOutputInformation(); |
| 74 | outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), this->UpdateExtent); |
| 75 | |
| 76 | vtkDebugMacro("Updating extent " << this->UpdateExtent[0] << " " << this->UpdateExtent[1] << " " |
| 77 | << this->UpdateExtent[2] << " " << this->UpdateExtent[3] << " " |
| 78 | << this->UpdateExtent[4] << " " << this->UpdateExtent[5]); |
| 79 | |
| 80 | // Prepare increments for the update extent. |
| 81 | this->ComputePointDimensions(this->UpdateExtent, this->PointDimensions); |
| 82 | this->ComputePointIncrements(this->UpdateExtent, this->PointIncrements); |
| 83 | this->ComputeCellDimensions(this->UpdateExtent, this->CellDimensions); |
| 84 | this->ComputeCellIncrements(this->UpdateExtent, this->CellIncrements); |
| 85 | |
| 86 | // Let superclasses read data. This also allocates output data. |
| 87 | this->Superclass::ReadXMLData(); |
| 88 | |
| 89 | // Use the ExtentSplitter to split the update extent into |
| 90 | // sub-extents read by each piece. |
| 91 | if (!this->ComputePieceSubExtents()) |
| 92 | { |
| 93 | // Not all needed data are available. |
| 94 | this->DataError = 1; |
| 95 | return; |
| 96 | } |
| 97 | |
| 98 | // Split current progress range based on fraction contributed by |
| 99 | // each sub-extent. |
| 100 | float progressRange[2] = { 0, 0 }; |
| 101 | this->GetProgressRange(progressRange); |
| 102 | |
| 103 | // Calculate the cumulative fraction of data contributed by each |
| 104 | // sub-extent (for progress). |
| 105 | int n = this->ExtentSplitter->GetNumberOfSubExtents(); |
| 106 | float* fractions = new float[n + 1]; |
| 107 | int i; |
| 108 | fractions[0] = 0; |
| 109 | for (i = 0; i < n; ++i) |
| 110 | { |
| 111 | // Get this sub-extent. |
| 112 | this->ExtentSplitter->GetSubExtent(i, this->SubExtent); |
| 113 | |
| 114 | // Add this sub-extent's volume to the cumulative volume. |
| 115 | int pieceDims[3] = { 0, 0, 0 }; |
| 116 | this->ComputePointDimensions(this->SubExtent, pieceDims); |
| 117 | fractions[i + 1] = fractions[i] + pieceDims[0] * pieceDims[1] * pieceDims[2]; |
| 118 | } |
| 119 | if (fractions[n] == 0) |
| 120 | { |
| 121 | fractions[n] = 1; |
| 122 | } |
| 123 | for (i = 1; i <= n; ++i) |
| 124 | { |
| 125 | fractions[i] = fractions[i] / fractions[n]; |
| 126 | } |
| 127 |
nothing calls this directly
no test coverage detected