Got rid of maps, offset_size, translated, and rotated datasets.

This commit is contained in:
Paul Romano 2015-09-25 10:53:36 +07:00
parent 759f96c9e0
commit 9bc3b3358c
3 changed files with 22 additions and 70 deletions

View file

@ -96,32 +96,16 @@ The current revision of the summary file format is 1.
Unique ID of the material assigned to the cell. This dataset is present only
if fill_type is set to 'normal'.
**/geometry/cells/cell <uid>/maps** (*int*)
TODO: Add description.
**/geometry/cells/cell <uid>/offset** (*int[]*)
Offset used for distribcell tally filter. This dataset is present only if
Offsets used for distribcell tally filter. This dataset is present only if
fill_type is set to 'universe'.
**/geometry/cells/cell <uid>/translated** (*int*)
Indicates if a translation is to be applied to the fill universe if one is
present. Note that this dataset assumes values of 0 or 1. This dataset is
present only if fill_type is set to 'universe'.
**/geometry/cells/cell <uid>/translation** (*double[3]*)
Translation applied to the fill universe. This dataset is present only if
fill_type is set to 'universe'.
**/geometry/cells/cell <uid>/rotated** (*int*)
Indicates if a rotation is to be applied to the fill universe if one is
present. Note that this dataset assumes values of 0 or 1. This dataset is
present only if fill_type is set to 'universe'.
**/geometry/cells/cell <uid>/rotation** (*double[3]*)
Angles in degrees about the x-, y-, and z-axes for which the fill universe
@ -188,14 +172,6 @@ The current revision of the summary file format is 1.
Outer universe assigned to lattice cells outside the defined range.
**/geometry/lattices/lattice <uid>/offset_size** (*int[]*)
TODO: Explain offset_size
**/geometry/lattices/lattice <uid>/maps** (*int*)
TODO: Explain maps
**/geometry/lattices/lattice <uid>/offsets** (*int[]*)
Offsets used for distribcell tally filter.

View file

@ -224,21 +224,17 @@ class Summary(object):
cell = openmc.Cell(cell_id=cell_id, name=name)
if fill_type == 'universe':
maps = self._f['geometry/cells'][key]['maps'].value
if maps > 0:
if 'offset' in self._f['geometry/cells'][key]:
offset = self._f['geometry/cells'][key]['offset'][...]
cell.offsets = offset
translated = self._f['geometry/cells'][key]['translated'].value
if translated:
if 'translation' in self._f['geometry/cells'][key]:
translation = \
self._f['geometry/cells'][key]['translation'][...]
translation = np.asarray(translation, dtype=np.float64)
cell.translation = translation
rotated = self._f['geometry/cells'][key]['rotated'].value
if rotated:
if 'rotation' in self._f['geometry/cells'][key]:
rotation = \
self._f['geometry/cells'][key]['rotation'][...]
rotation = np.asarray(rotation, dtype=np.int)
@ -301,11 +297,11 @@ class Summary(object):
index = self._f['geometry/lattices'][key]['index'].value
name = self._f['geometry/lattices'][key]['name'].value.decode()
lattice_type = self._f['geometry/lattices'][key]['type'].value.decode()
maps = self._f['geometry/lattices'][key]['maps'].value
offset_size = self._f['geometry/lattices'][key]['offset_size'].value
if offset_size > 0:
if 'offsets' in self._f['geometry/lattices'][key]:
offsets = self._f['geometry/lattices'][key]['offsets'][...]
else:
offsets = None
if lattice_type == 'rectangular':
dimension = self._f['geometry/lattices'][key]['dimension'][...]
@ -346,7 +342,7 @@ class Summary(object):
universes = universes[:, ::-1, :]
lattice.universes = universes
if offset_size > 0:
if offsets:
offsets = np.swapaxes(offsets, 0, 1)
offsets = np.swapaxes(offsets, 1, 2)
lattice.offsets = offsets
@ -440,7 +436,7 @@ class Summary(object):
# Lattice is 2D; extract the only axial level
lattice.universes = universes[0]
if offset_size > 0:
if offsets:
lattice.offsets = offsets
# Add the Lattice to the global dictionary of all Lattices

View file

@ -157,23 +157,15 @@ contains
case (CELL_FILL)
call write_dataset(cell_group, "fill_type", "universe")
call write_dataset(cell_group, "fill", universes(c%fill)%id)
call write_dataset(cell_group, "maps", size(c%offset))
if (size(c%offset) > 0) then
call write_dataset(cell_group, "offset", c%offset)
end if
if (allocated(c%translation)) then
call write_dataset(cell_group, "translated", 1)
call write_dataset(cell_group, "translation", c%translation)
else
call write_dataset(cell_group, "translated", 0)
end if
if (allocated(c%rotation)) then
call write_dataset(cell_group, "rotated", 1)
call write_dataset(cell_group, "rotation", c%rotation)
else
call write_dataset(cell_group, "rotated", 0)
end if
case (CELL_LATTICE)
@ -298,10 +290,16 @@ contains
! Write internal OpenMC index for this lattice
call write_dataset(lattice_group, "index", i)
! Write name for this lattice
! Write name, pitch, and outer universe
call write_dataset(lattice_group, "name", lat%name)
call write_dataset(lattice_group, "pitch", lat%pitch)
call write_dataset(lattice_group, "outer", lat%outer)
! Write distribcell offsets if present
if (size(lat%offset) > 0) then
call write_dataset(lattice_group, "offsets", lat%offset)
end if
! Write lattice type
select type (lat)
type is (RectLattice)
! Write lattice type.
@ -310,15 +308,6 @@ contains
! Write lattice dimensions, lower left corner, and pitch
call write_dataset(lattice_group, "dimension", lat%n_cells)
call write_dataset(lattice_group, "lower_left", lat%lower_left)
call write_dataset(lattice_group, "pitch", lat%pitch)
call write_dataset(lattice_group, "outer", lat%outer)
call write_dataset(lattice_group, "offset_size", size(lat%offset))
call write_dataset(lattice_group, "maps", size(lat%offset,1))
if (size(lat%offset) > 0) then
call write_dataset(lattice_group, "offsets", lat%offset)
end if
! Write lattice universes.
allocate(lattice_universes(lat%n_cells(1), lat%n_cells(2), &
@ -330,8 +319,6 @@ contains
end do
end do
end do
call write_dataset(lattice_group, "universes", lattice_universes)
deallocate(lattice_universes)
type is (HexLattice)
! Write lattice type.
@ -341,17 +328,8 @@ contains
call write_dataset(lattice_group, "n_rings", lat%n_rings)
call write_dataset(lattice_group, "n_axial", lat%n_axial)
! Write lattice center, pitch and outer universe.
! Write lattice center
call write_dataset(lattice_group, "center", lat%center)
call write_dataset(lattice_group, "pitch", lat%pitch)
call write_dataset(lattice_group, "outer", lat%outer)
call write_dataset(lattice_group, "offset_size", size(lat%offset))
call write_dataset(lattice_group, "maps", size(lat%offset,1))
if (size(lat%offset) > 0) then
call write_dataset(lattice_group, "offsets", lat%offset)
end if
! Write lattice universes.
allocate(lattice_universes(2*lat%n_rings - 1, 2*lat%n_rings - 1, &
@ -372,10 +350,12 @@ contains
end do
end do
end do
call write_dataset(lattice_group, "universes", lattice_universes)
deallocate(lattice_universes)
end select
! Write lattice universes
call write_dataset(lattice_group, "universes", lattice_universes)
deallocate(lattice_universes)
call close_group(lattice_group)
end do LATTICE_LOOP