Update summary.h5 files for distribmat

This commit is contained in:
Sterling Harper 2016-01-09 23:02:29 -05:00
parent 12844d0dd1
commit d5d486536b
6 changed files with 39 additions and 9 deletions

View file

@ -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:

View file

@ -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

View file

@ -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)

View file

@ -1 +1 @@
dcb9a612432305763ad10aaaab3ed095716cbb73f6b357ec180d300ccf365f9781aac7b1f3228c8756ceccf6aa230d0e03cf18ef2c0bc21fba1f082c3d5d6896
24a3537446feafcf79fc84d268b43130e9521ad7cccfcf733ba35ca50bf3c644e0b8e91bfdef7bdb4073783197cfdd730d1e459fc622aa3ce6dcf3143c805a1f

View file

@ -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

View file

@ -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.*')