Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
NodeSetEdge.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
22#include <functional>
23
24namespace shamrock::solvergraph {
25
44 template<class Tedge>
45 class NodeSetEdge : public INode {
46
47 std::function<void(Tedge &)> set_edge;
48
49 public:
55 NodeSetEdge(std::function<void(Tedge &)> set_edge) : set_edge(std::move(set_edge)) {}
56
66 inline void set_edges(std::shared_ptr<IEdge> to_set) {
69 }
70
79 set_edge(get_rw_edge<Tedge>(0));
80 }
81
87 inline virtual std::string _impl_get_label() const { return "SetEdge"; };
88
94 inline virtual std::string _impl_get_tex() const {
95
96 auto to_set = get_rw_edge_base(0).get_tex_symbol();
97
98 std::string tex = R"tex(
99 Set edge ${to_set}$
100 )tex";
101
102 shambase::replace_all(tex, "{to_set}", to_set);
103
104 return tex;
105 }
106 };
107
108} // namespace shamrock::solvergraph
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
IEdge & get_rw_edge_base(int slot)
Get a reference to a read write edge and cast it to the type IEdge.
Definition INode.hpp:100
void __internal_set_ro_edges(std::vector< std::shared_ptr< IEdge > > new_ro_edges)
Set the read only edges.
Definition INode.hpp:171
A node that applies a custom function to modify connected edges.
virtual std::string _impl_get_label() const
Get the label of the node.
void set_edges(std::shared_ptr< IEdge > to_set)
Set the edges of the node.
virtual std::string _impl_get_tex() const
Get the TeX representation of the node.
void _impl_evaluate_internal()
Evaluate the node.
NodeSetEdge(std::function< void(Tedge &)> set_edge)
Construct a new NodeSetEdge object.
void replace_all(std::string &inout, std::string_view what, std::string_view with)
replace all occurence of a search string with another
Definition string.hpp:183
STL namespace.
This file contains the definition for the stacktrace related functionality.
#define __shamrock_stack_entry()
Macro to create a stack entry.