------------------------------------------------------------------------------
| 174 | |
| 175 | //------------------------------------------------------------------------------ |
| 176 | void vtkAMRDataObject::SetDataSet(unsigned int level, unsigned int idx, vtkDataSet* grid) |
| 177 | { |
| 178 | if (!grid || !this->AMRMetaData) |
| 179 | { |
| 180 | return; // nullptr grid, nothing to do |
| 181 | } |
| 182 | if (level >= this->GetNumberOfLevels() || idx >= this->GetNumberOfBlocks(level)) |
| 183 | { |
| 184 | vtkErrorMacro("Invalid data set index: " << level << " " << idx); |
| 185 | return; |
| 186 | } |
| 187 | |
| 188 | vtkCartesianGrid* cg = vtkCartesianGrid::SafeDownCast(grid); |
| 189 | if (!cg) |
| 190 | { |
| 191 | vtkErrorMacro("Unsupported grid type: " << grid->GetClassName()); |
| 192 | return; |
| 193 | } |
| 194 | |
| 195 | int gridDescr = cg->GetDataDescription(); |
| 196 | if (this->AMRMetaData->GetGridDescription() < 0) |
| 197 | { |
| 198 | this->AMRMetaData->SetGridDescription(gridDescr); |
| 199 | } |
| 200 | else if (gridDescr != this->AMRMetaData->GetGridDescription()) |
| 201 | { |
| 202 | vtkErrorMacro("Inconsistent types of vtkCartesianGrid"); |
| 203 | return; |
| 204 | } |
| 205 | |
| 206 | // update bounds |
| 207 | double bb[6]; |
| 208 | grid->GetBounds(bb); |
| 209 | for (int i = 0; i < 3; ++i) |
| 210 | { |
| 211 | this->Bounds[i * 2] = std::min(bb[i * 2], this->Bounds[i * 2]); |
| 212 | this->Bounds[i * 2 + 1] = std::max(bb[i * 2 + 1], this->Bounds[i * 2 + 1]); |
| 213 | } // END for each dimension |
| 214 | |
| 215 | this->SetPartition(level, idx, grid); |
| 216 | } |
| 217 | |
| 218 | //------------------------------------------------------------------------------ |
| 219 | void vtkAMRDataObject::SetGridDescription(int gridDescription) |
no test coverage detected