montepy.UnitHalfSpace#
- class montepy.UnitHalfSpace(divider, side, is_cell, node=None)#
Bases:
HalfSpaceThe leaf node for the HalfSpace tree.
This can only be used as leaves and represents one half_space of a a divider. The easiest way to generate one is with the divider with unary operators. For surfaces you can choose the positive (True) or negative (False) side quickly:
bottom_half = -surf top_half = +surf
For a cell you can only take the complement:
comp = ~cell
Note
When you complement a cell you don’t actually get a UnitHalfSpace directly. You get a UnitHalfSpace wrapped with a complementing HalfSpace Tree
HalfSpace / # \ UnitHalfSpace None | Cell- Parameters:
Methods:
parse_input_node(node[, is_cell])Parses the given syntax node as a UnitHalfSpace.
remove_duplicate_surfaces(deleting_dict)Updates old surface numbers to prepare for deleting surfaces.
update_pointers(cells, surfaces, cell)Update pointers, and link this object to other objects in the problem.
Attributes:
The divider this UnitHalfSpace is based on.
Whether or not the divider this uses is a cell.
The left side of the binary tree of this half_space.
The node that this UnitHalfSpace is based on if any.
The operator for applying to this binary tree.
The right side of the binary tree of this half_space if any.
Which side of the divider this HalfSpace is on.
- static parse_input_node(node, is_cell=False)#
Parses the given syntax node as a UnitHalfSpace.
- Parameters:
- Returns:
the HalfSpace properly representing the input geometry.
- Return type:
- _update_values()#
- remove_duplicate_surfaces(deleting_dict: dict[int, tuple[Surface, Surface]])#
Updates old surface numbers to prepare for deleting surfaces.
This will ensure any new surfaces or complements properly get added to the parent cell’s
surfacesandcomplements.Changed in version 1.0.0: The form of the deleting_dict was changed as
Surfaceis no longer hashable.
- update_pointers(cells, surfaces, cell)#
Update pointers, and link this object to other objects in the problem.
This will:
Link this HalfSpace (and its children) to the parent cell.
Update the divider parameter to point to the relevant surface or cell.
Update the parent’s
surfaces, andcomplements.
- property divider#
The divider this UnitHalfSpace is based on.
- property is_cell#
Whether or not the divider this uses is a cell.
- Returns:
True if this is a cell based HalfSpace
- Return type:
- property left#
The left side of the binary tree of this half_space.
- Returns:
the left side of the tree.
- Return type:
- property node#
The node that this UnitHalfSpace is based on if any.
- Returns:
The ValueNode that this UnitHalfSpace is tied to.
- Return type:
- property operator#
The operator for applying to this binary tree.
- Returns:
the operator for the tree.
- Return type:
- property right#
The right side of the binary tree of this half_space if any.
- Returns:
the right side of the tree.
- Return type:
- property side#
Which side of the divider this HalfSpace is on.
This maps the conventional positive/negative half_spaces of MCNP to boolean values. True is the positive side, and False is the negative one. For cells this is always True as the Complementing logic is handled by the parent binary tree.
- Returns:
the side of the divider for the HalfSpace
- Return type: