openmc icon indicating copy to clipboard operation
openmc copied to clipboard

Initialize geometry

Open church89 opened this issue 3 years ago • 1 comments

This PR originated from a need I currently had to reinitialize a geometry when running OpenMc in memory openmc.lib, but without having to re-initialize all with openmc.lib.init() :point_right: forum. In order to add this capability I simply defined a new function openmc_initialize_geometry in /openmc/src/finalize.cpp, that free the memory assigned to the geometry and simply re-assign it. I then added it as an external function to /openmc/include/capi.h and link to the Python API through /openmc/lib/core.py.

church89 avatar Aug 04 '22 13:08 church89

@church89 My comment before still stands -- the function you've added would need to call some of the other functions that are called in read_input_xml to be robust. Otherwise, it might leave the newly-loaded geometry in an incomplete state.

paulromano avatar Aug 15 '22 18:08 paulromano