Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
KillParticles.cpp
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
18
20
22 StackEntry stack_loc{};
23 auto edges = get_edges();
24
25 edges.part_to_remove.check_allocated(edges.patchdatas.patchdatas.get_ids());
26
27 edges.patchdatas.patchdatas.for_each(
28 [&](u64 id_patch, shamrock::patch::PatchDataLayer &patchdata) {
29 auto &buf = edges.part_to_remove.buffers.get(id_patch);
30 u32 bsize = buf.get_size();
31 if (bsize > 0) {
32 patchdata.remove_ids(buf, bsize);
33 }
34 });
35 }
36
37 std::string KillParticles::_impl_get_tex() const {
38
39 auto part_to_remove = get_ro_edge_base(0).get_tex_symbol();
40 auto patchdatas = get_rw_edge_base(0).get_tex_symbol();
41
42 std::string tex = R"tex(
43 Particle killing:
44
45 Remove particles ${part_to_remove}$ from ${patchdatas}$
46 )tex";
47
48 shambase::replace_all(tex, "{part_to_remove}", part_to_remove);
49 shambase::replace_all(tex, "{patchdatas}", patchdatas);
50
51 return tex;
52 }
53
54} // namespace shammodels::sph::modules
Declares the KillParticles module for removing particles.
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
virtual std::string _impl_get_tex() const
get the tex of the node
void _impl_evaluate_internal()
evaluate the node
PatchDataLayer container class, the layout is described in patchdata_layout.
void remove_ids(const sham::DeviceBuffer< u32 > &indexes, u32 len)
remove some particles ids
IEdge & get_rw_edge_base(int slot)
Get a reference to a read write edge and cast it to the type IEdge.
Definition INode.hpp:100
const IEdge & get_ro_edge_base(int slot)
Get a reference to a read only edge.
Definition INode.hpp:91
void replace_all(std::string &inout, std::string_view what, std::string_view with)
replace all occurence of a search string with another
Definition string.hpp:183
namespace for the sph model modules