------------------------------------------------------------------------------
| 106 | |
| 107 | //------------------------------------------------------------------------------ |
| 108 | int vtkAMReXGridReader::FillMetaData() |
| 109 | { |
| 110 | this->ReadMetaData(); |
| 111 | if (!this->Internal->headersAreRead) |
| 112 | { |
| 113 | // Error: failed to read header files |
| 114 | return (-1); |
| 115 | } |
| 116 | |
| 117 | this->SetUpDataArraySelections(); |
| 118 | |
| 119 | int dimension = this->GetDimension(); |
| 120 | int numberOfLevels = this->GetNumberOfLevels() + 1; |
| 121 | std::vector<unsigned int> numberOfBlocks(numberOfLevels); |
| 122 | for (int i = 0; i < numberOfLevels; ++i) |
| 123 | { |
| 124 | numberOfBlocks[i] = this->Internal->Header->levelSize[i]; |
| 125 | } |
| 126 | this->Metadata->Initialize(numberOfBlocks); |
| 127 | // The AMRBox always has 3 dimensions |
| 128 | double origin[3] = { 0.0, 0.0, 0.0 }; |
| 129 | double spacing[3] = { 0.0, 0.0, 0.0 }; |
| 130 | double blockOrigin[3] = { 0.0, 0.0, 0.0 }; |
| 131 | int blockDimension[3] = { 1, 1, 1 }; |
| 132 | for (int i = 0; i < dimension; ++i) |
| 133 | { |
| 134 | origin[i] = this->Internal->Header->problemDomainLoEnd[i]; |
| 135 | } |
| 136 | this->Metadata->SetOrigin(origin); |
| 137 | if (dimension == 3) |
| 138 | this->Metadata->SetGridDescription(vtkStructuredData::VTK_STRUCTURED_XYZ_GRID); |
| 139 | if (dimension == 2) |
| 140 | this->Metadata->SetGridDescription(vtkStructuredData::VTK_STRUCTURED_XY_PLANE); |
| 141 | int boxLo; |
| 142 | int boxHi; |
| 143 | long globalID = 0; |
| 144 | for (int i = 0; i < numberOfLevels; ++i) |
| 145 | { |
| 146 | for (int cc = 0; cc < dimension; ++cc) |
| 147 | { |
| 148 | spacing[cc] = this->Internal->Header->cellSize[i][cc]; |
| 149 | } |
| 150 | if (dimension == 2) |
| 151 | spacing[2] = spacing[1]; // Add spacing for the 3rd dimension |
| 152 | this->Metadata->SetSpacing(i, spacing); |
| 153 | if (i == numberOfLevels - 1) |
| 154 | { |
| 155 | this->Metadata->SetRefinementRatio(i, 1); |
| 156 | } |
| 157 | else |
| 158 | { |
| 159 | this->Metadata->SetRefinementRatio(i, this->Internal->Header->refinementRatio[i]); |
| 160 | } |
| 161 | for (int j = 0; j < this->Internal->LevelHeader[i]->levelBoxArraySize; ++j) |
| 162 | { |
| 163 | for (int k = 0; k < dimension; ++k) |
| 164 | { |
| 165 | boxLo = this->Internal->LevelHeader[i]->levelBoxArrays[j][0][k]; |
nothing calls this directly
no test coverage detected