Oakfield API Documentation 1.0.0
Numerical core APIs
Loading...
Searching...
No Matches
copy.h File Reference

Utility operator that copies one field into another compatible field. More...

#include "oakfield/operator_split.h"
#include <stdbool.h>
#include <stddef.h>
Include dependency graph for copy.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SimCopyOperatorConfig
 Configuration for copying one compatible field into another. More...
 

Typedefs

typedef struct SimCopyOperatorConfig SimCopyOperatorConfig
 Configuration for copying one compatible field into another.
 

Functions

SimResult sim_add_copy_operator (struct SimContext *context, const SimCopyOperatorConfig *config, size_t *out_index)
 Register a field copy utility operator.
 
SimResult sim_copy_config (struct SimContext *context, size_t operator_index, SimCopyOperatorConfig *out_config)
 Copy the current configuration from a registered copy operator.
 
SimResult sim_copy_update (struct SimContext *context, size_t operator_index, const SimCopyOperatorConfig *config)
 Replace the configuration of a registered copy operator.
 

Detailed Description

Utility operator that copies one field into another compatible field.

The copy operator supports real double, complex double, and exact-integer fields. Exact integers are copied byte-for-byte and do not support accumulation or dt scaling.

Function Documentation

◆ sim_add_copy_operator()

SimResult sim_add_copy_operator ( struct SimContext context,
const SimCopyOperatorConfig config,
size_t *  out_index 
)

Register a field copy utility operator.

The implementation copies and normalizes config, resolves the default scale-by-dt policy, and validates that source and destination fields have the same element count, element size, and scalar domain.

Parameters
contextSimulation context that will own the operator.
configOptional copy configuration; NULL selects zero-initialized defaults.
[out]out_indexOptional destination for the registered operator index.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL context or invalid fields, SIM_RESULT_TYPE_MISMATCH for incompatible domains, SIM_RESULT_OUT_OF_MEMORY on allocation failure, or a registration error.

◆ sim_copy_config()

SimResult sim_copy_config ( struct SimContext context,
size_t  operator_index,
SimCopyOperatorConfig out_config 
)

Copy the current configuration from a registered copy operator.

Parameters
contextSimulation context containing the operator.
operator_indexIndex returned by sim_add_copy_operator().
[out]out_configReceives the operator's normalized configuration.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL pointers, SIM_RESULT_NOT_FOUND for a missing operator, or SIM_RESULT_INVALID_STATE when the operator has no copy state.

◆ sim_copy_update()

SimResult sim_copy_update ( struct SimContext context,
size_t  operator_index,
const SimCopyOperatorConfig config 
)

Replace the configuration of a registered copy operator.

config is required. The replacement is normalized and the referenced fields are validated before it is stored.

Parameters
contextSimulation context containing the operator.
operator_indexIndex of the copy operator to update.
configReplacement copy configuration.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL inputs or invalid fields, SIM_RESULT_NOT_FOUND for a missing operator, SIM_RESULT_INVALID_STATE for missing state, or SIM_RESULT_TYPE_MISMATCH for incompatible field domains.