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

Made method to auto insert new materials to data_inputs. #488

Closed MicahGale closed 3 months ago

MicahGale commented 3 months ago

Description

This makes adding materials a lot more convenient. This is done by making a new subclass of NumberedObjectCollection: NumberedDataObjectCollection. When an item is added to this (anyway, because under the hood append is always used) it is also added to problem.data_inputs. When they are deleted vice versa is true as well.

Items appended try to reflect user preference by being 1 after the last instance of this type in data_inputs. So a new material will be added after the previous final material.

This isn't perfect but users can always sort data_inputs how they please.

Fixes #465. fixes #93.

Checklist

MicahGale commented 3 months ago

TODO: