Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ComputeJ.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
21#include "shambackends/vec.hpp"
25
27
28 template<class Tvec, template<class> class SPHKernel>
29 class NodeComputeJ : public shamrock::solvergraph::INode {
30
31 using Tscal = shambase::VecComponent<Tvec>;
32
33 Tscal part_mass;
34 Tscal mu_0;
35
36 public:
37 NodeComputeJ(Tscal part_mass, Tscal mu_0) : part_mass(part_mass), mu_0(mu_0) {}
38
48
49 inline void set_edges(
50 std::shared_ptr<shamrock::solvergraph::Indexes<u32>> part_counts,
51 std::shared_ptr<shammodels::sph::solvergraph::NeighCache> neigh_cache,
52 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tvec>> xyz,
53 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> hpart,
54 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tscal>> omega,
55 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tvec>> B_on_rho,
56 std::shared_ptr<shamrock::solvergraph::IFieldSpan<Tvec>> J) {
57 __internal_set_ro_edges({part_counts, neigh_cache, xyz, hpart, omega, B_on_rho});
59 }
60
61 inline Edges get_edges() {
62 return Edges{
70 };
71 }
72
74
75 inline virtual std::string _impl_get_label() const { return "ComputeJ"; };
76
77 virtual std::string _impl_get_tex() const;
78 };
79
80} // namespace shammodels::sph::modules
virtual std::string _impl_get_tex() const
get the tex of the node
Definition ComputeJ.cpp:106
virtual std::string _impl_get_label() const
get the label of the node
Definition ComputeJ.hpp:75
void _impl_evaluate_internal()
evaluate the node
Definition ComputeJ.cpp:28
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:31
T & get_rw_edge(int slot)
Get a read write edge and cast it to the type T.
Definition INode.hpp:97
void __internal_set_rw_edges(std::vector< std::shared_ptr< IEdge > > new_rw_edges)
Set the read write edges.
Definition INode.hpp:249
void __internal_set_ro_edges(std::vector< std::shared_ptr< IEdge > > new_ro_edges)
Set the read only edges.
Definition INode.hpp:238
const T & get_ro_edge(int slot)
Get a read only edge and cast it to the type T.
Definition INode.hpp:91
namespace for the sph model modules