ddg.datastructures.nets.net module

class ddg.datastructures.nets.net.Net(fct, domain, *args, name='Net')[source]

Bases: Callable

Base class for nets.

Parameters:
fctfunction

Function defining the net.

domainddg.datastructures.nets.domain.Domain or list of intervals

Domain of fct.

namestr, optional

Name of the net (mostly used for blender conversion).

Attributes:
fctfunction

Function defining the net.

domainddg.datastructures.nets.domain.Domain

Domain of fct.

namestr

Name of the net (mostly used for blender conversion).

dimensionint

Dimension of the domain.

property fct
property dimension
class ddg.datastructures.nets.net.EmptyNet(coordinates, name='Empty')[source]

Bases: Net, Iterable

property dimension
property fct
class ddg.datastructures.nets.net.PointNet(value, name='Point')[source]

Bases: Net, Iterable

property dimension
property fct
class ddg.datastructures.nets.net.SmoothNet(fct, domain, *args, **kwargs)[source]

Bases: Net

Store and manage data of a smooth net.

Parameters:
fctfunction

Function defining the net.

domainddg.datastructures.nets.domain.SmoothDomain or list of intervals

Domain of fct.

periodicityset, optional

Set containing indices of periodic coordinate directions.

periodicbool

Alternative way of specifying periodicity for one dimensional net. It precedes periodicity if set.

namestr, optional

Name of the net (mostly used for blender conversion).

See also

Net, NetCollection
property dimension
property fct
class ddg.datastructures.nets.net.SmoothCurve(*args, **kwargs)[source]

Bases: SmoothNet

property dimension
property fct
class ddg.datastructures.nets.net.DiscreteNet(fct, domain, hint=None, **kwargs)[source]

Bases: Net, Iterable

Store and manage data of a discrete net.

Parameters:
fctfunction

Function defining the net.

domainddg.datastructures.nets.domain.DiscreteDomain or list of intervals

Domain of ‘fct’.

periodicityset, optional

Set containing indices of periodic coordinate directions.

traverserddg.datastructures.nets.traverser.Traverser, optional

Traversing scheme of the dicrete net.

namestr, optional

Name of the net (mostly used for blender conversion).

inititerable or ddg.datastructures.nets.domain.DiscreteDomain, optional

Preset initial data or generate all data in the given domain.

hintfunction, optional

Function returning the net points needed to compute the value for a given net point (by default there is no hint function). If specified the values are calculated iteratively.

See also

Net, NetCollection

Notes

  • The hint function has to return an empty list for all net points which are initialized by fct.

  • The function fct will be called repeatedly to calculate the value for the given index. It has to guarantee that the calculation will stop, i.e. that it will hit initial data.:

    E.g.: Suppose the missing vertex has the index (i,j). Then `fct`
    could use the values at vertices ((i-1,j-1), (i,j-1), (i-1, j))
    to calculate the missing value
                        (i-1,j)   (i,j)
                  input -> o--------o <- missing
                           |        |
                           |        |
                           |        |
                  input -> o--------o <- input
                       (i-1,j-1)  (i,j-1)
    If the standard axis {(i,0) | i int} and {(0,i) | i int}
    are initial data (either given by `fct` itself or
    previously set) this definition is well defined.
    
  • If hint is not given the calculations are made recursively. So it may easyly generate RecursionError for exeeding recursition depth. Thus it is important to take the search pattern of fct into account for choosing the traverser.:

    E.g.: Suppose the inital data is given in a zick-zack pattern in the
    fourth quadrant like
    
                        (0,0) o--o
                                 |
                         (-1,-1) o--o
                                    |
                            (-2,-2) o--o
    
    If we suppose `fct` to use the search pattern from the comment
    above a (finite) linear traverser will generate `RecursitionError`
    for a relatively small search box (about 80x80). However a
    diagonal traverser will guarantee a small recursition depth.
    
            1-->2-->3-->4           1   5   8   10
                                      \   \   \
                5-->6-->7               2   6   9
                                          \   \
                    8-->9                   3   7
                                              \
                        10                      4
             (lin. trav.)            (diag. trav.)
    
Attributes:
traverserddg.datastructures.nets.traverser.Traverser

Get the traverser of the Domain.

property traverser

Get the traverser of the Domain.

Returns:
ddg.datastructures.nets.traverser.Traverser
evaluate()[source]
property dimension
property fct
class ddg.datastructures.nets.net.DiscreteRecursiveNet(*args, **kwargs)[source]

Bases: DiscreteNet

Recursive implementation of DiscreteNet.

property dimension
evaluate()
property fct
property traverser

Get the traverser of the Domain.

Returns:
ddg.datastructures.nets.traverser.Traverser
class ddg.datastructures.nets.net.DiscreteIterativeNet(*args, **kwargs)[source]

Bases: DiscreteNet

Iterative implementation of DiscreteNet.

property dimension
evaluate()
property fct
property traverser

Get the traverser of the Domain.

Returns:
ddg.datastructures.nets.traverser.Traverser
class ddg.datastructures.nets.net.DiscreteCurve(*args, **kwargs)[source]

Bases: DiscreteRecursiveNet

property dimension
evaluate()
property fct
property traverser

Get the traverser of the Domain.

Returns:
ddg.datastructures.nets.traverser.Traverser
class ddg.datastructures.nets.net.NetCollection(nets=[], name='NetCollection')[source]

Bases: Sized, Iterable, Container

Collection of Nets

Parameters:
netsList of nets

Nets to be contained in the collection.

namestr (default=’NetCollection’)

Name of the collection.

Attributes:
namestring

Name of the collection

dimensionint

Dimension of the collection.

add(net)[source]

Add a net to the collection.

Parameters:
netNet
property dimension

Dimension of the collection.

Only works if all nets in the collection have the same dimension.

Returns:
int
Raises:
AttributeError
  • If collection is empty

  • If nets in collection have different dimensions.