Expose Solid 0.5.1 state APIs
This commit is contained in:
@@ -66,6 +66,16 @@ int main(void)
|
||||
int solid_active_count = 0;
|
||||
int solid_failed_count = 0;
|
||||
double solid_values[SPHLITE_SOLID_SUMMARY_VALUE_COUNT] = {0.0};
|
||||
double solid_particle_values[4 * SPHLITE_SOLID_PARTICLE_VALUE_COUNT] = {0.0};
|
||||
int solid_failure_status[4] = {0};
|
||||
int solid_reference_neighbor_count[4] = {0};
|
||||
int solid_reference_degenerate[4] = {0};
|
||||
int solid_correction_status[4] = {0};
|
||||
int solid_state_count = 0;
|
||||
double solid_diagnostics[SPHLITE_SOLID_DIAGNOSTIC_VALUE_COUNT] = {0.0};
|
||||
double solid_reference_values[SPHLITE_SOLID_REFERENCE_VALUE_COUNT] = {0.0};
|
||||
int solid_reference_neighbor_min = 0;
|
||||
int solid_correction_status_max = 0;
|
||||
|
||||
if (SPHLITE_PHASE_SOLID != 4 || SPHLITE_PHASE_GAS != 2 ||
|
||||
SPHLITE_STATUS_ACTIVE != 0) {
|
||||
@@ -153,6 +163,40 @@ int main(void)
|
||||
solid_values, SPHLITE_SOLID_SUMMARY_VALUE_COUNT - 1) != -1) {
|
||||
return fail("small Solid summary capacity did not return -1");
|
||||
}
|
||||
if (sphlite_get_solid_particle_state(4, NULL,
|
||||
4 * SPHLITE_SOLID_PARTICLE_VALUE_COUNT, solid_failure_status,
|
||||
solid_reference_neighbor_count, solid_reference_degenerate,
|
||||
solid_correction_status, &solid_state_count) != -1) {
|
||||
return fail("null Solid state values did not return -1");
|
||||
}
|
||||
if (sphlite_get_solid_particle_state(4, solid_particle_values,
|
||||
SPHLITE_SOLID_PARTICLE_VALUE_COUNT - 1, solid_failure_status,
|
||||
solid_reference_neighbor_count, solid_reference_degenerate,
|
||||
solid_correction_status, &solid_state_count) != -1) {
|
||||
return fail("small Solid state capacity did not return -1");
|
||||
}
|
||||
if (sphlite_get_solid_particle_state(4, solid_particle_values,
|
||||
4 * SPHLITE_SOLID_PARTICLE_VALUE_COUNT, NULL,
|
||||
solid_reference_neighbor_count, solid_reference_degenerate,
|
||||
solid_correction_status, &solid_state_count) != -1) {
|
||||
return fail("null Solid failure status did not return -1");
|
||||
}
|
||||
if (sphlite_get_solid_diagnostics(NULL,
|
||||
SPHLITE_SOLID_DIAGNOSTIC_VALUE_COUNT) != -1) {
|
||||
return fail("null Solid diagnostics did not return -1");
|
||||
}
|
||||
if (sphlite_get_solid_diagnostics(solid_diagnostics,
|
||||
SPHLITE_SOLID_DIAGNOSTIC_VALUE_COUNT - 1) != -1) {
|
||||
return fail("small Solid diagnostics capacity did not return -1");
|
||||
}
|
||||
if (sphlite_get_solid_reference_quality(NULL, &solid_correction_status_max,
|
||||
solid_reference_values, SPHLITE_SOLID_REFERENCE_VALUE_COUNT) != -1) {
|
||||
return fail("null Solid reference min did not return -1");
|
||||
}
|
||||
if (sphlite_get_solid_reference_quality(&solid_reference_neighbor_min,
|
||||
&solid_correction_status_max, solid_reference_values, 0) != -1) {
|
||||
return fail("small Solid reference capacity did not return -1");
|
||||
}
|
||||
if (sphlite_get_gas_summary(&gas_volume, gas_center, &gas_mean_pressure,
|
||||
&gas_max_pressure) != 2) {
|
||||
return fail("uninitialized gas summary did not return Fortran state error");
|
||||
@@ -161,6 +205,16 @@ int main(void)
|
||||
solid_values, SPHLITE_SOLID_SUMMARY_VALUE_COUNT) != 2) {
|
||||
return fail("uninitialized Solid summary did not return Fortran state error");
|
||||
}
|
||||
if (sphlite_get_solid_particle_state(4, solid_particle_values,
|
||||
4 * SPHLITE_SOLID_PARTICLE_VALUE_COUNT, solid_failure_status,
|
||||
solid_reference_neighbor_count, solid_reference_degenerate,
|
||||
solid_correction_status, &solid_state_count) != 2) {
|
||||
return fail("uninitialized Solid state did not return Fortran state error");
|
||||
}
|
||||
if (sphlite_get_solid_diagnostics(solid_diagnostics,
|
||||
SPHLITE_SOLID_DIAGNOSTIC_VALUE_COUNT) != 2) {
|
||||
return fail("uninitialized Solid diagnostics did not return state error");
|
||||
}
|
||||
|
||||
ierr = sphlite_initialize();
|
||||
if (ierr != 0) return fail("initialize failed");
|
||||
@@ -176,6 +230,11 @@ int main(void)
|
||||
ierr = sphlite_get_solid_summary(&solid_active_count, &solid_failed_count,
|
||||
solid_values, SPHLITE_SOLID_SUMMARY_VALUE_COUNT);
|
||||
if (ierr != 2) return fail("unbuilt Solid summary did not return Fortran state error");
|
||||
ierr = sphlite_get_solid_particle_state(4, solid_particle_values,
|
||||
4 * SPHLITE_SOLID_PARTICLE_VALUE_COUNT, solid_failure_status,
|
||||
solid_reference_neighbor_count, solid_reference_degenerate,
|
||||
solid_correction_status, &solid_state_count);
|
||||
if (ierr != 2) return fail("unbuilt Solid state did not return Fortran state error");
|
||||
|
||||
ierr = sphlite_get_version(&major, &minor, &patch);
|
||||
if (ierr != 0) return fail("get_version failed");
|
||||
@@ -216,6 +275,30 @@ int main(void)
|
||||
if (solid_values[13] <= 0.0 || solid_values[15] <= 0.0) {
|
||||
return fail("Solid dt summary content mismatch");
|
||||
}
|
||||
ierr = sphlite_get_solid_particle_state(4, solid_particle_values,
|
||||
4 * SPHLITE_SOLID_PARTICLE_VALUE_COUNT, solid_failure_status,
|
||||
solid_reference_neighbor_count, solid_reference_degenerate,
|
||||
solid_correction_status, &solid_state_count);
|
||||
if (ierr != 0 || solid_state_count != 4) return fail("Solid state query failed");
|
||||
if (solid_failure_status[0] != SPHLITE_STATUS_ACTIVE ||
|
||||
solid_reference_neighbor_count[0] < 0 ||
|
||||
solid_correction_status[0] < 0) {
|
||||
return fail("Solid state content mismatch");
|
||||
}
|
||||
ierr = sphlite_get_solid_diagnostics(solid_diagnostics,
|
||||
SPHLITE_SOLID_DIAGNOSTIC_VALUE_COUNT);
|
||||
if (ierr != 0) return fail("Solid diagnostics query failed");
|
||||
if (solid_diagnostics[0] < 0.0 || solid_diagnostics[1] < 0.0 ||
|
||||
solid_diagnostics[2] < 0.0) {
|
||||
return fail("Solid diagnostics content mismatch");
|
||||
}
|
||||
ierr = sphlite_get_solid_reference_quality(&solid_reference_neighbor_min,
|
||||
&solid_correction_status_max, solid_reference_values,
|
||||
SPHLITE_SOLID_REFERENCE_VALUE_COUNT);
|
||||
if (ierr != 0) return fail("Solid reference quality query failed");
|
||||
if (solid_reference_neighbor_min < 0 || solid_correction_status_max < 0) {
|
||||
return fail("Solid reference quality content mismatch");
|
||||
}
|
||||
|
||||
if (sphlite_get_particle_state(4, NULL, phase, status, material_id, section_id,
|
||||
x, v, a, rho, pressure, internal_energy, temperature, h, &count) != -1) {
|
||||
|
||||
@@ -36,6 +36,25 @@ int main()
|
||||
if (solid.dt_limits[0] <= 0.0 || solid.dt_limits[2] <= 0.0) {
|
||||
return 1;
|
||||
}
|
||||
sphlite::SolidParticleState solid_state = sphlite::solid_particle_state();
|
||||
if (solid_state.values.size() !=
|
||||
SPHLITE_SOLID_PARTICLE_VALUE_COUNT * state.particle_id_ext.size()) {
|
||||
return 1;
|
||||
}
|
||||
if (solid_state.failure_status[0] != sphlite::StatusActive ||
|
||||
solid_state.reference_neighbor_count[0] < 0 ||
|
||||
solid_state.correction_status[0] < 0) {
|
||||
return 1;
|
||||
}
|
||||
sphlite::SolidDiagnostics solid_diag = sphlite::solid_diagnostics();
|
||||
if (solid_diag.max_strain_rate < 0.0 || solid_diag.max_acceleration < 0.0 ||
|
||||
solid_diag.internal_force_residual < 0.0) {
|
||||
return 1;
|
||||
}
|
||||
sphlite::SolidReferenceQuality quality = sphlite::solid_reference_quality();
|
||||
if (quality.reference_neighbor_min < 0 || quality.correction_status < 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user