63 lines
2.2 KiB
C
63 lines
2.2 KiB
C
// C ABI for the heat-flow solver (hsolv): opaque doc, pipeline, mesh accessors, progress callback.
|
|
#pragma once
|
|
|
|
#include <stddef.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct FemmHeatDoc FemmHeatDoc;
|
|
|
|
// pct in 0..100, or -1 for label-only updates. label may be NULL.
|
|
typedef void (*FemmHeatProgressFn)(int pct, const char* label, void* user);
|
|
|
|
// lifetime
|
|
FemmHeatDoc* femm_heat_doc_new(void);
|
|
void femm_heat_doc_free(FemmHeatDoc* doc);
|
|
|
|
// progress reporting routed to the host (Rust/Iced).
|
|
void femm_heat_doc_set_progress(FemmHeatDoc* doc, FemmHeatProgressFn fn, void* user);
|
|
|
|
// pipeline. each returns 1 on success, 0 on failure.
|
|
int femm_heat_doc_load_feh (FemmHeatDoc* doc, const char* path);
|
|
int femm_heat_doc_load_mesh (FemmHeatDoc* doc);
|
|
int femm_heat_doc_load_prev (FemmHeatDoc* doc);
|
|
int femm_heat_doc_renumber (FemmHeatDoc* doc);
|
|
int femm_heat_doc_solve (FemmHeatDoc* doc);
|
|
int femm_heat_doc_write_results(FemmHeatDoc* doc, const char* out_path);
|
|
|
|
// problem attributes after load_feh.
|
|
int femm_heat_doc_axisymmetric (const FemmHeatDoc* doc);
|
|
double femm_heat_doc_depth (const FemmHeatDoc* doc);
|
|
double femm_heat_doc_precision (const FemmHeatDoc* doc);
|
|
double femm_heat_doc_dt (const FemmHeatDoc* doc);
|
|
|
|
// mesh, valid after load_mesh + renumber.
|
|
int femm_heat_doc_num_nodes (const FemmHeatDoc* doc);
|
|
void femm_heat_doc_node (const FemmHeatDoc* doc, int i, double* x, double* y);
|
|
int femm_heat_doc_num_elements (const FemmHeatDoc* doc);
|
|
void femm_heat_doc_element (const FemmHeatDoc* doc, int i, int* p0, int* p1, int* p2);
|
|
|
|
// property table sizes.
|
|
int femm_heat_doc_num_materials (const FemmHeatDoc* doc);
|
|
int femm_heat_doc_num_boundaries (const FemmHeatDoc* doc);
|
|
int femm_heat_doc_num_conductors (const FemmHeatDoc* doc);
|
|
|
|
// field-point sampling after solve. component selects which scalar to fetch.
|
|
typedef enum {
|
|
FEMM_HEAT_FIELD_T = 0,
|
|
FEMM_HEAT_FIELD_FX = 1,
|
|
FEMM_HEAT_FIELD_FY = 2,
|
|
FEMM_HEAT_FIELD_F_MAG = 3,
|
|
FEMM_HEAT_FIELD_GX = 4,
|
|
FEMM_HEAT_FIELD_GY = 5,
|
|
FEMM_HEAT_FIELD_G_MAG = 6,
|
|
} FemmHeatField;
|
|
|
|
double femm_heat_doc_field_at(const FemmHeatDoc* doc, double x, double y, FemmHeatField component);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|