Hi,
I'm not sure if this is the right place to ask this question (or if it should be in a forum for bugs). Anyway, I'm having some troubles to get the code from nsbench (ch. 21 in the FEniCS book) working. In particular I'm trying to use the g2 and g3 solvers. I've been troubleshooting some myself and I think I have localized what causes the problem, but I'm not sure how to fix it. In the solvers (g2 and g3) a parameter, d1, is defined by the following command:
d1 = Expression(cppcode_d1, element=DG)
And in the cppcode_d1 there is a code segment like this one:
for (CellIterator cell(mesh); !cell.end(); ++cell)
{
some code
for (VertexIterator vertex(*cell); !vertex.end(); ++vertex)
{
for (uint i = 0; i < gdim; ++i)
{
some code again
}
}
some more code
}
However, when compiling I get the following error message:
error: ‘VertexIterator’ was not declared in this scope
The CellIterator works fine though. I'm not a C++ programmer (or a programmer at all...) so I don't know how to proceed from this. Any tips?
Thank you in advance!
P.S I have the latest version of FEniCS installed (1.2.0). If anyone wants to try the code from nsbench: I believe that PeriodicBC changed name to PeriodicBoundaryComputation in the new version (you will need to change this in the code).
edit: Here is an example demonstrating my problem.
I have a file named test.py where I have the this code
from dolfin import *
from testcppcode import *
d1 = Expression(testcppcode_d1)
and in testcppcode.py I have the following code
testcppcode_d1 = """
class Delta1 : public Expression
{
public:
Delta1() : Expression() {}
void update(boost::shared_ptr<dolfin::Function> u)
{
const Mesh& mesh = *(*(u->function_space())).mesh();
double U = 0.0;
for (CellIterator cell(mesh); !cell.end(); ++cell)
{
for (VertexIterator vertex(*cell); !vertex.end(); ++vertex)
{
U++;
}
}
}
};"""
This gives me the error message: ‘VertexIterator’ was not declared in this scope.