elementseq
The elementseq module.
- class nutils.elementseq.References(ndims)
Bases:
SingletonAbstract base class for a sequence of
Referenceobjects.- Parameters:
ndims (
int) – The number of dimensions of the references in this sequence.
Notes
Subclasses must implement
__len__()andget().- static from_iter(value, ndims)
Create a
Referencessequence from an iterator.- Parameters:
- Returns:
sequence
- Return type:
- static uniform(value, length)
Create a uniform
References.- Parameters:
- Returns:
sequence
- Return type:
- static empty(ndims)
Create an empty
Referencessequence.- Parameters:
ndims (
int)- Returns:
sequence
- Return type:
- __bool__(self)
Return
bool(self).
- abstractmethod __len__(self)
Return
len(self).
- __iter__(self)
Implement
iter(self).
- __getitem__(index: int) Reference
- __getitem__(index: slice | ndarray) References
Return
self[index].
- __add__(self, other)
Return
self+other.
- __mul__(other: int) Reference
- __mul__(other: References) References
Return
self*other.
- abstractmethod get(self, index)
Return the reference at
index.
- 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:
- 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:
- repeat(self, count)
Return this sequence repeated
counttimes.- Parameters:
count (
int)- Returns:
sequence – This sequence repeated
counttimes.- Return type:
- product(self, other)
Return the product of this sequence with another sequence.
- Parameters:
other (
References)- Returns:
sequence – The product sequence.
- Return type:
- chain(self, other)
Return the chained sequence of this sequence with
other.- Parameters:
other (
References)- Returns:
sequence – The chained sequence.
- Return type:
- 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:
- 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: