Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
AddForceCentralGravPotential.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
19#include "shambackends/vec.hpp"
24
25namespace shammodels::common::modules {
26
27 template<class Tvec>
29
30 using Tscal = shambase::VecComponent<Tvec>;
31
32 public:
34
43
44 inline void set_edges(
45 std::shared_ptr<shamrock::solvergraph::IDataEdge<Tscal>> constant_G,
46 std::shared_ptr<shamrock::solvergraph::IDataEdge<Tscal>> central_mass,
47 std::shared_ptr<shamrock::solvergraph::IDataEdge<Tvec>> central_pos,
48 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tvec>> spans_positions,
49 std::shared_ptr<shamrock::solvergraph::Indexes<u32>> sizes,
50 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tvec>> spans_accel_ext) {
52 {constant_G, central_mass, central_pos, spans_positions, sizes});
53 __internal_set_rw_edges({spans_accel_ext});
54 }
55
56 inline Edges get_edges() {
57 return Edges{
58 get_ro_edge<shamrock::solvergraph::IDataEdge<Tscal>>(0),
60 get_ro_edge<shamrock::solvergraph::IDataEdge<Tvec>>(2),
62 get_ro_edge<shamrock::solvergraph::Indexes<u32>>(4),
64 }
65
67
68 inline virtual std::string _impl_get_label() const {
69 return "AddForceCentralGravPotential";
70 };
71
72 virtual std::string _impl_get_tex() const;
73 };
74
75} // namespace shammodels::common::modules
virtual std::string _impl_get_tex() const
get the tex of the node
virtual std::string _impl_get_label() const
get the label of the node
Interface for a solver graph edge representing a field as spans.
Inode is node between data edges, takes multiple inputs, multiple outputs.
Definition INode.hpp:30
T & get_rw_edge(int slot)
Get a read write edge and cast it to the type T.
Definition INode.hpp:86
void __internal_set_rw_edges(std::vector< std::shared_ptr< IEdge > > new_rw_edges)
Set the read write edges.
Definition INode.hpp:181
void __internal_set_ro_edges(std::vector< std::shared_ptr< IEdge > > new_ro_edges)
Set the read only edges.
Definition INode.hpp:171
const T & get_ro_edge(int slot)
Get a read only edge and cast it to the type T.
Definition INode.hpp:80