nifty7.domain_tuple module

class DomainTuple(domain, _callingfrommake=False)[source]

Bases: object

Ordered sequence of Domain objects.

This class holds a tuple of Domain objects, which together form the space on which a Field is defined. This corresponds to a tensor product of the corresponding vector fields.

Notes

DomainTuples should never be created using the constructor, but rather via the factory function make!

property axes

axis indices of the underlying domains

Type

tuple of tuple of int

static make(domain)[source]

Returns a DomainTuple matching domain.

This function checks whether a matching DomainTuple already exists. If yes, this object is returned, otherwise a new DomainTuple object is created and returned.

Parameters

domain (Domain or tuple of Domain or DomainTuple) – The geometrical structure for which the DomainTuple shall be obtained.

static scalar_domain()[source]
scalar_weight(spaces=None)[source]

Returns the uniform volume element for a sub-domain of self.

Parameters

spaces (int, tuple of int or None) – Indices of the sub-domains to be considered. If None, the entire domain is used.

Returns

If the requested sub-domain has a uniform volume element, it is returned. Otherwise, None is returned.

Return type

float or None

property shape

number of pixels along each axis

The shape of the array-like object required to store information defined on the DomainTuple.

Type

tuple of int

property size

total number of pixels.

Equivalent to the products over all entries in the object’s shape.

Type

int

total_volume(spaces=None)[source]

Returns the total volume of self or of a subspace of it.

Parameters

spaces (int, tuple of int or None) – Indices of the sub-domains of the domain to be considered. If None, the total volume of the whole domain is returned.

Returns

the total volume of the requested (sub-)domain.

Return type

float