Commit 65841a3f authored by Tianyuan Zheng's avatar Tianyuan Zheng
Browse files

mingConventions] changed ElementIterator "eIt", "eEndIt",

IntersectionIterator "isIt", "isEndIt", integer indeces "eIdx", "vIdx"
and "isIdx"

reviewed by kathinka



git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@11574 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 936705e8
......@@ -165,8 +165,8 @@ public:
ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt)
{
int idx = this->elementMapper().map(*eIt);
rank[idx] = this->gridView_().comm().rank();
int eIdx = this->elementMapper().map(*eIt);
rank[eIdx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *eIt);
elemBcTypes.update(this->problem_(), *eIt);
......
......@@ -114,8 +114,8 @@ public:
ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt)
{
int idx = this->elementMapper().map(*eIt);
rank[idx] = this->gridView_().comm().rank();
int eIdx = this->elementMapper().map(*eIt);
rank[eIdx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *eIt);
elemBcTypes.update(this->problem_(), *eIt, fvGeometry);
......
......@@ -125,21 +125,21 @@ public:
ElementIterator eEndIt = this->gridView_().template end<0>();
for (; eIt != eEndIt; ++eIt)
{
int idx = this->elementMapper().map(*eIt);
rank[idx] = this->gridView_().comm().rank();
int eIdx = this->elementMapper().map(*eIt);
rank[eIdx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *eIt);
elemBcTypes.update(this->problem_(), *eIt, fvGeometry);
int numLocalVerts = eIt->template count<dim>();
for (int vertIdx = 0; vertIdx < numLocalVerts; ++vertIdx)
for (int vIdx = 0; vIdx < numLocalVerts; ++vIdx)
{
int globalIdx = this->vertexMapper().map(*eIt, vertIdx, dim);
int globalIdx = this->vertexMapper().map(*eIt, vIdx, dim);
volVars.update(sol[globalIdx],
this->problem_(),
*eIt,
fvGeometry,
vertIdx,
vIdx,
false);
pn [globalIdx] = volVars.pressure();
......
......@@ -214,29 +214,29 @@ public:
ScalarField &cellPressure = *writer.allocateManagedBuffer(numElements);
// initialize cell stresses, cell-wise hydraulic parameters and cell pressure with zero
for (unsigned int elemIdx = 0; elemIdx < numElements; ++elemIdx) {
effStressX[elemIdx] = Scalar(0.0);
for (unsigned int eIdx = 0; eIdx < numElements; ++eIdx) {
effStressX[eIdx] = Scalar(0.0);
if (dim >= 2)
effStressY[elemIdx] = Scalar(0.0);
effStressY[eIdx] = Scalar(0.0);
if (dim >= 3)
effStressZ[elemIdx] = Scalar(0.0);
effStressZ[eIdx] = Scalar(0.0);
totalStressX[elemIdx] = Scalar(0.0);
totalStressX[eIdx] = Scalar(0.0);
if (dim >= 2)
totalStressY[elemIdx] = Scalar(0.0);
totalStressY[eIdx] = Scalar(0.0);
if (dim >= 3)
totalStressZ[elemIdx] = Scalar(0.0);
totalStressZ[eIdx] = Scalar(0.0);
principalStress1[elemIdx] = Scalar(0.0);
principalStress1[eIdx] = Scalar(0.0);
if (dim >= 2)
principalStress2[elemIdx] = Scalar(0.0);
principalStress2[eIdx] = Scalar(0.0);
if (dim >= 3)
principalStress3[elemIdx] = Scalar(0.0);
principalStress3[eIdx] = Scalar(0.0);
effPorosity[elemIdx] = Scalar(0.0);
cellPorosity[elemIdx] = Scalar(0.0);
cellKx[elemIdx] = Scalar(0.0);
cellPressure[elemIdx] = Scalar(0.0);
effPorosity[eIdx] = Scalar(0.0);
cellPorosity[eIdx] = Scalar(0.0);
cellKx[eIdx] = Scalar(0.0);
cellPressure[eIdx] = Scalar(0.0);
}
ScalarField &rank = *writer.allocateManagedBuffer(numElements);
......@@ -246,24 +246,24 @@ public:
ElementBoundaryTypes elemBcTypes;
// initialize start and end of element iterator
ElementIterator elemIt = this->gridView_().template begin<0>();
ElementIterator endit = this->gridView_().template end<0>();
ElementIterator eIt = this->gridView_().template begin<0>();
ElementIterator eEndIt = this->gridView_().template end<0>();
// loop over all elements (cells)
for (; elemIt != endit; ++elemIt)
for (; eIt != eEndIt; ++eIt)
{
unsigned int elemIdx = this->problem_().model().elementMapper().map(*elemIt);
rank[elemIdx] = this->gridView_().comm().rank();
unsigned int eIdx = this->problem_().model().elementMapper().map(*eIt);
rank[eIdx] = this->gridView_().comm().rank();
fvGeometry.update(this->gridView_(), *elemIt);
elemBcTypes.update(this->problem_(), *elemIt, fvGeometry);
elemVolVars.update(this->problem_(), *elemIt, fvGeometry, false);
fvGeometry.update(this->gridView_(), *eIt);
elemBcTypes.update(this->problem_(), *eIt, fvGeometry);
elemVolVars.update(this->problem_(), *eIt, fvGeometry, false);
// loop over all local vertices of the cell
int numScv = elemIt->template count<dim>();
int numScv = eIt->template count<dim>();
for (int scvIdx = 0; scvIdx < numScv; ++scvIdx)
{
unsigned int globalIdx = this->dofMapper().map(*elemIt, scvIdx, dim);
unsigned int globalIdx = this->dofMapper().map(*eIt, scvIdx, dim);
pressure[globalIdx] = elemVolVars[scvIdx].pressure();
moleFraction0[globalIdx] = elemVolVars[scvIdx].moleFraction(0);
......@@ -286,12 +286,12 @@ public:
viscosity[globalIdx] = elemVolVars[scvIdx].viscosity();
porosity[globalIdx] = elemVolVars[scvIdx].porosity();
Kx[globalIdx] = this->problem_().spatialParams().intrinsicPermeability(
*elemIt, fvGeometry, scvIdx)[0][0];
*eIt, fvGeometry, scvIdx)[0][0];
// calculate cell quantities by adding up scv quantities and dividing through numScv
cellPorosity[elemIdx] += elemVolVars[scvIdx].porosity() / numScv;
cellKx[elemIdx] += this->problem_().spatialParams().intrinsicPermeability(
*elemIt, fvGeometry, scvIdx)[0][0] / numScv;
cellPressure[elemIdx] += elemVolVars[scvIdx].pressure() / numScv;
cellPorosity[eIdx] += elemVolVars[scvIdx].porosity() / numScv;
cellKx[eIdx] += this->problem_().spatialParams().intrinsicPermeability(
*eIt, fvGeometry, scvIdx)[0][0] / numScv;
cellPressure[eIdx] += elemVolVars[scvIdx].pressure() / numScv;
};
// calculate cell quantities for variables which are defined at the integration point
......@@ -305,7 +305,7 @@ public:
//prepare the flux calculations (set up and prepare geometry, FE gradients)
FluxVariables fluxVars(this->problem_(),
*elemIt, fvGeometry,
*eIt, fvGeometry,
faceIdx,
elemVolVars);
......@@ -314,26 +314,26 @@ public:
tmpEffStress = fluxVars.sigma();
tmpEffStress /= fvGeometry.numScvf;
effPorosity[elemIdx] += tmpEffPoro;
effPorosity[eIdx] += tmpEffPoro;
// in case of rock mechanics sign convention compressive stresses
// are defined to be positive
if(rockMechanicsSignConvention_){
effStressX[elemIdx] -= tmpEffStress[0];
effStressX[eIdx] -= tmpEffStress[0];
if (dim >= 2) {
effStressY[elemIdx] -= tmpEffStress[1];
effStressY[eIdx] -= tmpEffStress[1];
}
if (dim >= 3) {
effStressZ[elemIdx] -= tmpEffStress[2];
effStressZ[eIdx] -= tmpEffStress[2];
}
}
else{
effStressX[elemIdx] += tmpEffStress[0];
effStressX[eIdx] += tmpEffStress[0];
if (dim >= 2) {
effStressY[elemIdx] += tmpEffStress[1];
effStressY[eIdx] += tmpEffStress[1];
}
if (dim >= 3) {
effStressZ[elemIdx] += tmpEffStress[2];
effStressZ[eIdx] += tmpEffStress[2];
}
}
}
......@@ -342,33 +342,33 @@ public:
// in case of rock mechanics sign convention compressive stresses
// are defined to be positive and total stress is calculated by adding the pore pressure
if(rockMechanicsSignConvention_){
totalStressX[elemIdx][0] = effStressX[elemIdx][0] + cellPressure[elemIdx];
totalStressX[elemIdx][1] = effStressX[elemIdx][1];
totalStressX[elemIdx][2] = effStressX[elemIdx][2];
totalStressX[eIdx][0] = effStressX[eIdx][0] + cellPressure[eIdx];
totalStressX[eIdx][1] = effStressX[eIdx][1];
totalStressX[eIdx][2] = effStressX[eIdx][2];
if (dim >= 2) {
totalStressY[elemIdx][0] = effStressY[elemIdx][0];
totalStressY[elemIdx][1] = effStressY[elemIdx][1] + cellPressure[elemIdx];
totalStressY[elemIdx][2] = effStressY[elemIdx][2];
totalStressY[eIdx][0] = effStressY[eIdx][0];
totalStressY[eIdx][1] = effStressY[eIdx][1] + cellPressure[eIdx];
totalStressY[eIdx][2] = effStressY[eIdx][2];
}
if (dim >= 3) {
totalStressZ[elemIdx][0] = effStressZ[elemIdx][0];
totalStressZ[elemIdx][1] = effStressZ[elemIdx][1];
totalStressZ[elemIdx][2] = effStressZ[elemIdx][2] + cellPressure[elemIdx];
totalStressZ[eIdx][0] = effStressZ[eIdx][0];
totalStressZ[eIdx][1] = effStressZ[eIdx][1];
totalStressZ[eIdx][2] = effStressZ[eIdx][2] + cellPressure[eIdx];
}
}
else{
totalStressX[elemIdx][0] = effStressX[elemIdx][0] - cellPressure[elemIdx];
totalStressX[elemIdx][1] = effStressX[elemIdx][1];
totalStressX[elemIdx][2] = effStressX[elemIdx][2];
totalStressX[eIdx][0] = effStressX[eIdx][0] - cellPressure[eIdx];
totalStressX[eIdx][1] = effStressX[eIdx][1];
totalStressX[eIdx][2] = effStressX[eIdx][2];
if (dim >= 2) {
totalStressY[elemIdx][0] = effStressY[elemIdx][0];
totalStressY[elemIdx][1] = effStressY[elemIdx][1] - cellPressure[elemIdx];
totalStressY[elemIdx][2] = effStressY[elemIdx][2];
totalStressY[eIdx][0] = effStressY[eIdx][0];
totalStressY[eIdx][1] = effStressY[eIdx][1] - cellPressure[eIdx];
totalStressY[eIdx][2] = effStressY[eIdx][2];
}
if (dim >= 3) {
totalStressZ[elemIdx][0] = effStressZ[elemIdx][0];
totalStressZ[elemIdx][1] = effStressZ[elemIdx][1];
totalStressZ[elemIdx][2] = effStressZ[elemIdx][2] - cellPressure[elemIdx];
totalStressZ[eIdx][0] = effStressZ[eIdx][0];
totalStressZ[eIdx][1] = effStressZ[eIdx][1];
totalStressZ[eIdx][2] = effStressZ[eIdx][2] - cellPressure[eIdx];
}
}
}
......@@ -381,16 +381,16 @@ public:
a2=Scalar(0);
a3=Scalar(0);
for (unsigned int elemIdx = 0; elemIdx < numElements; elemIdx++)
for (unsigned int eIdx = 0; eIdx < numElements; eIdx++)
{
eigenValues = Scalar(0);
totalStress = Scalar(0);
totalStress[0] = totalStressX[elemIdx];
totalStress[0] = totalStressX[eIdx];
if (dim >= 2)
totalStress[1] = totalStressY[elemIdx];
totalStress[1] = totalStressY[eIdx];
if (dim >= 3)
totalStress[2] = totalStressZ[elemIdx];
totalStress[2] = totalStressZ[eIdx];
calculateEigenValues<dim>(eigenValues, totalStress);
......@@ -407,11 +407,11 @@ public:
a2 = eigenValues[1];
if (a1 >= a2) {
principalStress1[elemIdx] = a1;
principalStress2[elemIdx] = a2;
principalStress1[eIdx] = a1;
principalStress2[eIdx] = a2;
} else {
principalStress1[elemIdx] = a2;
principalStress2[elemIdx] = a1;
principalStress1[eIdx] = a2;
principalStress2[eIdx] = a1;
}
}
......@@ -422,42 +422,42 @@ public:
if (a1 >= a2) {
if (a1 >= a3) {
principalStress1[elemIdx] = a1;
principalStress1[eIdx] = a1;
if (a2 >= a3) {
principalStress2[elemIdx] = a2;
principalStress3[elemIdx] = a3;
principalStress2[eIdx] = a2;
principalStress3[eIdx] = a3;
}
else //a3 > a2
{
principalStress2[elemIdx] = a3;
principalStress3[elemIdx] = a2;
principalStress2[eIdx] = a3;
principalStress3[eIdx] = a2;
}
}
else // a3 > a1
{
principalStress1[elemIdx] = a3;
principalStress2[elemIdx] = a1;
principalStress3[elemIdx] = a2;
principalStress1[eIdx] = a3;
principalStress2[eIdx] = a1;
principalStress3[eIdx] = a2;
}
} else // a2>a1
{
if (a2 >= a3) {
principalStress1[elemIdx] = a2;
principalStress1[eIdx] = a2;
if (a1 >= a3) {
principalStress2[elemIdx] = a1;
principalStress3[elemIdx] = a3;
principalStress2[eIdx] = a1;
principalStress3[eIdx] = a3;
}
else //a3>a1
{
principalStress2[elemIdx] = a3;
principalStress3[elemIdx] = a1;
principalStress2[eIdx] = a3;
principalStress3[eIdx] = a1;
}
}
else //a3>a2
{
principalStress1[elemIdx] = a3;
principalStress2[elemIdx] = a2;
principalStress3[elemIdx] = a1;
principalStress1[eIdx] = a3;
principalStress2[eIdx] = a2;
principalStress3[eIdx] = a1;
}
}
}
......
......@@ -349,8 +349,8 @@ public:
if (!enablePartialReassemble)
return;
ElementIterator elemIt = gridView_().template begin<0>();
ElementIterator elemEndIt = gridView_().template end<0>();
ElementIterator eIt = gridView_().template begin<0>();
ElementIterator eEndIt = gridView_().template end<0>();
// mark the red vertices and update the tolerance of the
// linearization which actually will get achieved
......@@ -367,13 +367,13 @@ public:
};
// Mark all red elements
for (; elemIt != elemEndIt; ++elemIt) {
for (; eIt != eEndIt; ++eIt) {
// find out whether the current element features a red
// vertex
bool isRed = false;
int numVerts = elemIt->template count<dim>();
int numVerts = eIt->template count<dim>();
for (int i=0; i < numVerts; ++i) {
int globalI = vertexMapper_().map(*elemIt, i, dim);
int globalI = vertexMapper_().map(*eIt, i, dim);
if (vertexColor_[globalI] == Red) {
isRed = true;
break;
......@@ -382,7 +382,7 @@ public:
// if yes, the element color is also red, else it is not
// red, i.e. green for the mean time
int globalElemIdx = elementMapper_().map(*elemIt);
int globalElemIdx = elementMapper_().map(*eIt);
if (isRed)
elementColor_[globalElemIdx] = Red;
else
......@@ -390,16 +390,16 @@ public:
}
// Mark yellow vertices (as orange for the mean time)
elemIt = gridView_().template begin<0>();
for (; elemIt != elemEndIt; ++elemIt) {
int elemIdx = this->elementMapper_().map(*elemIt);
if (elementColor_[elemIdx] != Red)
eIt = gridView_().template begin<0>();
for (; eIt != eEndIt; ++eIt) {
int eIdx = this->elementMapper_().map(*eIt);
if (elementColor_[eIdx] != Red)
continue; // non-red elements do not tint vertices
// yellow!
int numVerts = elemIt->template count<dim>();
int numVerts = eIt->template count<dim>();
for (int i=0; i < numVerts; ++i) {
int globalI = vertexMapper_().map(*elemIt, i, dim);
int globalI = vertexMapper_().map(*eIt, i, dim);
// if a vertex is already red, don't recolor it to
// yellow!
if (vertexColor_[globalI] != Red)
......@@ -408,19 +408,19 @@ public:
}
// Mark yellow elements
elemIt = gridView_().template begin<0>();
for (; elemIt != elemEndIt; ++elemIt) {
int elemIdx = this->elementMapper_().map(*elemIt);
if (elementColor_[elemIdx] == Red) {
eIt = gridView_().template begin<0>();
for (; eIt != eEndIt; ++eIt) {
int eIdx = this->elementMapper_().map(*eIt);
if (elementColor_[eIdx] == Red) {
continue; // element is red already!
}
// check whether the element features a yellow
// (resp. orange at this point) vertex
bool isYellow = false;
int numVerts = elemIt->template count<dim>();
int numVerts = eIt->template count<dim>();
for (int i=0; i < numVerts; ++i) {
int globalI = vertexMapper_().map(*elemIt, i, dim);
int globalI = vertexMapper_().map(*eIt, i, dim);
if (vertexColor_[globalI] == Orange) {
isYellow = true;
break;
......@@ -428,21 +428,21 @@ public:
};
if (isYellow)
elementColor_[elemIdx] = Yellow;
elementColor_[eIdx] = Yellow;
}
// Demote orange vertices to yellow ones if it has at least
// one green element as a neighbor.
elemIt = gridView_().template begin<0>();
for (; elemIt != elemEndIt; ++elemIt) {
int elemIdx = this->elementMapper_().map(*elemIt);
if (elementColor_[elemIdx] != Green)
eIt = gridView_().template begin<0>();
for (; eIt != eEndIt; ++eIt) {
int eIdx = this->elementMapper_().map(*eIt);
if (elementColor_[eIdx] != Green)
continue; // yellow and red elements do not make
// orange vertices yellow!
int numVerts = elemIt->template count<dim>();
int numVerts = eIt->template count<dim>();
for (int i=0; i < numVerts; ++i) {
int globalI = vertexMapper_().map(*elemIt, i, dim);
int globalI = vertexMapper_().map(*eIt, i, dim);
// if a vertex is orange, recolor it to yellow!
if (vertexColor_[globalI] == Orange)
vertexColor_[globalI] = Yellow;
......@@ -469,14 +469,14 @@ public:
* \brief Returns the reassemble color of a vertex
*
* \param element An element which contains the vertex
* \param vertIdx The local index of the vertex in the element.
* \param vIdx The local index of the vertex in the element.
*/
int vertexColor(const Element &element, int vertIdx) const
int vertexColor(const Element &element, int vIdx) const
{
if (!enablePartialReassemble)
return Red; // reassemble unconditionally!
int globalIdx = vertexMapper_().map(element, vertIdx, dim);
int globalIdx = vertexMapper_().map(element, vIdx, dim);
return vertexColor_[globalIdx];
}
......
......@@ -369,8 +369,8 @@ public:
// include boundary conditions
// iterate over element intersections of codim dim-1
IntersectionIterator isIt = model_.problem().gridView().ibegin(eg.entity());
const IntersectionIterator &endIt = model_.problem().gridView().iend(eg.entity());
for (; isIt != endIt; ++isIt)
const IntersectionIterator &isEndIt = model_.problem().gridView().iend(eg.entity());
for (; isIt != isEndIt; ++isIt)
{
// handle only faces on the boundary
if (!isIt->boundary())
......
......@@ -173,9 +173,9 @@ public:
for (int j = 0; j< dim; ++j)
outStream << this->curSol()[numScv*(numEq-dim) + dofIdx*dim + j][0] <<" ";
int vertIdx = this->dofMapper().map(entity);
int vIdx = this->dofMapper().map(entity);
if (!outStream.good())
DUNE_THROW(Dune::IOError, "Could not serialize vertex " << vertIdx);
DUNE_THROW(Dune::IOError, "Could not serialize vertex " << vIdx);
}
/*!
......@@ -287,38 +287,38 @@ public:
// initialize cell stresses, cell-wise hydraulic parameters and cell pressure with zero
for(int elemIdx = 0; elemIdx < numElements; ++elemIdx){
deltaEffStressX[elemIdx] = Scalar(0.0);
for(int eIdx = 0; eIdx < numElements; ++eIdx){
deltaEffStressX[eIdx] = Scalar(0.0);
if (dim >= 2)
deltaEffStressY[elemIdx] = Scalar(0.0);
deltaEffStressY[eIdx] = Scalar(0.0);
if (dim >= 3)
deltaEffStressZ[elemIdx] = Scalar(0.0);
deltaEffStressZ[eIdx] = Scalar(0.0);
totalStressX[elemIdx] = Scalar(0.0);
totalStressX[eIdx] = Scalar(0.0);
if (dim >= 2)
totalStressY[elemIdx] = Scalar(0.0);
totalStressY[eIdx] = Scalar(0.0);
if (dim >= 3)
totalStressZ[elemIdx] = Scalar(0.0);
totalStressZ[eIdx] = Scalar(0.0);
initStressX[elemIdx] = Scalar(0.0);
initStressX[eIdx] = Scalar(0.0);
if (dim >= 2)
initStressY[elemIdx] = Scalar(0.0);
initStressY[eIdx] = Scalar(0.0);
if (dim >= 3)
initStressZ[elemIdx] = Scalar(0.0);
initStressZ[eIdx] = Scalar(0.0);
principalStress1[elemIdx] = Scalar(0.0);
principalStress1[eIdx] = Scalar(0.0);
if (dim >= 2)
principalStress2[elemIdx] = Scalar(0.0);
principalStress2[eIdx] = Scalar(0.0);
if (dim >= 3)
principalStress3[elemIdx] = Scalar(0.0);
principalStress3[eIdx] = Scalar(0.0);
effPorosity[elemIdx] = Scalar(0.0);
effKx[elemIdx] = Scalar(0.0);
effectivePressure[elemIdx] = Scalar(0.0);
deltaEffPressure[elemIdx] = Scalar(0.0);
effPorosity[eIdx] = Scalar(0.0);
effKx[eIdx] = Scalar(0.0);
effectivePressure[eIdx] = Scalar(0.0);
deltaEffPressure[eIdx] = Scalar(0.0);
Pcrtens[elemIdx] = Scalar(0.0);
Pcrshe[elemIdx] = Scalar(0.0);
Pcrtens[eIdx] = Scalar(0.0);
Pcrshe[eIdx] = Scalar(0.0);
}
ScalarField &rank = *writer.allocateManagedBuffer(numElements);
......@@ -328,16 +328,16 @@ public:
ElementVolumeVariables elemVolVars;
// initialize start and end of element iterator
ElementIterator elemIt = this->gridView_().template begin<0>();
ElementIterator endit = this->gridView_().template end<0>();
ElementIterator eIt = this->gridView_().template begin<0>();
ElementIterator eEndit = this->gridView_().template end<0>();
// loop over all elements (cells)
for (; elemIt != endit; ++elemIt) {
for (; eIt != eEndit; ++eIt) {
// get FE function spaces to calculate gradients (gradient data of momentum balance
// equation is not stored in fluxvars since it is not evaluated at box integration point)
// copy the values of the sol vector to the localFunctionSpace values of the current element
LocalFunctionSpace localFunctionSpace(this->problem_().model().jacobianAssembler().gridFunctionSpace());
localFunctionSpace.bind(*elemIt);
localFunctionSpace.bind(*eIt);
std::vector<Scalar> values;
localFunctionSpace.vread(sol, values);
......@@ -350,18 +350,18 @@ public:
typedef typename ScalarDispLFS::Traits::FiniteElementType::Traits::LocalBasisType::Traits::JacobianType JacobianType_V;
typedef typename ScalarDispLFS::Traits::FiniteElementType::Traits::LocalBasisType::Traits::RangeFieldType RF;