Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ComputeOmega.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
20#include "shambackends/vec.hpp"
24
26
27 template<class Tvec, template<class> class SPHKernel>
29
30 using Tscal = shambase::VecComponent<Tvec>;
31
32 static constexpr Tscal kernel_radius = SPHKernel<Tscal>::Rkern;
33 Tscal part_mass;
34
35 public:
36 NodeComputeOmega(Tscal part_mass) : part_mass(part_mass) {}
37
45
46 inline void set_edges(
47 std::shared_ptr<shamrock::solvergraph::Indexes<u32>> part_counts,
48 std::shared_ptr<shammodels::sph::solvergraph::NeighCache> neigh_cache,
49 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tvec>> xyz,
50 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> hpart,
51 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> omega) {
52 __internal_set_ro_edges({part_counts, neigh_cache, xyz, hpart});
54 }
55
56 inline Edges get_edges() {
57 return Edges{
58 get_ro_edge<shamrock::solvergraph::Indexes<u32>>(0),
59 get_ro_edge<shammodels::sph::solvergraph::NeighCache>(1),
60 get_ro_edge<shamrock::solvergraph::IFieldSpan<Tvec>>(2),
62 get_rw_edge<shamrock::solvergraph::IFieldSpan<Tscal>>(0),
63 };
64 }
65
67
68 inline virtual std::string _impl_get_label() const { return "ComputeOmega"; };
69
70 virtual std::string _impl_get_tex() const;
71 };
72
73 template<class T>
75
76 T val_to_set;
77
78 public:
79 SetWhenMask(T val_to_set) : val_to_set(val_to_set) {}
80
86
87 inline void set_edges(
88 std::shared_ptr<shamrock::solvergraph::Indexes<u32>> part_counts,
89 std::shared_ptr<shamrock::solvergraph::IFieldSpan<u32>> mask,
90 std::shared_ptr<shamrock::solvergraph::IFieldSpan<T>> field_to_set) {
91 __internal_set_ro_edges({part_counts, mask});
92 __internal_set_rw_edges({field_to_set});
93 }
94
95 inline Edges get_edges() {
96 return Edges{
97 get_ro_edge<shamrock::solvergraph::Indexes<u32>>(0),
99 get_rw_edge<shamrock::solvergraph::IFieldSpan<T>>(0),
100 };
101 }
102
104
105 inline virtual std::string _impl_get_label() const { return "SetWhenMask"; };
106
107 virtual std::string _impl_get_tex() const;
108 };
109
110} // namespace shammodels::sph::modules
virtual std::string _impl_get_tex() const
get the tex of the node
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_label() const
get the label of the node
void _impl_evaluate_internal()
evaluate the node
virtual std::string _impl_get_tex() const
get the tex 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
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
namespace for the sph model modules