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

Method copy

python/dolfinx/fem/function.py:546–559  ·  view source on GitHub ↗

Create a copy of the Function. The function space is shared and the degree-of-freedom vector is copied. Returns: A new Function with a copy of the degree-of-freedom vector.

(self)

Source from the content-addressed store, hash-verified

544 self._cpp_object.interpolate_f(np.asarray(u0(x), dtype=self.dtype), cells0)
545
546 def copy(self) -> Function[Scalar]:
547 """Create a copy of the Function.
548
549 The function space is shared and the degree-of-freedom vector is
550 copied.
551
552 Returns:
553 A new Function with a copy of the degree-of-freedom vector.
554 """
555 return Function(
556 self.function_space,
557 la.Vector(type(self.x._cpp_object)(self.x._cpp_object)),
558 name=self.name,
559 )
560
561 @property
562 def x(self) -> la.Vector[Scalar]:

Callers 15

test_copyFunction · 0.95
FMethod · 0.45
JMethod · 0.45
nestedMethod · 0.45
monolithicMethod · 0.45
nested_solveMethod · 0.45

Calls 2

FunctionClass · 0.70
VectorMethod · 0.45

Tested by 15

test_copyFunction · 0.76
FMethod · 0.36
JMethod · 0.36
nestedMethod · 0.36
monolithicMethod · 0.36
nested_solveMethod · 0.36