Hi
This could be solved using some try-catch+MPI communication. Otherwise the fenicstools package has a nice solution for this. Examples of both below
from dolfin import *
from numpy import array
mesh = UnitSquareMesh(4, 4)
V = FunctionSpace(mesh, "CG", 1)
u = interpolate(Expression("x[0]"), V)
x = array([0.25, 0.75])
# Simple example, works only for scalar space
try:
uu = u(x)
except:
uu = -1e16
print "Not found on proc ", MPI.rank(mpi_comm_world())
ux = MPI.max(mpi_comm_world(), uu)
print "Proc ", MPI.rank(mpi_comm_world()), " ux = ", ux
from fenicstools import Probes
p = Probes(x, V) # This works for any mixed space
# Probe once
p(u)
# Probe once again (here same result)
p(u)
# Print results of first probings on rank 0
pa = p.array()
if MPI.rank(mpi_comm_world()) == 0:
print "Probe = ", pa[0]