From f8fcf09b50fa21139e3f5b97c806842729bf5d28 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Fri, 11 May 2018 19:53:35 -0500 Subject: [PATCH 1/3] Justify the (slightly wonky) list 3 criterion with static_l2 --- boxtree/traversal.py | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/boxtree/traversal.py b/boxtree/traversal.py index 6960e45..8dcc235 100644 --- a/boxtree/traversal.py +++ b/boxtree/traversal.py @@ -789,16 +789,46 @@ void generate(LIST_ARG_DECL USER_ARG_DECL box_id_t target_box_number) %endfor ; - // l^2 distance between source box and target box. - // Negative indicates overlap. - coord_t l_2_box_dist = + <% assert not sources_have_extent %> + + // We're considering convergence of a multipole + // in the (square) source box at all locations + // in the (round) target box. We need + + // src_box_l2_radius + // / d_2(src_box_center, tgt_box) <= sqrt(d)/3 + + // <=> + + // src_box_linf_radius * sqrt(d) + // / d_2(src_box_center, tgt_box) <= sqrt(d)/3 + + // <=> + + // 3 * src_box_linf_radius + // <= d_2(src_box_center, tgt_box) + + // <=> + + // 3 * src_box_linf_radius + // <= d_2(src_box_center, tgt_box_center) + // - sqrt(d) * tgt_stickout_l_inf_rad + + // <=> (because why not) + + // 2 * src_box_linf_radius + // <= d_2(src_box_center, tgt_box_center) + // - sqrt(d) * tgt_stickout_l_inf_rad + // - src_box_linf_radius + + coord_t rhs = sqrt(l_2_squared_center_dist) - sqrt((coord_t) (${dimensions})) * tgt_stickout_l_inf_rad - source_l_inf_rad; meets_sep_crit = l_2_box_dist >= - (2 - 8 * COORD_T_MACH_EPS) * source_l_inf_rad; + (2 - 8 * COORD_T_MACH_EPS) * rhs; } %else: -- GitLab From 70e9fa0b1c4c613db644c83440c0b0e82ac43bb1 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Fri, 11 May 2018 19:20:20 -0500 Subject: [PATCH 2/3] Improve comment for list 4 separation criterion --- boxtree/traversal.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/boxtree/traversal.py b/boxtree/traversal.py index 8dcc235..53d6ab3 100644 --- a/boxtree/traversal.py +++ b/boxtree/traversal.py @@ -951,6 +951,24 @@ inline bool meets_sep_bigger_criterion( coord_vec_t source_center, int source_level, coord_t stick_out_factor) { + <% + assert not sources_have_extent + %> + + // What we are interested in ensuring is that + + // (*) + // d_2(src_box, tgt_center) + // >= 3 * (radius of tgt box potentially + // including stick-out) + + // (because convergence factors are in l^2, + // irrespective of how we measure) + + // Since d_2(a, b) >= d_inf(a, b), ensuring that + // (*) holds with d_inf implies that it also holds + // with d_2. + coord_t target_rad = LEVEL_TO_RAD(target_level); coord_t source_rad = LEVEL_TO_RAD(source_level); coord_t max_allowed_center_l_inf_dist = ( -- GitLab From dfe4b25f93eff526e6adf92c807910e8db420f11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kl=C3=B6ckner?= Date: Fri, 11 May 2018 21:18:10 -0400 Subject: [PATCH 3/3] Fix the variable rename in the list 3 criterion for static_l2 --- boxtree/traversal.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/boxtree/traversal.py b/boxtree/traversal.py index 53d6ab3..9f032a9 100644 --- a/boxtree/traversal.py +++ b/boxtree/traversal.py @@ -827,8 +827,9 @@ void generate(LIST_ARG_DECL USER_ARG_DECL box_id_t target_box_number) * tgt_stickout_l_inf_rad - source_l_inf_rad; - meets_sep_crit = l_2_box_dist >= - (2 - 8 * COORD_T_MACH_EPS) * rhs; + meets_sep_crit = ( + (2 - 8 * COORD_T_MACH_EPS) * source_l_inf_rad + <= rhs); } %else: -- GitLab