Expose explosive release balance interfaces

This commit is contained in:
Codex
2026-07-03 13:52:49 +08:00
parent fbbaab3771
commit 111e907509
16 changed files with 569 additions and 35 deletions
+11
View File
@@ -92,6 +92,13 @@ def main() -> int:
"explosive_released_energy",
"explosive_detonation_time_min",
"explosive_detonation_time_max",
"explosive_initial_mass",
"explosive_remaining_mass",
"explosive_release_mass_error",
"explosive_release_energy_error",
"explosive_release_momentum_x",
"explosive_release_momentum_y",
"explosive_release_momentum_z",
"status",
):
require_field(inspect.stdout, field)
@@ -158,6 +165,10 @@ def main() -> int:
raise AssertionError("CLI explosive lambda mismatch")
if float(explosive_fields["explosive_released_energy"]) <= 0.0:
raise AssertionError("CLI explosive released energy mismatch")
if float(explosive_fields["explosive_initial_mass"]) <= 0.0:
raise AssertionError("CLI explosive initial mass mismatch")
if float(explosive_fields["explosive_release_energy_error"]) != 0.0:
raise AssertionError("CLI explosive release energy balance mismatch")
check = run_command([exe, model, "--check"])
if "mode: check" not in check.stdout:
+9
View File
@@ -33,6 +33,8 @@ def main() -> int:
raise AssertionError("Python wrapper is missing Gas extended C ABI diagnostics")
if not hasattr(solver.lib, "sphlite_get_explosive_summary"):
raise AssertionError("Python wrapper is missing Explosive C ABI diagnostics")
if not hasattr(solver.lib, "sphlite_get_explosive_release_balance"):
raise AssertionError("Python wrapper is missing Explosive release C ABI")
if not hasattr(solver.lib, "sphlite_set_ignition_point"):
raise AssertionError("Python wrapper is missing Explosive ignition C ABI")
if solver.version() != (0, 4, 1):
@@ -59,6 +61,8 @@ def main() -> int:
raise AssertionError("inspect helper did not include Gas extended diagnostics")
if "explosive_particles" not in solid_summary or "explosive_lambda_range" not in solid_summary:
raise AssertionError("inspect helper did not include Explosive diagnostics")
if "explosive_release_mass_values" not in solid_summary:
raise AssertionError("inspect helper did not include Explosive release balance")
solver.set_output_directory(root / "build-codex-unix")
solver.write_output(0, 0.0)
restart = root / "build-codex-unix" / "python_restart.tmp"
@@ -135,6 +139,11 @@ def main() -> int:
raise AssertionError("explosive summary lambda mismatch")
if explosive_summary["explosive_released_totals"][1] <= 0.0:
raise AssertionError("explosive summary energy mismatch")
explosive_balance = explosive.explosive_release_balance()
if explosive_balance["explosive_release_mass_values"][0] <= 0.0:
raise AssertionError("explosive release balance mass mismatch")
if explosive_balance["explosive_release_energy_values"][0] <= 0.0:
raise AssertionError("explosive release balance energy mismatch")
finally:
explosive.finalize()