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

Utility operator that writes a scaled copy of one field to another field. More...

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

Go to the source code of this file.

Classes

struct  SimScaleOperatorConfig
 Configuration for scaling one compatible field into another. More...
 

Typedefs

typedef struct SimScaleOperatorConfig SimScaleOperatorConfig
 Configuration for scaling one compatible field into another.
 

Functions

SimResult sim_add_scale_operator (struct SimContext *context, const SimScaleOperatorConfig *config, size_t *out_index)
 Register a scale utility operator.
 
SimResult sim_scale_config (struct SimContext *context, size_t operator_index, SimScaleOperatorConfig *out_config)
 Copy the current configuration from a registered scale operator.
 
SimResult sim_scale_update (struct SimContext *context, size_t operator_index, const SimScaleOperatorConfig *config)
 Replace the configuration of a registered scale operator.
 

Detailed Description

Utility operator that writes a scaled copy of one field to another field.

The scale operator supports real double and complex double fields with matching layouts and scalar domains. It can overwrite or accumulate into the destination.

Function Documentation

◆ sim_add_scale_operator()

SimResult sim_add_scale_operator ( struct SimContext context,
const SimScaleOperatorConfig config,
size_t *  out_index 
)

Register a scale utility operator.

The implementation copies and normalizes config, resolves the default scale-by-dt policy, and validates matching real-double or complex-double fields.

Parameters
contextSimulation context that will own the operator.
configOptional scale 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 fields, SIM_RESULT_OUT_OF_MEMORY on allocation failure, or a registration error.

◆ sim_scale_config()

SimResult sim_scale_config ( struct SimContext context,
size_t  operator_index,
SimScaleOperatorConfig out_config 
)

Copy the current configuration from a registered scale operator.

Parameters
contextSimulation context containing the operator.
operator_indexIndex returned by sim_add_scale_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 scale state.

◆ sim_scale_update()

SimResult sim_scale_update ( struct SimContext context,
size_t  operator_index,
const SimScaleOperatorConfig config 
)

Replace the configuration of a registered scale 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 scale operator to update.
configReplacement scale 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.