elementseq

The elementseq module.

class nutils.elementseq.References(ndims)

Bases: Singleton

Abstract base class for a sequence of Reference objects.

Parameters:

ndims (int) – The number of dimensions of the references in this sequence.

Notes

Subclasses must implement __len__() and get().

static from_iter(value, ndims)

Create a References sequence from an iterator.

Parameters:
Returns:

sequence

Return type:

References

static uniform(value, length)

Create a uniform References.

Parameters:
Returns:

sequence

Return type:

References

static empty(ndims)

Create an empty References sequence.

Parameters:

ndims (int) –

Returns:

sequence

Return type:

References

__bool__(self)

Return bool(self).

abstract __len__(self)

Return len(self).

__iter__(self)

Implement iter(self).

__getitem__(index: int) Reference
__getitem__(index: Union[slice, ndarray]) References

Return self[index].

__add__(self, other)

Return self+other.

__mul__(other: int) Reference
__mul__(other: References) References

Return self*other.

abstract get(self, index)

Return the reference at index.

Parameters:

index (int) –

Returns:

reference – The reference at index.

Return type:

Reference

take(self, indices)

Return a selection of this sequence.

Parameters:

indices (numpy.ndarray, ndim: 1, dtype: int) – The indices of references of this sequence to select.

Returns:

references – The sequence of selected references.

Return type:

References

compress(self, mask)

Return a selection of this sequence.

Parameters:

mask (numpy.ndarray, ndim: 1, dtype: bool) – A boolean mask of references of this sequence to select.

Returns:

sequence – The sequence of selected references.

Return type:

References

repeat(self, count)

Return this sequence repeated count times.

Parameters:

count (int) –

Returns:

sequence – This sequence repeated count times.

Return type:

References

product(self, other)

Return the product of this sequence with another sequence.

Parameters:

other (References) –

Returns:

sequence – The product sequence.

Return type:

References

chain(self, other)

Return the chained sequence of this sequence with other.

Parameters:

other (References) –

Returns:

sequence – The chained sequence.

Return type:

References

property children: References

Return the sequence of child references.

Returns:

The sequence of child references:

(cref for ref in self for cref in ref.child_refs)

Return type:

References

property edges: References

Return the sequence of edge references.

Returns:

The sequence of edge references:

(eref for ref in self for eref in ref.edge_refs)

Return type:

References

property isuniform: bool

True if all reference in this sequence are equal.

getpoints(self, ischeme, degree)

Return a sequence of Points.