48 const u32 cell_global_id,
49 const shambase::VecComponent<Tvec> delta_cell,
56 ACCField &&field_access) {
57 auto get_avg_neigh = [&](
auto &graph_links) -> T {
59 u32 cnt = graph_links.for_each_object_link_cnt(cell_global_id, [&](
u32 id_b) {
60 acc += field_access(id_b);
63 T err_val = std::numeric_limits<T>::quiet_NaN();
64 return (cnt > 0) ? acc / cnt : err_val;
68 T W_i = field_access(cell_global_id);
69 T W_xp = get_avg_neigh(graph_iter_xp);
70 T W_xm = get_avg_neigh(graph_iter_xm);
71 T W_yp = get_avg_neigh(graph_iter_yp);
72 T W_ym = get_avg_neigh(graph_iter_ym);
73 T W_zp = get_avg_neigh(graph_iter_zp);
74 T W_zm = get_avg_neigh(graph_iter_zm);
76 T inv_delta_cell_sqr = 1.0 / (delta_cell * delta_cell);
78 T laplace_x = inv_delta_cell_sqr * (-W_xm + 2. * W_i - W_xp);
79 T laplace_y = inv_delta_cell_sqr * (-W_ym + 2. * W_i - W_yp);
80 T laplace_z = inv_delta_cell_sqr * (-W_zm + 2. * W_i - W_zp);
81 T res = (laplace_x + laplace_y + laplace_z);
T laplacian_7pt(const u32 cell_global_id, const shambase::VecComponent< Tvec > delta_cell, const AMRGraphLinkiterator &graph_iter_xp, const AMRGraphLinkiterator &graph_iter_xm, const AMRGraphLinkiterator &graph_iter_yp, const AMRGraphLinkiterator &graph_iter_ym, const AMRGraphLinkiterator &graph_iter_zp, const AMRGraphLinkiterator &graph_iter_zm, ACCField &&field_access)
Get the discretized laplacian.