ddg.datastructures.nets.traverser module
- class ddg.datastructures.nets.traverser.Traverser(gens, **kwargs)[source]
Bases:
objectImplement methods to traverse a discrete net.
This is a stack of walkers for (parts of) a discrete net with \(\mathbb{Z}^n\) combinatorics. Walkers are generator functions returning generators for indices of the net.
- classmethod Diag(*args, shape='triang', dirct='NE', mode=1, bdy=True, shift=(0, 0))[source]
Setup a diagonal traversing scheme.
- Parameters:
- argsfloat
Number of vertex points in side(s) of
shape. The number of required/accepted arguments depends onshape.- shape{‘half’, ‘triang’}, optional
Select the general shape the traverser operates on.
- dirct{‘NE’, ‘SW’}, optional
Select the direction of movement for the traverser.
- mode{1, …, 8}, optional
Select a special type of the choosen shape. The number of modes depends on the shape.
- bdybool, optional
Decide whether to include the boundary of shape (if exists). Set
Trueto include.- shifttuple of int, optional
Constant shift for traversed shape.
- Returns:
- Traverser
Notes
The number of vertex points is calculated from each element of
argsby ceiling its absolut values.Elements of
argsneed to be finite.
- classmethod Linear(*args, intervals=None, shape='quad', dirct='N', mode=1, bdy=True, shift=(0, 0))[source]
Setup a linear traversing scheme.
- Parameters:
- argsfloat
Number of vertex points in side(s) of
shape. The number of required/accepted arguments depends onshape.- intervallslist of int tuples, optional
Side intervalls of a rectangular domain.
- shape{‘quad’, ‘triang’}, optional
Select the general shape the traverser operates on.
- dirct{‘N’, ‘S’, ‘E’, ‘W’}, optional
Select the direction of movement for the traverser.
- mode{1, …, 8}, optional
Select a special type of the choosen shape. The number of modes depends on the shape.
- bdybool, optional
Decide whether to include the boundary of shape (if exists). Set
Trueto include.- shifttuple of int, optional
Constant shift for traversed shape.
- Returns:
- Traverser
Notes
The number of vertex points is calculated from each element of
argsby ceiling its absolut values.- If an element of
argsisinf, the half axis is taken as a side.WARNING:This might not produce a traverser finding all points in thegivenshape.
- classmethod Circular(shape='half', dirct='ACW', mode=1, bdy=True, shift=(0, 0))[source]
Setup a rectangular index domain.
- Parameters:
- shape{‘quad’, ‘half’}, optional
Select the general shape the traverser operates on.
- dirct{‘CW’, ‘ACW’}, optional
Select the direction of movement for the traverser.
- mode{1, …, 6}, optional
Select a special type of the choosen shape. The number of modes depends on the shape.
- bdybool, optional
Decide whether to include the boundary of shape (if exists). Set
Trueto include.- shifttuple of int, optional
Constant shift for traversed shape.
- Returns:
- Traverser