core.elements.helper module

Define helper functions applying on elements.

force_a_lattice_for_every_element(elts: Sequence[Element]) None

Give a lattice index to every element.

Elements before the first LATTICE command will be in the same lattice as the elements after the first LATTICE command.

Elements after the first LATTICE command will be in the previous lattice.

Example

Element/Command

Lattice before

Lattice after

QP1

None

0

DR1

None

0

LATTICE

QP2

0

0

DR2

0

0

END LATTICE

QP3

None

0

LATTICE

DR3

1

1

END LATTICE

QP4

None

1

force_a_section_for_every_element(elts: Sequence[Element]) None

Give a section index to every element.

give_name_to_elements(elts: Sequence[Element], warn_default_element_names: bool = True) None

Give to every :class:`.Element the name TraceWin would give it.