Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
OperationIf.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
22
23#define NODE_EDGES(X_RO, X_RW) X_RO(shamrock::solvergraph::IDataEdge<bool>, condition)
24
25namespace shamrock::solvergraph {
26
34 class OperationIf : public INode {
35 std::shared_ptr<INode> then_node;
36 std::shared_ptr<INode> else_node;
37 std::string name;
38
39 public:
46 std::string name,
47 std::shared_ptr<INode> then_node = {},
48 std::shared_ptr<INode> else_node = {})
49 : then_node(std::move(then_node)), else_node(std::move(else_node)),
50 name(std::move(name)) {}
51
52 EXPAND_NODE_EDGES(NODE_EDGES)
53
55
56 inline std::string _impl_get_label() const { return name; }
57
58 std::string _impl_get_dot_graph_partial() const;
59
60 inline virtual std::string _impl_get_dot_graph_node_start() const {
61 return sham::format("n_{}", get_uuid());
62 }
63 inline virtual std::string _impl_get_dot_graph_node_end() const {
64 return sham::format("n_{}_end", get_uuid());
65 }
66
67 std::string _impl_get_tex() const;
68 };
69
70} // namespace shamrock::solvergraph
71
72#undef NODE_EDGES
u64 get_uuid() const
Get the UUID of the node.
Definition INode.hpp:55
std::string _impl_get_dot_graph_partial() const
get the dot graph of the node partial
std::string _impl_get_label() const
get the label of the node
void _impl_evaluate_internal()
evaluate the node
virtual std::string _impl_get_dot_graph_node_start() const
get the dot graph of the node start
virtual std::string _impl_get_dot_graph_node_end() const
get the dot graph of the node end
OperationIf(std::string name, std::shared_ptr< INode > then_node={}, std::shared_ptr< INode > else_node={})
std::string _impl_get_tex() const
get the tex of the node