| 336 | } |
| 337 | |
| 338 | void vtkAMRBox::Coarsen(int r) |
| 339 | { |
| 340 | assert("pre: Input refinement ratio must be >= 2" && (r >= 2)); |
| 341 | assert("pre: AMR Box instance is invalid" && !this->IsInvalid()); |
| 342 | |
| 343 | if (this->Empty()) |
| 344 | { |
| 345 | std::cerr << "WARNING: tried refining an empty AMR box!\n"; |
| 346 | std::cerr << "FILE:" << __FILE__ << std::endl; |
| 347 | std::cerr << "LINE:" << __LINE__ << std::endl; |
| 348 | std::cerr.flush(); |
| 349 | return; |
| 350 | } |
| 351 | for (int q = 0; q < 3; ++q) |
| 352 | { |
| 353 | if (this->EmptyDimension(q)) |
| 354 | { |
| 355 | continue; |
| 356 | } |
| 357 | this->LoCorner[q] = |
| 358 | ((this->LoCorner[q] < 0) ? -abs(this->LoCorner[q] + 1) / r - 1 : this->LoCorner[q] / r); |
| 359 | this->HiCorner[q] = |
| 360 | (this->HiCorner[q] < 0 ? -abs(this->HiCorner[q] + 1) / r - 1 : this->HiCorner[q] / r); |
| 361 | } |
| 362 | assert("post: Coarsened AMR box should not be empty!" && !this->Empty()); |
| 363 | assert("post: Coarsened AMR Box instance is invalid" && !this->IsInvalid()); |
| 364 | } |
| 365 | |
| 366 | void vtkAMRBox::Refine(int r) |
| 367 | { |