Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
SinkParticlesFlagAccreteHard.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
18
20#include "shambackends/vec.hpp"
27#include <memory>
28#include <vector>
29
30#define NODE_EDGES(X_RO, X_RW) \
31 /* ------------------- (field) inputs ------------------- */ \
32 X_RO(shamrock::solvergraph::Indexes<u32>, part_counts) \
33 X_RO(shamrock::solvergraph::IFieldSpan<Tvec>, positions) \
34 \
35 /* ------------------- (sink) inputs ------------------- */ \
36 X_RO(shamrock::solvergraph::IDataEdge<std::vector<Tvec>>, sink_positions) \
37 X_RO(shamrock::solvergraph::IDataEdge<std::vector<Tscal>>, sink_accr_radii) \
38 \
39 /* ------------------- outputs ------------------- */ \
40 /* sink_accretion_table[id_a] = who should accrete part [id_a] (or u32_max if none); */ \
41 X_RW(shamrock::solvergraph::Field<u32>, sink_accretion_table)
42
44
45 template<class Tvec>
46 class SinkParticlesFlagAccreteHard : public shamrock::solvergraph::INode,
48
49 using Tscal = shambase::VecComponent<Tvec>;
50
51 std::unique_ptr<sham::DeviceBuffer<Tvec>> sink_pos;
52 std::unique_ptr<sham::DeviceBuffer<Tscal>> sink_accr_radii;
53
54 public:
55 SinkParticlesFlagAccreteHard() = default;
56
57 EXPAND_NODE_EDGES(NODE_EDGES)
58
60
61 inline void free_alloc() {
62 sink_pos = {};
63 sink_accr_radii = {};
64 }
65
66 inline virtual std::string _impl_get_label() const {
67 return "SinkParticlesFlagAccreteHard";
68 }
69
70 virtual std::string _impl_get_tex() const;
71 };
72
73} // namespace shammodels::sph::modules
74
75#undef NODE_EDGES
virtual std::string _impl_get_label() const
get the label of the node
virtual std::string _impl_get_tex() const
get the tex of the node
Interface for data edges that can free their allocated memory.
Definition IFreeable.hpp:28
Inode is node between data edges, takes multiple inputs, multiple outputs.
Definition INode.hpp:31
namespace for the sph model modules