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

Method sub

python/dolfinx/fem/function.py:777–794  ·  view source on GitHub ↗

Return the i-th sub space. Args: i: Index of the subspace to extract. Returns: A subspace. Note: If the subspace is re-used, for performance reasons the returned subspace should be stored by the caller to avoid re

(self, i: int)

Source from the content-addressed store, hash-verified

775 return self.element.num_sub_elements
776
777 def sub(self, i: int) -> FunctionSpace[Real]:
778 """Return the i-th sub space.
779
780 Args:
781 i: Index of the subspace to extract.
782
783 Returns:
784 A subspace.
785
786 Note:
787 If the subspace is re-used, for performance reasons the
788 returned subspace should be stored by the caller to avoid
789 repeated re-computation of the subspace.
790 """
791 assert self.ufl_element().num_sub_elements > i
792 sub_element = self.ufl_element().sub_elements[i]
793 cppV_sub = self._cpp_object.sub([i]) # type: ignore
794 return FunctionSpace(self._mesh, sub_element, cppV_sub)
795
796 def component(self):
797 """Return the component relative to the parent space."""

Callers

nothing calls this directly

Calls 2

FunctionSpaceClass · 0.70
subMethod · 0.45

Tested by

no test coverage detected