25 TgridVec>::_impl_evaluate_internal() {
26 auto edges = get_edges();
29 auto &ids_to_check = edges.ids_to_check.data;
30 auto &sim_box = edges.sim_box.value;
31 auto &patch_tree = edges.patch_tree.get_patch_tree();
32 auto &patch_boxes = edges.patch_boxes;
37 auto &ghost_layers_candidates = edges.ghost_layers_candidates.values;
39 auto paving = get_paving(mode, sim_box);
41 using namespace shamrock::patch;
44 for_each_paving_tile(mode, [&](
i32 xoff,
i32 yoff,
i32 zoff) {
46 for (
auto id : ids_to_check) {
47 auto patch_box = patch_boxes.values.get(
id);
50 auto patch_box_mapped = paving.f_aabb(patch_box, xoff, yoff, zoff);
52 patch_tree.host_for_each_leafs(
53 [&](
u64 tree_id, PtNode n) {
58 return tree_cell.get_intersect(patch_box_mapped).is_not_empty();
60 [&](
u64 id_found, PtNode n) {
62 if ((id_found ==
id) && (xoff == 0) && (yoff == 0) && (zoff == 0)) {
69 ghost_layers_candidates.add_obj(
79 auto sim_box = get_ro_edge_base(0).get_tex_symbol();
80 auto patch_tree = get_ro_edge_base(1).get_tex_symbol();
81 auto patch_boxes = get_ro_edge_base(2).get_tex_symbol();
82 auto ghost_layers_candidates = get_rw_edge_base(0).get_tex_symbol();
84 std::string tex = R
"tex(
85 Find Ghost Layer Candidates
88 \caption{Find Ghost Layer Candidates Algorithm}
90 \SetKwInOut{Input}{Input}
91 \SetKwInOut{Output}{Output}
92 \Input{Simulation box, patch tree, patch boxes}
93 \Output{Ghost layer candidates}
95 \For{each paving tile offset $(x_{\rm off}, y_{\rm off}, z_{\rm off})$}{
96 \uIf{periodic in $x$}{$x_{\rm off} \in \{-1, 0, 1\}$}
97 \Else{$x_{\rm off} = 0$}
98 \uIf{periodic in $y$}{$y_{\rm off} \in \{-1, 0, 1\}$}
99 \Else{$y_{\rm off} = 0$}
100 \uIf{periodic in $z$}{$z_{\rm off} \in \{-1, 0, 1\}$}
101 \Else{$z_{\rm off} = 0$}
103 \For{each local patch $P_i$}{
104 $B_i \leftarrow$ patch box of $P_i$\;
105 $B_i^{\rm mapped} \leftarrow f(B_i, x_{\rm off}, y_{\rm off}, z_{\rm off})$\;
107 \For{each tree node $T_j$}{
108 $B_j \leftarrow$ tree node box\;
109 \If{$B_i^{\rm mapped} \cap B_j \neq \emptyset$ \textbf{and} $(i \neq j$ \textbf{or} $(x_{\rm off}, y_{\rm off}, z_{\rm off}) \neq (0,0,0))$}{
110 Add ghost layer candidate: $(P_i, P_j, x_{\rm off}, y_{\rm off}, z_{\rm off})$\;
117 \textbf{Note:} $f(B, x, y, z)$ is the paving function that maps box $B$ by offset $(x, y, z)$