GEOUNED-org / GEOUNED

A tool to convert CAD to CSG & CSG to CAD for Monte Carlo transport codes
European Union Public License 1.2
45 stars 27 forks source link

[Feature request] - modular user interface #184

Open shimwell opened 1 month ago

shimwell commented 1 month ago

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

Currently the CadToCsg.start() method does quite a lot of stuff. I'm thinking this could be broken down into stages to give more fine grain control to the user and make the code more testable.

Keen to see what others think

Describe the solution you'd like

A more modular approach that allows users to perform individual steps. This is also be useful if we ever want to replace parts of the code based. Here is an idea of what the steps could be

geo = geouned.CadToCsg()
geo.load_cad(step_file="example.step")
geo.decompose(args)
geo.convert(args)
geo.void_generation(args)
geo.export_csg(out_format='serpent'))

this has the advantage of moving some of the huge amount of arguments to where they are needed. We have already seen this with the export_csg which was able to delay the requirement of the user to specify the out_format to the final step and therefore save time if they want to change arguments relating to a single stage. For example the step_file could be passed to load_cad as no other function needs it. This would also make it easer to test discreate functionality

Describe alternatives you've considered

keeping the code structure as it currently is

shimwell commented 1 month ago

related to issues #80 and #114 which request similar functionality