This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

PyCharm - Unresolved reference

+1 vote

I have installed FEniCS 1.6.0 in a Linux environment (Ubuntu GNOME 14.04 LTC). FEniCS itself is working properly, but i am having trouble getting my IDE (PyCharm Community Edition 5.0) running "at full speed". If i type in (MWE),

from dolfin import *
e = Expression('0.0')

everything works as expected. The Expression class is recognized; tab completion works, i can jump to the implementation and so on. However if i type in (MWE),

from dolfin import *
p = Point(0,0,0)

my IDE lights up like a Christmas tree showing the error Unresolved reference 'Point'. The code still works, but all the nice features of my IDE are gone.

Now i know that this error means that the definition of the Point class was not found; but how come that the Expression class is recognized correctly and the Point class is not? And even more importantly; how can i fix it?

Cheers,
emher

asked Nov 11, 2015 by emher FEniCS User (1,290 points)

2 Answers

+1 vote
 
Best answer

It turns out that for classes within the cpp part of dolfin, the parent module must be imported separately (at least in PyCharm) for syntax highlighting/autocompletion to work. Hence my MWE would take the following form

from dolfin.cpp.mesh import * 
p = Point(0, 0, 0)

since the Point class is located in the dolfin.cpp.mesh module. If classes from other cpp modules are used, these modules must be imported too.

answered Feb 11, 2016 by emher FEniCS User (1,290 points)
0 votes

Difficult to say, but it may be due to the way that SWIG handles overloading. I guess Point can take different numbers of arguments for 2D or 3D. Try with ipython or another interactive environment. For example, I have never had a problem with the TAB key autocompletion in ipython.

answered Nov 16, 2015 by chris_richardson FEniCS Expert (31,740 points)
...