]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Initialize member variables. 3498/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 7 Nov 2016 21:30:22 +0000 (14:30 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 7 Nov 2016 21:30:22 +0000 (14:30 -0700)
Also rename one to match current coding practices. Add to the
variable's documentation.

include/deal.II/base/data_out_base.h
source/base/data_out_base.cc

index 258f0f9af161ab9905e21ee9bc56f445c6c029a7..ab3df47fa99f1a24e9dd927f8e6b0e3fc65feed4 100644 (file)
@@ -1126,11 +1126,21 @@ namespace DataOutBase
     /// Flags used to specify filtering behavior
     DataOutBase::DataOutFilterFlags   flags;
 
-    /// Dimensionality of the nodes, used to properly output filtered data
-    int         node_dim;
+    /**
+     * The number of space dimensions in which the vertices represented
+     * by the current object live. This corresponds to the usual
+     * <dim> argument, but since this class is not templated on the
+     * dimension, we need to store it here.
+     */
+    unsigned int      node_dim;
 
-    /// Number of vertices per cell
-    int         n_cell_verts;
+    /**
+     * The number of vertices per cell. Equal to
+     * GeometryInfo<node_dim>::vertices_per_cell. We need to store
+     * it as a run-time variable here because the dimension
+     * node_dim is also a run-time variable.
+     */
+    unsigned int      vertices_per_cell;
 
     /// Map of points to an internal index
     Map3DPoint        existing_points;
@@ -1156,8 +1166,19 @@ namespace DataOutBase
     void internal_add_cell(const unsigned int &cell_index, const unsigned int &pt_index);
 
   public:
-    DataOutFilter() : flags(false, true) {};
-    DataOutFilter(const DataOutBase::DataOutFilterFlags &flags) : flags(flags) {};
+    DataOutFilter()
+      :
+      flags(false, true),
+      node_dim (numbers::invalid_unsigned_int),
+      vertices_per_cell (numbers::invalid_unsigned_int)
+    {}
+
+    DataOutFilter(const DataOutBase::DataOutFilterFlags &flags)
+      :
+      flags(flags),
+      node_dim (numbers::invalid_unsigned_int),
+      vertices_per_cell (numbers::invalid_unsigned_int)
+    {}
 
     /**
      * Write a point with the specified index into the filtered data set. If
@@ -1233,7 +1254,7 @@ namespace DataOutBase
      */
     unsigned int n_cells() const
     {
-      return filtered_cells.size()/n_cell_verts;
+      return filtered_cells.size()/vertices_per_cell;
     };
 
     /**
index 9a4f7b03c2d1bc2575018e7ae224294eaa6f9b74..ad6c48e0d58c79e78a36bb8c6bd759efb95c2bc7 100644 (file)
@@ -489,7 +489,8 @@ void DataOutBase::DataOutFilter::fill_node_data(std::vector<double> &node_data)
 
   for (it=existing_points.begin(); it!=existing_points.end(); ++it)
     {
-      for (int d=0; d<node_dim; ++d) node_data[node_dim*it->second+d] = it->first(d);
+      for (unsigned int d=0; d<node_dim; ++d)
+        node_data[node_dim*it->second+d] = it->first(d);
     }
 }
 
@@ -515,7 +516,7 @@ DataOutBase::DataOutFilter::write_cell(
   unsigned int d3)
 {
   unsigned int base_entry = index * GeometryInfo<dim>::vertices_per_cell;
-  n_cell_verts = GeometryInfo<dim>::vertices_per_cell;
+  vertices_per_cell = GeometryInfo<dim>::vertices_per_cell;
   internal_add_cell(base_entry+0, start);
   internal_add_cell(base_entry+1, start+d1);
   if (dim>=2)

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.