Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
AddForceShearingBoxInertialPart.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
25
26#define NODE_EDGES(X_RO, X_RW) \
27 /* ------------------- inputs ------------------- */ \
28 X_RO(shamrock::solvergraph::IDataEdge<Tscal>, eta) \
29 X_RO(shamrock::solvergraph::IFieldSpan<Tvec>, spans_positions) \
30 X_RO(shamrock::solvergraph::Indexes<u32>, sizes) \
31 \
32 /* ------------------- outputs ------------------- */ \
33 X_RW(shamrock::solvergraph::IFieldSpan<Tvec>, spans_accel_ext)
34
35namespace shammodels::common::modules {
36 template<class Tvec>
37 class AddForceShearingBoxInertialPart : public shamrock::solvergraph::INode {
38
39 using Tscal = shambase::VecComponent<Tvec>;
40
41 public:
42 AddForceShearingBoxInertialPart() = default;
43
44 EXPAND_NODE_EDGES(NODE_EDGES)
45
47
49
50 auto edges = get_edges();
51
52 edges.spans_positions.check_sizes(edges.sizes.indexes);
53 edges.spans_accel_ext.ensure_sizes(edges.sizes.indexes);
54
55 Tscal eta = edges.eta.data;
56
58 shamsys::instance::get_compute_scheduler_ptr(),
59 sham::DDMultiRef{edges.spans_positions.get_spans()},
60 sham::DDMultiRef{edges.spans_accel_ext.get_spans()},
61 edges.sizes.indexes,
62 [two_eta = 2 * eta](u32 gid, const Tvec *xyz, Tvec *axyz_ext) {
63 Tvec r_a = xyz[gid];
64 axyz_ext[gid] += Tvec{r_a.x() * two_eta, 0, 0};
65 });
66 }
67
68 inline virtual std::string _impl_get_label() const {
69 return "AddForceShearingBoxInertialPart";
70 }
71
72 inline virtual std::string _impl_get_tex() const { return "TODO"; }
73 };
74} // namespace shammodels::common::modules
75
76#undef NODE_EDGES
Header file describing a Node Instance.
std::uint32_t u32
32 bit unsigned integer
virtual std::string _impl_get_label() const
get the label of the node
Inode is node between data edges, takes multiple inputs, multiple outputs.
Definition INode.hpp:30
void distributed_data_kernel_call(sham::DeviceScheduler_ptr dev_sched, RefIn in, RefOut in_out, const shambase::DistributedData< index_t > &thread_counts, Functor &&func)
A variant of sham::kernel_call for distributed data.
#define __shamrock_stack_entry()
Macro to create a stack entry.
A variant of sham::MultiRef for distributed data.