Copying a function in dolfinx

For now you can make a workaround as follows:

func = Function(V)
copy = Function(V)
copy.x.array[:] = func.x.array

There is an issue registered on github, and a proposed fix is added in: Fix function copy option by jorgensd · Pull Request #1916 · FEniCS/dolfinx · GitHub

3 Likes