Region
Operation |
Symbol (Python) |
Symbol (MCNP) |
Semantics |
|---|---|---|---|
Union |
|
|
OR |
Intersection |
|
space |
AND |
Complement |
|
|
NOT |
Note
Complements may be applied to cells or regions.
- class mcnpy.Region(*args, **kwargs)[source]
Bases:
Region,ABCA representation of the model object Region.
- static from_expression(expression, surfaces, cells)[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 surfaces referenced by a region and return them
- Parameters
surfaces (collections.OrderedDict, optional) – Dictionary mapping surface IDs to
mcnpy.Surfaceinstances- Returns
surfaces – Dictionary mapping surface IDs to
mcnpy.Surfaceinstances- Return type
collections.OrderedDict
- class mcnpy.Intersection(*args, **kwargs)[source]
Bases:
Intersection,Region,MutableSequenceA representation of the model object Intersection.
- Parameters
nodes (iterable of mcnpy.Region) – Nodes for Intersection.
- class mcnpy.Union(*args, **kwargs)[source]
Bases:
Union,Region,MutableSequenceA representation of the model object Union.
- Parameters
nodes (iterable of mcnpy.Region) – Nodes for Union.
- class mcnpy.Complement(*args, **kwargs)[source]
Bases:
Complement,RegionA representation of the model object Complement.
- Parameters
cell (mcnpy.Cell) – Cell for Complement.
node (mcnpy.Region) – Node for Complement.
- get_surfaces(surfaces=None)[source]
Recursively find and return all the surfaces referenced by the node
- Parameters
surfaces (collections.OrderedDict, optional) – Dictionary mapping surface IDs to
mcnpy.Surfaceinstances- Returns
surfaces – Dictionary mapping surface IDs to
mcnpy.Surfaceinstances- Return type
collections.OrderedDict