Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ComputeLuminosity.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
21#include "shambackends/vec.hpp"
25
27
28 template<class Tvec, template<class> class SPHKernel>
30
31 using Tscal = shambase::VecComponent<Tvec>;
32
33 Tscal part_mass;
34 Tscal alpha_u;
35
36 public:
37 NodeComputeLuminosity(Tscal part_mass, Tscal alpha_u)
38 : part_mass(part_mass), alpha_u(alpha_u) {}
39
50
51 inline void set_edges(
52 std::shared_ptr<shamrock::solvergraph::Indexes<u32>> part_counts,
53 std::shared_ptr<shammodels::sph::solvergraph::NeighCache> neigh_cache,
54 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tvec>> xyz,
55 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> hpart,
56 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> omega,
58 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> pressure,
59 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> luminosity) {
60 __internal_set_ro_edges({part_counts, neigh_cache, xyz, hpart, omega, u, pressure});
61 __internal_set_rw_edges({luminosity});
62 }
63
64 inline Edges get_edges() {
65 return Edges{
66 get_ro_edge<shamrock::solvergraph::Indexes<u32>>(0),
67 get_ro_edge<shammodels::sph::solvergraph::NeighCache>(1),
68 get_ro_edge<shamrock::solvergraph::IFieldSpan<Tvec>>(2),
70 get_ro_edge<shamrock::solvergraph::IFieldSpan<Tscal>>(4),
72 get_ro_edge<shamrock::solvergraph::IFieldSpan<Tscal>>(6),
74 }
75
77
78 inline virtual std::string _impl_get_label() const { return "ComputeLuminosity"; };
79
80 virtual std::string _impl_get_tex() const;
81 };
82
83} // namespace shammodels::sph::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
namespace for the sph model modules