Skip to content
Snippets Groups Projects
Commit 19ba8527 authored by Sander, Oliver's avatar Sander, Oliver
Browse files

Use more range-based for loops

parent 7005aae5
No related branches found
No related tags found
No related merge requests found
...@@ -202,9 +202,6 @@ int main (int argc, char *argv[]) try ...@@ -202,9 +202,6 @@ int main (int argc, char *argv[]) try
BitSetVector<1> dirichletVertices(gridView.size(dim), false); BitSetVector<1> dirichletVertices(gridView.size(dim), false);
BitSetVector<1> neumannVertices(gridView.size(dim), false); BitSetVector<1> neumannVertices(gridView.size(dim), false);
GridType::Codim<dim>::LeafIterator vIt = gridView.begin<dim>();
GridType::Codim<dim>::LeafIterator vEndIt = gridView.end<dim>();
const GridView::IndexSet& indexSet = gridView.indexSet(); const GridView::IndexSet& indexSet = gridView.indexSet();
// Make Python function that computes which vertices are on the Dirichlet boundary, // Make Python function that computes which vertices are on the Dirichlet boundary,
...@@ -216,16 +213,15 @@ int main (int argc, char *argv[]) try ...@@ -216,16 +213,15 @@ int main (int argc, char *argv[]) try
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,dimworld>, bool> pythonNeumannVertices(Python::evaluate(lambda)); PythonFunction<FieldVector<double,dimworld>, bool> pythonNeumannVertices(Python::evaluate(lambda));
for (; vIt!=vEndIt; ++vIt) { for (auto&& vertex : vertices(gridView))
{
bool isDirichlet; bool isDirichlet;
pythonDirichletVertices.evaluate(vIt->geometry().corner(0), isDirichlet); pythonDirichletVertices.evaluate(vertex.geometry().corner(0), isDirichlet);
dirichletVertices[indexSet.index(*vIt)] = isDirichlet; dirichletVertices[indexSet.index(vertex)] = isDirichlet;
bool isNeumann; bool isNeumann;
pythonNeumannVertices.evaluate(vIt->geometry().corner(0), isNeumann); pythonNeumannVertices.evaluate(vertex.geometry().corner(0), isNeumann);
neumannVertices[indexSet.index(*vIt)] = isNeumann; neumannVertices[indexSet.index(vertex)] = isNeumann;
} }
BoundaryPatch<GridView> dirichletBoundary(gridView, dirichletVertices); BoundaryPatch<GridView> dirichletBoundary(gridView, dirichletVertices);
......
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