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

Use range-based for for cleaner code

[[Imported from SVN: r10110]]
parent 4c6d6143
Branches
Tags
No related merge requests found
...@@ -146,9 +146,6 @@ int main (int argc, char *argv[]) try ...@@ -146,9 +146,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,
...@@ -160,15 +157,15 @@ int main (int argc, char *argv[]) try ...@@ -160,15 +157,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,dim>, bool> pythonNeumannVertices(Python::evaluate(lambda)); PythonFunction<FieldVector<double,dim>, bool> pythonNeumannVertices(Python::evaluate(lambda));
for (; vIt!=vEndIt; ++vIt) for (auto&& v : vertices(gridView))
{ {
bool isDirichlet; bool isDirichlet;
pythonDirichletVertices.evaluate(vIt->geometry().corner(0), isDirichlet); pythonDirichletVertices.evaluate(v.geometry().corner(0), isDirichlet);
dirichletVertices[indexSet.index(*vIt)] = isDirichlet; dirichletVertices[indexSet.index(v)] = isDirichlet;
bool isNeumann; bool isNeumann;
pythonNeumannVertices.evaluate(vIt->geometry().corner(0), isNeumann); pythonNeumannVertices.evaluate(v.geometry().corner(0), isNeumann);
neumannVertices[indexSet.index(*vIt)] = isNeumann; neumannVertices[indexSet.index(v)] = 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.
Please register or to comment