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

Utility operator that advances field phase by a rate times the timestep. More...

Include dependency graph for phase_rotate.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PhaseRotateOperatorConfig
 Configuration for applying a uniform phase rotation to a target field. More...
 

Typedefs

typedef struct PhaseRotateOperatorConfig PhaseRotateOperatorConfig
 Configuration for applying a uniform phase rotation to a target field.
 

Functions

SimResult sim_add_phase_rotate_operator (struct SimContext *context, const PhaseRotateOperatorConfig *config, size_t *out_index)
 Register a phase-rotation utility operator.
 
SimResult sim_phase_rotate_config (struct SimContext *context, size_t operator_index, PhaseRotateOperatorConfig *out_config)
 Copy the current configuration from a registered phase-rotation operator.
 
SimResult sim_phase_rotate_update (struct SimContext *context, size_t operator_index, const PhaseRotateOperatorConfig *config)
 Replace the configuration of a registered phase-rotation operator.
 

Detailed Description

Utility operator that advances field phase by a rate times the timestep.

Complex fields are rotated by exp(i * phase_rate * dt). Real fields, or fields constrained to real spectral subspaces, receive the projected cos(theta) scale.

Function Documentation

◆ sim_add_phase_rotate_operator()

SimResult sim_add_phase_rotate_operator ( struct SimContext context,
const PhaseRotateOperatorConfig config,
size_t *  out_index 
)

Register a phase-rotation utility operator.

The implementation copies and normalizes config, validates that the target field is real double or complex double, and may register a symbolic kernel for unconstrained complex rotations.

Parameters
contextSimulation context that will own the operator.
configOptional phase-rotation configuration; NULL selects field 0 and zero rate.
[out]out_indexOptional destination for the registered operator index.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL context or invalid field, SIM_RESULT_TYPE_MISMATCH for unsupported field storage, SIM_RESULT_OUT_OF_MEMORY on allocation failure, or a registration error.

◆ sim_phase_rotate_config()

SimResult sim_phase_rotate_config ( struct SimContext context,
size_t  operator_index,
PhaseRotateOperatorConfig out_config 
)

Copy the current configuration from a registered phase-rotation operator.

Parameters
contextSimulation context containing the operator.
operator_indexIndex returned by sim_add_phase_rotate_operator().
[out]out_configReceives the operator 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 phase-rotation state.

◆ sim_phase_rotate_update()

SimResult sim_phase_rotate_update ( struct SimContext context,
size_t  operator_index,
const PhaseRotateOperatorConfig config 
)

Replace the configuration of a registered phase-rotation operator.

config is required. A non-finite replacement phase_rate preserves the previous rate. A successful update refreshes operator info, patches the kernel constant when one is registered, and invalidates the scheduler plan.

Parameters
contextSimulation context containing the operator.
operator_indexIndex of the phase-rotation operator to update.
configReplacement phase-rotation configuration.
Returns
SIM_RESULT_OK on success, SIM_RESULT_INVALID_ARGUMENT for NULL inputs or invalid field, SIM_RESULT_NOT_FOUND for a missing operator, SIM_RESULT_INVALID_STATE for missing state, or SIM_RESULT_TYPE_MISMATCH for unsupported field storage.