Skip to content

Add vcml_to_moving_boundary_input entrypoint#19

Merged
jcschaff merged 2 commits into
mainfrom
add-moving-boundary-input
Jun 24, 2026
Merged

Add vcml_to_moving_boundary_input entrypoint#19
jcschaff merged 2 commits into
mainfrom
add-moving-boundary-input

Conversation

@jcschaff

Copy link
Copy Markdown
Member

Summary

Adds vcml_to_moving_boundary_input, a new entrypoint analogous to vcml_to_finite_volume_input, that converts a VCML simulation into Moving Boundary solver input. The output is a MovingBoundarySetup XML file — the format consumed by the vcell-mbsolver package (MovingBoundarySolver.from_xml).

import libvcell
success, msg = libvcell.vcml_to_moving_boundary_input(
    vcml_content=vcml, simulation_name="Simulation33", output_dir_path=out_dir
)
# out_dir now contains a *mb.xml MovingBoundarySetup file

Design

  • The named simulation must already be configured for the Moving Boundary solver; otherwise a clear error is returned (the input is generated from MovingBoundary-specific math — spatial processes / front velocities — so this is meaningless for other solvers).
  • Messaging is disabled, so the server-only <jms> element is omitted from the generated XML.

Changes

Java (vcell-native/)

  • solvers/LocalMovingBoundarySolverStandalone.java (new) — writes mb.xml via MovingBoundaryFileWriter, skipping the native-executable lookup that the stock MovingBoundarySolver.initialize() performs (mirrors LocalFVSolverStandalone for Finite Volume).
  • SolverUtils.vcmlToMovingBoundaryInput — loads the BioModel, validates the solver, writes input.
  • Entrypoints.java — new @CEntryPoint vcmlToMovingBoundaryInput.
  • MainRecorder.java — exercises the new path so native-image records its reflection/resource config.

Python (libvcell/)

  • native_utils.py registers the new symbol guarded by hasattr so the package still loads against older shared libraries.
  • native_calls.py / solver_utils.py / __init__.py add and export vcml_to_moving_boundary_input.

Tests & fixtures

  • Java: 4 SolverEntrypointsTest cases (writes a MovingBoundarySetup mb.xml; bad sim name; wrong solver; SBML-instead) — all pass on the JVM (23/23 in the suite).
  • Python: a test that skips until the native library is rebuilt with the new symbol.
  • Solver_Suite_6_2.vcml (simulation Simulation33 uses the Moving Boundary solver) added to both test-resource trees.

Verification

  • ✅ Full vcell-native Java suite: 23/23 pass (incl. the 4 new tests).
  • mypy --strict clean; ruff clean on changed code.
  • import libvcell loads and exports the new function.

Note for reviewers

The Python end-to-end path requires rebuilding the native shared library (scripts/local_build_native.sh) to expose the new C entry point. CI performs this build, which is what exercises the (currently skipped) Python test.

🤖 Generated with Claude Code

jcschaff and others added 2 commits June 23, 2026 22:55
Adds a new entrypoint, analogous to vcml_to_finite_volume_input, that converts
a VCML simulation into Moving Boundary solver input. The generated file is a
MovingBoundarySetup XML, the format consumed by the vcell-mbsolver package
(MovingBoundarySolver.from_xml).

Java (vcell-native):
- LocalMovingBoundarySolverStandalone: subclass of MovingBoundarySolver that
  writes the mb.xml input via MovingBoundaryFileWriter while skipping the native
  executable lookup performed by the stock initialize() (mirrors how
  LocalFVSolverStandalone exposes an input-only path for Finite Volume).
- SolverUtils.vcmlToMovingBoundaryInput: loads the BioModel and requires the
  named simulation to already use the Moving Boundary solver (clear error
  otherwise, since the input is generated from MovingBoundary-specific math).
- Entrypoints: new @centrypoint vcmlToMovingBoundaryInput.
- MainRecorder: exercises the new path so native-image records its config.

Python (libvcell):
- native_utils registers the new symbol guarded by hasattr so the package still
  loads against older shared libraries that predate it.
- native_calls / solver_utils / __init__ add and export
  vcml_to_moving_boundary_input.

Tests:
- Java: 4 SolverEntrypointsTest cases (writes a MovingBoundarySetup mb.xml;
  bad sim name; wrong solver; SBML-instead) - all pass on the JVM.
- Python: a test that skips until the native library is rebuilt with the new
  symbol.
- Fixture: Solver_Suite_6_2.vcml (simulation "Simulation33" uses the Moving
  Boundary solver) added to both test-resource trees.

The Python end-to-end path requires rebuilding the native shared library
(scripts/local_build_native.sh) to expose the new C entry point.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The prettier pre-commit hook (run by the CI quality job via `make check`)
reformatted CLAUDE.md; apply it so the hook passes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jcschaff jcschaff merged commit ff3716e into main Jun 24, 2026
6 checks passed
@jcschaff jcschaff deleted the add-moving-boundary-input branch June 24, 2026 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant