Shamrock
2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shamrock
include
shamrock
patch
PatchField.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
#include "
shambase/DistributedData.hpp
"
19
#include "
shambackends/sycl.hpp
"
20
#include <memory>
21
namespace
shamrock::patch {
22
23
template
<
class
T>
24
class
PatchField
{
25
public
:
26
shambase::DistributedData<T>
field_all;
27
28
PatchField
(
shambase::DistributedData<T>
&&field_all) : field_all(field_all) {}
29
30
T &get(
u64
id
) {
return
field_all.
get
(
id
); }
31
};
32
33
template
<
class
T>
34
class
PatchtreeField
{
35
public
:
36
std::unique_ptr<sycl::buffer<T>> internal_buf;
37
38
inline
void
reset() { internal_buf.reset(); }
39
40
inline
void
allocate(
u32
size) { internal_buf = std::make_unique<sycl::buffer<T>>(size); }
41
};
42
}
// namespace shamrock::patch
DistributedData.hpp
u32
std::uint32_t u32
32 bit unsigned integer
Definition
aliases_int.hpp:27
u64
std::uint64_t u64
64 bit unsigned integer
Definition
aliases_int.hpp:26
shambase::DistributedData
Represents a collection of objects distributed across patches identified by a u64 id.
Definition
DistributedData.hpp:43
shambase::DistributedData::get
T & get(u64 id)
Returns a reference to an object in the collection.
Definition
DistributedData.hpp:145
shamrock::patch::PatchField
Definition
PatchField.hpp:24
shamrock::patch::PatchtreeField
Definition
PatchField.hpp:34
sycl.hpp
Generated on Wed May 13 2026 13:21:49 for Shamrock by
1.9.8