Expose water diagnostics through public APIs

This commit is contained in:
Codex
2026-07-02 21:20:51 +08:00
parent 61b81e9d50
commit 03c05d6931
10 changed files with 280 additions and 24 deletions
+37
View File
@@ -53,6 +53,15 @@ extern void SPHLITE_FC_sphft_write_restart_chars(
const int *chars, const int *count, int *ierr);
extern void SPHLITE_FC_sphft_read_restart_chars(
const int *chars, const int *count, int *ierr);
extern void SPHLITE_FC_sphft_get_water_summary(
double *mass,
double *momentum,
double *max_pressure,
double *min_density,
double *max_density,
int *ierr);
extern void SPHLITE_FC_sphft_get_water_dt_limits(
double *dt_cfl, double *dt_accel, double *dt_viscous, int *ierr);
static int sphlite_call_path(
const char *path,
@@ -273,3 +282,31 @@ int sphlite_read_restart(const char *filename)
return sphlite_call_path(
filename, SPHLITE_FC_sphft_read_restart_chars);
}
int sphlite_get_water_summary(double *mass,
double *momentum,
double *max_pressure,
double *min_density,
double *max_density)
{
int ierr = 0;
if (mass == NULL || momentum == NULL || max_pressure == NULL ||
min_density == NULL || max_density == NULL) {
return -1;
}
SPHLITE_FC_sphft_get_water_summary(mass, momentum, max_pressure,
min_density, max_density, &ierr);
return ierr;
}
int sphlite_get_water_dt_limits(double *dt_cfl,
double *dt_accel,
double *dt_viscous)
{
int ierr = 0;
if (dt_cfl == NULL || dt_accel == NULL || dt_viscous == NULL) {
return -1;
}
SPHLITE_FC_sphft_get_water_dt_limits(dt_cfl, dt_accel, dt_viscous, &ierr);
return ierr;
}