ddg.nets package
Subpackages
Module contents
Package for smooth and discrete nets.
- ddg.nets.sample_interval(interval, sample, option='', atol=None, anchor=None)[source]
Sample an interval.
- Parameters:
- intervaltuple
tuple containing the boundaries of the interval
- samplefloat, int or list
list is containing a float in the first, and int in the second entry Stepsize (or amount of samples if ‘t’ option is set). If given a list for compound sampling, the first entry is the stepsize, while the second is the total amount of samples.
- optionstring (default=””)
- Options for the sampling.The supported options are:‘t’otal amount of samples given‘s’ymmetric sampling‘p’eriodic‘c’ompound sampling, both stepsize and amount of samples givenWhen option ‘c’ is set, the sampling will choose between the stepsizeand total amount according to the type of interval. In the case of anunbounded interval, it will also cut off the interval similar tobound_domain.When option ‘s’ is set, the sampling will be fit symmetrically insidethe interval.
- atolfloat or None (default=None)
Tolerance for the sampling. Is not used when ‘t’ is set or the interval is unbounded.
This function uses the global tolerance defaults if
atolorrtolare set to None. Seeddg.nonexactfor details.- anchorfloat or None (default=None)
Point inside the interval. The sampling will be chosen such that the point is part of it.
- Returns:
- tuple
- containing:[0] the (modified) boundaries of the sampled interval[1] amount of samples[2] sampling function
- Raises:
- NotImplementedError
if given options are not compatible with eachother
- ValueError
if sample is not compatible with the given options
See also
- ddg.nets.sample_smooth_domain(domain, sampling, anchor=None, atol=1e-08)[source]
Samples a smooth domain.
- Parameters:
- domainddg.nets.SmoothDomain
SmoothDomain to sample.
- samplinglist, int or float
- Determines how the domain is sampled.If a default stepsize/sample amount and optionshould be used for all directions, either pass an int/float (will beregarded as stepsize), or a list of length 2 where the first entry isthe stepsize/sample amount and the second is the option to use.Else pass a list of length of the dimension of the domain where eachentry can be either an int/float or a list of length two (same rules asabove).Options:‘’ : stepsize given. The interval will be sampled with the givenstepsize starting from its lower bound.‘t’ : use the number as total amount of samples. The interval will bedivided up into the given number of samples in an equal fashion.Note that this option is only available for bounded intervals.Will raise a warning, if the number is a float.‘c’ : compound sampling. Behaves as option ‘t’ for bounded and ‘’ forunbounded intervals. Additionally only the given amount of sampleswill be returned for unbounded directions.Sampling given as a list [stepsize, amount of samples, ‘c’]‘s’ : symmetric sampling. This option tries to fit as many samples aspossible of the given stepsize in the interval in a symmetric fashionaround its center.
- anchorlist, tuple or None
Anchor point to use for the sampling process, given as a list/tuple of anchors for each direction. Directions where the anchor is None will be sampled normally, while for the others the sampling process ensures that the given set of values appears as one of the samples. For example for the anchor (2, None, 3) the resulting discrete net will attain the value (2, x, 3) at some point of its domain, where x is some value depending on the sampling of the second direction. Note that this option is not available for the options ‘s’, ‘t’ and ‘c’.
- atollist, int or float
Tolerance(s) used in the sampling process. Either pass a single value to use for all directions, or a list of length of the dimension of the domain of floats/ints.
This function uses the global tolerance defaults if
atolorrtolare set to None. Seeddg.nonexactfor details.
- Returns:
- ddg.nets.DiscreteNet
See also
- ddg.nets.sample_smooth_net(net, sampling, anchor=None, atol=1e-08, name=None)[source]
Samples a smooth net.
- Parameters:
- netddg.nets.SmoothNet
Smooth net to sample.
- samplinglist, int or float
See sample_smooth_domain.
- anchorlist or None
Anchor point for sampling process.
- atollist, int or float
Tolerance(s) for sampling process.
- namestring
Name of the sampled net. If None, uses net.name instead.
- Returns:
- sampled_net
ddg.nets.net.DiscreteNet or ddg.nets.net.EmptyNet or ddg.nets.net.PointNet
See also
- ddg.nets.sampling_decomposer(sampling, atol, anchor, dimension)[source]
Helper function for sample_smooth_domain. Given parameters of a sampling, this function returns a list of usable length for the sampling process of domains.
- Parameters:
- samplinglist, int or float
Stepsize/Amount of samples and additional options. To default pass an int/float. If not pass a list of the form [stepsize/samples, option].
- atollist, int or float
Tolerance(s) used in the sampling process. To default pass an int/float. If not pass a list of tolerances for each direction.
If
Noneis given, will returnNoneagain, i.e. won’t replace it with the global default.- anchorlist, tuple or None
Anchor point used in the sampling process.
- dimensionint
Dimension of the domain you want to sample.
- Returns:
- list
- List of the decomposed sampling.[0] stepsize/samples[1] options[2] tolerances[3] anchor
See also
- ddg.nets.bound_domain(domain, bounding)[source]
- Parameters:
- domainddg.nets.Smooth/DiscreteRectangularDomain or ddg.nets.Smooth/DiscreteNet
Given (unbounded) rectangular domain to bound, or net whose domain is to be bound
- boundingint/float
- Bounding range.If an interval (a,b) in the domain is unbounded,we bound it in the smooth case by(1) [a, a+bounding], if a > -inf(2) [b-bounding, b], if b < inf, or(3) [-bounding/2, bounding/2] if a == -inf and b == inf.In the discrete case, bounding is the total amount of points chosen inan unbounded direction.(1) [a, a+bounding-1], if a > -inf(2) [b-bounding+1, b], if b < inf, or(3) [1-bounding/2, bounding/2] if a == -inf and b == inf.
- Returns:
- ddg.nets.Smooth/DiscreteRectangularDomain or ddg.nets.Smooth/DiscreteNet
Will be the same type as domain, e.g. a discrete/smooth rectangular domain, if domain was discrete/smooth rectangular domain.
- ddg.nets.compose(f, n)[source]
The composition x -> f(n(x)) adapted to nets and net collections.
- Parameters:
- fcallable or numpy.ndarray
- nNet or NetCollection
- Returns:
- Net or NetCollection
The same type as
n.
Examples
>>> import numpy as np >>> from ddg.nets import SmoothNet >>> from ddg.nets import compose
>>> line = SmoothNet(lambda t: np.array([t, 0]), [(0, np.pi, True)]) >>> line(2) array([2, 0]) >>> translated_line = compose(lambda x: x + (0, 1), line) >>> translated_line(2) array([2, 1]) >>> linearly_transformed_line = compose(np.array([[2, 1], [0, 1]]), line) >>> linearly_transformed_line(2) array([4, 0])
Unlike
def f_after_n(x): return f(n(x))
composeretains the net domain(s) by returning a net or net collection.>>> type(linearly_transformed_line) <class 'ddg.nets._net.SmoothCurve'> >>> linearly_transformed_line.domain SmoothInterval([0.0, 3.14..., True])
The parameter
nis required to be a net or a net collection. If it isn’t, then there is no need to retain a domain, sodef f_after_n(x): return f(n(x))
suffices.
- ddg.nets.concatenate(net, fct)[source]
Create a net which’s function is the conatenation of the function of the original net and fct and has the same domain as the original.
- Parameters:
- netddg.nets.Net or subclass of it
Net with compatible function for fct
- fctfunction
Function to concatenate with the net function
- Returns:
- ddg.nets.Net
Exact type is the same as given net
- ddg.nets.cone(curve, cone_vertex, name='Cone')[source]
Generate a cone over a given cone.
- Parameters:
- curveddg.nets.SmoothNet
Spatial curve.
- cone_vertexnumpy.array
Coordinates of a point in space
- name: str
Name of the surface.
- Returns:
- ddg.nets.SmoothNet
Cone
Notes
The cone is generated by connecting all the pointes of the curve with the cone vertex.
- ddg.nets.continue_by_reflection(net, direction, reflection, invertdirection=False)[source]
Continue a net by reflection.
Given a net, direction and reflection, the function returns a net with an expanded domain in direction direction. Points outside the domain of the orignal domain will be mapped to a point corresponding to it inside of the domain before the new net evaluates first the function of the original net before applying the reflection.
- Parameters:
- netddg.nets.SmoothNet or DiscreteNet
Net to continue by reflection
- directionint
Direction in which the domain will be expanded. Points outside the original domain will be mapped to the point corresponding to it and the reflection will be applied after the function was evalued
- reflectionint, Iterable, function
- If given an integer or an Iterable containing integers, reflectiondetermines the coordinates changing sign after the original net isevalued at the point corresponding to the one given outside theoriginal domain, e.g. for a point p outside of the original domaincorresponding to p~ and reflect the function given by the int/IterablenewNet(p) == reflect(net(p~))If a function is given, it will be used instead.WARNING:In case a function is given, it will not be checked if it canaccept the output of the net or not.
- invertdirectionbool, optional
If set to False, the domain will be expanded in positive direction If set to True, the domain will be expanded in negative direction
- Returns:
- ddg.nets.Net
Same type as net
- Raises:
- IndexError
If direction is not in range of domain dimension
- TypeError
If reflection is neither an int, Iterable or function
Examples
>>> import numpy as np >>> from ddg.nets import SmoothNet >>> from ddg.nets import continue_by_reflection >>> net = SmoothNet(lambda *a: np.array(a), [[0, 2]] * 2) >>> reflectionnet = continue_by_reflection(net, 0, 0) >>> reflectionnet(3, 0) array([-1, 0])
- ddg.nets.coordinate_grid(net, sampling, anchor=None, atol=None)[source]
Get a grid of your net of given sampling (fineness in each direction)
- Parameters:
- net: ddg.nets.SmoothNet
Given net (must be SmoothNet with RectangularDomain).
- samplinglist, int or float
Determines how the domain is sampled. See sample_smooth_domain.
- anchornumpy.ndarray, or None
Point inside the domain of the net. The sampling will be chosen such that the point is part of it.
- atolfloat or None (default=None)
Is used as tolerance for symmetric sampling. See: sample_interval
This function uses the global tolerance defaults if
atolorrtolare set to None. Seeddg.nonexactfor details.
- Returns:
- list of NetCollections of coordinate lines in every direction
- ddg.nets.coordinate_hypersurface(net, component, value=None)[source]
Generate the (parameterized) level set of a coordinate-direction.
- Parameters:
- netSmoothNet or DiscreteNet with rectangular domain
Source net.
- componentnumpy.ndarray
Coordinate to set to a constant value.
- valueValue for the chosen component of the domain.
If no value is given the output net will depend on the value as a Parameter.
- Returns:
- ddg.nets.Net
The hypersurface as a net.
Notes
The hypersurface is generated by setting one coordinates to a constant given value.
- ddg.nets.coordinate_line(net, point, direction)[source]
Gives a curve on the net starting at a point in a given direction.
- Parameters:
- netSmoothNet or DiscreteNet with rectangular domain
Given net.
- pointIterable of Real
Point in the domain from where to start the curve.
- directionnumpy.array, or int
Direction in the domain as an array, or component as int.
- Returns:
- ddg.nets.Net
A line on the net.
Notes
If direction is given as an int, the periodicity of the net in the given direction is inherited by the curve.
- ddg.nets.coordinate_lines(net, direction, sampling, anchor=None, atol=None)[source]
Get coordinate lines in a given coordinate direction.
- Parameters:
- netddg.nets.SmoothNet
Given net (must be SmoothNet with rectangular domain).
- directionint
Direction of the coordinate lines (component number).
- samplinglist, int or float
See sample_smooth_domain
- anchorlist, tuple or NONE
Point inside the domain of the net. The sampling will be chosen such that the point is part of it.
- atolfloat or None (default=None)
Is used as tolerance for symmetric sampling. See: sample_interval
This function uses the global tolerance defaults if
atolorrtolare set to None. Seeddg.nonexactfor details.
- Returns:
- ddg.nets.NetCollection
Coordinate lines as a NetCollection.
Notes
They will be stepsize apart in all other directions.
A set anchor precedes symmetric sampling
- ddg.nets.create_subdomain(domain, subdomain)[source]
Create subdomain of a given discrete domain.
- WARNING:
To assure that the output is always a subdomain of the given domain, subdomain will be intersected with the domain.
- Parameters:
- domainddg.nets.DiscreteRectangularDomain
Given domain to reduce to a subdomain, or net.
- subdomainlist, or DiscreteDomain
- Each entry in the list corresponds to a direction:* int - number of values to take* tuple - subdomain in given directionIf a DiscreteDomain is given, it will just be returned as is.
- Returns:
- ddg.datastrucuters.nets.domain.DiscreteRectangularDomain
Subdomain.
- ddg.nets.Net
A discrete net containing the new shrunken domain, if the net was given.
- ddg.nets.cut_bounding_box(curve, distances=(1.0, 1.0, 1.0), center=(0.0, 0.0, 0.0))[source]
Cuts the curve within the given bounding box.
only works for curves with infinite domain
works best for curves with small sample size (no additional points on the boundary of the bounding_box are set)
The box is given by:
{x in R^3 | - distances[i] < <x - center, e_i> < distances[i]}.A picture of the box:
y-axis ▲ │ ┌───────────▲───────────┐ │ │ d_0│ │ d_0 = distances[0] │ │ │ d_1 │ d_1 = distances[1] │ │ └───────────► │ │ center │ │ │ │ │ └───────────────────────┘ │ └────────────────────────────► z-axis points at eye x-axis- Parameters:
- curveddg.nets.DiscreteCurve
curve to be cut
- distancessequence of three floats (default=(1.0,1.0,1.0))
Distances of planes parallel to the coordinate planes to the given center.
- center: sequence of three floats (default=(0.0,0.0,0.0))
Center of the bounding box.
- Returns:
- ddg.nets.NetCollection
NetCollection of the remaining segments of the curve
- Raises:
- ValueError
If the curves domain is infinite. If
len(distances) != 3. Iflen(center) != 3.
- ddg.nets.cylinder(curve, axis=2, name='Cylinder')[source]
Generate a cylinder from a planar base curve
- Parameters:
- curveddg.nets.SmoothNet
Planar curve.
- axis0, 1, 2
Axis of the cylinder
- name: str
Name of the surface.
- Returns:
- ddg.nets.SmoothNet
Cylinder.
- ddg.nets.dehomogenize(net)[source]
Dehomogenize the values of given net.
- Parameters:
- netddg.nets.Net
The net to operate on.
- Returns:
- A net of the same type.
See also
Notes
It is assumed that the values of the net are of type
np.array.
- ddg.nets.delete_direction(domain, direction)[source]
Delete one direction of a domain.
- Parameters:
- domain: SmoothRectangularDomain or Discrete RectangularDomain
may be parametrized
- direction: int
- Returns:
- domain
of same class of one dimension less
- ddg.nets.diagonal_lines(net, direction, sampling, anchor=None, atol=None)[source]
Get coordinate lines in a given coordinate direction.
- Parameters:
- netddg.nets.SmoothNet
Given 2-dim net (must be SmoothNet with rectangular domain). Only works for bounded nets.
- direction: np.array of dim 2
vector consisting of 1 and -1, determining the direction of the diagonals
- samplinglist of length 2 of form [number, “option”] or float (stepsize)
See ddg.nets.conversion.sample_smooth_domain
- anchornumpy.ndarray, or None
Point inside the domain of the net. The sampling will be chosen such that the point is part of it.
- atolfloat or None (default=None)
Is used as tolerance for symmetric sampling. See: sample_interval
This function uses the global tolerance defaults if
atolorrtolare set to None. Seeddg.nonexactfor details.
- Returns:
- ddg.nets.NetCollection
Coordinate lines as a NetCollection.
Notes
They will be stepsize apart in all other directions.
A set anchor precedes symmetric sampling
- ddg.nets.embed(net, level=0, component=-1)[source]
Embeds the given net in a space one dimension higher than before.
- Parameters:
- netddg.nets.Net
The net to operate on.
- levelfloat
(default 0)
- componentint (default=-1)
Component to add
- Returns:
- A net of the same type.
See also
Notes
It is assumed that the values of the net are of type
np.array.
- ddg.nets.evaluate(net)[source]
Evaluate a discrete net on its entire domain.
This should NOT replace net[net.domain]. Instead use this function if the function of a net has effects outside it, i.e. when a net creates blender object and link them to the scene on its own.
- Parameters:
- netddg.nets.DiscreteNet or subclass of it
- Returns:
- 0
If successfull
- Raises:
- TypeError
if net was not a (subclass of) ddg.nets.DiscreteNet
- ddg.nets.homogenize(net)[source]
Homogenize the values of given net.
- Parameters:
- netddg.nets.Net
The net to operate on.
- Returns:
- A net of the same type.
See also
Notes
It is assumed that the values of the net are of type
np.array.
- ddg.nets.octahedral_grid(net, stepsize, anchor=None, atol=None)[source]
Get diagonal lines in each diagonal direction of the coordinate planes of the domain
- Parameters:
- netddg.nets.SmoothNet
Given 3-dimensional net (must be SmoothNet with rectangular domain).
- stepsizeint or float
Determines the length of the diagonal of the occuring squares.
- anchornumpy.ndarray of dimension 3, or None
Point inside the domain of the net. The sampling will be chosen such that the point is part of it.
- atolfloat or None (default=None)
Is used as tolerance for symmetric sampling. See: sample_interval
This function uses the global tolerance defaults if
atolorrtolare set to None. Seeddg.nonexactfor details.
- Returns:
- list of NetCollections
- ddg.nets.NetCollection
Diagonal lines as a NetCollection.
- ddg.nets.shrink_domain(domain, amount)[source]
Shrinks domain by a given amount from the left and right.
- Parameters:
- domainddg.nets.DiscreteRectangularDomain or SmoothRectangularDomain
Domain to shrink, or a net to take the domain from. Discrete domains can only be shrunk by integer values.
- amountlist or float
- Specifies how much is taken away in each direction from the domain:* float/int - value to take away from left and right in every direction* list - every entry in the list corresponds to one direction,and may be None, int, or a tuple of int or None.
- Returns:
- ddg.nets.Domain
Shrunken domain, if the domain was given.
- ddg.nets.Net
The input discrete net containing the new shrunken domain, if the net was given.
- Raises:
- TypeError
if domain was discrete, but non-integer amount was passed
Notes
Only bounded directions will be shrunken.
Periodicity is inherited only for the directions that are not shrunken.
- ddg.nets.surface_of_revolution(curve, axis=2, name='Surface of Revolution')[source]
Generate a surface of revolution from a planar curve
- Parameters:
- curveddg.nets.SmoothNet
Planar curve.
- axis0, 1, 2
Axis of rotation.
- name: str
Name of the surface.
- Returns:
- ddg.nets.SmoothNet
Surface of revolution.
- ddg.nets.vertices(net)[source]
Get all vertex values from a given net or net collection.
- Parameters:
- netddg.nets.DiscreteNet or NetCollection
The net or net collection to obtain all the vertices from
- Returns:
- Generator
Generator containing all vertex values.
- class ddg.nets.DiscreteCurve(*args, **kwargs)[source]
Bases:
DiscreteRecursiveNet- property dimension
- evaluate()
- property fct
- property traverser
Get the traverser of the Domain.
- Returns:
- ddg.nets.traverser.Traverser
- class ddg.nets.DiscreteIterativeNet(*args, **kwargs)[source]
Bases:
DiscreteNetIterative implementation of DiscreteNet.
- property dimension
- evaluate()
- property fct
- property traverser
Get the traverser of the Domain.
- Returns:
- ddg.nets.traverser.Traverser
- class ddg.nets.DiscreteNet(fct, domain, hint=None, **kwargs)[source]
Bases:
Net,IterableStore and manage data of a discrete net.
- Parameters:
- fctfunction
Function defining the net.
- domainddg.nets.DiscreteDomain or list of intervals
Domain of ‘fct’.
- periodicityset, optional
Set containing indices of periodic coordinate directions.
- traverserddg.nets.traverser.Traverser, optional
Traversing scheme of the dicrete net.
- namestr, optional
Name of the net (mostly used for blender conversion).
- inititerable or ddg.nets.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
Notes
The
hintfunction has to return an empty list for all net points which are initialized byfct.The function
fctwill 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
hintis not given the calculations are made recursively. So it may easyly generateRecursionErrorfor exeeding recursition depth. Thus it is important to take the search pattern offctinto 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.nets.traverser.TraverserGet the traverser of the Domain.
- property traverser
Get the traverser of the Domain.
- Returns:
- ddg.nets.traverser.Traverser
- property dimension
- property fct
- class ddg.nets.DiscreteRecursiveNet(*args, **kwargs)[source]
Bases:
DiscreteNetRecursive implementation of DiscreteNet.
- property dimension
- evaluate()
- property fct
- property traverser
Get the traverser of the Domain.
- Returns:
- ddg.nets.traverser.Traverser
- class ddg.nets.EmptyNet(coordinates, name='Empty')[source]
Bases:
Net,Iterable- property dimension
- property fct
- class ddg.nets.Net(fct, domain, *args, name='Net')[source]
Bases:
CallableBase class for nets.
- Parameters:
- fctfunction
Function defining the net.
- domainddg.nets.Domain or list of intervals
Domain of
fct.- namestr, optional
Name of the net (mostly used for blender conversion).
See also
- Attributes:
- fctfunction
Function defining the net.
- domainddg.nets.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.nets.NetCollection(nets=[], name='NetCollection')[source]
Bases:
Sized,Iterable,ContainerCollection 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
dimensionintDimension of the collection.
- 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.
- class ddg.nets.PointNet(value, name='Point')[source]
Bases:
Net,Iterable- property dimension
- property fct
- class ddg.nets.SmoothCurve(*args, **kwargs)[source]
Bases:
SmoothNet- property dimension
- property fct
- class ddg.nets.SmoothNet(fct, domain, *args, **kwargs)[source]
Bases:
NetStore and manage data of a smooth net.
- Parameters:
- fctfunction
Function defining the net.
- domainddg.nets.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
- property dimension
- property fct
- class ddg.nets.DiscreteDiagonalDomain(*args, domain_type='rectangular', **kwargs)[source]
Bases:
DiscreteDomainImplement a diagonal strip index domain.
- Parameters:
- heightfloat
Hight of the strip.
- widthfloat
Width of the strip.
- shifttuple of int, optional
Base shift for diagonal domain.
Notes
The number of vertex points is calculated from the elements of
argsby ceiling their absolut values, respectively.There needs to be at least one positional argument and at most two. If
argshas length one both sides are given that lenth.The elements of
argsare assigned to the sides of the diagonal strip as follows:^ o------o args[0]+1 . / / . / / v o------o < . . .> args[1]+1If
baseisinfthe half axis is taken as the base edge.The
modeselects one of the following diagonal strips (NOT IMPLEMENTED YET):o------o------o o------o------o \ \ \ / / / \ 4 \ 3 \ / 2 / 1 / \ \ \ / / / o------o------o o------o------o
- Attributes:
- edge_datalist
List of edges in the domain given by index pairs.
- face_datalist
List of edges in the domain given by tuples of indices (at least triples).
- property edge_data
- property face_data
- class ddg.nets.DiscreteDomain(*args, domain_type='rectangular', **kwargs)[source]
Bases:
DomainFactory class for the discrete domains.
- Parameters:
- traverserddg.nets.traverser.Traverser
Traversing scheme of the discrete net.
- domain_type{‘rectangular’, ‘triangular’, ‘diagonal’}, optional
The type of discrete domain to use.
- Raises:
- NotImplementedError
If the domain type does not exist.
- Attributes:
- edge_datalist
List of edges in the domain given by index pairs.
- face_datalist
List of edges in the domain given by tuples of indices (at least triples).
- traverserddg.nets.traverser.Traverser
Traversing scheme of the discrete net.
- property edge_data
- property face_data
- class ddg.nets.DiscreteInterval(*args)[source]
Bases:
DiscreteRectangularDomainSpecial case of a one-dimensional rectangular domain.
- Parameters:
- intervaltuple of two floats [and a single bool] or
- function returning such a tuple
One tuple defining the endpoints of the interval and if it is periodic or not.
See also
- Attributes:
- interval: tuple
The tuple defining the interval
- periodicbool
- property interval
Interval as a tuple.
- property periodic
- property bounded
- property bounded_directions
- count(value) integer -- return number of occurrences of value
- property dimension
- property double_edged
- property edge_data
- property face_data
- index(value[, start[, stop]]) integer -- return first index of value.
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- property intervals
- property periodicity
- property traverser
- property unbounded_directions
- class ddg.nets.DiscreteRectangularDomain(domain, **kwargs)[source]
Bases:
DiscreteDomain,SequenceStore data on a rectangular index domain.
- Parameters:
- *argstuples of int
List of ranges of vertices.
- periodicityset or list, optional
Specify which coordinate directions are periodic. (default: No periodicity).
- traverserddg.nets.traverser.Traverser, optional
Traversing scheme of the discrete domain.
See also
- Attributes:
- periodicityset
Set containing indices of periodic coordinate directions.
- intervalslist of tuples
List of the coordinate intervals.
- bounded_directionslist
List containing the indices of the bounded directions of the domain.
- unbounded_directionslist
List containing the indices of the unbounded directions of the domain.
Methods
recover
Returns the current state of the domain in a format that can be used to initialize a constant domain with the same intervals and periodicity
- property edge_data
- property face_data
- property dimension
- property double_edged
- property intervals
- property periodicity
- property traverser
- property bounded
- property unbounded_directions
- property bounded_directions
- count(value) integer -- return number of occurrences of value
- index(value[, start[, stop]]) integer -- return first index of value.
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- class ddg.nets.DiscreteTriangularDomain(*args, domain_type='rectangular', **kwargs)[source]
Bases:
DiscreteDomainStore data on a triangular index domain.
- Parameters:
- basefloat
Number of vertex points in base edge of triangle.
- shifttuple of int, optional
Base shift for triangle.
- mode{1, …, 8}, optional
Select triangle shape.
Notes
The number of vertex points is calculated from
baseby ceiling the absolut value ofbase.The triangle is constructed from
baseby:o ^ / | . / | . base+1 / | . o-------o v < . . . > base+1If
baseisinfthe half axis is taken as the base edge.The
modeselects one of the following triangles (NOT IMPLEMENTED YET):o--------o--------o | \ 3 | 2 / | | \ | / | | 4 \ | / 1 | o--------o--------o | 5 / | \ 8 | | / | \ | | / 6 | 7 \ | o--------o--------o
- Attributes:
- edge_datalist
List of edges in the domain given by index pairs.
- face_datalist
List of edges in the domain given by tuples of indices (at least triples).
- property edge_data
- property face_data
- class ddg.nets.Domain(dimension, *args)[source]
Bases:
ContainerBase class for storing information on a
point-domainof a net.- Parameters:
- dimensionnon negative int
Dimension of the Domain.
- Attributes:
- dimensionnon negative int
Dimension of the Domain.
- class ddg.nets.SmoothDomain(*args, domain_type='rectangular', **kwargs)[source]
Bases:
DomainFactory class for the smooth domains.
- Parameters:
- domain_type{‘rectangular’}, optional
The type of discrete domain to use.
- Raises:
- NotImplementedError
If the domain type does not exist.
See also
- class ddg.nets.SmoothInterval(interval)[source]
Bases:
SmoothRectangularDomainSpecial case of a one-dimensional rectangular domain.
- Parameters:
- intervaltuple of two floats and an optional bool
A tuple defining the endpoints and periodicity of the interval. Periodicity is assumed False if not given.
See also
- Attributes:
- interval: tuple
The tuple defining the interval
- property interval
Interval as a tuple.
- property periodic
- property bounded
- property bounded_directions
- count(value) integer -- return number of occurrences of value
- property dimension
- index(value[, start[, stop]]) integer -- return first index of value.
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.
- property intervals
- property periodicity
- property unbounded_directions
- class ddg.nets.SmoothRectangularDomain(domain)[source]
Bases:
SmoothDomain,SequenceStore information on a rectangular domain.
- Parameters:
- domainlist of tuples (float, float[, bool])
Tuples define the intervals as (lowerbound, upperbound, periodic) Periodic is optional and assumed False if not given.
See also
- Attributes:
- periodicityset
Set containing indices of periodic coordinate directions.
- intervalslist of tuples
List of the coordinate intervals.
- bounded_directionslist
List containing the indices of the bounded directions of the domain.
- unbounded_directionslist
List containing the indices of the unbounded directions of the domain.
Methods
recover
Returns the current state of the domain in a format that can be used to initialize a constant domain with the same intervals and periodicity
- property intervals
- property periodicity
- property bounded
- property dimension
- property unbounded_directions
- property bounded_directions
- count(value) integer -- return number of occurrences of value
- index(value[, start[, stop]]) integer -- return first index of value.
Raises ValueError if the value is not present.
Supporting start and stop arguments is optional, but recommended.