virtualization of local function adapter fails
There is a segmentation fault when one tries to plug a "localfunction" object as coefficient into a model. This is caused by the clone in the VirtualizedLocalFunction and some memory corruption in the local function adapter class. Example code:
import math, dune.fem, ufl, dune.ufl
import dune.create as create
grid = create.grid("ALUConform", dune.grid.cartesianDomain([0,0],[1,1],[16,16]), dimgrid=2)
# two grid functions to use as coefficients
coeffFunc = create.function("global", grid, "global_velocity", 0, lambda x: [2])
x = ufl.SpatialCoordinate(ufl.triangle)
funcUFL = create.function("ufl", grid, "ufl", 1, ufl.as_vector([ x[0] ]) )
# set up a local function with a coefficient
# version 1 (this one is fine)
expr1 = ufl.as_vector([ x[1]*coeffFunc[0] ])
funcUFL1 = create.function("ufl", grid, "ufl1", 1, expr1)
# verseion 2 (this one seg faults)
expr2 = ufl.as_vector([ x[1]*funcUFL[0] ])
funcUFL2 = create.function("ufl", grid, "ufl1", 1, expr2)
for e in grid.elements():
print( funcUFL1.localFunction(e).evaluate([0,0]) )
# print( funcUFL2.localFunction(e).evaluate([0,0]) ) # seg faults
Edited by Andreas Dedner