MCPcopy Create free account
hub / github.com/NanoComp/meep / split_by_binarytree

Function split_by_binarytree

src/structure_dump.cpp:467–488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465}
466
467void 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
490void structure::load_chunk_layout(const char *filename, boundary_region &br) {
491 // Load chunk grid_volumes from a file

Callers 1

choose_chunkdivisionMethod · 0.85

Calls 9

is_leafMethod · 0.80
get_proc_idMethod · 0.80
in_direction_minMethod · 0.80
surroundingsMethod · 0.80
num_directionMethod · 0.80
split_at_fractionMethod · 0.80
left_treeMethod · 0.80
right_treeMethod · 0.80
in_directionMethod · 0.45

Tested by

no test coverage detected