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
17
18
#include "
shambase/DistributedData.hpp
"
19
#include "
shambackends/sycl.hpp
"
20
#include <memory>
21
#include <utility>
22
namespace
shamrock::patch {
23
24
template
<
class
T>
25
class
PatchField {
26
public
:
27
shambase::DistributedData<T>
field_all;
28
29
PatchField(
shambase::DistributedData<T>
&&field_all) : field_all(std::move(field_all)) {}
30
31
T &get(
u64
id
) {
return
field_all.get(
id
); }
32
const
T &get(
u64
id
)
const
{
return
field_all.get(
id
); }
33
};
34
35
template
<
class
T>
36
class
PatchtreeField
{
37
public
:
38
std::unique_ptr<sycl::buffer<T>> internal_buf;
39
40
inline
void
reset() { internal_buf.reset(); }
41
42
inline
void
allocate(
u32
size) { internal_buf = std::make_unique<sycl::buffer<T>>(size); }
43
};
44
}
// 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:47
shamrock::patch::PatchtreeField
Definition
PatchField.hpp:36
sycl.hpp
Generated on
for Shamrock by
1.15.0