Cell and material instance counting for PyAPI
Created by: wbinventor
This PR introduces new features in the PyAPI to count the number of instances of each cell and material in a geometry as I suggested in #797 (closed). This is intended to help support @cjosey with his development of OpenDeplete.
Geometry.count_material_instances() methods can be called to recursively count the number of instances of cells/materials in a geometry. The final counts are stored in the new
Material.num_instances properties, respectively. An example of how this new code be used and tested (i.e., in one of our Python example input files) could be as follows:
geometry.count_cell_instances() geometry.count_material_instances() for cell in geometry.get_all_cells().values(): print(cell.id, cell.name, cell.num_instances) for material in geometry.get_all_materials().values(): print(material.id, material.name, material.num_instances)
@cjosey do you want to take a look at this and see if you can use it as a way to generically determine the number of distribmats you need to define for OpenDeplete?