Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
GSPHUtilities.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
25
26namespace shammodels::gsph {
27
37 template<class Tvec, class SPHKernel>
39 public:
40 using Tscal = shambase::VecComponent<Tvec>;
41
42 static constexpr Tscal Rkern = SPHKernel::Rkern;
43
47
48 PatchScheduler &sched;
49
50 GSPHUtilities(PatchScheduler &sched) : sched(sched) {}
51
63 GhostHndl &interf_handle, SerialPatchTree<Tvec> &sptree, Tscal h_evol_max) {
64
65 using namespace shamrock::patch;
66
67 const u32 ihpart = sched.pdl_old().template get_field_idx<Tscal>("hpart");
68
69 PatchField<Tscal> interactR_patch = sched.map_owned_to_patch_field_simple<Tscal>(
70 [&](const Patch p, PatchDataLayer &pdat) -> Tscal {
71 if (!pdat.is_empty()) {
72 return pdat.get_field<Tscal>(ihpart).compute_max() * h_evol_max * Rkern;
73 } else {
75 }
76 });
77
78 PatchtreeField<Tscal> interactR_mpi_tree = sptree.make_patch_tree_field(
79 sched,
80 shamsys::instance::get_compute_queue(),
81 interactR_patch,
82 [](Tscal h0, Tscal h1, Tscal h2, Tscal h3, Tscal h4, Tscal h5, Tscal h6, Tscal h7) {
83 return sham::max_8points(h0, h1, h2, h3, h4, h5, h6, h7);
84 });
85
86 return interf_handle.make_interface_cache(sptree, interactR_mpi_tree, interactR_patch);
87 }
88 };
89
90} // namespace shammodels::gsph
GSPH-specific ghost handler using Newtonian physics field names.
Header file describing a Node Instance.
MPI scheduler.
std::uint32_t u32
32 bit unsigned integer
The MPI scheduler.
Container for objects shared between two distributed data elements.
GSPH-specific utilities for ghost particle handling.
InterfBuildCache build_interf_cache(GhostHndl &interf_handle, SerialPatchTree< Tvec > &sptree, Tscal h_evol_max)
Build interface cache for ghost particle communication.
PatchDataLayer container class, the layout is described in patchdata_layout.
Patch object that contain generic patch information.
Definition Patch.hpp:33