Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Public Member Functions | List of all members
shamrock::solvergraph::NodeSetEdge< Tedge > Class Template Reference

A node that applies a custom function to modify connected edges. More...

#include <shamrock/include/shamrock/solvergraph/NodeSetEdge.hpp>

+ Inheritance diagram for shamrock::solvergraph::NodeSetEdge< Tedge >:
+ Collaboration diagram for shamrock::solvergraph::NodeSetEdge< Tedge >:

Public Member Functions

 NodeSetEdge (std::function< void(Tedge &)> set_edge)
 Construct a new NodeSetEdge object.
 
void set_edges (std::shared_ptr< IEdge > to_set)
 Set the edges of the node.
 
void _impl_evaluate_internal ()
 Evaluate the node.
 
virtual std::string _impl_get_label () const
 Get the label of the node.
 
virtual std::string _impl_get_tex () const
 Get the TeX representation of the node.
 
- Public Member Functions inherited from shamrock::solvergraph::INode
 INode (const INode &)=delete
 
INodeoperator= (const INode &)=delete
 would violate shared_from_this() & unique UUID
 
 INode (INode &&) noexcept=default
 would violate shared_from_this() & unique UUID
 
INodeoperator= (INode &&) noexcept=default
 Move assignment - automatically delegates to base classes and members.
 
std::shared_ptr< INodegetptr_shared ()
 Get a shared pointer to this node.
 
std::weak_ptr< INodegetptr_weak ()
 Get a weak pointer to this node.
 
std::vector< std::shared_ptr< IEdge > > & get_ro_edges ()
 Get the read only edges.
 
std::vector< std::shared_ptr< IEdge > > & get_rw_edges ()
 Get the read write edges.
 
void __internal_set_ro_edges (std::vector< std::shared_ptr< IEdge > > new_ro_edges)
 Set the read only edges.
 
void __internal_set_rw_edges (std::vector< std::shared_ptr< IEdge > > new_rw_edges)
 Set the read write edges.
 
template<class Func >
void on_edge_ro_edges (Func &&f)
 Apply a function to the read only edges.
 
template<class Func >
void on_edge_rw_edges (Func &&f)
 Apply a function to the read write edges.
 
virtual ~INode ()
 Destructor (virtual) & reset the edges.
 
template<class T >
const T & get_ro_edge (int slot)
 Get a read only edge and cast it to the type T.
 
template<class T >
T & get_rw_edge (int slot)
 Get a read write edge and cast it to the type T.
 
const IEdgeget_ro_edge_base (int slot)
 Get a reference to a read only edge.
 
const IEdgeget_ro_edge_base (int slot) const
 
IEdgeget_rw_edge_base (int slot)
 Get a reference to a read write edge and cast it to the type IEdge.
 
const IEdgeget_rw_edge_base (int slot) const
 
void evaluate ()
 Evaluate the node.
 
std::string get_dot_graph ()
 Get the dot graph of the node (Currently only an alias to get_dot_graph_partial)
 
std::string get_dot_graph_partial ()
 Get the dot graph of the subgraph corresponding to the node.
 
std::string get_dot_graph_node_start ()
 Get the id of the node start in the dot graph.
 
std::string get_dot_graph_node_end ()
 Get the id of the node end in the dot graph.
 
std::string get_tex ()
 Get the TeX of the node.
 
std::string get_tex_partial ()
 Get the TeX of the node partial.
 
virtual std::string print_node_info () const
 print the node info
 
- Public Member Functions inherited from shambase::WithUUID< INode, u64 >
u64 get_uuid () const
 Get the uuid of the class.
 
 WithUUID ()
 Constructor of the class.
 

Additional Inherited Members

- Protected Member Functions inherited from shamrock::solvergraph::INode
virtual std::string _impl_get_dot_graph_partial () const
 get the dot graph of the node partial
 
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
 
- Protected Attributes inherited from shambase::WithUUID< INode, u64 >
u64 uuid
 The unique identifier of the class.
 

Detailed Description

template<class Tedge>
class shamrock::solvergraph::NodeSetEdge< Tedge >

A node that applies a custom function to modify connected edges.

This node executes a user-defined function on a connected edge, allowing for custom modifications or operations on the edge data. The function is applied during node evaluation.

Template Parameters
TedgeThe type of the edge that this node operates on
// Example: Create a node that sets values in an edge
auto setter_function = [](MyEdgeType& edge) {
edge.set_value(42);
};
auto set_node = std::make_shared<NodeSetEdge<MyEdgeType>>(setter_function);
set_node->set_edges(my_edge);

Definition at line 45 of file NodeSetEdge.hpp.

Constructor & Destructor Documentation

◆ NodeSetEdge()

template<class Tedge >
shamrock::solvergraph::NodeSetEdge< Tedge >::NodeSetEdge ( std::function< void(Tedge &)>  set_edge)
inline

Construct a new NodeSetEdge object.

Parameters
set_edgeThe function to apply to the connected edge during evaluation

Definition at line 55 of file NodeSetEdge.hpp.

Member Function Documentation

◆ _impl_evaluate_internal()

template<class Tedge >
void shamrock::solvergraph::NodeSetEdge< Tedge >::_impl_evaluate_internal ( )
inlinevirtual

Evaluate the node.

Applies the custom function to the connected read-write edge. This is where the actual modification of the edge takes place.

Implements shamrock::solvergraph::INode.

Definition at line 77 of file NodeSetEdge.hpp.

◆ _impl_get_label()

template<class Tedge >
virtual std::string shamrock::solvergraph::NodeSetEdge< Tedge >::_impl_get_label ( ) const
inlinevirtual

Get the label of the node.

Returns
std::string The node label "SetEdge"

Implements shamrock::solvergraph::INode.

Definition at line 87 of file NodeSetEdge.hpp.

◆ _impl_get_tex()

template<class Tedge >
virtual std::string shamrock::solvergraph::NodeSetEdge< Tedge >::_impl_get_tex ( ) const
inlinevirtual

Get the TeX representation of the node.

Returns
std::string A TeX string describing the node operation

Implements shamrock::solvergraph::INode.

Definition at line 94 of file NodeSetEdge.hpp.

+ Here is the call graph for this function:

◆ set_edges()

template<class Tedge >
void shamrock::solvergraph::NodeSetEdge< Tedge >::set_edges ( std::shared_ptr< IEdge to_set)
inline

Set the edges of the node.

Configures the edge that will be modified by this node. The edge is set as a read-write edge, allowing the custom function to modify its contents during evaluation.

Parameters
to_setThe edge to be modified by the custom function

Definition at line 66 of file NodeSetEdge.hpp.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: