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
+23
View File
@@ -136,6 +136,12 @@ class SPHLite:
ctypes.POINTER(ctypes.c_double),
]
self.lib.sphlite_get_explosive_summary.restype = ctypes.c_int
self.lib.sphlite_get_explosive_release_balance.argtypes = [
ctypes.POINTER(ctypes.c_double),
ctypes.POINTER(ctypes.c_double),
ctypes.POINTER(ctypes.c_double),
]
self.lib.sphlite_get_explosive_release_balance.restype = ctypes.c_int
self.lib.sphlite_get_particle_state.argtypes = [
ctypes.c_int,
@@ -433,6 +439,21 @@ class SPHLite:
"explosive_detonation_time_range": list(detonation_range),
}
def explosive_release_balance(self) -> dict[str, float | list[float]]:
mass_type = ctypes.c_double * 4
energy_type = ctypes.c_double * 2
momentum_type = ctypes.c_double * 3
mass_values = mass_type()
energy_values = energy_type()
momentum_values = momentum_type()
self._check(self.lib.sphlite_get_explosive_release_balance(
mass_values, energy_values, momentum_values))
return {
"explosive_release_mass_values": list(mass_values),
"explosive_release_energy_values": list(energy_values),
"explosive_release_momentum_values": list(momentum_values),
}
def inspect(self, filename: str | Path) -> dict[str, int | float | list[float]]:
self.read_inp(filename)
self.build_model()
@@ -448,6 +469,7 @@ class SPHLite:
summary.update(self.gas_extended_summary())
summary.update(self.gas_source_summary())
summary.update(self.explosive_summary())
summary.update(self.explosive_release_balance())
return summary
def run(self, filename: str | Path) -> dict[str, int | float | list[float]]:
@@ -462,4 +484,5 @@ class SPHLite:
summary.update(self.gas_extended_summary())
summary.update(self.gas_source_summary())
summary.update(self.explosive_summary())
summary.update(self.explosive_release_balance())
return summary