Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
patch_field.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
19#include "shambackends/sycl.hpp"
20#include <vector>
21
22template<class type>
24 public:
25 sycl::buffer<type> buf_local;
26 sycl::buffer<type> buf_global;
27};
28
29namespace legacy {
30
36 template<class type>
37 class PatchField {
38 public:
39 using T = type;
40
41 std::vector<type> local_nodes_value;
42
43 std::vector<type> global_values;
44
45 inline void build_global(MPI_Datatype &dtype) {
46 shamalgs::collective::vector_allgatherv(
47 local_nodes_value, dtype, global_values, dtype, MPI_COMM_WORLD);
48 }
49
50 inline BufferedPField<type> get_buffers() {
52 sycl::buffer<type>(local_nodes_value.data(), local_nodes_value.size()),
53 sycl::buffer<type>(global_values.data(), global_values.size()),
54 };
55 }
56 };
57
58} // namespace legacy
Define a field attached to a patch (example: FMM multipoles, hmax in SPH)