MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / sub

Method sub

python/dolfinx/fem/function.py:584–601  ·  view source on GitHub ↗

Return a sub-function (a view into the ``Function``). Sub-functions are indexed ``i = 0, ..., N-1``, where ``N`` is the number of sub-spaces. Args: i: Index of the sub-function to extract. Returns: A view into the parent ``Function``.

(self, i: int)

Source from the content-addressed store, hash-verified

582 return self.name
583
584 def sub(self, i: int) -> Function[Scalar]:
585 """Return a sub-function (a view into the ``Function``).
586
587 Sub-functions are indexed ``i = 0, ..., N-1``, where ``N`` is
588 the number of sub-spaces.
589
590 Args:
591 i: Index of the sub-function to extract.
592
593 Returns:
594 A view into the parent ``Function``.
595
596 Note:
597 If the sub-Function is re-used, for performance reasons the
598 returned ``Function`` should be stored by the caller to
599 avoid repeated re-computation of the subspace.
600 """
601 return Function(self._V.sub(i), self.x, name=f"{self!s}_{i}")
602
603 def split(self) -> tuple[Function[Scalar], ...]:
604 """Extract (any) sub-functions.

Callers 15

monolithicMethod · 0.95
monolithic_solveMethod · 0.95
test_mixed_constant_bcFunction · 0.95
test_facet_expressionFunction · 0.95
test_save_vtk_mixedFunction · 0.95
splitMethod · 0.95
mixed_elementFunction · 0.95

Calls 1

FunctionClass · 0.70

Tested by 15

monolithicMethod · 0.76
monolithic_solveMethod · 0.76
test_mixed_constant_bcFunction · 0.76
test_facet_expressionFunction · 0.76
test_save_vtk_mixedFunction · 0.76
test_tabulate_dofsFunction · 0.36
test_empty_rank_collapseFunction · 0.36