Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
NodeFreeAlloc.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
22namespace shamrock::solvergraph {
23
30 class NodeFreeAlloc : public INode {
31
32 public:
33 NodeFreeAlloc() {}
34
35#define NODE_FREE_ALLOC_EDGES(X_RO, X_RW) X_RW(shamrock::solvergraph::IEdge, to_free)
36 EXPAND_NODE_EDGES(NODE_FREE_ALLOC_EDGES)
37#undef NODE_FREE_ALLOC_EDGES
38
40 inline void _impl_evaluate_internal() { get_edges().to_free.free_alloc(); }
41
43 inline virtual std::string _impl_get_label() const { return "FreeAlloc"; };
44
46 inline virtual std::string _impl_get_tex() const {
47
48 auto to_free = get_rw_edge_base(0).get_tex_symbol();
49
50 std::string tex = R"tex(
51 Free allocation ${to_free}$
52 )tex";
53
54 shambase::replace_all(tex, "{to_free}", to_free);
55
56 return tex;
57 }
58 };
59
60} // namespace shamrock::solvergraph
Inode is node between data edges, takes multiple inputs, multiple outputs.
Definition INode.hpp:30
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
A node that simply frees the allocation of the connected node.
virtual std::string _impl_get_tex() const
Get the TeX representation of the node.
void _impl_evaluate_internal()
Evaluate the node.
virtual std::string _impl_get_label() const
Get the label of the node.
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