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

Method clone

python/dolfinx/fem/function.py:742–770  ·  view source on GitHub ↗

Create a FunctionSpace which shares data with this space. The new space has a different unique integer ID. Create a new FunctionSpace :math:`W` which shares data with this FunctionSpace :math:`V`, but with a different unique integer ID. This function is helpful for

(self)

Source from the content-addressed store, hash-verified

740 super().__init__(ufl_domain, element)
741
742 def clone(self) -> FunctionSpace[Real]:
743 """Create a FunctionSpace which shares data with this space.
744
745 The new space has a different unique integer ID.
746
747 Create a new FunctionSpace :math:`W` which shares data with this
748 FunctionSpace :math:`V`, but with a different unique integer ID.
749
750 This function is helpful for defining mixed problems and using
751 blocked linear algebra. For example, a matrix block defined on
752 the spaces :math:`V \\times W` where, :math:`V` and :math:`W`
753 are defined on the same finite element and mesh can be
754 identified as an off-diagonal block whereas the :math:`V \\times
755 V` and :math:`V \\times V` matrices can be identified as
756 diagonal blocks. This is relevant for the handling of boundary
757 conditions.
758
759 Returns:
760 A new function space that shares data
761 """ # noqa: D301
762 try:
763 Vcpp = _cpp.fem.FunctionSpace_float64(
764 self._cpp_object.mesh, self._cpp_object.element, self._cpp_object.dofmap
765 ) # type: ignore
766 except TypeError:
767 Vcpp = _cpp.fem.FunctionSpace_float32(
768 self._cpp_object.mesh, self._cpp_object.element, self._cpp_object.dofmap
769 ) # type: ignore
770 return FunctionSpace(self._mesh, self.ufl_element(), Vcpp)
771
772 @property
773 def num_sub_spaces(self) -> int:

Callers 7

test_extract_formsFunction · 0.80
test_cloneFunction · 0.80

Calls 1

FunctionSpaceClass · 0.70

Tested by 7

test_extract_formsFunction · 0.64
test_cloneFunction · 0.64