33 auto edges = get_edges();
35 edges.spans_block_cell_sizes.check_sizes(edges.sizes.indexes);
36 edges.spans_phi.check_sizes(edges.sizes.indexes);
37 edges.spans_rho.check_sizes(edges.sizes.indexes);
38 edges.spans_phi_res.check_sizes(edges.sizes.indexes);
39 edges.spans_phi_res_bis.check_sizes(edges.sizes.indexes);
40 edges.spans_phi_p.check_sizes(edges.sizes.indexes);
41 edges.spans_rhs.check_sizes(edges.sizes.indexes);
43 auto &q = shamsys::instance::get_compute_scheduler().get_queue();
44 Tscal mean_rho = edges.mean_rho.value;
46 edges.cell_neigh_graph.graph.for_each(
48 auto &cell_sizes_span = edges.spans_block_cell_sizes.get_spans().get(
id);
49 auto &phi_span = edges.spans_phi.get_spans().get(
id);
50 auto &rho_span = edges.spans_rho.get_spans().get(
id);
51 auto &phi_res_span = edges.spans_phi_res.get_spans().get(
id);
52 auto &phi_res_bis_span = edges.spans_phi_res_bis.get_spans().get(
id);
53 auto &phi_p_span = edges.spans_phi_p.get_spans().get(
id);
54 auto &rhs_span = edges.spans_rhs.get_spans().get(
id);
56 auto get_graph = [&](Direction dir) ->
const AMRGraph & {
60 const AMRGraph &graph_neigh_xp = get_graph(Direction::xp);
61 const AMRGraph &graph_neigh_xm = get_graph(Direction::xm);
62 const AMRGraph &graph_neigh_yp = get_graph(Direction::yp);
63 const AMRGraph &graph_neigh_ym = get_graph(Direction::ym);
64 const AMRGraph &graph_neigh_zp = get_graph(Direction::zp);
65 const AMRGraph &graph_neigh_zm = get_graph(Direction::zm);
67 u32 cell_count = edges.sizes.indexes.get(
id) * block_size;
81 sham::MultiRef{phi_res_span, phi_res_bis_span, phi_p_span, rhs_span},
83 [block_size = block_size, fourPiG = fourPiG, mean_rho](
85 const Tscal *__restrict cell_sizes,
86 const Tscal *__restrict phi,
87 const Tscal *__restrict rho,
94 Tscal *__restrict phi_res,
95 Tscal *__restrict phi_res_bis,
96 Tscal *__restrict phi_p,
97 Tscal *__restrict rhs) {
113 Tscal delta_cell = cell_sizes[cell_global_id / block_size];
114 Tscal dV = delta_cell * delta_cell * delta_cell;
115 Tscal b_rhs = -fourPiG * (rho[cell_global_id] - mean_rho) * dV;
117 phi_res[cell_global_id] = b_rhs - Aphi;
118 phi_res_bis[cell_global_id] = 0.5 * (b_rhs - Aphi);
119 phi_p[cell_global_id] = b_rhs - Aphi;
120 rhs[cell_global_id] = b_rhs;
void kernel_call(sham::DeviceQueue &q, RefIn in, RefOut in_out, u32 n, Functor &&func, SourceLocation &&callsite=SourceLocation{})
Submit a kernel to a SYCL queue.
T laplacian_7pt(const shambase::VecComponent< Tvec > *cell_sizes, const u32 block_size, const u32 cell_global_id, 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 (finite volume) Laplacian.