zasim.cagen.border - Handling borders

Inheritance diagram of zasim.cagen.border

class zasim.cagen.border.BorderSizeEnsurer[source]

Bases: zasim.cagen.bases.BorderHandler

The BorderSizeEnsurer ensures, that - depending on the bounding box returned by Neighbourhood.bounding_box() - the underlying config array is big enough, so that getting the neighbourhood from the outermost cells will not access outside the bounds of the array.

resize_array(array)[source]
new_config()[source]

Resizes the configuration array.

is_position_valid(pos)[source]
correct_position(pos)[source]
class zasim.cagen.border.BaseBorderCopier[source]

Bases: zasim.cagen.border.BorderSizeEnsurer

This base class for border copiers executes a retargetted version of the pure-py code,that was generated for ensuring the borders are neat after a full step, when new_config is called.

Note

In order for this to work you have to use tee_copy_hook() instead of StepFunc.add_py_code() for creating the border fixup code, so that it can be retargetted and reused.

visit()[source]

Initialise copy_py_code.

new_config()[source]

Runs the retargetted version of the border copy code created in visit().

tee_copy_hook(code)[source]

Append a piece of code to the “after_step” hook as well as the local code piece that gets retargetted and run in new_config().

correct_position(pos)[source]
correct_position_c(pos)[source]

Create a bit of C code, that calculates the corrected position for a position given as a tuple of variable names.

class zasim.cagen.border.SimpleBorderCopier[source]

Bases: zasim.cagen.border.BaseBorderCopier

Copy over cell values, so that reading from a cell at the border over the border yields a sensible result.

In the case of the SimpleBorderCopier, the borders act like “portals” to the opposite side of the field.

This class should work with any number of dimensions.

visit()[source]

Generate code for copying over or otherwise handling data from the borders.

corect_position_code(pos)[source]

Create a piece of py code, that calculates the source for a read that would set the right value at position pos, which is beyond the border.

class zasim.cagen.border.TwoDimSlicingBorderCopier[source]

Bases: zasim.cagen.border.BaseBorderCopier

This class copies, with only little code, each side to the opposite side. It only works on two-dimensional configurations.

visit()[source]

Generate code for copying over or otherwise handling data from the borders.

build_name(parts)[source]
correct_position(pos)[source]
class zasim.cagen.border.TwoDimZeroReader[source]

Bases: zasim.cagen.border.BorderSizeEnsurer

This BorderHandler makes sure that zeros will always be read when peeking over the border.

Previous topic

zasim.cagen.neighbourhoods

Next topic

zasim.cagen.computations

This Page