I'm getting a segmentation fault and I can't figure out why. Here is a very minimal example.
this is the kernel cpp file. Call it tmp.cpp
:
#include <boost/math/special_functions/bessel.hpp>
using boost::math::cyl_bessel_k;
namespace dolfin {
class Xpr : public Expression
{
public:
Xpr() : Expression() { }
void eval(Array<double>& values, const Array<double>& y) const
{
values[0] = cyl_bessel_k( 0.5, 0.0002 );
}
};
}
and here is a python file to create it:
from dolfin import *
# This is to check the values i'm using are OK
from scipy import special as sp
print sp.kv( 0.5, 0.0002 )
# The FunctionSpace seems to be irrelevant
V = FunctionSpace( UnitIntervalMesh( 22 ), "CG", 1 )
# If I comment this line out I get a warning message from PETsC! -------------
fund = Function( V )
# Read code from file.
c_file = open( "tmp.cpp" , 'r' )
# We can compile the expression without a problem
xp = Expression( c_file.read() )
print "all good up to this point"
xp( 0.0 )
What's even weirder is that if I comment the line in python marked by -------, then PETSC
catches the segmentation fault (it says it is "signal 11") and kills the MPI processes itself!!!
Any clarifications would be most helpful.