| 465 | } |
| 466 | |
| 467 | void split_by_binarytree(grid_volume gvol, std::vector<grid_volume> &result_gvs, |
| 468 | std::vector<int> &result_ids, const binary_partition *bp) { |
| 469 | // reached a leaf |
| 470 | if (bp->is_leaf()) { |
| 471 | result_gvs.push_back(gvol); |
| 472 | result_ids.push_back(bp->get_proc_id()); |
| 473 | return; |
| 474 | } |
| 475 | |
| 476 | const auto &plane = bp->get_plane(); |
| 477 | int split_point = static_cast<int>((plane.pos - gvol.surroundings().in_direction_min(plane.dir)) / |
| 478 | gvol.surroundings().in_direction(plane.dir) * |
| 479 | gvol.num_direction(plane.dir) + |
| 480 | 0.5); |
| 481 | // traverse left branch |
| 482 | grid_volume left_gvol = gvol.split_at_fraction(false, split_point, plane.dir); |
| 483 | split_by_binarytree(left_gvol, result_gvs, result_ids, bp->left_tree()); |
| 484 | |
| 485 | // traverse right branch |
| 486 | grid_volume right_gvol = gvol.split_at_fraction(true, split_point, plane.dir); |
| 487 | split_by_binarytree(right_gvol, result_gvs, result_ids, bp->right_tree()); |
| 488 | } |
| 489 | |
| 490 | void structure::load_chunk_layout(const char *filename, boundary_region &br) { |
| 491 | // Load chunk grid_volumes from a file |
no test coverage detected