]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Prefer ++iterator to iterator++ in loops. 2993/head
authorDavid Wells <wellsd2@rpi.edu>
Sun, 14 Aug 2016 22:57:42 +0000 (18:57 -0400)
committerDavid Wells <wellsd2@rpi.edu>
Sun, 21 Aug 2016 13:07:45 +0000 (09:07 -0400)
These were caught by cppcheck.

include/deal.II/fe/fe_series.h
source/grid/grid_tools.cc
source/grid/tria.cc
source/lac/sparsity_tools.cc
source/numerics/point_value_history.cc

index fe4c461c3c3efbed70a738c4041a6ad200c4b85d..fdb4509aa6b3ca8f73fc06c43f2b9652a0167d48 100644 (file)
@@ -377,7 +377,7 @@ FESeries::process_coefficients(const Table<dim,T> &coefficients,
 
   // now go through the map and populate the @p norm_values based on @p norm:
   for (typename std::map<unsigned int, std::vector<T> >::const_iterator it = pred_to_values.begin();
-       it != pred_to_values.end(); it++)
+       it != pred_to_values.end(); ++it)
     {
       predicate_values.push_back(it->first);
       Vector<T> values(it->second.begin(),
index bc8b262c14ab0725edba3de93740d003d2e84757..d75ec11de151505f3d2dead98af8e13108c795aa 100644 (file)
@@ -3589,7 +3589,7 @@ next_cell:
       {
         for (std::set<unsigned int>::iterator it = face2_vertices.begin();
              it != face2_vertices.end();
-             it++)
+             ++it)
           {
             if (orthogonal_equality(face1->vertex(i),face2->vertex(*it),
                                     direction, offset, matrix))
index c0fa0b5e7a90b5338303b6a9d465668df6e5088f..a70616c3c620b7ac6693224770667f6775766700 100644 (file)
@@ -1940,7 +1940,7 @@ namespace internal
           std::vector<unsigned short int> vertex_touch_count (v.size(), 0);
           typename std::map<std::pair<int,int>,
                    typename Triangulation<dim,spacedim>::line_iterator>::iterator i;
-          for (i=needed_lines.begin(); i!=needed_lines.end(); i++)
+          for (i=needed_lines.begin(); i!=needed_lines.end(); ++i)
             {
               // touch the vertices of
               // this line
@@ -2310,7 +2310,7 @@ namespace internal
           std::vector<unsigned short int> vertex_touch_count (v.size(), 0);
           typename std::map<std::pair<int,int>,
                    typename Triangulation<dim,spacedim>::line_iterator>::iterator i;
-          for (i=needed_lines.begin(); i!=needed_lines.end(); i++)
+          for (i=needed_lines.begin(); i!=needed_lines.end(); ++i)
             {
               // touch the vertices of
               // this line
@@ -9305,7 +9305,7 @@ copy_triangulation (const Triangulation<dim, spacedim> &old_tria)
   typename std::map<types::manifold_id,
            SmartPointer<const Manifold<dim,spacedim> , Triangulation<dim, spacedim> > >::const_iterator
            bdry_iterator = old_tria.manifold.begin();
-  for (; bdry_iterator != old_tria.manifold.end() ; bdry_iterator++)
+  for (; bdry_iterator != old_tria.manifold.end() ; ++bdry_iterator)
     manifold[bdry_iterator->first] = bdry_iterator->second;
 
 
index 55cc166cdb44ab6f7e395b61ddc251c56c5016cd..2494eba0e7c1ec0e9f4c197fb309451e64aeaacf 100644 (file)
@@ -639,7 +639,7 @@ namespace SparsityTools
                 {
                   Assert(ptr!=end, ExcInternalError());
                   dsp.add(row, *ptr);
-                  ptr++;
+                  ++ptr;
                 }
             }
           Assert(ptr==end, ExcInternalError());
@@ -761,7 +761,7 @@ namespace SparsityTools
                 {
                   Assert(ptr!=end, ExcInternalError());
                   dsp.add(row, *ptr);
-                  ptr++;
+                  ++ptr;
                 }
             }
           Assert(ptr==end, ExcInternalError());
index 3c071306e42918dea56ecaeed5f1d94831156706..ee6cf4ad2618b6a4ff19e8ecd09b316b6f6bf6eb 100644 (file)
@@ -302,7 +302,7 @@ void PointValueHistory<dim>
 
   std::map <std::string, std::vector <std::vector <double> > >::iterator
   data_store_begin = data_store.begin ();
-  for (; data_store_begin != data_store.end (); data_store_begin++)
+  for (; data_store_begin != data_store.end (); ++data_store_begin)
     {
       // add an extra row to each vector
       // entry
@@ -422,7 +422,7 @@ void PointValueHistory<dim>
 
       std::map <std::string, std::vector <std::vector <double> > >::iterator
       data_store_begin = data_store.begin ();
-      for (; data_store_begin != data_store.end (); data_store_begin++)
+      for (; data_store_begin != data_store.end (); ++data_store_begin)
         {
           // add an extra row to each vector
           // entry
@@ -582,7 +582,7 @@ void PointValueHistory<dim>
   unsigned int n_stored = mask->second.n_selected_components(dof_handler->get_fe ().n_components ());
 
   typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
-  for (unsigned int data_store_index = 0; point != point_geometry_data.end (); point++, data_store_index++)
+  for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index)
     {
       // Look up the components to add
       // in the component_mask, and
@@ -636,7 +636,7 @@ void PointValueHistory<dim>
 
   // Loop over points and find correct cell
   typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
-  for (unsigned int data_store_index = 0; point != point_geometry_data.end (); point++, data_store_index++)
+  for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index)
     {
       // we now have a point to query,
       // need to know what cell it is in
@@ -762,7 +762,7 @@ void PointValueHistory<dim>
       // we now have the data and need to save it
       // loop over data names
       typename std::vector<std::string>::const_iterator name = vector_names.begin();
-      for (; name != vector_names.end(); name++)
+      for (; name != vector_names.end(); ++name)
         {
           typename std::map <std::string, std::vector <std::vector <double> > >::iterator data_store_field = data_store.find(*name);
           Assert (data_store_field != data_store.end(), ExcMessage("vector_name not in class"));
@@ -834,7 +834,7 @@ void PointValueHistory<dim>
 
   typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
   Vector <number> value (dof_handler->get_fe().n_components());
-  for (unsigned int data_store_index = 0; point != point_geometry_data.end (); point++, data_store_index++)
+  for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index)
     {
       // Make a Vector <double> for the value
       // at the point. It will have as many
@@ -961,7 +961,7 @@ void PointValueHistory<dim>
       //AssertThrow (!triangulation_changed, ExcDoFHandlerChanged ());
 
       typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
-      for (unsigned int data_store_index = 0; point != point_geometry_data.end (); point++, data_store_index++)
+      for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index)
         {
           // for each point, open a file to
           // be written to
@@ -1081,7 +1081,7 @@ Vector<double> PointValueHistory<dim>
   Vector<double> dof_vector (dof_handler->n_dofs ());
 
   typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
-  for (; point != point_geometry_data.end (); point++)
+  for (; point != point_geometry_data.end (); ++point)
     {
       for (unsigned int component = 0; component < dof_handler->get_fe ().n_components (); component++)
         {
@@ -1103,7 +1103,7 @@ void PointValueHistory<dim>
   std::vector <std::vector <Point <dim> > > actual_points;
   typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
 
-  for (; point != point_geometry_data.end (); point++)
+  for (; point != point_geometry_data.end (); ++point)
     {
       actual_points.push_back (point->support_point_locations);
     }
@@ -1134,7 +1134,7 @@ void PointValueHistory<dim>
 
   // Loop over points and find correct cell
   typename std::vector <internal::PointValueHistory::PointGeometryData <dim> >::iterator point = point_geometry_data.begin ();
-  for (unsigned int data_store_index = 0; point != point_geometry_data.end (); point++, data_store_index++)
+  for (unsigned int data_store_index = 0; point != point_geometry_data.end (); ++point, ++data_store_index)
     {
       // we now have a point to query,
       // need to know what cell it is in
@@ -1180,7 +1180,7 @@ void PointValueHistory<dim>
     {
       if (!cleared)
         {
-          for (; point != point_geometry_data.end (); point++)
+          for (; point != point_geometry_data.end (); ++point)
             {
               out << "# Requested location: " << point->requested_location << "\n";
               out << "# DoF_index : Support location (for each component)\n";
@@ -1222,7 +1222,7 @@ void PointValueHistory<dim>
     {
       out << "Mnemonic: data set size (mask size, n true components) : n data sets\n";
     }
-  for (; data_store_begin != data_store.end (); data_store_begin++)
+  for (; data_store_begin != data_store.end (); ++data_store_begin)
     {
       // Find field mnemonic
       std::string vector_name = data_store_begin->first;
@@ -1278,7 +1278,7 @@ bool PointValueHistory<dim>
       data_store_begin = data_store.begin ();
       if (have_dof_handler)
         {
-          for (; data_store_begin != data_store.end (); data_store_begin++)
+          for (; data_store_begin != data_store.end (); ++data_store_begin)
             {
               Assert (data_store_begin->second.size() > 0,
                       ExcInternalError());
@@ -1306,7 +1306,7 @@ bool PointValueHistory<dim>
     {
       std::map <std::string, std::vector <std::vector <double> > >::iterator
       data_store_begin = data_store.begin ();
-      for (; data_store_begin != data_store.end (); data_store_begin++)
+      for (; data_store_begin != data_store.end (); ++data_store_begin)
         {
           Assert (data_store_begin->second.size() > 0,
                   ExcInternalError());

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.