]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix uninitialized variables in Utilities::MPI::MinMaxAvg 254/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 18 Nov 2014 12:02:45 +0000 (13:02 +0100)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Tue, 18 Nov 2014 12:02:45 +0000 (13:02 +0100)
include/deal.II/base/mpi.h
source/base/mpi.cc

index a6943e36910a9f8c81e7ccfca55988cb70cf0d22..75a5667f2f3a1b022eede5d819ede937fe564e31 100644 (file)
@@ -216,6 +216,8 @@ namespace Utilities
      */
     struct MinMaxAvg
     {
+      MinMaxAvg();
+
       double sum;
       double min;
       double max;
index e24043da95d6b70447be1bb2724e55d9113e8748..dd05f4361c67485ffc0295f206a12220bd24f56e 100644 (file)
@@ -186,8 +186,7 @@ namespace Utilities
 
     namespace
     {
-      // custom MIP_Op for
-      // calculate_collective_mpi_min_max_avg
+      // custom MIP_Op for calculate_collective_mpi_min_max_avg
       void max_reduce ( const void *in_lhs_,
                         void *inout_rhs_,
                         int *len,
@@ -206,7 +205,7 @@ namespace Utilities
           }
         else if (inout_rhs->min == in_lhs->min)
           {
-            // choose lower cpu index when tied to make operator cumutative
+            // choose lower cpu index when tied to make operator commutative
             if (inout_rhs->min_index > in_lhs->min_index)
               inout_rhs->min_index = in_lhs->min_index;
           }
@@ -218,7 +217,7 @@ namespace Utilities
           }
         else if (inout_rhs->max == in_lhs->max)
           {
-            // choose lower cpu index when tied to make operator cumutative
+            // choose lower cpu index when tied to make operator commutative
             if (inout_rhs->max_index > in_lhs->max_index)
               inout_rhs->max_index = in_lhs->max_index;
           }
@@ -227,6 +226,18 @@ namespace Utilities
 
 
 
+    MinMaxAvg::MinMaxAvg ()
+      :
+      sum (0.),
+      min (std::numeric_limits<double>::max()),
+      max (-min),
+      min_index (0),
+      max_index (0),
+      avg (0)
+    {}
+
+
+
     MinMaxAvg
     min_max_avg(const double my_value,
                 const MPI_Comm &mpi_communicator)

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.