Shamrock
2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shammodels
sph
src
modules
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
17
#include "
shammodels/sph/modules/KillParticles.hpp
"
18
19
namespace
shammodels::sph::modules
{
20
21
void
KillParticles::_impl_evaluate_internal
() {
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
KillParticles.hpp
Declares the KillParticles module for removing particles.
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
shammodels::sph::modules::KillParticles::_impl_get_tex
virtual std::string _impl_get_tex() const
get the tex of the node
Definition
KillParticles.cpp:37
shammodels::sph::modules::KillParticles::_impl_evaluate_internal
void _impl_evaluate_internal()
evaluate the node
Definition
KillParticles.cpp:21
shamrock::patch::PatchDataLayer
PatchDataLayer container class, the layout is described in patchdata_layout.
Definition
PatchDataLayer.hpp:35
shamrock::patch::PatchDataLayer::remove_ids
void remove_ids(const sham::DeviceBuffer< u32 > &indexes, u32 len)
remove some particles ids
Definition
PatchDataLayer.cpp:214
shamrock::solvergraph::INode::get_rw_edge_base
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
shamrock::solvergraph::INode::get_ro_edge_base
const IEdge & get_ro_edge_base(int slot)
Get a reference to a read only edge.
Definition
INode.hpp:91
shambase::replace_all
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
shammodels::sph::modules
namespace for the sph model modules
Definition
AnalysisAngularMomentum.hpp:28
shambase::details::BasicStackEntry
Definition
stacktrace.hpp:106
Generated on Wed May 13 2026 13:21:49 for Shamrock by
1.9.8