[cig-commits] commit 1872 by heister to /var/svn/dealii/aspect

dealii.demon at gmail.com dealii.demon at gmail.com
Tue Sep 10 13:11:46 PDT 2013


Revision 1872

define variables inside for loop

U   trunk/aspect/source/particle/particle.cc


http://www.dealii.org/websvn/revision.php?repname=Aspect+Repository&path=%2F&rev=1872&peg=1872

Diff:
Modified: trunk/aspect/source/particle/particle.cc
===================================================================
--- trunk/aspect/source/particle/particle.cc	2013-09-10 20:08:08 UTC (rev 1871)
+++ trunk/aspect/source/particle/particle.cc	2013-09-10 20:09:57 UTC (rev 1872)
@@ -69,14 +69,13 @@
     void
     BaseParticle<dim>::write_data (std::vector<double> &data) const
     {
-	unsigned int i;
-        // Write location data
-        for (i = 0; i < dim; ++i)
+       // Write location data
+        for (unsigned int i = 0; i < dim; ++i)
           {
 		data.push_back(location(i));
           }
         // Write velocity data
-        for (i = 0; i < dim; ++i)
+        for (unsigned int i = 0; i < dim; ++i)
           {
 		data.push_back(velocity(i));
           }
@@ -86,14 +85,14 @@
     template <int dim>
     unsigned int BaseParticle<dim>::read_data(const std::vector<double> &data, const unsigned int &pos)
     {
-      unsigned int i, p = pos;
+      unsigned int p = pos;
         // Read location data
-        for (i = 0; i < dim; ++i)
+        for (unsigned int i = 0; i < dim; ++i)
           {
             location (i) = data[p++];
           }
         // Write velocity data
-        for (i = 0; i < dim; ++i)
+        for (unsigned int i = 0; i < dim; ++i)
           {
             velocity (i) = data[p++];
           }


More information about the CIG-COMMITS mailing list