idaholab / MontePy

MontePy is the most user friendly Python library (API) to read, edit, and write MCNP input files.
https://www.montepy.org/
MIT License
32 stars 7 forks source link

Add support for Just-In-Time parsing #529

Open MicahGale opened 2 months ago

MicahGale commented 2 months ago

Is your feature request related to a problem? Please describe.

This issue is related to #382, and came from a discussion with @dodu94.

Right now reading a large file can be resource intensive. Usually while editing an MCNP input file a small fraction of the inputs are actually edited.

Describe the solution you'd like

So the idea is: what if the parsing step only occurs when a specific object is accessed.

For instance

# very fast step
problem = montepy.read_jit(...)
# this is when parsing actually occurs
problem.cells[5].mass_density = 1.0

Describe alternatives you've considered An alternative would be #382.

Additional context

This would be most useful for fusion models.