montepy.surfaces.cylinder_on_axis module

class montepy.surfaces.cylinder_on_axis.CylinderOnAxis(input=None)

Bases: Surface

Represents surfaces: CX, CY, CZ

Parameters:

input (Input) – The Input object representing the input

property allowed_keywords

The allowed keywords for this class of MCNP_Card.

The allowed keywords that would appear in the parameters block. For instance for cells the keywords IMP and VOL are allowed. The allowed keywords need to be in upper case.

Deprecated since version 0.2.0: This is no longer needed. Instead this is specified in montepy.input_parser.tokens.MCNP_Lexer._KEYWORDS().

Returns:

A set of the allowed keywords. If there are none this should return the empty set.

Return type:

set

property cells

A generator of Cells that use this surface.

Return type:

generator

property comments

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

static compress_jump_values(values)

Takes a list of strings and jump values and combines repeated jump values.

e.g., 1 1 J J 3 J becomes 1 1 2J 3 J

Deprecated since version 0.2.0: This should be automatically handled by the syntax tree instead.

Parameters:

values (list) – a list of string and Jump values to try to compress

Returns:

a list of MCNP word strings that have jump compression

Return type:

list

Raises:

DeprecationWarning – raised always.

static compress_repeat_values(values, threshold=1e-06)

Takes a list of floats, and tries to compress it using repeats.

E.g., 1 1 1 1 would compress to 1 3R

Deprecated since version 0.2.0: This should be automatically handled by the syntax tree instead.

Parameters:
  • values (list) – a list of float values to try to compress

  • threshold (float) – the minimum threshold to consider two values different

Returns:

a list of MCNP word strings that have repeat compression

Return type:

list

Raises:

DeprecationWarning – always raised.

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)

Creates a string representation of this MCNP_Object that can be written to file.

Parameters:

mcnp_version (tuple) – 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

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

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

Added in version 0.2.0.

Returns:

the leading comments.

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.

property number

The surface number to use.

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

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.

Rytpe:

dict

property periodic_surface

The surface that this surface is periodic with respect to

Return type:

Surface

property radius

The radius of the cylinder

Return type:

float

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

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

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.

Raises:

IllegalState if any condition exists that make the object incomplete.

property words

The words from the input file for this card.

Warning

Deprecated since version 0.2.0: This has been replaced by the syntax tree data structure.

Raises:

DeprecationWarning – Access the syntax tree instead.

static wrap_string_for_mcnp(string, mcnp_version, is_first_line)

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.

Returns:

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

Return type:

list

static wrap_words_for_mcnp(words, mcnp_version, is_first_line)

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

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

Deprecated since version 0.2.0: The concept of words is deprecated, and should be handled by syntax trees now.

Parameters:
  • words (list) – A list of the “words” or data-grams that needed to added to this card. Each word will be separated by at least one space.

  • 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 card. The first line will not be indented.

Returns:

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

Return type:

list

Raises:

DeprecationWarning – raised always.