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
18
20#include "shambase/string.hpp"
23#include <functional>
24
25namespace shamrock::solvergraph {
26
45 template<class Tedge>
46 class NodeSetEdge : public INode {
47
48 std::function<void(Tedge &)> set_edge;
49
50 public:
56 NodeSetEdge(std::function<void(Tedge &)> set_edge) : set_edge(std::move(set_edge)) {}
57
67 inline void set_edges(std::shared_ptr<IEdge> to_set) {
70 }
71
80 set_edge(get_rw_edge<Tedge>(0));
81 }
82
88 inline virtual std::string _impl_get_label() const { return "SetEdge"; };
89
95 inline virtual std::string _impl_get_tex() const {
96
97 auto to_set = get_rw_edge_base(0).get_tex_symbol();
98
99 std::string tex = R"tex(
100 Set edge ${to_set}$
101 )tex";
102
103 shambase::replace_all(tex, "{to_set}", to_set);
104
105 return tex;
106 }
107 };
108
109} // namespace shamrock::solvergraph
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
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:147
void __internal_set_ro_edges(std::vector< std::shared_ptr< IEdge > > new_ro_edges)
Set the read only edges.
Definition INode.hpp:238
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:106
This file contains the definition for the stacktrace related functionality.
#define __shamrock_stack_entry()
Macro to create a stack entry.