openmc.Region

class openmc.Region[source]

Region of space that can be assigned to a cell.

Region is an abstract base class that is inherited by openmc.Halfspace, openmc.Intersection, openmc.Union, and openmc.Complement. Each of those respective classes are typically not instantiated directly but rather are created through operators of the Surface and Region classes.

clone(memo=None)[source]

Create a copy of this region - each of the surfaces in the region’s nodes will be cloned and will have new unique IDs.

Parameters:memo (dict or None) – A nested dictionary of previously cloned objects. This parameter is used internally and should not be specified by the user.
Returns:clone – The clone of this region
Return type:openmc.Region
static from_expression(expression, surfaces)[source]

Generate a region given an infix expression.

Parameters:
  • expression (str) – Boolean expression relating surface half-spaces. The possible operators are union ‘|’, intersection ‘ ‘, and complement ‘~’. For example, ‘(1 -2) | 3 ~(4 -5)’.
  • surfaces (dict) – Dictionary whose keys are suface IDs that appear in the Boolean expression and whose values are Surface objects.
get_surfaces(surfaces=None)[source]

Recursively find all the surfaces referenced by a region and return them

Parameters:surfaces (collections.OrderedDict, optional) – Dictionary mapping surface IDs to openmc.Surface instances
Returns:surfaces – Dictionary mapping surface IDs to openmc.Surface instances
Return type:collections.OrderedDict
translate(vector, memo=None)[source]

Translate region in given direction

Parameters:
  • vector (iterable of float) – Direction in which region should be translated
  • memo (dict or None) – Dictionary used for memoization. This parameter is used internally and should not be specified by the user.
Returns:

Translated region

Return type:

openmc.Region