From c4b83ced54a66dd52d229507edf2214beddea1f3 Mon Sep 17 00:00:00 2001 From: "wbinventor@gmail.com" Date: Wed, 30 Dec 2015 14:43:33 -0500 Subject: [PATCH] Fixed bugs in OpenCG compatiblity and Summary Python modules for new z-y-z Universe ordering --- openmc/opencg_compatible.py | 6 +++--- openmc/summary.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openmc/opencg_compatible.py b/openmc/opencg_compatible.py index afa57c78d9..62192355de 100644 --- a/openmc/opencg_compatible.py +++ b/openmc/opencg_compatible.py @@ -905,7 +905,7 @@ def get_opencg_lattice(openmc_lattice): for z in range(dimension[2]): for y in range(dimension[1]): for x in range(dimension[0]): - universe_id = universes[x][dimension[1]-y-1][z].id + universe_id = universes[z][dimension[1]-y-1][x].id universe_array[z][y][x] = unique_universes[universe_id] opencg_lattice = opencg.Lattice(lattice_id, name) @@ -963,7 +963,7 @@ def get_openmc_lattice(opencg_lattice): outer = opencg_lattice.outside # Initialize an empty array for the OpenMC nested Universes in this Lattice - universe_array = np.ndarray(tuple(np.array(dimension)), + universe_array = np.ndarray(tuple(np.array(dimension)[::-1]), dtype=openmc.Universe) # Create OpenMC Universes for each unique nested Universe in this Lattice @@ -977,7 +977,7 @@ def get_openmc_lattice(opencg_lattice): for y in range(dimension[1]): for x in range(dimension[0]): universe_id = universes[z][y][x].id - universe_array[x][y][z] = unique_universes[universe_id] + universe_array[z][y][x] = unique_universes[universe_id] # Reverse y-dimension in array to match ordering in OpenCG universe_array = universe_array[:, ::-1, :] diff --git a/openmc/summary.py b/openmc/summary.py index bc6551e7cb..3d0e37ddad 100644 --- a/openmc/summary.py +++ b/openmc/summary.py @@ -356,8 +356,8 @@ class Summary(object): self.get_universe_by_id(universe_ids[x, y, z]) # Transpose, reverse y-dimension for appropriate ordering - shape = universes.shape - universes = np.transpose(universes, (1, 0, 2)) + shape = universes.shape[::-1] + universes = np.transpose(universes, (2, 1, 0)) universes.shape = shape universes = universes[:, ::-1, :] lattice.universes = universes