FFC JIT compiler called too many times

Issue #1009 wontfix
Stefan Jakobsson created an issue

The FFC JIT compiler is called one time for each subdomain although the same type of integral is computed for all subdomains. This creates many similar source files and slows down the computation. It should be possible to call the JIT compiler only once per integral type.

import fenics as fn
import numpy as np

numIntervals=20
mesh = fn.IntervalMesh(numIntervals, 0.0, 1.0*numIntervals)

# Create measure
subdomain_data = fn.MeshFunction("size_t", mesh, mesh.topology().dim())
subdomain_data.set_values(np.arange(numIntervals,dtype='uint'))
dx = fn.Measure('dx', domain=mesh, subdomain_data=subdomain_data)

V = fn.FunctionSpace(mesh, "CG", 1)
u = fn.interpolate(fn.Expression("x[0]", degree=2), V)

print "Compute integrals on subdomains (the FFC JIT compiler is called numIntervals times):"
vs = np.zeros(numIntervals)
for k in range(numIntervals):
    vs[k] = fn.assemble(u*dx(k))

Comments (1)

  1. Log in to comment