openmsr / CAD_to_OpenMC

code to target the conversion from a step-file to a h5m-geometry for neutronics
MIT License
25 stars 16 forks source link

Cache calculated solids properties #66

Closed sjcrs closed 8 months ago

sjcrs commented 8 months ago

This change to the way solids are matched within merge_all() leads to significant speedup of file processing. In my tests, a 243-volume CAD file had its processing time reduced from 28 minutes to 3 minutes.

It caches volumes, bounding boxes, and centers, of meshed and unmeshed volumes, rather than repeatedly calling the CadQuery volume calculation inside a nested loop. While it changes the inputs arguments for similar_solids, it doesn't appear that function is used anywhere else, so overall this method modification has a small footprint.

ebknudsen commented 8 months ago

Seems fine by me. Thank you very much @sjcrs for the contribution.