[PATCH] C++ correctness fixes

Richard Guenther rguenth at tat.physik.uni-tuebingen.de
Thu Jun 27 11:41:54 UTC 2002


Hi!

The attached patch provides some fixes for C++ correctness to either
avoid warnings or, in case of ContextMapper.h, fix the destructor being
not virtual.

All of these were catched by gcc3.1, pooma r2 now compiles without
warnings [apart from using <*.h> rather than <*> includes].

Richard.

Btw. is it considered good practice to post patches to this mailinglist?
I have (after some cleanup) more stuff pending, like introducing HDF5
I/O classes and activation of CoordinateSystem support (much like the one
from pooma-2.3.0). For my own development I set up a bitkeeper repository
to mirror the CVS one, but its not pullable from outside our institute.

--
Richard Guenther <richard.guenther at uni-tuebingen.de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
The GLAME Project: http://www.glame.de/
-------------- next part --------------
# This is a BitKeeper generated patch for the following project:
# Project Name: pooma/cheetah repository tracking CVS/tarball
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.26    -> 1.27   
#	r2/src/Field/DiffOps/FieldShiftEngine.h	1.2     -> 1.3    
#	r2/src/Field/FieldEngine/FieldEngine.h	1.2     -> 1.3    
#	r2/src/Partition/ContextMapper.h	1.2     -> 1.3    
#	r2/src/Field/NearestNeighbors.h	1.2     -> 1.3    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/06/27	rguenth at bellatrix.tat.physik.uni-tuebingen.de	1.27
# C++ correctness fixes
# --------------------------------------------
#
diff --minimal -Nru a/r2/src/Field/DiffOps/FieldShiftEngine.h b/r2/src/Field/DiffOps/FieldShiftEngine.h
--- a/r2/src/Field/DiffOps/FieldShiftEngine.h	Thu Jun 27 13:36:27 2002
+++ b/r2/src/Field/DiffOps/FieldShiftEngine.h	Thu Jun 27 13:36:27 2002
@@ -440,7 +440,7 @@
 	      const std::vector<FieldOffset<outputDim> > &vs1,
               const Centering<outputDim> &centering)
   {
-    typedef std::vector<FieldOffset<outputDim> >::size_type size_type;
+    typedef typename std::vector<FieldOffset<outputDim> >::size_type size_type;
 
     // Create a model field with the new centering.
 
diff --minimal -Nru a/r2/src/Field/FieldEngine/FieldEngine.h b/r2/src/Field/FieldEngine/FieldEngine.h
--- a/r2/src/Field/FieldEngine/FieldEngine.h	Thu Jun 27 13:36:27 2002
+++ b/r2/src/Field/FieldEngine/FieldEngine.h	Thu Jun 27 13:36:27 2002
@@ -184,8 +184,8 @@
   
   FieldEngine(const This_t &model)
     : num_materials_m(model.num_materials_m),
-      stride_m(model.stride_m),
       centering_m(model.centering_m),
+      stride_m(model.stride_m),
       data_m(model.data_m),
       physicalCellDomain_m(model.physicalCellDomain_m),
       guards_m(model.guards_m),
@@ -246,8 +246,8 @@
   FieldEngine(const FieldEngine<Mesh, T2, EngineTag2> &model,
               const Domain_t &d)
     : num_materials_m(model.numMaterials()),
-      stride_m(model.centeringSize()),
       centering_m(model.centering()),
+      stride_m(model.centeringSize()),
       guards_m(0),
       mesh_m(model.mesh(),
              inputDomainToVertexDomain(d))
@@ -284,8 +284,8 @@
   FieldEngine(const FieldEngine<Mesh2, T2, EngineTag2> &model,
               const Domain &d)
     : num_materials_m(model.numMaterials()),
-      stride_m(model.centeringSize()),
       centering_m(model.centering()),
+      stride_m(model.centeringSize()),
       guards_m(0)
   {
     addSubFields();
@@ -306,8 +306,8 @@
   FieldEngine(const FieldEngine<Mesh, T2, EngineTag2> &model,
               const INode<Dim> &i)
     : num_materials_m(model.numMaterials()),
-      stride_m(model.centeringSize()),
       centering_m(model.centering()),
+      stride_m(model.centeringSize()),
       guards_m(0),
       mesh_m(model.mesh(),
              inputDomainToVertexDomain(i.domain())) // FIXME: should hand INode to mesh?
@@ -344,8 +344,8 @@
   FieldEngine(const FieldEngine<Mesh2, T2, EngineTag2> &model,
               const EngineView<Tag> &ev)
     : num_materials_m(model.numMaterials()),
-      stride_m(model.centeringSize()),
       centering_m(model.centering()),
+      stride_m(model.centeringSize()),
       physicalCellDomain_m(model.physicalCellDomain()),
       guards_m(model.guardLayers()),
       mesh_m(model.mesh())
@@ -368,8 +368,8 @@
   FieldEngine(const FieldEngine<Mesh, T, EngineTag2> &model,
               const FieldEnginePatch<Dim> &p)
     : num_materials_m(model.numMaterials()),
-      stride_m(model.centeringSize()),
       centering_m(model.centering()),
+      stride_m(model.centeringSize()),
       guards_m(model.guardLayers()),
       mesh_m(model.mesh()) // FIXME: should take a view of the mesh???
   {
@@ -386,8 +386,8 @@
   FieldEngine(const FieldEngine<Mesh2, T2, EngineTag2> &model, 
               const ComponentWrapper<Components> &cw)
     : num_materials_m(model.numMaterials()),
-      stride_m(model.centeringSize()),
       centering_m(model.centering()),
+      stride_m(model.centeringSize()),
       physicalCellDomain_m(model.physicalCellDomain()),
       guards_m(model.guardLayers()),
       mesh_m(model.mesh())
@@ -407,8 +407,8 @@
   FieldEngine(const This_t &model, 
               const Pooma::DontCopyRelations &d)
     : num_materials_m(model.numMaterials()),
-      stride_m(model.centeringSize()),
       centering_m(model.centering()),
+      stride_m(model.centeringSize()),
       physicalCellDomain_m(model.physicalCellDomain_m),
       guards_m(model.guardLayers()),
       mesh_m(model.mesh())
diff --minimal -Nru a/r2/src/Field/NearestNeighbors.h b/r2/src/Field/NearestNeighbors.h
--- a/r2/src/Field/NearestNeighbors.h	Thu Jun 27 13:36:27 2002
+++ b/r2/src/Field/NearestNeighbors.h	Thu Jun 27 13:36:27 2002
@@ -112,7 +112,7 @@
 
     // Determine nearest neighbors for each output value.
 
-    for (Answer_t::size_type outputIndex = 0;
+    for (typename Answer_t::size_type outputIndex = 0;
 	 outputIndex < outputCentering.size();
 	 ++outputIndex)
       answer[outputIndex] = nearestNeighbors(inputPositions,
@@ -156,7 +156,7 @@
 
     // Determine nearest neighbors for each field offset.
 
-    for (FieldOffsetList_t::size_type folIndex = 0;
+    for (typename FieldOffsetList_t::size_type folIndex = 0;
 	 folIndex < outputCentering.size();
 	 ++folIndex) {
       PInsist(fieldOffsetList[folIndex].subFieldNumber() < outputCentering.size(),
@@ -221,7 +221,7 @@
 
     FieldOffset_vt answerHolder;
     if (IntraCellOnly) {
-      for (MinimumSet::size_type minIndex = 0;
+      for (typename MinimumSet::size_type minIndex = 0;
 	   minIndex < minimumSet.size();
 	   ++minIndex)
 	answerHolder.push_back(FieldOffset_t(Loc<Dim>(0),
@@ -229,7 +229,7 @@
     }
     else {
       FieldOffset_vt partialAnswer;
-      for (MinimumSet::size_type minIndex = 0;
+      for (typename MinimumSet::size_type minIndex = 0;
 	   minIndex < minimumSet.size();
 	   ++minIndex)
 	{
diff --minimal -Nru a/r2/src/Partition/ContextMapper.h b/r2/src/Partition/ContextMapper.h
--- a/r2/src/Partition/ContextMapper.h	Thu Jun 27 13:36:27 2002
+++ b/r2/src/Partition/ContextMapper.h	Thu Jun 27 13:36:27 2002
@@ -78,6 +78,8 @@
 
   ContextMapper(){};
 
+  virtual ~ContextMapper(){};
+
   virtual void map(const List_t & templist) const = 0;
 
   


More information about the pooma-dev mailing list