#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 #define SPHLITE_SOLID_SUMMARY_VALUE_COUNT 16 #define SPHLITE_SOLID_PARTICLE_VALUE_COUNT 22 #define SPHLITE_SOLID_DIAGNOSTIC_VALUE_COUNT 3 #define SPHLITE_SOLID_REFERENCE_VALUE_COUNT 1 #define SPHLITE_COUPLING_REGION_CONTACT 1 #define SPHLITE_COUPLING_REGION_CONTINUUM 2 #define SPHLITE_COUPLING_EXPORT_PARTICLE 1 #define SPHLITE_COUPLING_EXPORT_FACET 2 #define SPHLITE_COUPLING_EXPORT_BOTH 3 #define SPHLITE_COUPLING_IMPORT_FORCE 1 #define SPHLITE_COUPLING_IMPORT_FACET_LOAD 2 #define SPHLITE_COUPLING_IMPORT_MOTION 3 #define SPHLITE_COUPLING_LOAD_PARTICLE_FORCE 1 #define SPHLITE_COUPLING_LOAD_FACET_FORCE 2 #define SPHLITE_COUPLING_LOAD_PRESSURE 3 #define SPHLITE_COUPLING_LOAD_TRACTION 4 #define SPHLITE_COUPLING_DISTRIBUTION_UNIFORM 1 #define SPHLITE_COUPLING_DISTRIBUTION_AREA 2 #define SPHLITE_COUPLING_DISTRIBUTION_MASS 3 #define SPHLITE_COUPLING_CONTACT_STATE_NONE 0 #define SPHLITE_COUPLING_CONTACT_STATE_IMPORT 1 #define SPHLITE_COUPLING_MOTION_NONE 0 #define SPHLITE_COUPLING_MOTION_VELOCITY 1 #define SPHLITE_COUPLING_MOTION_POSITION 2 #define SPHLITE_COUPLING_MOTION_DIRECT 1 #define SPHLITE_COUPLING_MOTION_PENALTY 2 #define SPHLITE_COUPLING_PARTICLE_SCALAR_COUNT 7 #define SPHLITE_COUPLING_PARTICLE_VECTOR_COUNT 3 #define SPHLITE_COUPLING_FACET_VECTOR_COUNT 3 #define SPHLITE_COUPLING_DIAGNOSTIC_VALUE_COUNT 27 #define SPHLITE_COUPLING_DIAGNOSTIC_COUNT_COUNT 12 #define SPHLITE_COUPLING_CONTACT_DIAGNOSTIC_VALUE_COUNT 1 #define SPHLITE_COUPLING_CONTACT_DIAGNOSTIC_COUNT_COUNT 7 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_vtu(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); SPHLITE_API int sphlite_get_water_dt_limits(double *dt_cfl, double *dt_accel, double *dt_viscous); SPHLITE_API int sphlite_get_gas_summary(double *volume, double *center, double *mean_pressure, double *max_pressure); SPHLITE_API int sphlite_get_gas_bubble_metrics(double *equivalent_radius, double *radius_rate, double *center); SPHLITE_API int sphlite_get_gas_dt_limits(double *dt_cfl, double *dt_accel, double *dtcrit); SPHLITE_API int sphlite_get_gas_extended_summary(double *mass, double *momentum, double *density_range, double *dt_limits); SPHLITE_API int sphlite_get_gas_source_summary(double *mass_source, double *momentum_source, double *energy_source); SPHLITE_API int sphlite_set_ignition_point(double x, double y, double z, double time); SPHLITE_API int sphlite_get_explosive_summary(int *particle_count, int *reacted_count, double *lambda_range, double *released_totals, double *detonation_time_range); SPHLITE_API int sphlite_get_explosive_release_balance(double *mass_values, double *energy_values, double *momentum_values); SPHLITE_API int sphlite_get_solid_summary(int *active_count, int *failed_count, double *values, int value_capacity); SPHLITE_API int sphlite_get_solid_particle_state(int max_particles, double *values, int value_capacity, int *failure_status, int *reference_neighbor_count, int *reference_degenerate, int *correction_status, int *count); SPHLITE_API int sphlite_get_solid_diagnostics(double *values, int value_capacity); SPHLITE_API int sphlite_get_solid_reference_quality(int *reference_neighbor_min, int *correction_status, double *values, int value_capacity); SPHLITE_API int sphlite_coupling_get_region_count(int *count); SPHLITE_API int sphlite_coupling_get_region_info(int region_index, char *name, int name_capacity, int *region_type, int *export_mode, int *import_mode, int *enabled, int *particle_count, int *facet_count); SPHLITE_API int sphlite_coupling_get_region_modes(int region_index, int *load_mode, int *distribution_mode, int *contact_state_mode); SPHLITE_API int sphlite_coupling_export_particles(int region_index, int capacity, int *count, int *ext_ids, int *internal_indices, int *phases, int *statuses, int *materials, int *sections, double *scalar_values, double *vector_values); SPHLITE_API int sphlite_coupling_export_facets(int region_index, int capacity, int *count, int *facet_ids, int *particle_ids, int *materials, int *sections, double *vector_values, double *area_values); SPHLITE_API int sphlite_coupling_apply_particle_forces(int region_index, int force_count, const int *export_indices, const double *forces); SPHLITE_API int sphlite_coupling_apply_facet_loads(int region_index, int load_count, const int *facet_ids, const double *loads); SPHLITE_API int sphlite_coupling_apply_facet_pressures(int region_index, int load_count, const int *facet_ids, const double *pressures, int distribution_mode, int coupling_step); SPHLITE_API int sphlite_coupling_apply_facet_tractions(int region_index, int load_count, const int *facet_ids, const double *tractions, int distribution_mode, int coupling_step); SPHLITE_API int sphlite_coupling_apply_facet_resultants(int region_index, int load_count, const int *facet_ids, const double *resultants, int distribution_mode, int coupling_step); SPHLITE_API int sphlite_coupling_apply_contact_state(int region_index, int contact_count, const int *facet_ids, const double *normals, const double *gaps, const double *penetrations, const double *contact_pressures, int coupling_step); SPHLITE_API int sphlite_coupling_apply_motion_boundary(int region_index, int export_index, int target_kind, int mode, const double *target); SPHLITE_API int sphlite_coupling_clear_imports(void); SPHLITE_API int sphlite_coupling_get_load_balance(double *input_force, double *distributed_force, double *force_error, double *input_moment, double *distributed_moment, double *moment_error); SPHLITE_API int sphlite_coupling_get_contact_diagnostics(int *counts, int count_capacity, double *values, int value_capacity); SPHLITE_API int sphlite_coupling_get_diagnostics(double *values, int value_capacity, int *counts, int count_capacity); #ifdef __cplusplus } #endif #endif