openmc.Union

class openmc.Union(nodes)[source]

Union of two or more regions.

Instances of Union are generally created via the | operator applied to two instances of openmc.Region. This is illustrated in the following example:

>>> s1 = openmc.ZPlane(z0=0.0)
>>> s2 = openmc.Sphere(r=637.1e6)
>>> type(-s2 | +s1)
<class 'openmc.region.Union'>

Instances of this class behave like a mutable sequence, e.g., they can be indexed and have an append() method.

Parameters:nodes (iterable of openmc.Region) – Regions to take the union of
Variables:bounding_box (2-tuple of numpy.array) – Lower-left and upper-right coordinates of an axis-aligned bounding box
clone(memo=None)[source]

Create a copy of this region - each of the surfaces in the union’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 union
Return type:openmc.Union
insert(index, value)[source]

S.insert(index, value) – insert value before index

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.Union