]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid a compiler warning by setting the values of old_min_product directly and not...
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 27 Jul 2009 10:28:28 +0000 (10:28 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Mon, 27 Jul 2009 10:28:28 +0000 (10:28 +0000)
git-svn-id: https://svn.dealii.org/trunk@19118 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/source/grid/grid_tools.cc

index 7367f06b9822fc73541c2fcb1b1ed4e333b16065..0d255e31634a5977573c0e6ce422e838d4cc0b28 100644 (file)
@@ -1459,49 +1459,52 @@ namespace internal
          [GeometryInfo<structdim>::vertices_per_cell];
        GeometryInfo<structdim>::alternating_form_at_vertices (parent_vertices,
                                                               parent_alternating_forms);
-       
-       for (unsigned int test=0; test<2; ++test)
-         {
-           Point<spacedim> child_vertices
-             [GeometryInfo<structdim>::max_children_per_cell]
-             [GeometryInfo<structdim>::vertices_per_cell];
 
-           for (unsigned int c=0; c<object->n_children(); ++c)
-             for (unsigned int i=0; i<GeometryInfo<structdim>::vertices_per_cell; ++i)
-               child_vertices[c][i] = object->child(c)->vertex(i);
+       Point<spacedim> child_vertices
+         [GeometryInfo<structdim>::max_children_per_cell]
+         [GeometryInfo<structdim>::vertices_per_cell];
+
+       for (unsigned int c=0; c<object->n_children(); ++c)
+         for (unsigned int i=0; i<GeometryInfo<structdim>::vertices_per_cell; ++i)
+           child_vertices[c][i] = object->child(c)->vertex(i);
+
+       Tensor<spacedim-structdim,spacedim> child_alternating_forms
+         [GeometryInfo<structdim>::max_children_per_cell]
+         [GeometryInfo<structdim>::vertices_per_cell];
+
+       for (unsigned int c=0; c<object->n_children(); ++c)
+         GeometryInfo<structdim>::alternating_form_at_vertices (child_vertices[c],
+                                                                child_alternating_forms[c]);
+       
+       old_min_product = child_alternating_forms[0][0] * parent_alternating_forms[0];
+       for (unsigned int c=0; c<object->n_children(); ++c)
+         for (unsigned int i=0; i<GeometryInfo<structdim>::vertices_per_cell; ++i)
+           for (unsigned int j=0; j<GeometryInfo<structdim>::vertices_per_cell; ++j)
+             old_min_product = std::min (old_min_product,
+                                         child_alternating_forms[c][i] *
+                                         parent_alternating_forms[j]);
 
+                                            // for the new minimum value,
                                             // replace mid-object
-                                            // vertex. note that for
-                                            // child i, the mid-object
-                                            // vertex happens to have the
-                                            // number
+                                            // vertex. note that for child
+                                            // i, the mid-object vertex
+                                            // happens to have the number
                                             // max_children_per_cell-i
-           if (test == 1)
-             for (unsigned int c=0; c<object->n_children(); ++c)
-               child_vertices[c][GeometryInfo<structdim>::max_children_per_cell-c-1]
-                 = object_mid_point;
-       
-           Tensor<spacedim-structdim,spacedim> child_alternating_forms
-             [GeometryInfo<structdim>::max_children_per_cell]
-             [GeometryInfo<structdim>::vertices_per_cell];
+       for (unsigned int c=0; c<object->n_children(); ++c)
+         child_vertices[c][GeometryInfo<structdim>::max_children_per_cell-c-1]
+           = object_mid_point;
 
-           for (unsigned int c=0; c<object->n_children(); ++c)
-             GeometryInfo<structdim>::alternating_form_at_vertices (child_vertices[c],
-                                                                    child_alternating_forms[c]);
+       for (unsigned int c=0; c<object->n_children(); ++c)
+         GeometryInfo<structdim>::alternating_form_at_vertices (child_vertices[c],
+                                                                child_alternating_forms[c]);
        
-           double min = child_alternating_forms[0][0] * parent_alternating_forms[0];
-           for (unsigned int c=0; c<object->n_children(); ++c)
-             for (unsigned int i=0; i<GeometryInfo<structdim>::vertices_per_cell; ++i)
-               for (unsigned int j=0; j<GeometryInfo<structdim>::vertices_per_cell; ++j)
-               min = std::min (min,
-                               child_alternating_forms[c][i] *
-                               parent_alternating_forms[j]);
-
-           if (test == 0)
-             old_min_product = min;
-           else
-             new_min_product = min;
-         }
+       new_min_product = child_alternating_forms[0][0] * parent_alternating_forms[0];
+       for (unsigned int c=0; c<object->n_children(); ++c)
+         for (unsigned int i=0; i<GeometryInfo<structdim>::vertices_per_cell; ++i)
+           for (unsigned int j=0; j<GeometryInfo<structdim>::vertices_per_cell; ++j)
+             new_min_product = std::min (new_min_product,
+                                         child_alternating_forms[c][i] *
+                                         parent_alternating_forms[j]);
 
                                         // if new minimum value is
                                         // better than before, and if

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.