Shamrock
2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shammodels
sph
include
shammodels
sph
modules
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
19
#include "
shambackends/DeviceBuffer.hpp
"
20
#include "
shambackends/vec.hpp
"
21
#include "
shamrock/solvergraph/Field.hpp
"
22
#include "
shamrock/solvergraph/IFieldSpan.hpp
"
23
#include "
shamrock/solvergraph/Indexes.hpp
"
24
#include "
shamsolvergraph/IFreeable.hpp
"
25
#include "
shamsolvergraph/edge/IDataEdge.hpp
"
26
#include "
shamsolvergraph/node/INode.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
43
namespace
shammodels::sph::modules
{
44
45
template
<
class
Tvec>
46
class
SinkParticlesFlagAccreteHard :
public
shamrock::solvergraph::INode
,
47
public
shamrock::solvergraph::IFreeable
{
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
59
void
_impl_evaluate_internal
();
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
DeviceBuffer.hpp
Field.hpp
IDataEdge.hpp
IFieldSpan.hpp
IFreeable.hpp
INode.hpp
Indexes.hpp
shammodels::sph::modules::SinkParticlesFlagAccreteHard::_impl_get_label
virtual std::string _impl_get_label() const
get the label of the node
Definition
SinkParticlesFlagAccreteHard.hpp:66
shammodels::sph::modules::SinkParticlesFlagAccreteHard::free_alloc
void free_alloc()
Free allocated memory.
Definition
SinkParticlesFlagAccreteHard.hpp:61
shammodels::sph::modules::SinkParticlesFlagAccreteHard::_impl_get_tex
virtual std::string _impl_get_tex() const
get the tex of the node
Definition
SinkParticlesFlagAccreteHard.cpp:98
shammodels::sph::modules::SinkParticlesFlagAccreteHard::_impl_evaluate_internal
void _impl_evaluate_internal()
evaluate the node
Definition
SinkParticlesFlagAccreteHard.cpp:26
shamrock::solvergraph::IFreeable
Interface for data edges that can free their allocated memory.
Definition
IFreeable.hpp:28
shamrock::solvergraph::INode
Inode is node between data edges, takes multiple inputs, multiple outputs.
Definition
INode.hpp:31
shammodels::sph::modules
namespace for the sph model modules
Definition
AnalysisAngularMomentum.hpp:28
vec.hpp
Generated on
for Shamrock by
1.15.0