Skip to content
Snippets Groups Projects
Commit 1564e1cb authored by Oliver Sander's avatar Oliver Sander Committed by sander
Browse files

Python predicate methods return 'bool' now.

This used to be 'int', because dunepython didn't support the python-to-C
conversion for bool.

[[Imported from SVN: r9819]]
parent da2e2a79
No related branches found
No related tags found
No related merge requests found
...@@ -257,19 +257,19 @@ int main (int argc, char *argv[]) try ...@@ -257,19 +257,19 @@ int main (int argc, char *argv[]) try
// Make Python function that computes which vertices are on the Dirichlet boundary, // Make Python function that computes which vertices are on the Dirichlet boundary,
// based on the vertex positions. // based on the vertex positions.
std::string lambda = std::string("lambda x: (") + parameterSet.get<std::string>("dirichletVerticesPredicate") + std::string(")"); std::string lambda = std::string("lambda x: (") + parameterSet.get<std::string>("dirichletVerticesPredicate") + std::string(")");
PythonFunction<FieldVector<double,dim>, int> pythonDirichletVertices(Python::evaluate(lambda)); PythonFunction<FieldVector<double,dim>, bool> pythonDirichletVertices(Python::evaluate(lambda));
// Same for the Neumann boundary // Same for the Neumann boundary
lambda = std::string("lambda x: (") + parameterSet.get<std::string>("neumannVerticesPredicate", "0") + std::string(")"); lambda = std::string("lambda x: (") + parameterSet.get<std::string>("neumannVerticesPredicate", "0") + std::string(")");
PythonFunction<FieldVector<double,dim>, int> pythonNeumannVertices(Python::evaluate(lambda)); PythonFunction<FieldVector<double,dim>, bool> pythonNeumannVertices(Python::evaluate(lambda));
for (; vIt!=vEndIt; ++vIt) { for (; vIt!=vEndIt; ++vIt) {
int isDirichlet; bool isDirichlet;
pythonDirichletVertices.evaluate(vIt->geometry().corner(0), isDirichlet); pythonDirichletVertices.evaluate(vIt->geometry().corner(0), isDirichlet);
dirichletVertices[indexSet.index(*vIt)] = isDirichlet; dirichletVertices[indexSet.index(*vIt)] = isDirichlet;
int isNeumann; bool isNeumann;
pythonNeumannVertices.evaluate(vIt->geometry().corner(0), isNeumann); pythonNeumannVertices.evaluate(vIt->geometry().corner(0), isNeumann);
neumannNodes[indexSet.index(*vIt)] = isNeumann; neumannNodes[indexSet.index(*vIt)] = isNeumann;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment