18template<
class Tvec,
class Tgr
idVec>
23 using namespace shamrock::patch;
40 scheduler().for_each_patchdata_nonempty(
42 shamlog_debug_ln(
"[AMR Flux]",
"forward euler integration patch", p.id_patch);
51 u32 cell_count = pdat.get_obj_cnt() * AMRBlock::block_size;
63 auto rhov = buf_rhov.get_write_access(depends_list);
64 auto rhoe = buf_rhoe.get_write_access(depends_list);
66 auto e = q.
submit(depends_list, [&, dt](sycl::handler &cgh) {
67 shambase::parallel_for(cgh, cell_count,
"accumulate fluxes", [=](
u32 id_a) {
68 const u32 cell_global_id = (
u32) id_a;
70 rho[id_a] += dt * acc_dt_rho_patch[id_a];
71 rhov[id_a] += dt * acc_dt_rhov_patch[id_a];
72 rhoe[id_a] += dt * acc_dt_rhoe_patch[id_a];
81 buf_rhov.complete_event_state(e);
82 buf_rhoe.complete_event_state(e);
85 if (solver_config.is_dust_on()) {
95 scheduler().for_each_patchdata_nonempty([&, dt](
99 "[AMR Flux]",
"forward euler integration patch for dust fields", p.id_patch);
107 u32 cell_count = pdat.get_obj_cnt() * AMRBlock::block_size;
108 u32 ndust = solver_config.dust_config.ndust;
114 auto acc_dt_rho_dust_patch = dt_rho_dust_patch.
get_read_access(depends_list);
115 auto acc_dt_rhov_dust_patch = dt_rhov_dust_patch.
get_read_access(depends_list);
118 auto rhov_dust = buf_rhov_dust.get_write_access(depends_list);
120 auto e = q.
submit(depends_list, [&, dt](sycl::handler &cgh) {
121 shambase::parallel_for(cgh, ndust * cell_count,
"accumulate fluxes", [=](
u32 id_a) {
122 rho_dust[id_a] += dt * acc_dt_rho_dust_patch[id_a];
123 rhov_dust[id_a] += dt * acc_dt_rhov_dust_patch[id_a];
130 buf_rhov_dust.complete_event_state(e);
std::uint32_t u32
32 bit unsigned integer
A buffer allocated in USM (Unified Shared Memory)
void complete_event_state(sycl::event e) const
Complete the event state of the buffer.
T * get_write_access(sham::EventList &depends_list, SourceLocation src_loc=SourceLocation{})
Get a read-write pointer to the buffer's data.
const T * get_read_access(sham::EventList &depends_list, SourceLocation src_loc=SourceLocation{}) const
Get a read-only pointer to the buffer's data.
A SYCL queue associated with a device and a context.
sycl::event submit(Fct &&fct)
Submits a kernel to the SYCL queue.
DeviceQueue & get_queue(u32 id=0)
Get a reference to a DeviceQueue.
Class to manage a list of SYCL events.
u32 get_field_idx(const std::string &field_name) const
Get the field id if matching name & type.
PatchDataLayer container class, the layout is described in patchdata_layout.
T & get_check_ref(const std::unique_ptr< T > &ptr, SourceLocation loc=SourceLocation())
Takes a std::unique_ptr and returns a reference to the object it holds. It throws a std::runtime_erro...
namespace for math utility
namespace for the main framework
Patch object that contain generic patch information.