lattice module

Define LATTICE and LATTICE_END instructions.

class Lattice(line, dat_idx=None, **kwargs)[source]

Bases: Command

Used to get the number of elements per lattice.

Parameters:
is_implemented: bool = True
n_attributes: int | range | Collection = (1, 2)
__init__(line, dat_idx=None, **kwargs)[source]

Save lattice structure.

Parameters:
Return type:

None

set_influenced_elements(instructions, **kwargs)[source]

Determine the index of the elements concerned by apply().

Here, this is all the elements between this command and the next LATTICE or LATTICE_END instruction.

Parameters:
Return type:

None

apply(instructions, **kwargs)[source]

Set lattice section number of elements in current lattice.

Parameters:
Return type:

list[Instruction]

_current_section_number(instructions)[source]

Get section number of self.

Parameters:

instructions (list[Instruction])

Return type:

int

_current_lattice_number(instructions, index)[source]

Get lattice number of current object.

We look for Element in instructions in reversed order, starting from self. We take the first non negative lattice index that we find, and return it + 1. If we do not find anything, this is because no Element had a defined lattice number before.

This approach allows for Element without a lattice number, as for examples drifts between a LatticeEnd and a Lattice.

Parameters:
Return type:

int

_abc_impl = <_abc._abc_data object at 0x7318fb808a40>
class LatticeEnd(line, dat_idx=None, **kwargs)[source]

Bases: Command

Define the end of lattice.

Parameters:
is_implemented: bool = True
n_attributes: int | range | Collection = 0
__init__(line, dat_idx=None, **kwargs)[source]

Call mother __init__ method.

Parameters:
Return type:

None

set_influenced_elements(instructions, **kwargs)[source]

Determine the index of the elements concerned by apply().

Here, this is all the elements that are between this command and the next LATTICE instruction.

Parameters:
Return type:

None

_abc_impl = <_abc._abc_data object at 0x7318fb808500>
apply(instructions, **kwargs)[source]

Reset the lattice index of every influenced element.

Todo

As for now, the effect of this command will be overriden by the _force_a_lattice_for_every_element. See how I should handle this…

Parameters:
Return type:

list[Instruction]