Extract (any) sub-functions. A sub-function can be extracted from a discrete function that is in a mixed, vector, or tensor FunctionSpace. The sub-function resides in the subspace of the mixed space. Returns: First level of subspaces of the function spac
(self)
| 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. |
| 605 | |
| 606 | A sub-function can be extracted from a discrete function that is |
| 607 | in a mixed, vector, or tensor FunctionSpace. The sub-function |
| 608 | resides in the subspace of the mixed space. |
| 609 | |
| 610 | Returns: |
| 611 | First level of subspaces of the function space. |
| 612 | """ |
| 613 | num_sub_spaces = self.function_space.num_sub_spaces |
| 614 | if num_sub_spaces == 1: |
| 615 | raise RuntimeError("No subfunctions to extract") |
| 616 | return tuple(self.sub(i) for i in range(num_sub_spaces)) |
| 617 | |
| 618 | def collapse(self) -> Function[Scalar]: |
| 619 | """Create a collapsed version of this Function.""" |