ddg.datastructures.nets.conversion module

ddg.datastructures.nets.conversion.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.

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
ddg.datastructures.nets.conversion.sample_smooth_domain(domain, sampling, anchor=None, atol=1e-08)[source]

Samples a smooth domain.

Parameters:
domainddg.datastructures.nets.domain.SmoothDomain

SmoothDomain to sample.

samplinglist, int or float
Determines how the domain is sampled.
If a default stepsize/sample amount and option
should be used for all directions, either pass an int/float (will be
regarded as stepsize), or a list of length 2 where the first entry is
the stepsize/sample amount and the second is the option to use.
Else pass a list of length of the dimension of the domain where each
entry can be either an int/float or a list of length two (same rules as
above).

Options:
‘t’ : use the number as total amount of samples. Will raise a
warning, if the number is a float
‘s’ : symmetric sampling.

WARNING! Not compatible with anchor and ‘t’ yet.
‘p’ : direction is periodic. Only needs to be set manually, if the
direction in the domain was not marked as periodic.
‘c’ : compound sampling. Sampling given as a list
[stepsize, amount of samples, ‘c’]
anchorlist, tuple or None

Anchor point to use for the sampling process.

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.

Returns:
ddg.datastructures.nets.net.DiscreteNet
ddg.datastructures.nets.conversion.sample_smooth_net(net, sampling, anchor=None, atol=1e-08, name=None, outsnet=False)[source]

Samples a smooth net.

Parameters:
netddg.datastructures.nets.net.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.

outsnetbool

Set to true, the function returns a tuple of the sampled net and the sampling net instead.

Returns:
ddg.datastructures.nets.net.DiscreteNet or
tuple