Commit d76ef6ca authored by Timo Koch's avatar Timo Koch
Browse files

[range-based-for] Use ADL as intended by dune

Argument dependent lookup deduces the Dune namespace from
the function arguments that are also in namespace Dune.
parent 17137c22
......@@ -55,7 +55,7 @@ public:
const auto element = *gridView_.template begin<0>();
int fIdx = 0;
for (const auto& intersection : Dune::intersections(gridView_, element))
for (const auto& intersection : intersections(gridView_, element))
{
int idxInInside = intersection.indexInInside();
......@@ -198,13 +198,13 @@ public:
intersectionMapLocal_.clear();
intersectionMapLocal_.resize(elementMapper_.size());
for (const auto& element : Dune::elements(gridView_))
for (const auto& element : elements(gridView_))
{
int eIdxGlobal = index(element);
int fIdx = 0;
// run through all intersections with neighbors
for (const auto& intersection : Dune::intersections(gridView_, element))
for (const auto& intersection : intersections(gridView_, element))
{
int indexInInside = intersection.indexInInside();
intersectionMapLocal_[eIdxGlobal][fIdx] = indexInInside;
......@@ -214,13 +214,13 @@ public:
}
int globalIntersectionIdx = 0;
for (const auto& element : Dune::elements(gridView_))
for (const auto& element : elements(gridView_))
{
int eIdxGlobal = index(element);
int fIdx = 0;
// run through all intersections with neighbors
for (const auto& intersection : Dune::intersections(gridView_, element))
for (const auto& intersection : intersections(gridView_, element))
{
if (intersection.neighbor())
{
......@@ -237,7 +237,7 @@ public:
}
else
{
for (const auto& intersectionNeighbor : Dune::intersections(gridView_, neighbor))
for (const auto& intersectionNeighbor : intersections(gridView_, neighbor))
{
if (intersectionNeighbor.neighbor())
{
......
......@@ -352,7 +352,7 @@ protected:
// evaluate boundary conditions for the intersections of
// the current element
const BoundaryTypes &bcTypes = this->bcTypes_(scvIdx);
for (const auto& intersection : Dune::intersections(this->gridView_(), this->element_()))
for (const auto& intersection : intersections(this->gridView_(), this->element_()))
{
// handle only intersections on the boundary
if (!intersection.boundary())
......
......@@ -104,7 +104,7 @@ public:
ElementVolumeVariables elemVolVars;
// Loop over elements
for (const auto& element : Dune::elements(this->problem_.gridView()))
for (const auto& element : elements(this->problem_.gridView()))
{
if (element.partitionType() != Dune::InteriorEntity)
continue;
......@@ -158,7 +158,7 @@ public:
VolumeVariables volVars;
ElementBoundaryTypes elemBcTypes;
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
int eIdx = this->elementMapper().index(element);
......
......@@ -132,7 +132,7 @@ public:
VolumeVariables volVars;
ElementBoundaryTypes elemBcTypes;
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
int idx = this->elementMapper().index(element);
......
......@@ -139,7 +139,7 @@ public:
VolumeVariables volVars;
ElementBoundaryTypes elemBcTypes;
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
int idx = this->elementMapper().index(element);
......
......@@ -154,7 +154,7 @@ public:
FVElementGeometry fvGeometry;
VolumeVariables volVars;
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
int idx = this->elementMapper().index(element);
rank[idx] = this->gridView_().comm().rank();
......@@ -199,7 +199,7 @@ public:
asImp_().writeFluxVarsHeader(fluxVarsFile);
fluxVarsFile << std::endl;
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
fvGeometry.update(this->gridView_(), element);
......@@ -216,7 +216,7 @@ public:
Scalar sumUPlus = 0.0;
Scalar sumYPlus = 0.0;
for (const auto& intersection : Dune::intersections(this->gridView_(), element))
for (const auto& intersection : intersections(this->gridView_(), element))
{
int fIdx = intersection.indexInInside();
......@@ -586,7 +586,7 @@ public:
{
FVElementGeometry fvGeometry;
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
fvGeometry.update(this->gridView_(), element);
......@@ -665,7 +665,7 @@ public:
{
FVElementGeometry fvGeometry;
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
fvGeometry.update(this->gridView_(), element);
......@@ -675,7 +675,7 @@ public:
fvGeometry,
false);
for (const auto& intersection : Dune::intersections(this->gridView_(), element))
for (const auto& intersection : intersections(this->gridView_(), element))
{
int fIdx = intersection.indexInInside();
FluxVariables fluxVars(this->problem_(),
......@@ -723,7 +723,7 @@ public:
{
FVElementGeometry fvGeometry;
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
fvGeometry.update(this->gridView_(), element);
......@@ -734,7 +734,7 @@ public:
false);
const ReferenceElement &refElement = ReferenceElements::general(element.geometry().type());
for (const auto& intersection : Dune::intersections(this->gridView_(), element))
for (const auto& intersection : intersections(this->gridView_(), element))
{
// handle only faces on the boundary
if (!intersection.boundary())
......
......@@ -161,7 +161,7 @@ public:
ElementBoundaryTypes elemBcTypes;
VolumeVariables volVars;
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
int idx = this->elementMapper().index(element);
rank[idx] = this->gridView_().comm().rank();
......@@ -227,7 +227,7 @@ public:
asImp_().writeFluxVarsHeader(fluxFile);
fluxFile << std::endl;
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
fvGeometry.update(this->gridView_(), element);
......@@ -245,7 +245,7 @@ public:
Scalar sumYPlus = 0.0;
Scalar sumEddyDiffusivity = 0.0;
for (const auto& intersection : Dune::intersections(this->gridView_(), element))
for (const auto& intersection : intersections(this->gridView_(), element))
{
int fIdx = intersection.indexInInside();
......
......@@ -173,7 +173,7 @@ public:
FVElementGeometry fvGeometry;
VolumeVariables volVars;
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
int idx = this->elementMapper().index(element);
rank[idx] = this->gridView_().comm().rank();
......@@ -242,7 +242,7 @@ public:
asImp_().writeFluxVarsHeader(fluxFile);
fluxFile << std::endl;
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
fvGeometry.update(this->gridView_(), element);
......@@ -261,7 +261,7 @@ public:
Scalar sumEddyDiffusivity = 0.0;
Scalar sumEddyConducitivity = 0.0;
for (const auto& intersection : Dune::intersections(this->gridView_(), element))
for (const auto& intersection : intersections(this->gridView_(), element))
{
int fIdx = intersection.indexInInside();
......
......@@ -246,7 +246,7 @@ public:
// initialize start and end of element iterator
// loop over all elements (cells)
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
if(element.partitionType() == Dune::InteriorEntity)
{
......
......@@ -99,7 +99,7 @@ private:
// each vertex
typedef std::set<int> NeighborSet;
std::vector<NeighborSet> neighbors(numVertices);
for (const auto& element : Dune::elements(this->problem().gridView())) {
for (const auto& element : elements(this->problem().gridView())) {
// loop over all element vertices
int n = element.subEntities(dim);
......
......@@ -320,7 +320,7 @@ public:
};
// Mark all red elements
for (const auto& element : Dune::elements(gridView_())) {
for (const auto& element : elements(gridView_())) {
// find out whether the current element features a red
// vertex
bool isRed = false;
......@@ -343,7 +343,7 @@ public:
}
// Mark yellow vertices (as orange for the mean time)
for (const auto& element : Dune::elements(gridView_())) {
for (const auto& element : elements(gridView_())) {
int eIdx = this->elementMapper_().index(element);
if (elementColor_[eIdx] != Red)
continue; // non-red elements do not tint vertices
......@@ -360,7 +360,7 @@ public:
}
// Mark yellow elements
for (const auto& element : Dune::elements(gridView_())) {
for (const auto& element : elements(gridView_())) {
int eIdx = this->elementMapper_().index(element);
if (elementColor_[eIdx] == Red) {
continue; // element is red already!
......@@ -384,7 +384,7 @@ public:
// Demote orange vertices to yellow ones if it has at least
// one green element as a neighbor.
for (const auto& element : Dune::elements(gridView_())) {
for (const auto& element : elements(gridView_())) {
int eIdx = this->elementMapper_().index(element);
if (elementColor_[eIdx] != Green)
continue; // yellow and red elements do not make
......
......@@ -242,7 +242,7 @@ public:
{
storage = 0;
for (const auto& element : Dune::elements(gridView_()))
for (const auto& element : elements(gridView_()))
{
if(element.partitionType() == Dune::InteriorEntity)
{
......@@ -836,7 +836,7 @@ protected:
//
// TODO: the initial condition needs to be unique for
// each vertex. we should think about the API...
for (const auto& element : Dune::elements(gridView_())) {
for (const auto& element : elements(gridView_())) {
// deal with the current element
fvGeometry.update(gridView_(), element);
......@@ -905,11 +905,11 @@ protected:
boundaryIndices_.resize(numDofs());
std::fill(boundaryIndices_.begin(), boundaryIndices_.end(), false);
for (const auto& element : Dune::elements(gridView_())) {
for (const auto& element : elements(gridView_())) {
Dune::GeometryType geomType = element.geometry().type();
const ReferenceElement &refElement = ReferenceElements::general(geomType);
for (const auto& intersection : Dune::intersections(gridView_(), element)) {
for (const auto& intersection : intersections(gridView_(), element)) {
if (intersection.boundary()) {
if (isBox)
{
......
......@@ -370,7 +370,7 @@ public:
}
// include boundary conditions
// iterate over element intersections of codim dim-1
for (const auto& intersection : Dune::intersections(model_.problem().gridView(), eg.entity()))
for (const auto& intersection : intersections(model_.problem().gridView(), eg.entity()))
{
// handle only faces on the boundary
if (!intersection.boundary())
......
......@@ -326,7 +326,7 @@ public:
const typename GridFunctionSpace::Ordering& ordering = gridFunctionSpace.ordering();
// initialize start and end of element iterator
// loop over all elements (cells)
for (const auto& element : Dune::elements(this->gridView_())) {
for (const auto& element : elements(this->gridView_())) {
if(element.partitionType() == Dune::InteriorEntity)
{
......
......@@ -118,7 +118,7 @@ public:
VolumeVariables volVars;
ElementBoundaryTypes elemBcTypes;
for (const auto& element : Dune::elements(this->gridView_()))
for (const auto& element : elements(this->gridView_()))
{
if(element.partitionType() == Dune::InteriorEntity)
{
......
......@@ -125,7 +125,7 @@ public:
if(!isBox)
{
for (const auto& element : Dune::elements(levelView))
for (const auto& element : elements(levelView))
{
//get your map entry
AdaptedValues &adaptedValues = adaptionMap_[element];
......@@ -152,7 +152,7 @@ public:
}
else
{
for (const auto& entity : Dune::entities(levelView, Dune::Codim<dofCodim>()))
for (const auto& entity : entities(levelView, Dune::Codim<dofCodim>()))
{
//get your map entry
AdaptedValues &adaptedValues = adaptionMap_[entity];
......@@ -190,7 +190,7 @@ public:
{
LevelGridView levelView = grid_.levelGridView(level);
for (const auto& element : Dune::elements(levelView))
for (const auto& element : elements(levelView))
{
// only treat non-ghosts, ghost data is communicated afterwards
if (element.partitionType() == Dune::GhostEntity)
......
......@@ -234,7 +234,7 @@ public:
typedef std::unordered_map<int, int> CoarsenMarkerType;
CoarsenMarkerType coarsenMarker;
for (const auto& element : Dune::elements(problem_.gridView()))
for (const auto& element : elements(problem_.gridView()))
{
// only mark non-ghost elements
if (element.partitionType() != Dune::GhostEntity)
......@@ -342,7 +342,7 @@ private:
bool checkNeighborsRefine_(const Element &element, int level = 1)
{
// this also refines the neighbor elements
for(const auto& intersection : Dune::intersections(problem_.gridView(), element))
for(const auto& intersection : intersections(problem_.gridView(), element))
{
if(!intersection.neighbor())
continue;
......@@ -386,14 +386,14 @@ private:
{
// run through all cells
done=true;
for (const auto& element : Dune::elements(leafGridView))
for (const auto& element : elements(leafGridView))
{
// only mark non-ghost elements
if (element.partitionType() == Dune::GhostEntity)
continue;
// run through all neighbor-cells (intersections)
for (const auto& intersection : Dune::intersections(leafGridView, element))
for (const auto& intersection : intersections(leafGridView, element))
{
if(!intersection.neighbor())
continue;
......
......@@ -209,7 +209,7 @@ public:
// 1) calculate Indicator -> min, maxvalues
// loop over all leaf elements
for (const auto& element : Dune::elements(problem_.gridView()))
for (const auto& element : elements(problem_.gridView()))
{
int globalIdxI = problem_.elementMapper().index(element);
......@@ -251,7 +251,7 @@ public:
if (indicatorVector_[globalIdxI] != refineCell && (refineAtDirichletBC_ || refineAtFluxBC_))
{
// Calculate the boundary indicator for all boundary intersections
for (const auto& intersection : Dune::intersections(problem_.gridView(), element))
for (const auto& intersection : intersections(problem_.gridView(), element))
{
if (intersection.boundary())
{
......
......@@ -483,7 +483,7 @@ protected:
greenElems_ = 0;
// reassemble the elements...
for (const auto& element : Dune::elements(gridView_())) {
for (const auto& element : elements(gridView_())) {
if (element.partitionType() == Dune::GhostEntity)
{
asImp_().assembleGhostElement_(element);
......
......@@ -92,7 +92,7 @@ private:
}
// Mark all red elements
for (const auto& element : Dune::elements(this->gridView_())) {
for (const auto& element : elements(this->gridView_())) {
// find out whether the current element features a red
// vertex
bool isRed = false;
......@@ -119,7 +119,7 @@ private:
}
// Mark yellow vertices (as orange for the mean time)
for (const auto& element : Dune::elements(this->gridView_())) {
for (const auto& element : elements(this->gridView_())) {
int eIdx = this->elementMapper_().index(element);
if (this->elementColor_[eIdx] != ParentType::Red)
......@@ -150,7 +150,7 @@ private:
Dune::ForwardCommunication);
// Mark yellow elements
for (const auto& element : Dune::elements(this->gridView_())) {
for (const auto& element : elements(this->gridView_())) {
int eIdx = this->elementMapper_().index(element);
if (this->elementColor_[eIdx] == ParentType::Red) {
......@@ -177,7 +177,7 @@ private:
// Demote orange vertices to yellow ones if it has at least
// one green element as a neighbor.
for (const auto& element : Dune::elements(this->gridView_())) {
for (const auto& element : elements(this->gridView_())) {
int eIdx = this->elementMapper_().index(element);
if (this->elementColor_[eIdx] != ParentType::Green)
......@@ -231,7 +231,7 @@ private:
// each vertex
typedef std::set<int> NeighborSet;
std::vector<NeighborSet> neighbors(numVerticesGlobal);
for (const auto& element : Dune::elements(this->gridView_())) {
for (const auto& element : elements(this->gridView_())) {
int numVerticesLocal = element.subEntities(dim);
// if the element is not in the interior or the process
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment