From 8e61f0a29a5fbea46adc13387dab3bd5be7a991c Mon Sep 17 00:00:00 2001
From: Christoph Grueninger <christoph.grueninger@iws.uni-stuttgart.de>
Date: Thu, 10 May 2012 11:06:51 +0000
Subject: [PATCH] Made some variables unsigned int instead of int to get rid of
 sign-compare Warnings. (not reviewed but change in principle agreed by bernd)

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@8292 2fb0f335-1f38-0410-981e-8018bf24f1b0
---
 dumux/boxmodels/1p2c/1p2cmodel.hh             |  2 +-
 dumux/boxmodels/2p/2pmodel.hh                 |  4 +-
 dumux/boxmodels/2p2c/2p2clocalresidual.hh     | 12 ++---
 dumux/boxmodels/2p2c/2p2cmodel.hh             |  4 +-
 dumux/boxmodels/mpnc/mpncnewtoncontroller.hh  |  8 ++--
 .../2p/diffusion/mimetic/croperator.hh        |  6 +--
 .../diffusion/mimetic/mimeticgroundwater.hh   | 48 +++++++++----------
 .../2p/diffusion/mimetic/mimeticoperator.hh   |  2 +-
 .../2p2c/fvpressure2p2cmultiphysics.hh        |  2 +-
 dumux/linear/foreignoverlapfrombcrsmatrix.hh  |  2 +-
 dumux/linear/overlappingbcrsmatrix.hh         | 16 +++----
 11 files changed, 53 insertions(+), 53 deletions(-)

diff --git a/dumux/boxmodels/1p2c/1p2cmodel.hh b/dumux/boxmodels/1p2c/1p2cmodel.hh
index bd779f07f8..7296adacec 100644
--- a/dumux/boxmodels/1p2c/1p2cmodel.hh
+++ b/dumux/boxmodels/1p2c/1p2cmodel.hh
@@ -137,7 +137,7 @@ public:
         //use vertical faces for vx and horizontal faces for vy calculation
         std::vector<DimVector> boxSurface(numVertices);
         // initialize velocity fields
-          for (int i = 0; i < numVertices; ++i)
+          for (unsigned int i = 0; i < numVertices; ++i)
           {
 
               velocityX[i] = 0;
diff --git a/dumux/boxmodels/2p/2pmodel.hh b/dumux/boxmodels/2p/2pmodel.hh
index 0652c2fe06..31ff97cc9a 100644
--- a/dumux/boxmodels/2p/2pmodel.hh
+++ b/dumux/boxmodels/2p/2pmodel.hh
@@ -160,7 +160,7 @@ public:
         if(velocityOutput) // check if velocity output is demanded
         {
             // initialize velocity fields
-            for (int i = 0; i < numVertices; ++i)
+            for (unsigned int i = 0; i < numVertices; ++i)
             {
                 (*velocityN)[i] = Scalar(0);
                 (*velocityW)[i] = Scalar(0);
@@ -385,7 +385,7 @@ public:
             if(velocityOutput) // check if velocity output is demanded
             {
                 // divide the vertex velocities by the number of adjacent scvs i.e. cells
-                for(int globalIdx = 0; globalIdx < numVertices; ++globalIdx){
+                for(unsigned int globalIdx = 0; globalIdx < numVertices; ++globalIdx){
                     (*velocityW)[globalIdx] /= (*cellNum)[globalIdx];
                     (*velocityN)[globalIdx] /= (*cellNum)[globalIdx];
                 }
diff --git a/dumux/boxmodels/2p2c/2p2clocalresidual.hh b/dumux/boxmodels/2p2c/2p2clocalresidual.hh
index 2596a573b7..5d3c798bd4 100644
--- a/dumux/boxmodels/2p2c/2p2clocalresidual.hh
+++ b/dumux/boxmodels/2p2c/2p2clocalresidual.hh
@@ -188,11 +188,11 @@ class TwoPTwoCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual)
         // compute storage term of all components within all phases
         storage = 0;
 
-        for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
+        for (unsigned int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
         {
-            for (int compIdx = contiCompIdx1_(); compIdx <= contiCompIdx2_(); ++compIdx)
+            for (unsigned int compIdx = contiCompIdx1_(); compIdx <= contiCompIdx2_(); ++compIdx)
             {
-                int eqIdx = (compIdx == wCompIdx) ? contiWEqIdx : contiNEqIdx;
+                unsigned int eqIdx = (compIdx == wCompIdx) ? contiWEqIdx : contiNEqIdx;
                 storage[eqIdx] += volVars.density(phaseIdx)
                     * volVars.saturation(phaseIdx)
                     * volVars.fluidState().massFraction(phaseIdx, compIdx);
@@ -243,7 +243,7 @@ class TwoPTwoCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual)
         ////////
         // advective fluxes of all components in all phases
         ////////
-        for (int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
+        for (unsigned int phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx)
         {
             // data attached to upstream and the downstream vertices
             // of the current phase
@@ -252,9 +252,9 @@ class TwoPTwoCLocalResidual: public GET_PROP_TYPE(TypeTag, BaseLocalResidual)
             const VolumeVariables &dn =
                 this->curVolVars_(fluxVars.downstreamIdx(phaseIdx));
 
-            for (int compIdx = contiCompIdx1_(); compIdx <= contiCompIdx2_(); ++compIdx)
+            for (unsigned int compIdx = contiCompIdx1_(); compIdx <= contiCompIdx2_(); ++compIdx)
             {
-                int eqIdx = (compIdx == wCompIdx) ? contiWEqIdx : contiNEqIdx;
+                unsigned int eqIdx = (compIdx == wCompIdx) ? contiWEqIdx : contiNEqIdx;
                 // add advective flux of current component in current
                 // phase
                 if (massUpwindWeight_ > 0.0)
diff --git a/dumux/boxmodels/2p2c/2p2cmodel.hh b/dumux/boxmodels/2p2c/2p2cmodel.hh
index d26d879ad4..6ece760964 100644
--- a/dumux/boxmodels/2p2c/2p2cmodel.hh
+++ b/dumux/boxmodels/2p2c/2p2cmodel.hh
@@ -313,7 +313,7 @@ public:
         if(velocityOutput_) // check if velocity output is demanded
         {
             // initialize velocity fields
-            for (int i = 0; i < numVertices; ++i)
+            for (unsigned int i = 0; i < numVertices; ++i)
             {
                 (*velocityN)[i] = Scalar(0);
                 (*velocityW)[i] = Scalar(0);
@@ -484,7 +484,7 @@ public:
         if(velocityOutput_)
         {
             // divide the vertex velocities by the number of adjacent scvs i.e. cells
-            for(int globalIdx = 0; globalIdx<numVertices; ++globalIdx){
+            for(unsigned int globalIdx = 0; globalIdx<numVertices; ++globalIdx){
                 (*velocityW)[globalIdx] /= (*cellNum)[globalIdx];
                 (*velocityN)[globalIdx] /= (*cellNum)[globalIdx];
             }
diff --git a/dumux/boxmodels/mpnc/mpncnewtoncontroller.hh b/dumux/boxmodels/mpnc/mpncnewtoncontroller.hh
index 02fa865014..12d48be360 100644
--- a/dumux/boxmodels/mpnc/mpncnewtoncontroller.hh
+++ b/dumux/boxmodels/mpnc/mpncnewtoncontroller.hh
@@ -55,12 +55,12 @@ public:
     static void chop(SolutionVector &uCurrentIter,
                      const SolutionVector &uLastIter)
     {
-        for (int i = 0; i < uLastIter.size(); ++i) {
-            for (int phaseIdx = 0; phaseIdx < numPhases - 1; ++phaseIdx)
+        for (unsigned int i = 0; i < uLastIter.size(); ++i) {
+            for (unsigned int phaseIdx = 0; phaseIdx < numPhases - 1; ++phaseIdx)
                 saturationChop_(uCurrentIter[i][S0Idx + phaseIdx],
                                 uLastIter[i][S0Idx + phaseIdx]);
             pressureChop_(uCurrentIter[i][p0Idx], uLastIter[i][p0Idx]);
-            for (int comp = 0; comp < numComponents; ++comp) {
+            for (unsigned int comp = 0; comp < numComponents; ++comp) {
                 pressureChop_(uCurrentIter[i][fug0Idx + comp], uLastIter[i][fug0Idx + comp]);
             }
 
@@ -217,7 +217,7 @@ public:
             lineSearchUpdate_(uCurrentIter, uLastIter, deltaU);
         }
         else {
-            for (int i = 0; i < uLastIter.size(); ++i) {
+            for (unsigned int i = 0; i < uLastIter.size(); ++i) {
                 uCurrentIter[i] = uLastIter[i];
                 uCurrentIter[i] -= deltaU[i];
             }
diff --git a/dumux/decoupled/2p/diffusion/mimetic/croperator.hh b/dumux/decoupled/2p/diffusion/mimetic/croperator.hh
index f4f68f5de4..950afa0575 100644
--- a/dumux/decoupled/2p/diffusion/mimetic/croperator.hh
+++ b/dumux/decoupled/2p/diffusion/mimetic/croperator.hh
@@ -287,7 +287,7 @@ public:
             unsigned int numFaces = it->template count<1>();
 
             // get local to global id map
-            for (int k = 0; k < numFaces; k++)
+            for (unsigned int k = 0; k < numFaces; k++)
             {
                 int alpha = faceMapper_.map(*it, k, 1);
                 local2Global[k] = alpha;
@@ -299,10 +299,10 @@ public:
 
 
             // accumulate local matrix into global matrix for non-hanging nodes
-            for (int i=0; i<numFaces; i++) // loop over rows, i.e. test functions
+            for (unsigned int i=0; i<numFaces; i++) // loop over rows, i.e. test functions
             {
                 // accumulate matrix
-                for (int j=0; j<numFaces; j++)
+                for (unsigned int j=0; j<numFaces; j++)
                 {
                     // the standard entry
                     A_[local2Global[i]][local2Global[j]] += loc.mat(i,j);
diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimeticgroundwater.hh b/dumux/decoupled/2p/diffusion/mimetic/mimeticgroundwater.hh
index 41ef58e47c..4cb5bcfe10 100644
--- a/dumux/decoupled/2p/diffusion/mimetic/mimeticgroundwater.hh
+++ b/dumux/decoupled/2p/diffusion/mimetic/mimeticgroundwater.hh
@@ -142,11 +142,11 @@ public:
         this->setcurrentsize(numFaces);
 
         // clear assemble data
-        for (int i=0; i<numFaces; i++)
+        for (unsigned int i=0; i<numFaces; i++)
         {
             this->b[i] = 0;
             this->bctype[i].reset();
-            for (int j=0; j<numFaces; j++)
+            for (unsigned int j=0; j<numFaces; j++)
                 this->A[i][j] = 0;
         }
 
@@ -178,7 +178,7 @@ public:
         this->setcurrentsize(numFaces);
 
         // clear assemble data
-        for (int i=0; i<numFaces; i++)
+        for (unsigned int i=0; i<numFaces; i++)
         {
             this->b[i] = 0;
             this->bctype[i].reset();
@@ -244,49 +244,49 @@ public:
         // Brezzi/Lipnikov/Simonicini M3AS 2005
         // (1) orthonormalize columns of the matrix R
         Scalar norm = R[0][0]*R[0][0];
-        for (int i = 1; i < numFaces; i++)
+        for (unsigned int i = 1; i < numFaces; i++)
             norm += R[i][0]*R[i][0];
         norm = sqrt(norm);
-        for (int i = 0; i < numFaces; i++)
+        for (unsigned int i = 0; i < numFaces; i++)
             R[i][0] /= norm;
         Scalar weight = R[0][1]*R[0][0];
-        for (int i = 1; i < numFaces; i++)
+        for (unsigned int i = 1; i < numFaces; i++)
             weight += R[i][1]*R[i][0];
-        for (int i = 0; i < numFaces; i++)
+        for (unsigned int i = 0; i < numFaces; i++)
             R[i][1] -= weight*R[i][0];
         norm = R[0][1]*R[0][1];
-        for (int i = 1; i < numFaces; i++)
+        for (unsigned int i = 1; i < numFaces; i++)
             norm += R[i][1]*R[i][1];
         norm = sqrt(norm);
-        for (int i = 0; i < numFaces; i++)
+        for (unsigned int i = 0; i < numFaces; i++)
             R[i][1] /= norm;
         if (dim == 3)
         {
             Scalar weight1 = R[0][2]*R[0][0];
             Scalar weight2 = R[0][2]*R[0][1];
-            for (int i = 1; i < numFaces; i++)
+            for (unsigned int i = 1; i < numFaces; i++)
             {
                 weight1 += R[i][2]*R[i][0];
                 weight2 += R[i][2]*R[i][1];
             }
-            for (int i = 0; i < numFaces; i++)
+            for (unsigned int i = 0; i < numFaces; i++)
                 R[i][1] -= weight1*R[i][0] + weight2*R[i][1];
             norm = R[0][2]*R[0][2];
-            for (int i = 1; i < numFaces; i++)
+            for (unsigned int i = 1; i < numFaces; i++)
                 norm += R[i][2]*R[i][2];
             norm = sqrt(norm);
-            for (int i = 0; i < numFaces; i++)
+            for (unsigned int i = 0; i < numFaces; i++)
                 R[i][2] /= norm;
         }
         //      std::cout << "~R =\dim" << R;
 
         // (2) Build the matrix ~D
         Dune::FieldMatrix<Scalar,2*dim,2*dim> D(0);
-        for (int s = 0; s < numFaces; s++)
+        for (unsigned int s = 0; s < numFaces; s++)
         {
             Dune::FieldVector<Scalar,2*dim> es(0);
             es[s] = 1;
-            for (int k = 0; k < numFaces; k++)
+            for (unsigned int k = 0; k < numFaces; k++)
             {
                 D[k][s] = es[k];
                 for (int i = 0; i < dim; i++)
@@ -305,9 +305,9 @@ public:
         // (3) Build the matrix W = Minv
         Dune::FieldMatrix<Scalar,2*dim,dim> NK(N);
         NK.rightmultiply (K);
-        for (int i = 0; i < numFaces; i++)
+        for (unsigned int i = 0; i < numFaces; i++)
         {
-            for (int j = 0; j < numFaces; j++)
+            for (unsigned int j = 0; j < numFaces; j++)
             {
                 W[i][j] = NK[i][0]*N[j][0];
                 for (int k = 1; k < dim; k++)
@@ -332,12 +332,12 @@ public:
         // calculate the part of the matrix C coupling velocities and element pressures.
         // This is just a row vector of size numFaces.
         // scale with volume
-        for (int i = 0; i < numFaces; i++)
+        for (unsigned int i = 0; i < numFaces; i++)
             c[i] = faceVol[i];
 
         // Set up the element part of the matrix \Pi coupling velocities
         // and pressure-traces. This is a diagonal matrix with entries given by faceVol.
-        for (int i = 0; i < numFaces; i++)
+        for (unsigned int i = 0; i < numFaces; i++)
             Pi[i][i] = faceVol[i];
 
         // Calculate the element part of the matrix D^{-1} = (c W c^T)^{-1} which is just a scalar value.
@@ -380,19 +380,19 @@ private:
 
         // Calculate the element part of the matrix F D^{-1} F^T.
         Dune::FieldMatrix<Scalar,2*dim,2*dim> FDinvFT(0);
-        for (int i = 0; i < numFaces; i++)
-            for (int j = 0; j < numFaces; j++)
+        for (unsigned int i = 0; i < numFaces; i++)
+            for (unsigned int j = 0; j < numFaces; j++)
                 FDinvFT[i][j] = dinv*F[i]*F[j];
 
         // Calculate the element part of the matrix S = Pi W Pi^T - F D^{-1} F^T.
-        for (int i = 0; i < numFaces; i++)
-            for (int j = 0; j < numFaces; j++)
+        for (unsigned int i = 0; i < numFaces; i++)
+            for (unsigned int j = 0; j < numFaces; j++)
                 this->A[i][j] = PiWPiT[i][j] - FDinvFT[i][j];
 
         // Calculate the source term F D^{-1} f
         // NOT WORKING AT THE MOMENT
         Scalar factor = dinv*qmean;
-        for (int i = 0; i < numFaces; i++)
+        for (unsigned int i = 0; i < numFaces; i++)
             this->b[i] = F[i]*factor;
 
         //        std::cout << "faceVol = " << faceVol << std::endl << "W = " << std::endl << W << std::endl
diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator.hh b/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator.hh
index 1ca9a047de..eaee89175d 100644
--- a/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator.hh
+++ b/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator.hh
@@ -99,7 +99,7 @@ public:
 
             // get local to global id map and pressure traces
             Dune::FieldVector<Scalar,2*dim> pressTrace(0);
-            for (int k = 0; k < numFaces; k++)
+            for (unsigned int k = 0; k < numFaces; k++)
             {
                 pressTrace[k] = u[this->faceMapper_.map(*it, k, 1)];
             }
diff --git a/dumux/decoupled/2p2c/fvpressure2p2cmultiphysics.hh b/dumux/decoupled/2p2c/fvpressure2p2cmultiphysics.hh
index a74042034b..e58691c1f7 100644
--- a/dumux/decoupled/2p2c/fvpressure2p2cmultiphysics.hh
+++ b/dumux/decoupled/2p2c/fvpressure2p2cmultiphysics.hh
@@ -795,7 +795,7 @@ void FVPressure2P2CMultiPhysics<TypeTag>::updateMaterialLaws()
     // iterate through leaf grid an copy subdomain information
     if(problem().timeManager().time() != 0.)
     {
-        for (int i= 0; i < nextSubdomain.size(); i++)
+        for (unsigned int i= 0; i < nextSubdomain.size(); i++)
         {
             problem().variables().cellData(i).subdomain() = nextSubdomain[i];
         }
diff --git a/dumux/linear/foreignoverlapfrombcrsmatrix.hh b/dumux/linear/foreignoverlapfrombcrsmatrix.hh
index a978645a43..da8c8a12c6 100644
--- a/dumux/linear/foreignoverlapfrombcrsmatrix.hh
+++ b/dumux/linear/foreignoverlapfrombcrsmatrix.hh
@@ -291,7 +291,7 @@ protected:
     {
         // determine the minimum rank for all indices
         masterRank_.resize(numLocal_, myRank_);
-        for (int localIdx = 0; localIdx < masterRank_.size(); ++localIdx) {
+        for (unsigned int localIdx = 0; localIdx < masterRank_.size(); ++localIdx) {
             int masterRank = myRank_;
             if (isBorder(localIdx)) {
                 // if the local index is a border index, loop over all ranks
diff --git a/dumux/linear/overlappingbcrsmatrix.hh b/dumux/linear/overlappingbcrsmatrix.hh
index 3907a27e0e..62b5cfcf36 100644
--- a/dumux/linear/overlappingbcrsmatrix.hh
+++ b/dumux/linear/overlappingbcrsmatrix.hh
@@ -131,7 +131,7 @@ public:
         BCRSMatrix::operator=(0.0);
 
         // assign the local rows
-        for (int rowIdx = 0; rowIdx < M.N(); ++rowIdx) {
+        for (unsigned int rowIdx = 0; rowIdx < M.N(); ++rowIdx) {
             ConstColIterator colIt = M[rowIdx].begin();
             ConstColIterator colEndIt = M[rowIdx].end();
             ColIterator myColIt = (*this)[rowIdx].begin();
@@ -251,7 +251,7 @@ private:
         // first, add all local matrix entries
         /////////
         entries_.resize(overlap_->numDomestic());
-        for (int rowIdx = 0; rowIdx < M.N(); ++rowIdx) {
+        for (unsigned int rowIdx = 0; rowIdx < M.N(); ++rowIdx) {
             ConstColIterator colIt = M[rowIdx].begin();
             ConstColIterator colEndIt = M[rowIdx].end();
             for (; colIt != colEndIt; ++colIt) {
@@ -268,21 +268,21 @@ private:
         typename PeerSet::const_iterator peerIt = peerSet.begin();
         typename PeerSet::const_iterator peerEndIt = peerSet.end();
         for (; peerIt != peerEndIt; ++peerIt) {
-            int peerRank = *peerIt;
+            unsigned int peerRank = *peerIt;
             sendRowIndices_(M, peerRank);
         }
 
         // then recieve all indices from the peers
         peerIt = peerSet.begin();
         for (; peerIt != peerEndIt; ++peerIt) {
-            int peerRank = *peerIt;
+            unsigned int peerRank = *peerIt;
             receiveRowIndices_(peerRank);
         }
 
         // wait until all send operations are completed
         peerIt = peerSet.begin();
         for (; peerIt != peerEndIt; ++peerIt) {
-            int peerRank = *peerIt;
+            unsigned int peerRank = *peerIt;
 
             numRowsSendBuff_[peerRank]->wait();
             rowSizesSendBuff_[peerRank]->wait();
@@ -300,14 +300,14 @@ private:
         /////////
 
         // set the row sizes
-        int numDomestic = overlap_->numDomestic();
-        for (int rowIdx = 0; rowIdx < numDomestic; ++rowIdx) {
+        unsigned int numDomestic = overlap_->numDomestic();
+        for (unsigned int rowIdx = 0; rowIdx < numDomestic; ++rowIdx) {
             this->setrowsize(rowIdx, entries_[rowIdx].size());
         }
         this->endrowsizes();
 
         // set the indices
-        for (int rowIdx = 0; rowIdx < numDomestic; ++rowIdx) {
+        for (unsigned int rowIdx = 0; rowIdx < numDomestic; ++rowIdx) {
             const std::set<ColIndex> &colIndices = entries_[rowIdx];
 
             typename std::set<ColIndex>::const_iterator colIdxIt = colIndices.begin();
-- 
GitLab