diff --git a/openmc/summary.py b/openmc/summary.py index 46fec01d5..ad1dd67ca 100644 --- a/openmc/summary.py +++ b/openmc/summary.py @@ -1,3 +1,4 @@ +from collections import Iterable import numpy as np import re @@ -477,10 +478,14 @@ class Summary(object): # Retrieve the object corresponding to the fill type and ID if fill_type == 'normal': - if fill_id > 0: - fill = self.get_material_by_id(fill_id) + if isinstance(fill_id, Iterable): + fill = [self.get_material_by_id(mat) if mat > 0 else 'void' + for mat in fill_id] else: - fill = 'void' + if fill_id > 0: + fill = self.get_material_by_id(fill_id) + else: + fill = 'void' elif fill_type == 'universe': fill = self.get_universe_by_id(fill_id) else: diff --git a/src/initialize.F90 b/src/initialize.F90 index 7457be90d..2c44755d2 100644 --- a/src/initialize.F90 +++ b/src/initialize.F90 @@ -1038,7 +1038,7 @@ contains integer, intent(out), allocatable :: counts(:,:) ! Target count logical, intent(out), allocatable :: found(:,:) ! Target found - integer :: i, j, k, l, m ! Loop counters + integer :: i, j, k ! Loop counters type(SetInt) :: cell_list ! distribells to track type(Universe), pointer :: univ ! pointer to universe class(Lattice), pointer :: lat ! pointer to lattice diff --git a/src/summary.F90 b/src/summary.F90 index 3fcc3e5c9..deccaddf5 100644 --- a/src/summary.F90 +++ b/src/summary.F90 @@ -107,6 +107,7 @@ contains integer :: i, j, k, m integer, allocatable :: lattice_universes(:,:,:) + integer, allocatable :: cell_materials(:) integer(HID_T) :: geom_group integer(HID_T) :: cells_group, cell_group integer(HID_T) :: surfaces_group, surface_group @@ -150,10 +151,16 @@ contains select case (c%type) case (CELL_NORMAL) call write_dataset(cell_group, "fill_type", "normal") - if (c%material(1) == MATERIAL_VOID) then - call write_dataset(cell_group, "material", -1) + if (size(c % material) == 1) then + call write_dataset(cell_group, "material", & + materials(c % material(1)) % id) else - call write_dataset(cell_group, "material", materials(c%material(1))%id) + allocate(cell_materials(size(c % material))) + do j = 1, size(c % material) + cell_materials(j) = materials(c % material(j)) % id + end do + call write_dataset(cell_group, "material", cell_materials) + deallocate(cell_materials) end if case (CELL_FILL) diff --git a/tests/test_distribmat/inputs_true.dat b/tests/test_distribmat/inputs_true.dat index 72d296c9b..48044e287 100644 --- a/tests/test_distribmat/inputs_true.dat +++ b/tests/test_distribmat/inputs_true.dat @@ -1 +1 @@ -dcb9a612432305763ad10aaaab3ed095716cbb73f6b357ec180d300ccf365f9781aac7b1f3228c8756ceccf6aa230d0e03cf18ef2c0bc21fba1f082c3d5d6896 \ No newline at end of file +24a3537446feafcf79fc84d268b43130e9521ad7cccfcf733ba35ca50bf3c644e0b8e91bfdef7bdb4073783197cfdd730d1e459fc622aa3ce6dcf3143c805a1f \ No newline at end of file diff --git a/tests/test_distribmat/results_true.dat b/tests/test_distribmat/results_true.dat index 9481371d8..5e93e4e47 100644 --- a/tests/test_distribmat/results_true.dat +++ b/tests/test_distribmat/results_true.dat @@ -1,2 +1,11 @@ k-combined: 1.433669E+00 7.069157E-03 +Cell + ID = 11 + Name = + Material = [2, 3, 2, 2] + Region = -10000 + Rotation = None + Translation = None + Offset = None + Distribcell index= 1 diff --git a/tests/test_distribmat/test_distribmat.py b/tests/test_distribmat/test_distribmat.py index b6bffd90d..61e40e64c 100644 --- a/tests/test_distribmat/test_distribmat.py +++ b/tests/test_distribmat/test_distribmat.py @@ -86,7 +86,7 @@ class DistribmatTestHarness(PyAPITestHarness): sets_file.inactive = 0 sets_file.particles = 1000 sets_file.set_source_space('box', [-1, -1, -1, 1, 1, 1]) - #sets_file.output = {'summary': True} + sets_file.output = {'summary': True} sets_file.export_to_xml() @@ -116,6 +116,15 @@ class DistribmatTestHarness(PyAPITestHarness): # # plots_file.export_to_xml() + def _get_results(self): + outstr = super(DistribmatTestHarness, self)._get_results() + su = openmc.Summary('summary.h5') + outstr += str(su.get_cell_by_id(11)) + return outstr + +# def _cleanup(self): +# return None + if __name__ == '__main__': harness = DistribmatTestHarness('statepoint.5.*')