27#define NODE_EDGES(X_RO, X_RW) \
29 X_RO(shamrock::solvergraph::Indexes<u32>, part_counts) \
32 X_RO(shamrock::solvergraph::IFieldSpan<Tscal>, hpart) \
33 X_RO(shamrock::solvergraph::IFieldSpan<Tscal>, cs) \
35 X_RW(shamrock::solvergraph::IFieldSpan<Tscal>, t_j)
42 using Tscal = shambase::VecComponent<Tvec>;
47 BallabioTsLimiter(
u32 ndust) : ndust(ndust) {}
49 EXPAND_NODE_EDGES(NODE_EDGES)
55 auto edges = get_edges();
57 auto &part_counts = edges.part_counts.indexes;
59 edges.t_j.ensure_sizes(part_counts);
61 auto &q = shamsys::instance::get_compute_scheduler().get_queue();
63 part_counts.for_each([&](
u64 id,
u32 count) {
66 sham::MultiRef{edges.hpart.get_spans().get(
id), edges.cs.get_spans().get(
id)},
71 const Tscal *__restrict hpart,
72 const Tscal *__restrict cs,
73 Tscal *__restrict t_j) {
74 u32 id_a = thread_id / ndust;
76 Tscal h_a = hpart[id_a];
77 Tscal cs_a = cs[id_a];
79 t_j[thread_id] = sycl::min(t_j[thread_id], h_a / cs_a);
84 inline virtual std::string
_impl_get_label()
const {
return "BallabioTsLimiter"; };
93 std::string tex = R
"tex(
97 {t_j}_{i,j} &= \min\left({t_j}_{i,j}, \frac{{hpart}_i}{{cs}_i}\right) \\
98 i &\in [0,{part_counts}) \\
Header file describing a Node Instance.
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
void _impl_evaluate_internal()
evaluate the node
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
Inode is node between data edges, takes multiple inputs, multiple outputs.
IEdge & get_rw_edge_base(int slot)
Get a reference to a read write edge and cast it to the type IEdge.
const IEdge & get_ro_edge_base(int slot)
Get a reference to a read only edge.
void kernel_call(sham::DeviceQueue &q, RefIn in, RefOut in_out, u32 n, Functor &&func, SourceLocation &&callsite=SourceLocation{})
Submit a kernel to a SYCL queue.
void replace_all(std::string &inout, std::string_view what, std::string_view with)
replace all occurence of a search string with another
namespace for the sph model modules
#define __shamrock_stack_entry()
Macro to create a stack entry.
A class that references multiple buffers or similar objects.