Shamrock
2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shammodels
ramses
include
shammodels
ramses
modules
AMRGridRefinementHandler.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
"
20
#include "
shammodels/common/amr/NeighGraph.hpp
"
21
#include "
shammodels/ramses/Solver.hpp
"
22
#include "
shammodels/ramses/modules/SolverStorage.hpp
"
23
#include "
shamrock/amr/AMRCell.hpp
"
24
25
namespace
shammodels::basegodunov::modules
{
26
27
template
<
class
Tvec,
class
Tgr
id
Vec>
28
class
AMRGridRefinementHandler
{
29
30
class
AMRBlockFinder;
31
class
AMRLowering;
32
33
public
:
34
using
Tscal = shambase::VecComponent<Tvec>;
35
using
Tgridscal = shambase::VecComponent<TgridVec>;
36
static
constexpr
u32
dim =
shambase::VectorProperties<Tvec>::dimension
;
37
static
constexpr
u32
split_count =
shambase::pow_constexpr<dim>
(2);
38
39
using
Config
=
SolverConfig<Tvec, TgridVec>
;
40
using
Storage
=
SolverStorage<Tvec, TgridVec, u64>
;
41
using
u_morton =
u64
;
42
using
AMRBlock =
typename
Config::AMRBlock
;
43
using
BlockCoord
=
shamrock::amr::AMRBlockCoord<TgridVec, 3>
;
44
using
OrientedAMRGraph = OrientedAMRGraph<Tvec, TgridVec>;
45
46
ShamrockCtx
&context;
47
Config
&solver_config;
48
Storage
&storage;
49
50
AMRGridRefinementHandler
(
ShamrockCtx
&context,
Config
&solver_config,
Storage
&storage)
51
: context(context), solver_config(solver_config), storage(storage) {}
52
53
void
update_refinement();
54
55
private
:
70
template
<
class
UserAcc,
class
... T>
71
void
gen_refine_block_changes(
72
shambase::DistributedData
<
sham::DeviceBuffer<u32>
> &refine_list,
73
shambase::DistributedData
<
sham::DeviceBuffer<u32>
> &derefine_list,
74
T &&...args);
75
76
template
<
class
UserAcc>
77
bool
internal_refine_grid(
shambase::DistributedData
<
sham::DeviceBuffer<u32>
> &&refine_list);
78
79
template
<
class
UserAcc>
80
bool
internal_derefine_grid(
81
shambase::DistributedData
<
sham::DeviceBuffer<u32>
> &&derefine_list);
82
83
template
<
class
UserAccCrit,
class
UserAccSplit,
class
UserAccMerge>
84
void
internal_update_refinement();
85
86
inline
PatchScheduler
&scheduler() {
return
shambase::get_check_ref
(context.sched); }
87
};
88
89
}
// namespace shammodels::basegodunov::modules
AMRCell.hpp
NeighGraph.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
PatchScheduler
The MPI scheduler.
Definition
PatchScheduler.hpp:85
ShamrockCtx
Definition
ShamrockCtx.hpp:42
sham::DeviceBuffer
A buffer allocated in USM (Unified Shared Memory)
Definition
DeviceBuffer.hpp:106
shambase::DistributedData
Represents a collection of objects distributed across patches identified by a u64 id.
Definition
DistributedData.hpp:43
shammodels::basegodunov::SolverStorage
Definition
SolverStorage.hpp:60
shammodels::basegodunov::modules::AMRGridRefinementHandler
Definition
AMRGridRefinementHandler.hpp:28
shamrock::amr::AMRBlockCoord
Definition
AMRCell.hpp:26
shambase::throw_with_loc
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
Definition
exception.hpp:132
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::modules
namespace for the basegodunov model modules
Definition
AMRCellInfos.hpp:20
Solver.hpp
SolverStorage.hpp
sham::VectorProperties
Definition
vec.hpp:25
shammodels::amr::AMRBlock
utility class to handle AMR blocks
Definition
AMRBlock.hpp:35
shammodels::basegodunov::SolverConfig
Definition
SolverConfig.hpp:145
vec.hpp
Generated on Wed May 13 2026 13:21:49 for Shamrock by
1.9.8