Small fixes for #538

This commit is contained in:
Sterling Harper 2015-12-30 15:57:44 -05:00
parent 56e8e7d681
commit 33375dfa30
4 changed files with 22 additions and 21 deletions

View file

@ -609,7 +609,7 @@ class Filter(object):
# If this region is in Cell corresponding to the
# distribcell filter bin, store it in dictionary
if cell_id == self.bins[0]:
offset = openmc_geometry.get_offset(path)
offset = openmc_geometry.get_cell_instance(path)
offsets_to_coords[offset] = coords
# Each distribcell offset is a DataFrame bin

View file

@ -42,7 +42,7 @@ class Geometry(object):
self._root_universe = root_universe
def get_offset(self, path):
def get_cell_instance(self, path):
"""Returns the corresponding location in the results array for a given path and
filter number. This is primarily intended to post-processing result when
a distribcell filter is used.
@ -77,7 +77,8 @@ class Geometry(object):
# Begin recursive call to compute offset starting with the base Universe
else:
offset = self._root_universe.get_offset(path, distribcell_ind)
offset = self._root_universe.get_cell_instance(path,
distribcell_ind)
self._offsets[(path, distribcell_ind)] = offset
# Return the final offset

View file

@ -285,7 +285,7 @@ class Cell(object):
else:
self.region = Intersection(self.region, region)
def get_offset(self, path, distribcell_ind):
def get_cell_instance(self, path, distribcell_ind):
# Get the current element and remove it from the list
cell_id = path[0]
path = path[1:]
@ -296,12 +296,12 @@ class Cell(object):
# If the Cell is filled by a Universe
elif self._type == 'fill':
offset = self._offsets[distribcell_ind-1]
offset += self._fill.get_offset(path, distribcell_ind)
offset = self.offsets[distribcell_ind-1]
offset += self.fill.get_cell_instance(path, distribcell_ind)
# If the Cell is filled by a Lattice
else:
offset = self._fill.get_offset(path, distribcell_ind)
offset = self.fill.get_cell_instance(path, distribcell_ind)
return offset
@ -605,7 +605,7 @@ class Universe(object):
self._cells.clear()
def get_offset(self, path, distribcell_ind):
def get_cell_instance(self, path, distribcell_ind):
# Get the current element and remove it from the list
path = path[1:]
@ -613,7 +613,7 @@ class Universe(object):
cell_id = path[0]
# Make a recursive call to the Cell within this Universe
offset = self._cells[cell_id].get_offset(path, distribcell_ind)
offset = self.cells[cell_id].get_cell_instance(path, distribcell_ind)
# Return the offset computed at all nested Universe levels
return offset
@ -1073,7 +1073,7 @@ class RectLattice(Lattice):
cv.check_greater_than('lattice pitch', dim, 0.0)
self._pitch = pitch
def get_offset(self, path, distribcell_ind):
def get_cell_instance(self, path, distribcell_ind):
# Get the current element and remove it from the list
i = path[0]
path = path[1:]
@ -1081,14 +1081,14 @@ class RectLattice(Lattice):
# For 2D Lattices
if len(self._dimension) == 2:
offset = self._offsets[i[1]-1, i[2]-1, 0, distribcell_ind-1]
offset += self._universes[i[1]][i[2]].get_offset(path,
distribcell_ind)
offset += self._universes[i[1]][i[2]].get_cell_instance(path,
distribcell_ind)
# For 3D Lattices
else:
offset = self._offsets[i[1]-1, i[2]-1, i[3]-1, distribcell_ind-1]
offset += self._universes[i[1]-1][i[2]-1][i[3]-1].get_offset(path,
distribcell_ind)
offset += self._universes[i[1]-1][i[2]-1][i[3]-1].get_cell_instance(
path, distribcell_ind)
return offset

View file

@ -1086,16 +1086,16 @@ contains
found(:,:) = .false.
k = 1
! Search through universes for distributed cells and assign each one a
! unique distribcell array index.
do i = 1, n_universes
univ => universes(i)
do j = 1, univ % n_cells
if (.not. cell_list % contains(univ % cells(j))) cycle
cells(univ % cells(j)) % distribcell_ind = k
univ_list(k) = univ % id
k = k + 1
if (cell_list % contains(univ % cells(j))) then
cells(univ % cells(j)) % distribcell_ind = k
univ_list(k) = univ % id
k = k + 1
end if
end do
end do