Files
SPHLite/include/sphlite_c_api.h
T
2026-07-02 21:10:04 +08:00

77 lines
2.9 KiB
C

#ifndef SPHLITE_C_API_H
#define SPHLITE_C_API_H
#ifdef _WIN32
# ifdef SPHLITE_BUILD_SHARED
# define SPHLITE_API __declspec(dllexport)
# else
# define SPHLITE_API
# endif
#else
# define SPHLITE_API
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define SPHLITE_PHASE_WATER 1
#define SPHLITE_PHASE_GAS 2
#define SPHLITE_PHASE_EXPLOSIVE 3
#define SPHLITE_PHASE_SOLID 4
#define SPHLITE_PHASE_SHELL 5
#define SPHLITE_PHASE_BOUNDARY 6
#define SPHLITE_PHASE_COUPLING 7
#define SPHLITE_PHASE_SOLID_FAILED 8
#define SPHLITE_PHASE_SHELL_FAILED 9
#define SPHLITE_STATUS_ACTIVE 0
#define SPHLITE_STATUS_INACTIVE 1
#define SPHLITE_STATUS_FAILED 2
#define SPHLITE_STATUS_RESERVED 3
SPHLITE_API int sphlite_initialize(void);
SPHLITE_API int sphlite_finalize(void);
SPHLITE_API int sphlite_get_version(int *major, int *minor, int *patch);
SPHLITE_API int sphlite_get_last_error(int *code, char *message, int message_capacity);
SPHLITE_API int sphlite_read_inp(const char *filename);
SPHLITE_API int sphlite_build_model(void);
SPHLITE_API int sphlite_estimate_stable_dt(double *dtcrit);
SPHLITE_API int sphlite_advance_explicit(double dt);
SPHLITE_API int sphlite_run_explicit(void);
SPHLITE_API int sphlite_get_current_time(double *time, int *step);
SPHLITE_API int sphlite_get_particle_count(int *count);
SPHLITE_API int sphlite_get_input_warning_count(int *count);
SPHLITE_API int sphlite_set_output_directory(const char *path);
SPHLITE_API int sphlite_set_output_interval(int interval);
SPHLITE_API int sphlite_write_output(int step, double time);
SPHLITE_API int sphlite_write_csv(const char *filename);
SPHLITE_API int sphlite_write_restart(const char *filename);
SPHLITE_API int sphlite_read_restart(const char *filename);
SPHLITE_API int sphlite_get_particle_state(int max_particles,
int *particle_id_ext,
int *phase,
int *status,
int *material_id,
int *section_id,
double *x,
double *v,
double *a,
double *rho,
double *pressure,
double *internal_energy,
double *temperature,
double *h,
int *count);
SPHLITE_API int sphlite_get_water_summary(double *mass,
double *momentum,
double *max_pressure,
double *min_density,
double *max_density);
#ifdef __cplusplus
}
#endif
#endif