mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Addressed comments by @wbinventor
This commit is contained in:
parent
8a275bbd77
commit
30548c7c80
3 changed files with 15 additions and 11 deletions
|
|
@ -271,7 +271,7 @@ class Geometry(object):
|
|||
surfaces = OrderedDict()
|
||||
|
||||
for cell in self.get_all_cells().values():
|
||||
surfaces = cell.region.get_surfaces_from_region(surfaces)
|
||||
surfaces = cell.region.get_surfaces(surfaces)
|
||||
return surfaces
|
||||
|
||||
def get_materials_by_name(self, name, case_sensitive=False, matching=False):
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class Region(object):
|
|||
def __ne__(self, other):
|
||||
return not self == other
|
||||
|
||||
def get_surfaces_from_region(self, surfaces = OrderedDict()):
|
||||
def get_surfaces(self, surfaces=None):
|
||||
"""
|
||||
Recursively find all the surfaces referenced by a region and return them
|
||||
|
||||
|
|
@ -61,8 +61,10 @@ class Region(object):
|
|||
Dictionary mapping surface IDs to :class:`openmc.Surface` instances
|
||||
|
||||
"""
|
||||
if not surfaces:
|
||||
surfaces = OrderedDict()
|
||||
for region in self:
|
||||
surfaces = region.get_surfaces_from_region(surfaces)
|
||||
surfaces = region.get_surfaces(surfaces)
|
||||
return surfaces
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -451,10 +453,9 @@ class Complement(Region):
|
|||
temp_region = ~self.node
|
||||
return temp_region.bounding_box
|
||||
|
||||
def get_surfaces_from_region(self, surfaces = OrderedDict()):
|
||||
def get_surfaces(self, surfaces=None):
|
||||
"""
|
||||
Recursively find all the surfaces referenced by the complement's node and return them
|
||||
Overwrites method Region.get_surfaces_from_region()
|
||||
Recursively find and return all the surfaces referenced by the node
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -467,6 +468,8 @@ class Complement(Region):
|
|||
Dictionary mapping surface IDs to :class:`openmc.Surface` instances
|
||||
|
||||
"""
|
||||
if not surfaces:
|
||||
surfaces = OrderedDict()
|
||||
for region in self.node:
|
||||
surfaces = region.get_surfaces_from_region(surfaces)
|
||||
surfaces = region.get_surfaces(surfaces)
|
||||
return surfaces
|
||||
|
|
|
|||
|
|
@ -1881,10 +1881,9 @@ class Halfspace(Region):
|
|||
return '-' + str(self.surface.id) if self.side == '-' \
|
||||
else str(self.surface.id)
|
||||
|
||||
def get_surfaces_from_region(self, surfaces = OrderedDict()):
|
||||
def get_surfaces(self, surfaces=None):
|
||||
"""
|
||||
Returns the surface that this is a halfspace of.
|
||||
Overwrites method Region.get_surfaces_from_region()
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -1897,8 +1896,10 @@ class Halfspace(Region):
|
|||
Dictionary mapping surface IDs to :class:`openmc.Surface` instances
|
||||
|
||||
"""
|
||||
if self.surface.id not in surfaces:
|
||||
surfaces[self.surface.id] = self.surface
|
||||
if not surfaces:
|
||||
surfaces = OrderedDict()
|
||||
|
||||
surfaces[self.surface.id] = self.surface
|
||||
return surfaces
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue