montepy.surfaces.axis_plane module#

Classes:

AxisPlane([input, number, surface_type])

Represents PX, PY, PZ

class montepy.surfaces.axis_plane.AxisPlane(input: Input | str = None, number: int = None, surface_type: SurfaceType | str = None)#

Bases: Surface

Represents PX, PY, PZ

Changed in version 1.0.0: Added number parameter

Parameters:
  • input (Union[Input, str]) – The Input object representing the input

  • number (int) – The number to set for this object.

  • surface_type (Union[SurfaceType, str]) – The surface_type to set for this object

Methods:

clone([starting_number, step])

Create a new independent instance of this object with a new number.

find_duplicate_surfaces(surfaces, tolerance)

Finds all surfaces that are effectively the same as this one.

format_for_mcnp_input(mcnp_version)

Creates a list of strings representing this MCNP_Object that can be written to file.

link_to_problem(problem)

Links the input to the parent problem for this input.

mcnp_str([mcnp_version])

Returns a string of this input as it would appear in an MCNP input file.

update_pointers(surfaces, data_inputs)

Updates the internal pointers to the appropriate objects.

validate()

Validates that the object is in a usable state.

wrap_string_for_mcnp(string, mcnp_version, ...)

Wraps the list of the words to be a well formed MCNP input.

Attributes:

COORDINATE

cells

A generator of Cells that use this surface.

comments

The comments associated with this input if any.

is_reflecting

If true this surface is a reflecting boundary.

is_white_boundary

If true this surface is a white boundary.

leading_comments

Any comments that come before the beginning of the input proper.

location

The location of the plane in space.

number

The current number of the object that will be written out to a new input.

old_number

The surface number that was used in the read file

old_periodic_surface

The surface number this is periodic with reference to in the original file.

old_transform_number

The transformation number for this surface in the original file.

parameters

A dictionary of the additional parameters for the object.

periodic_surface

The surface that this surface is periodic with respect to

surface_constants

The constants defining the surface

surface_type

The mnemonic for the type of surface.

trailing_comment

The trailing comments and padding of an input.

transform

The Transform object that translates this surface

static wrap_string_for_mcnp(string, mcnp_version, is_first_line, suppress_blank_end=True) list[str]#

Wraps the list of the words to be a well formed MCNP input.

multi-line inputs will be handled by using the indentation format, and not the “&” method.

Parameters:
  • string (str) – A long string with new lines in it, that needs to be chunked appropriately for MCNP inputs

  • mcnp_version (tuple) – the tuple for the MCNP that must be formatted for.

  • is_first_line (bool) – If true this will be the beginning of an MCNP input. The first line will not be indented.

  • suppress_blank_end (bool) – Whether or not to suppress any blank lines that would be added to the end. Good for anywhere but cell modifiers in the cell block.

Returns:

A list of strings that can be written to an input file, one item to a line.

Return type:

list

clone(starting_number=None, step=None)#

Create a new independent instance of this object with a new number.

This relies mostly on copy.deepcopy.

Notes

If starting_number, or step are not specified starting_number(), and step() are used as default values, if this object is tied to a problem. For instance a Material will use problem.materials default information. Otherwise 1 will be used as default values

Added in version 0.5.0.

Parameters:
  • starting_number (int) – The starting number to request for a new object number.

  • step (int) – the step size to use to find a new valid number.

Returns:

a cloned copy of this object.

Return type:

type(self)

find_duplicate_surfaces(surfaces, tolerance)#

Finds all surfaces that are effectively the same as this one.

Parameters:
  • surfaces (list) – a list of the surfaces to compare against this one.

  • tolerance (float) – the amount of relative error to allow

Returns:

A list of the surfaces that are identical

Return type:

list

format_for_mcnp_input(mcnp_version: tuple[int]) list[str]#

Creates a list of strings representing this MCNP_Object that can be written to file.

Parameters:

mcnp_version (tuple[int]) – The tuple for the MCNP version that must be exported to.

Returns:

a list of strings for the lines that this input will occupy.

Return type:

list

Links the input to the parent problem for this input.

This is done so that inputs can find links to other objects.

Parameters:

problem (MCNP_Problem) – The problem to link this input to.

mcnp_str(mcnp_version: tuple[int] = None)#

Returns a string of this input as it would appear in an MCNP input file.

..versionadded:: 1.0.0

Parameters:

mcnp_version (tuple[int]) – The tuple for the MCNP version that must be exported to.

Returns:

The string that would have been printed in a file

Return type:

str

update_pointers(surfaces, data_inputs)#

Updates the internal pointers to the appropriate objects.

Right now only periodic surface links will be made. Eventually transform pointers should be made.

Parameters:
  • surfaces (Surfaces) – A Surfaces collection of the surfaces in the problem.

  • data_cards (list) – the data_cards in the problem.

validate()#

Validates that the object is in a usable state.

COORDINATE = {SurfaceType.PX: 'x', SurfaceType.PY: 'y', SurfaceType.PZ: 'z'}#
property cells#

A generator of Cells that use this surface.

Return type:

generator

property comments: list[PaddingNode]#

The comments associated with this input if any.

This includes all C comments before this card that aren’t part of another card, and any comments that are inside this card.

Returns:

a list of the comments associated with this comment.

Return type:

list

property is_reflecting#

If true this surface is a reflecting boundary.

Return type:

bool

property is_white_boundary#

If true this surface is a white boundary.

Return type:

bool

property leading_comments: list[PaddingNode]#

Any comments that come before the beginning of the input proper.

Returns:

the leading comments.

Return type:

list

property location#

The location of the plane in space.

Return type:

float

property number#

The current number of the object that will be written out to a new input.

Return type:

int

property old_number#

The surface number that was used in the read file

Return type:

int

property old_periodic_surface#

The surface number this is periodic with reference to in the original file.

Return type:

int

property old_transform_number#

The transformation number for this surface in the original file.

Return type:

int

property parameters: dict[str, str]#

A dictionary of the additional parameters for the object.

e.g.: 1 0 -1 u=1 imp:n=0.5 has the parameters {"U": "1", "IMP:N": "0.5"}

Returns:

a dictionary of the key-value pairs of the parameters.

Return type:

unknown

Rytpe:

dict

property periodic_surface#

The surface that this surface is periodic with respect to

Return type:

Surface

property surface_constants#

The constants defining the surface

Return type:

list

property surface_type#

The mnemonic for the type of surface.

E.g. CY, PX, etc.

Return type:

SurfaceType

property trailing_comment: list[PaddingNode]#

The trailing comments and padding of an input.

Generally this will be blank as these will be moved to be a leading comment for the next input.

Returns:

the trailing c style comments and intermixed padding (e.g., new lines)

Return type:

list

property transform#

The Transform object that translates this surface

Return type:

Transform