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

Finite-difference Laplacian operator for 1D/2D fields. More...

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

Go to the source code of this file.

Classes

struct  SimLaplacianOperatorConfig
 Configuration for a finite-difference Laplacian operator. More...
 

Macros

#define SIM_LAPLACIAN_AXIS_AUTO   ((size_t)SIZE_MAX)
 

Typedefs

typedef enum SimLaplacianStencil SimLaplacianStencil
 Finite-difference stencils available for Laplacian evaluation.
 
typedef struct SimLaplacianOperatorConfig SimLaplacianOperatorConfig
 Configuration for a finite-difference Laplacian operator.
 

Enumerations

enum  SimLaplacianStencil { SIM_LAPLACIAN_STENCIL_CROSS_2 = 0 , SIM_LAPLACIAN_STENCIL_CROSS_4 , SIM_LAPLACIAN_STENCIL_ISOTROPIC_9 }
 Finite-difference stencils available for Laplacian evaluation. More...
 

Functions

SimResult sim_add_laplacian_operator (struct SimContext *context, const SimLaplacianOperatorConfig *config, size_t *out_index)
 Register a finite-difference Laplacian operator.
 
SimResult sim_laplacian_config (struct SimContext *context, size_t operator_index, SimLaplacianOperatorConfig *out_config)
 Copy the current Laplacian configuration from a registered operator.
 
SimResult sim_laplacian_update (struct SimContext *context, size_t operator_index, const SimLaplacianOperatorConfig *config)
 Replace the configuration of a registered Laplacian operator.
 

Detailed Description

Finite-difference Laplacian operator for 1D/2D fields.

Enumeration Type Documentation

◆ SimLaplacianStencil

Finite-difference stencils available for Laplacian evaluation.

Enumerator
SIM_LAPLACIAN_STENCIL_CROSS_2 

Second-order cross stencil.

SIM_LAPLACIAN_STENCIL_CROSS_4 

Fourth-order cross stencil.

SIM_LAPLACIAN_STENCIL_ISOTROPIC_9 

Nine-point isotropic stencil.

Function Documentation

◆ sim_add_laplacian_operator()

SimResult sim_add_laplacian_operator ( struct SimContext context,
const SimLaplacianOperatorConfig config,
size_t *  out_index 
)

Register a finite-difference Laplacian operator.

Parameters
contextSimulation context that will own the operator.
configOptional Laplacian configuration; NULL selects normalized defaults.
[out]out_indexOptional destination for the registered operator index.
Returns
SIM_RESULT_OK on success, or an error code from argument validation, field compatibility checks, allocation, or split registration.

◆ sim_laplacian_config()

SimResult sim_laplacian_config ( struct SimContext context,
size_t  operator_index,
SimLaplacianOperatorConfig out_config 
)

Copy the current Laplacian configuration from a registered operator.

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

◆ sim_laplacian_update()

SimResult sim_laplacian_update ( struct SimContext context,
size_t  operator_index,
const SimLaplacianOperatorConfig config 
)

Replace the configuration of a registered Laplacian operator.

config is required. The replacement is normalized and field compatibility is checked before storing it.

Parameters
contextSimulation context containing the operator.
operator_indexIndex of the Laplacian operator to update.
configReplacement Laplacian configuration.
Returns
SIM_RESULT_OK on success, or an error code from argument validation, lookup, state validation, or field compatibility checks.