Commit cf03bfcb authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

Implements some of the naming conventions from FS#184, mainly unifying

entity iterator and index names. 
Reviewed by Christoph. 


git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@10790 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 75703f18
......@@ -154,18 +154,18 @@ public:
visited[i] = false;
// LOOP 1 : Compute row sizes
Iterator eendit = gridView_.template end<0>();
for (Iterator it = gridView_.template begin<0>(); it != eendit; ++it)
Iterator eEndIt = gridView_.template end<0>();
for (Iterator eIt = gridView_.template begin<0>(); eIt != eEndIt; ++eIt)
{
Dune::GeometryType gt = it->geometry().type();
Dune::GeometryType gt = eIt->geometry().type();
const typename Dune::GenericReferenceElementContainer<Scalar,dim>::value_type&
refelem = Dune::GenericReferenceElements<Scalar,dim>::general(gt);
// faces, c=1
for (int i = 0; i < refelem.size(1); i++)
{
int index = allMapper_.map(*it, i,1);
int alpha = faceMapper_.map(*it, i,1);
int index = allMapper_.map(*eIt, i,1);
int alpha = faceMapper_.map(*eIt, i,1);
//std::cout << "index = " << index << ", alpha = " << alpha << std::endl;
if (!visited[index])
{
......@@ -188,9 +188,9 @@ public:
visited[i] = false;
// LOOP 2 : insert the nonzeros
for (Iterator it = gridView_.template begin<0>(); it!=eendit; ++it)
for (Iterator eIt = gridView_.template begin<0>(); eIt!=eEndIt; ++eIt)
{
Dune::GeometryType gt = it->geometry().type();
Dune::GeometryType gt = eIt->geometry().type();
const typename Dune::GenericReferenceElementContainer<Scalar,dim>::value_type&
refelem = Dune::GenericReferenceElements<Scalar,dim>::general(gt);
// std::cout << "ELEM " << GeometryName(gt) << std::endl;
......@@ -198,8 +198,8 @@ public:
// faces, c=1
for (int i = 0; i < refelem.size(1); i++)
{
int index = allMapper_.map(*it, i, 1);
int alpha = faceMapper_.map(*it, i, 1);
int index = allMapper_.map(*eIt, i, 1);
int alpha = faceMapper_.map(*eIt, i, 1);
if (!visited[index])
{
A_.addindex(alpha,alpha);
......@@ -207,7 +207,7 @@ public:
}
for (int k = 0; k < refelem.size(1); k++)
if (k != i) {
int beta = faceMapper_.map(*it, k, 1);
int beta = faceMapper_.map(*eIt, k, 1);
A_.addindex(alpha, beta);
//std::cout << "alpha = " << alpha << ", added beta = " << beta << std::endl;
}
......@@ -270,21 +270,21 @@ public:
int local2Global[2*GridView::dimension];
// run over all leaf elements
Iterator eendit = gridView_.template end<0>();
for (Iterator it = gridView_.template begin<0>(); it!=eendit; ++it)
Iterator eEndIt = gridView_.template end<0>();
for (Iterator eIt = gridView_.template begin<0>(); eIt!=eEndIt; ++eIt)
{
unsigned int numFaces = it->template count<1>();
unsigned int numFaces = eIt->template count<1>();
// get local to global id map
for (unsigned int k = 0; k < numFaces; k++)
{
int alpha = faceMapper_.map(*it, k, 1);
int alpha = faceMapper_.map(*eIt, k, 1);
local2Global[k] = alpha;
}
// build local stiffness matrix for CR elements
// inludes rhs and boundary condition information
loc.assemble(*it, 1); // assemble local stiffness matrix
loc.assemble(*eIt, 1); // assemble local stiffness matrix
// accumulate local matrix into global matrix for non-hanging nodes
......
......@@ -216,17 +216,17 @@ public:
typedef typename GridView::IntersectionIterator IntersectionIterator;
int i = -1;
IntersectionIterator endit = gridView_.iend(element);
for (IntersectionIterator it = gridView_.ibegin(element); it!=endit; ++it)
IntersectionIterator isEndIt = gridView_.iend(element);
for (IntersectionIterator isIt = gridView_.ibegin(element); isIt!=isEndIt; ++isIt)
{
// local number of facet
i = it->indexInInside();
i = isIt->indexInInside();
const Dune::FieldVector<Scalar,dim>& faceGlobal = it->geometry().center();
faceVol[i] = it->geometry().volume();
const Dune::FieldVector<Scalar,dim>& faceGlobal = isIt->geometry().center();
faceVol[i] = isIt->geometry().volume();
// get normal vector
const Dune::FieldVector<Scalar,dim>& unitOuterNormal = it->centerUnitOuterNormal();
const Dune::FieldVector<Scalar,dim>& unitOuterNormal = isIt->centerUnitOuterNormal();
N[i] = unitOuterNormal;
......
......@@ -82,18 +82,18 @@ public:
VType& velocity, PType& pressure)
{
// run over all level elements
Iterator eendit = this->gridView_.template end<0>();
for (Iterator it = this->gridView_.template begin<0>(); it!=eendit; ++it)
Iterator eEndIt = this->gridView_.template end<0>();
for (Iterator eIt = this->gridView_.template begin<0>(); eIt!=eEndIt; ++eIt)
{
unsigned int numFaces = it->template count<1>();
unsigned int numFaces = eIt->template count<1>();
int elemId = elementMapper.map(*it);
int elemId = elementMapper.map(*eIt);
// get local to global id map and pressure traces
Dune::FieldVector<Scalar,2*dim> pressTrace(0);
for (unsigned int k = 0; k < numFaces; k++)
{
pressTrace[k] = u[this->faceMapper_.map(*it, k, 1)];
pressTrace[k] = u[this->faceMapper_.map(*eIt, k, 1)];
}
// The notation is borrowed from Aarnes/Krogstadt/Lie 2006, Section 3.4.
......@@ -106,7 +106,7 @@ public:
Dune::FieldVector<Scalar,2*dim> F(0);
Scalar dinv = 0;
Scalar qmean = 0;
loc.assembleElementMatrices(*it, faceVol, W, c, Pi, dinv, F, qmean);
loc.assembleElementMatrices(*eIt, faceVol, W, c, Pi, dinv, F, qmean);
pressure[elemId] = dinv*(qmean + (F*pressTrace));
......
......@@ -342,8 +342,8 @@ protected:
// the current element
const BoundaryTypes &bcTypes = this->bcTypes_(scvIdx);
IntersectionIterator isIt = this->gridView_().ibegin(this->element_());
const IntersectionIterator &endIt = this->gridView_().iend(this->element_());
for (; isIt != endIt; ++isIt)
const IntersectionIterator &isEndIt = this->gridView_().iend(this->element_());
for (; isIt != isEndIt; ++isIt)
{
// handle only intersections on the boundary
if (!isIt->boundary())
......
......@@ -104,16 +104,16 @@ public:
ElementVolumeVariables elemVolVars;
// Loop over elements
ElementIterator elemIt = this->problem_.gridView().template begin<0>();
ElementIterator endit = this->problem_.gridView().template end<0>();
for (; elemIt != endit; ++elemIt)
ElementIterator eIt = this->problem_.gridView().template begin<0>();
ElementIterator eEndIt = this->problem_.gridView().template end<0>();
for (; eIt != eEndIt; ++eIt)
{
if (elemIt->partitionType() != Dune::InteriorEntity)
if (eIt->partitionType() != Dune::InteriorEntity)
continue;
fvGeometry.update(this->gridView_(), *elemIt);
elemVolVars.update(this->problem_(), *elemIt, fvGeometry);
this->localResidual().evalFluxes(*elemIt, elemVolVars);
fvGeometry.update(this->gridView_(), *eIt);
elemVolVars.update(this->problem_(), *eIt, fvGeometry);
this->localResidual().evalFluxes(*eIt, elemVolVars);
bool hasLeft = false;
bool hasRight = false;
......@@ -160,23 +160,23 @@ public:
VolumeVariables volVars;
ElementBoundaryTypes elemBcTypes;
ElementIterator elemIt = this->gridView_().template begin<0>();
ElementIterator endit = this->gridView_().template end<0>();
for (; elemIt != endit; ++elemIt)
ElementIterator eIt = this->gridView_().template begin<0>();
ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt)
{
int idx = this->elementMapper().map(*elemIt);
int idx = this->elementMapper().map(*eIt);
rank[idx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *elemIt);
elemBcTypes.update(this->problem_(), *elemIt);
fvGeometry.update(this->gridView_(), *eIt);
elemBcTypes.update(this->problem_(), *eIt);
int numLocalVerts = elemIt->template count<dim>();
int numLocalVerts = eIt->template count<dim>();
for (int i = 0; i < numLocalVerts; ++i)
{
int globalIdx = this->vertexMapper().map(*elemIt, i, dim);
int globalIdx = this->vertexMapper().map(*eIt, i, dim);
volVars.update(sol[globalIdx],
this->problem_(),
*elemIt,
*eIt,
fvGeometry,
i,
false);
......
......@@ -110,23 +110,23 @@ public:
VolumeVariables volVars;
ElementBoundaryTypes elemBcTypes;
ElementIterator elemIt = this->gridView_().template begin<0>();
ElementIterator endit = this->gridView_().template end<0>();
for (; elemIt != endit; ++elemIt)
ElementIterator eIt = this->gridView_().template begin<0>();
ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt)
{
int idx = this->elementMapper().map(*elemIt);
int idx = this->elementMapper().map(*eIt);
rank[idx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *elemIt);
elemBcTypes.update(this->problem_(), *elemIt, fvGeometry);
fvGeometry.update(this->gridView_(), *eIt);
elemBcTypes.update(this->problem_(), *eIt, fvGeometry);
int numLocalVerts = elemIt->template count<dim>();
int numLocalVerts = eIt->template count<dim>();
for (int i = 0; i < numLocalVerts; ++i)
{
int globalIdx = this->vertexMapper().map(*elemIt, i, dim);
int globalIdx = this->vertexMapper().map(*eIt, i, dim);
volVars.update(sol[globalIdx],
this->problem_(),
*elemIt,
*eIt,
fvGeometry,
i,
false);
......
......@@ -121,25 +121,25 @@ public:
VolumeVariables volVars;
ElementBoundaryTypes elemBcTypes;
ElementIterator elemIt = this->gridView_().template begin<0>();
ElementIterator endit = this->gridView_().template end<0>();
for (; elemIt != endit; ++elemIt)
ElementIterator eIt = this->gridView_().template begin<0>();
ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt)
{
int idx = this->elementMapper().map(*elemIt);
int idx = this->elementMapper().map(*eIt);
rank[idx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *elemIt);
elemBcTypes.update(this->problem_(), *elemIt, fvGeometry);
fvGeometry.update(this->gridView_(), *eIt);
elemBcTypes.update(this->problem_(), *eIt, fvGeometry);
int numLocalVerts = elemIt->template count<dim>();
for (int vertexIdx = 0; vertexIdx < numLocalVerts; ++vertexIdx)
int numLocalVerts = eIt->template count<dim>();
for (int vertIdx = 0; vertIdx < numLocalVerts; ++vertIdx)
{
int globalIdx = this->vertexMapper().map(*elemIt, vertexIdx, dim);
int globalIdx = this->vertexMapper().map(*eIt, vertIdx, dim);
volVars.update(sol[globalIdx],
this->problem_(),
*elemIt,
*eIt,
fvGeometry,
vertexIdx,
vertIdx,
false);
pn [globalIdx] = volVars.pressure();
......
......@@ -102,36 +102,36 @@ public:
unsigned numElements = this->gridView_().size(0);
ScalarField *rank = writer.allocateManagedBuffer(numElements);
ElementIterator elemIt = this->gridView_().template begin<0>();
ElementIterator elemEndIt = this->gridView_().template end<0>();
for (; elemIt != elemEndIt; ++elemIt)
ElementIterator eIt = this->gridView_().template begin<0>();
ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt)
{
int idx = this->problem_().model().elementMapper().map(*elemIt);
int idx = this->problem_().model().elementMapper().map(*eIt);
(*rank)[idx] = this->gridView_().comm().rank();
FVElementGeometry fvGeometry;
fvGeometry.update(this->gridView_(), *elemIt);
fvGeometry.update(this->gridView_(), *eIt);
ElementVolumeVariables elemVolVars;
elemVolVars.update(this->problem_(),
*elemIt,
*eIt,
fvGeometry,
false /* oldSol? */);
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
int globalIdx = this->dofMapper().map(*elemIt, scvIdx, dofCodim);
int globalIdx = this->dofMapper().map(*eIt, scvIdx, dofCodim);
const SpatialParams &spatialParams = this->problem_().spatialParams();
(*p)[globalIdx] = elemVolVars[scvIdx].pressure();
(*K)[globalIdx] = spatialParams.intrinsicPermeability(*elemIt,
(*K)[globalIdx] = spatialParams.intrinsicPermeability(*eIt,
fvGeometry,
scvIdx);
}
// velocity output
velocityOutput.calculateVelocity(*velocity, elemVolVars, fvGeometry, *elemIt, /*phaseIdx=*/0);
velocityOutput.calculateVelocity(*velocity, elemVolVars, fvGeometry, *eIt, /*phaseIdx=*/0);
}
writer.attachDofData(*p, "p", isBox);
......
......@@ -135,25 +135,25 @@ public:
unsigned numElements = this->gridView_().size(0);
ScalarField &rank = *writer.allocateManagedBuffer(numElements);
ElementIterator elemIt = this->gridView_().template begin<0>();
ElementIterator elemEndIt = this->gridView_().template end<0>();
for (; elemIt != elemEndIt; ++elemIt)
ElementIterator eIt = this->gridView_().template begin<0>();
ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt)
{
int idx = this->problem_().model().elementMapper().map(*elemIt);
int idx = this->problem_().model().elementMapper().map(*eIt);
rank[idx] = this->gridView_().comm().rank();
FVElementGeometry fvGeometry;
fvGeometry.update(this->gridView_(), *elemIt);
fvGeometry.update(this->gridView_(), *eIt);
ElementVolumeVariables elemVolVars;
elemVolVars.update(this->problem_(),
*elemIt,
*eIt,
fvGeometry,
false /* oldSol? */);
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
int globalIdx = this->dofMapper().map(*elemIt, scvIdx, dofCodim);
int globalIdx = this->dofMapper().map(*eIt, scvIdx, dofCodim);
pressure[globalIdx] = elemVolVars[scvIdx].pressure();
delp[globalIdx] = elemVolVars[scvIdx].pressure() - 1e5;
......@@ -166,7 +166,7 @@ public:
}
// velocity output
velocityOutput.calculateVelocity(*velocity, elemVolVars, fvGeometry, *elemIt, phaseIdx);
velocityOutput.calculateVelocity(*velocity, elemVolVars, fvGeometry, *eIt, phaseIdx);
}
writer.attachDofData(pressure, "P", isBox);
......
......@@ -160,13 +160,13 @@ public:
* the face of a sub-control volume.
*
* \param flux The diffusive flux over the sub-control-volume face for each phase
* \param fluxData The flux variables at the current SCV
* \param fluxVars The flux variables at the current SCV
*
* It doesn't do anything in two-phase model but is used by the
* non-isothermal two-phase models to calculate diffusive heat
* fluxes
*/
void computeDiffusiveFlux(PrimaryVariables &flux, const FluxVariables &fluxData) const
void computeDiffusiveFlux(PrimaryVariables &flux, const FluxVariables &fluxVars) const
{
// diffusive fluxes
flux += 0.0;
......
......@@ -149,25 +149,25 @@ public:
unsigned numElements = this->gridView_().size(0);
ScalarField *rank = writer.allocateManagedBuffer(numElements);
ElementIterator elemIt = this->gridView_().template begin<0>();
ElementIterator elemEndIt = this->gridView_().template end<0>();
for (; elemIt != elemEndIt; ++elemIt)
ElementIterator eIt = this->gridView_().template begin<0>();
ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt)
{
int idx = this->elementMapper().map(*elemIt);
int idx = this->elementMapper().map(*eIt);
(*rank)[idx] = this->gridView_().comm().rank();
FVElementGeometry fvGeometry;
fvGeometry.update(this->gridView_(), *elemIt);
fvGeometry.update(this->gridView_(), *eIt);
ElementVolumeVariables elemVolVars;
elemVolVars.update(this->problem_(),
*elemIt,
*eIt,
fvGeometry,
false /* oldSol? */);
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
int globalIdx = this->dofMapper().map(*elemIt, scvIdx, dofCodim);
int globalIdx = this->dofMapper().map(*eIt, scvIdx, dofCodim);
(*pw)[globalIdx] = elemVolVars[scvIdx].pressure(wPhaseIdx);
(*pn)[globalIdx] = elemVolVars[scvIdx].pressure(nPhaseIdx);
......@@ -183,8 +183,8 @@ public:
}
// velocity output
velocityOutput.calculateVelocity(*velocityW, elemVolVars, fvGeometry, *elemIt, wPhaseIdx);
velocityOutput.calculateVelocity(*velocityN, elemVolVars, fvGeometry, *elemIt, nPhaseIdx);
velocityOutput.calculateVelocity(*velocityW, elemVolVars, fvGeometry, *eIt, wPhaseIdx);
velocityOutput.calculateVelocity(*velocityN, elemVolVars, fvGeometry, *eIt, nPhaseIdx);
}
writer.attachDofData(*sn, "sn", isBox);
......
......@@ -156,14 +156,14 @@ public:
setSwitched_(false);
// check, if velocity output can be used (works only for cubes so far)
ElementIterator elemIt = this->gridView_().template begin<0>();
ElementIterator elemEndIt = this->gridView_().template end<0>();
for (; elemIt != elemEndIt; ++elemIt)
ElementIterator eIt = this->gridView_().template begin<0>();
ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt)
{
if (!isBox) // i.e. cell-centered discretization
{
int globalIdx = this->dofMapper().map(*elemIt);
const GlobalPosition &globalPos = elemIt->geometry().center();
int globalIdx = this->dofMapper().map(*eIt);
const GlobalPosition &globalPos = eIt->geometry().center();
// initialize phase presence
staticDat_[globalIdx].phasePresence
......@@ -208,14 +208,14 @@ public:
{
storage = 0;
ElementIterator elemIt = this->gridView_().template begin<0>();
const ElementIterator elemEndIt = this->gridView_().template end<0>();
for (; elemIt != elemEndIt; ++elemIt) {
if(elemIt->partitionType() == Dune::InteriorEntity)
ElementIterator eIt = this->gridView_().template begin<0>();
const ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt) {
if(eIt->partitionType() == Dune::InteriorEntity)
{
this->localResidual().evalPhaseStorage(*elemIt, phaseIdx);
this->localResidual().evalPhaseStorage(*eIt, phaseIdx);
for (unsigned int i = 0; i < this->localResidual().storageTerm().size(); ++i)
storage += this->localResidual().storageTerm()[i];
......@@ -326,25 +326,25 @@ public:
unsigned numElements = this->gridView_().size(0);
ScalarField *rank = writer.allocateManagedBuffer(numElements);
ElementIterator elemIt = this->gridView_().template begin<0>();
ElementIterator elemEndIt = this->gridView_().template end<0>();
for (; elemIt != elemEndIt; ++elemIt)
ElementIterator eIt = this->gridView_().template begin<0>();
ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt)
{
int idx = this->elementMapper().map(*elemIt);
int idx = this->elementMapper().map(*eIt);
(*rank)[idx] = this->gridView_().comm().rank();
FVElementGeometry fvGeometry;
fvGeometry.update(this->gridView_(), *elemIt);
fvGeometry.update(this->gridView_(), *eIt);
ElementVolumeVariables elemVolVars;
elemVolVars.update(this->problem_(),
*elemIt,
*eIt,
fvGeometry,
false /* oldSol? */);
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
int globalIdx = this->dofMapper().map(*elemIt, scvIdx, dofCodim);
int globalIdx = this->dofMapper().map(*eIt, scvIdx, dofCodim);
(*sN)[globalIdx] = elemVolVars[scvIdx].saturation(nPhaseIdx);
(*sW)[globalIdx] = elemVolVars[scvIdx].saturation(wPhaseIdx);
......@@ -370,8 +370,8 @@ public:
}
// velocity output
velocityOutput.calculateVelocity(*velocityW, elemVolVars, fvGeometry, *elemIt, wPhaseIdx);
velocityOutput.calculateVelocity(*velocityN, elemVolVars, fvGeometry, *elemIt, nPhaseIdx);
velocityOutput.calculateVelocity(*velocityW, elemVolVars, fvGeometry, *eIt, wPhaseIdx);
velocityOutput.calculateVelocity(*velocityN, elemVolVars, fvGeometry, *eIt, nPhaseIdx);
} // loop over elements
......@@ -465,14 +465,14 @@ public:
FVElementGeometry fvGeometry;
static VolumeVariables volVars;
ElementIterator elemIt = this->gridView_().template begin<0> ();
const ElementIterator &elemEndIt = this->gridView_().template end<0> ();
for (; elemIt != elemEndIt; ++elemIt)
ElementIterator eIt = this->gridView_().template begin<0> ();
const ElementIterator &eEndIt = this->gridView_().template end<0> ();
for (; eIt != eEndIt; ++eIt)
{
fvGeometry.update(this->gridView_(), *elemIt);
fvGeometry.update(this->gridView_(), *eIt);
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{
int globalIdx = this->dofMapper().map(*elemIt, scvIdx, dofCodim);
int globalIdx = this->dofMapper().map(*eIt, scvIdx, dofCodim);
if (staticDat_[globalIdx].visited)
continue;
......@@ -480,7 +480,7 @@ public:
staticDat_[globalIdx].visited = true;
volVars.update(curGlobalSol[globalIdx],
this->problem_(),
*elemIt,
*eIt,
fvGeometry,
scvIdx,
false);
......
......@@ -115,9 +115,9 @@ public:
*/
void computeStorageFracture(PrimaryVariables &storage, int scvIdx, bool usePrevSol) const
{
const ElementVolumeVariables &elemDat = usePrevSol ? this->prevVolVars_()
const ElementVolumeVariables &elemVolVars = usePrevSol ? this->prevVolVars_()
: this->curVolVars_();
const VolumeVariables &vertDat = elemDat[scvIdx];
const VolumeVariables &volVars = elemVolVars[scvIdx];
const Element &elem = this->element_();
bool isFracture = this->problem_().spatialParams().isVertexFracture(elem, scvIdx);
/*
......@@ -135,12 +135,12 @@ public:
*/
Dune::GeometryType gt = elem.geometry().type();
const typename Dune::GenericReferenceElementContainer<DT,dim>::value_type&
refElem = Dune::GenericReferenceElements<DT,dim>::general(gt);
refElement = Dune::GenericReferenceElements<DT,dim>::general(gt);
Scalar vol; //subcontrol volume
FVElementGeometry fvelem = this->fvGeometry_();
vol = fvelem.subContVol[scvIdx].volume;
for (int faceIdx=0; faceIdx<refElem.size(1); faceIdx++)
for (int faceIdx=0; faceIdx<refElement.size(1); faceIdx++)