Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
MultiRef.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
18
20
21namespace sham {
32 template<class... Targ>
33 struct MultiRef {
35 using storage_t = std::tuple<Targ &...>;
36
39
41 MultiRef(Targ &...arg) : storage(arg...) {}
42
45 auto get_read_access(sham::EventList &depends_list) {
47 return std::apply(
48 [&](auto &...__a) {
49 return std::tuple(details::get_read_access(__a, depends_list)...);
50 },
51 storage);
52 }
53
56 auto get_write_access(sham::EventList &depends_list) {
58 return std::apply(
59 [&](auto &...__a) {
60 return std::tuple(details::get_write_access(__a, depends_list)...);
61 },
62 storage);
63 }
64
67 void complete_event_state(sycl::event e) {
69 std::apply(
70 [&](auto &...__in) {
71 ((details::complete_event_state(__in, e)), ...);
72 },
73 storage);
74 }
75 };
76} // namespace sham
Class to manage a list of SYCL events.
Definition EventList.hpp:31
namespace for backends this one is named only sham since shambackends is too long to write
#define __shamrock_stack_entry()
Macro to create a stack entry.
storage_t storage
A tuple of references to the buffers.
Definition MultiRef.hpp:38
auto get_write_access(sham::EventList &depends_list)
Definition MultiRef.hpp:56
std::tuple< Targ &... > storage_t
A tuple of references to the buffers.
Definition MultiRef.hpp:35
MultiRef(Targ &...arg)
Constructor.
Definition MultiRef.hpp:41
auto get_read_access(sham::EventList &depends_list)
Definition MultiRef.hpp:45
void complete_event_state(sycl::event e)
Definition MultiRef.hpp:67