Shamrock
2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shammodels
common
include
shammodels
common
amr
AMRStencilCache.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 "
shambase/DistributedData.hpp
"
20
#include "
shambackends/sycl.hpp
"
21
#include "
shammodels/common/amr/AMRBlockStencil.hpp
"
22
#include "
shammodels/common/amr/AMRCellStencil.hpp
"
23
24
namespace
shammodels::basegodunov
{
25
26
struct
AMRStencilCache
{
27
28
using
cell_stencil_el_buf = std::unique_ptr<sycl::buffer<amr::cell::StencilElement>>;
29
30
using
dd_cell_stencil_el_buf
=
shambase::DistributedData<cell_stencil_el_buf>
;
31
std::unordered_map<u32, dd_cell_stencil_el_buf> storage;
32
33
void
insert_data(
u32
map_id,
dd_cell_stencil_el_buf
&&stencil_element) {
34
storage.emplace(map_id, std::forward<dd_cell_stencil_el_buf>(stencil_element));
35
}
36
37
sycl::buffer<amr::cell::StencilElement> &get_stencil_element(
u64
patch_id,
u32
map_id) {
38
return
shambase::get_check_ref
(storage.at(map_id).get(patch_id));
39
}
40
};
41
42
}
// namespace shammodels::basegodunov
AMRBlockStencil.hpp
utility to manipulate AMR blocks
AMRCellStencil.hpp
utility to manipulate AMR blocks
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::get_check_ref
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
shammodels::basegodunov
namespace for the basegodunov model
Definition
AMRCellInfos.hpp:20
shammodels::basegodunov::AMRStencilCache
Definition
AMRStencilCache.hpp:26
sycl.hpp
Generated on Wed May 13 2026 13:21:49 for Shamrock by
1.9.8