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

A solver graph node that copies field data from source field references to target fields. More...

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

+ Inheritance diagram for shamrock::solvergraph::CopyPatchDataField< T >:
+ Collaboration diagram for shamrock::solvergraph::CopyPatchDataField< T >:

Classes

struct  Edges
 Structure containing references to the node's input and output edges. More...
 

Public Member Functions

 CopyPatchDataField ()
 Default constructor.
 
void set_edges (std::shared_ptr< IFieldRefs< T > > original, std::shared_ptr< Field< T > > target)
 Sets the input and output edges for the copy operation.
 
Edges get_edges ()
 Retrieves the current edges of the node.
 
void _impl_evaluate_internal ()
 Internal implementation of the field copying operation.
 
std::string _impl_get_label () const
 Returns the human-readable label for this node.
 
std::string _impl_get_tex () const
 Returns the LaTeX representation of this node for documentation.
 
- 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 T>
class shamrock::solvergraph::CopyPatchDataField< T >

A solver graph node that copies field data from source field references to target fields.

This node performs a deep copy of field data from a source IFieldRefs container to a target Field. It handles distributed field data across multiple patches, ensuring that the target field is properly sized and populated with data from the source.

Template Parameters
TThe primitive type of the field data (e.g., f32, f64, u32, u64, f64_3)
// Create source and target field references
auto source_refs = FieldRefs<f32>::make_shared("source", "src");
auto target_field = std::make_shared<Field<f32>>(1, "target", "tgt");
// Create and configure the copy node
auto copy_node = std::make_shared<CopyPatchDataField<f32>>();
copy_node->set_edges(source_refs, target_field);
// Execute the copy operation
copy_node->evaluate();

The node will:

Author
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

Definition at line 58 of file CopyPatchDataField.hpp.

Constructor & Destructor Documentation

◆ CopyPatchDataField()

template<class T >
shamrock::solvergraph::CopyPatchDataField< T >::CopyPatchDataField ( )
inline

Default constructor.

Definition at line 62 of file CopyPatchDataField.hpp.

Member Function Documentation

◆ _impl_evaluate_internal()

template<class T >
void shamrock::solvergraph::CopyPatchDataField< T >::_impl_evaluate_internal ( )
virtual

Internal implementation of the field copying operation.

This method performs the actual copy operation by:

  1. Collecting size information from the source fields
  2. Ensuring the target field has the correct size for each patch
  3. Copying the field data from source to target using overwrite operations

Implements shamrock::solvergraph::INode.

Definition at line 23 of file CopyPatchDataField.cpp.

+ Here is the call graph for this function:

◆ _impl_get_label()

template<class T >
std::string shamrock::solvergraph::CopyPatchDataField< T >::_impl_get_label ( ) const
inlinevirtual

Returns the human-readable label for this node.

Returns
String identifier "CopyPatchDataField"

Implements shamrock::solvergraph::INode.

Definition at line 103 of file CopyPatchDataField.hpp.

◆ _impl_get_tex()

template<class T >
std::string shamrock::solvergraph::CopyPatchDataField< T >::_impl_get_tex ( ) const
virtual

Returns the LaTeX representation of this node for documentation.

Returns
LaTeX string describing the copy operation with field symbols

Implements shamrock::solvergraph::INode.

Definition at line 53 of file CopyPatchDataField.cpp.

+ Here is the call graph for this function:

◆ get_edges()

template<class T >
Edges shamrock::solvergraph::CopyPatchDataField< T >::get_edges ( )
inline

Retrieves the current edges of the node.

Returns
Edges structure containing references to original and target fields

Definition at line 86 of file CopyPatchDataField.hpp.

+ Here is the call graph for this function:

◆ set_edges()

template<class T >
void shamrock::solvergraph::CopyPatchDataField< T >::set_edges ( std::shared_ptr< IFieldRefs< T > >  original,
std::shared_ptr< Field< T > >  target 
)
inline

Sets the input and output edges for the copy operation.

Parameters
originalShared pointer to the source field references (read-only)
targetShared pointer to the target field (read-write)

Definition at line 76 of file CopyPatchDataField.hpp.

+ Here is the call graph for this function:

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