Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ValueLoader.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
19#include "shambackends/vec.hpp"
22
24
25 template<class Tvec, class TgridVec, class T>
27
28 public:
29 using Tscal = shambase::VecComponent<Tvec>;
30 using Tgridscal = shambase::VecComponent<TgridVec>;
32
35
36 ShamrockCtx &context;
37 Config &solver_config;
38 Storage &storage;
39
40 ValueLoader(ShamrockCtx &context, Config &solver_config, Storage &storage)
41 : context(context), solver_config(solver_config), storage(storage) {}
42
53 std::string field_name, std::array<Tgridscal, dim> offset, std::string result_name);
54
56 shamrock::ComputeField<T> &compute_field,
57 std::array<Tgridscal, dim> offset,
58 std::string result_name);
59
60 private:
61 inline PatchScheduler &scheduler() { return shambase::get_check_ref(context.sched); }
62
72 void load_patch_internal_block(
73 std::array<Tgridscal, dim> offset,
74 u32 nobj,
75 u32 nvar,
78
91 void load_patch_neigh_same_level(
92 std::array<Tgridscal, dim> offset,
93 sham::DeviceBuffer<TgridVec> &buf_cell_min,
94 sham::DeviceBuffer<TgridVec> &buf_cell_max,
96 u32 nobj,
97 u32 nvar,
100
113 void load_patch_neigh_level_up(
114 std::array<Tgridscal, dim> offset,
115 sham::DeviceBuffer<TgridVec> &buf_cell_min,
116 sham::DeviceBuffer<TgridVec> &buf_cell_max,
118 u32 nobj,
119 u32 nvar,
122
135 void load_patch_neigh_level_down(
136 std::array<Tgridscal, dim> offset,
137 sham::DeviceBuffer<TgridVec> &buf_cell_min,
138 sham::DeviceBuffer<TgridVec> &buf_cell_max,
140 u32 nobj,
141 u32 nvar,
144
145 void load_patch_internal_block_xm(
146 u32 nobj, u32 nvar, sham::DeviceBuffer<T> &src, sham::DeviceBuffer<T> &dest);
147
148 void load_patch_internal_block_ym(
149 u32 nobj, u32 nvar, sham::DeviceBuffer<T> &src, sham::DeviceBuffer<T> &dest);
150
151 void load_patch_internal_block_zm(
152 u32 nobj, u32 nvar, sham::DeviceBuffer<T> &src, sham::DeviceBuffer<T> &dest);
153
154 void load_patch_internal_block_xp(
155 u32 nobj, u32 nvar, sham::DeviceBuffer<T> &src, sham::DeviceBuffer<T> &dest);
156
157 void load_patch_internal_block_yp(
158 u32 nobj, u32 nvar, sham::DeviceBuffer<T> &src, sham::DeviceBuffer<T> &dest);
159
160 void load_patch_internal_block_zp(
161 u32 nobj, u32 nvar, sham::DeviceBuffer<T> &src, sham::DeviceBuffer<T> &dest);
162
163 void load_patch_neigh_same_level_xm(
164 std::array<Tgridscal, dim> offset,
165 sham::DeviceBuffer<TgridVec> &buf_cell_min,
166 sham::DeviceBuffer<TgridVec> &buf_cell_max,
168 u32 nobj,
169 u32 nvar,
172
173 void load_patch_neigh_same_level_ym(
174 std::array<Tgridscal, dim> offset,
175 sham::DeviceBuffer<TgridVec> &buf_cell_min,
176 sham::DeviceBuffer<TgridVec> &buf_cell_max,
178 u32 nobj,
179 u32 nvar,
182
183 void load_patch_neigh_same_level_zm(
184 std::array<Tgridscal, dim> offset,
185 sham::DeviceBuffer<TgridVec> &buf_cell_min,
186 sham::DeviceBuffer<TgridVec> &buf_cell_max,
188 u32 nobj,
189 u32 nvar,
192
193 void load_patch_neigh_same_level_xp(
194 std::array<Tgridscal, dim> offset,
195 sham::DeviceBuffer<TgridVec> &buf_cell_min,
196 sham::DeviceBuffer<TgridVec> &buf_cell_max,
198 u32 nobj,
199 u32 nvar,
202
203 void load_patch_neigh_same_level_yp(
204 std::array<Tgridscal, dim> offset,
205 sham::DeviceBuffer<TgridVec> &buf_cell_min,
206 sham::DeviceBuffer<TgridVec> &buf_cell_max,
208 u32 nobj,
209 u32 nvar,
212
213 void load_patch_neigh_same_level_zp(
214 std::array<Tgridscal, dim> offset,
215 sham::DeviceBuffer<TgridVec> &buf_cell_min,
216 sham::DeviceBuffer<TgridVec> &buf_cell_max,
218 u32 nobj,
219 u32 nvar,
222 };
223
224} // namespace shammodels::zeus::modules
std::uint32_t u32
32 bit unsigned integer
The MPI scheduler.
A buffer allocated in USM (Unified Shared Memory)
shamrock::ComputeField< T > load_value_with_gz(std::string field_name, std::array< Tgridscal, dim > offset, std::string result_name)
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...
Definition memory.hpp:110
namespace for the zeus model modules
Definition AMRTree.hpp:23