[MOAB-dev] commit/MOAB: danwu: Use a better way to fix [-Wunused-parameter] warnings.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Sep 6 16:11:27 CDT 2013


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/d243673a70ba/
Changeset:   d243673a70ba
Branch:      master
User:        danwu
Date:        2013-09-06 23:11:15
Summary:     Use a better way to fix [-Wunused-parameter] warnings.

Affected #:  4 files

diff --git a/src/moab/point_locater/element_maps/linear_hex_map.hpp b/src/moab/point_locater/element_maps/linear_hex_map.hpp
index 829addb..4b9cb77 100644
--- a/src/moab/point_locater/element_maps/linear_hex_map.hpp
+++ b/src/moab/point_locater/element_maps/linear_hex_map.hpp
@@ -36,24 +36,17 @@ class Linear_hex_map {
     //Constructor
     Linear_hex_map() {}
     //Copy constructor
-    Linear_hex_map( const Self & f ) {
-      // Remove the warning about unused parameter
-      if (NULL != &f) {}
-    }
+    Linear_hex_map( const Self & /* f */ ) {}
 
  public:
     //Natural coordinates
     template< typename Moab, typename Entity_handle, 
 	      typename Points, typename Point>
-    std::pair< bool, Point> operator()( const Moab & moab,
-					const Entity_handle & h, 
+    std::pair< bool, Point> operator()( const Moab & /* moab */,
+					const Entity_handle & /* h */,
 					const Points & v, 
 					const Point & p, 
 					const double tol = 1.e-6) const {
-      // Remove the warnings about unused parameters
-      if (NULL != &moab) {}
-      if (NULL != &h) {}
-
       Point result(3, 0.0);
       solve_inverse( p, result, v);
       bool point_found = solve_inverse( p, result, v, tol) &&

diff --git a/src/moab/point_locater/element_maps/quadratic_hex_map.hpp b/src/moab/point_locater/element_maps/quadratic_hex_map.hpp
index 92ea3ed..905b65c 100644
--- a/src/moab/point_locater/element_maps/quadratic_hex_map.hpp
+++ b/src/moab/point_locater/element_maps/quadratic_hex_map.hpp
@@ -53,15 +53,11 @@ class Quadratic_hex_map {
     //Natural coordinates
     template< typename Moab, typename Entity_handle, 
 	      typename Points, typename Point>
-    std::pair< bool, Point> operator()( const Moab & moab,
-					const Entity_handle & h, 
+    std::pair< bool, Point> operator()( const Moab & /* moab */,
+					const Entity_handle & /* h */,
 					const Points & v, 
 					const Point & p, 
 					const double tol = 1.e-6) const {
-      // Remove the warnings about unused parameters
-      if (NULL != &moab) {}
-      if (NULL != &h) {}
-
       Point result(3, 0.0);
       bool point_found = solve_inverse( p, result, v, tol) &&
                 is_contained( result, tol);
@@ -200,10 +196,7 @@ class Quadratic_hex_map {
     }
 
     template< typename Point, typename Points>
-    Matrix& jacobian( const Point & p, const Points & points, Matrix & J) const {
-    // Remove the warning about unused parameter
-    if (NULL != &points) {}
-
+    Matrix& jacobian( const Point & p, const Points & /* points */, Matrix & J) const {
     J = Matrix(0.0);
     for (int i = 0; i < 27; i++) {
       const double sh[3] = { SH(reference_points(i,0), p[0]),

diff --git a/src/moab/point_locater/element_maps/spectral_hex_map.hpp b/src/moab/point_locater/element_maps/spectral_hex_map.hpp
index c255545..11bd573 100644
--- a/src/moab/point_locater/element_maps/spectral_hex_map.hpp
+++ b/src/moab/point_locater/element_maps/spectral_hex_map.hpp
@@ -61,15 +61,11 @@ class Spectral_hex_map {
     //Natural coordinates
     template< typename Moab, typename Entity_handle, 
 	      typename Points, typename Point>
-    std::pair< bool, Point> operator()( const Moab & moab,
-					const Entity_handle & h, 
+    std::pair< bool, Point> operator()( const Moab & /* moab */,
+					const Entity_handle & /* h */,
 					const Points & v, 
 					const Point & p, 
-					const double tol=1.e-6) {
-        // Remove the warnings about unused parameters
-        if (NULL != &moab) {}
-        if (NULL != &h) {}
-
+					const double tol = 1.e-6) {
         Point result(3, 0.0);
         /*
         moab.tag_get_by_ptr(_xm1Tag, &eh, 1,(const void **) &_xyz[ 0] );
@@ -146,10 +142,7 @@ class Spectral_hex_map {
     }
 
     template< typename Point, typename Points>
-    Point& evaluate( const Point & p, const Points & points, Point & f) {
-      // Remove the warning about unused parameter
-      if (NULL != &points) {}
-
+    Point& evaluate( const Point & p, const Points & /* points */, Point & f) {
       for (int d = 0; d < 3; ++d) { lagrange_0(&_ld[ d], p[ 0]); }
       for (int d = 0; d < 3; ++d) {
         f[ d] = tensor_i3( _ld[ 0].J, _ld[ 0].n,
@@ -210,11 +203,7 @@ class Spectral_hex_map {
  }
 
   template< typename Point, typename Points>
-  Matrix& jacobian( const Point & p, const Points & points, Matrix & J) {
-    // Remove the warnings about unused parameters
-    if (NULL != &p) {}
-    if (NULL != &points) {}
-
+  Matrix& jacobian( const Point & /* p */, const Points & /* points */, Matrix & J) {
    	real x[ 3];
     for (int i = 0; i < 3; ++i) { _data.elx[ i] = _xyz[ i]; }
     opt_vol_set_intp_3(& _data, x);

diff --git a/tools/mbzoltan/MBZoltan.cpp b/tools/mbzoltan/MBZoltan.cpp
index 299e3c4..f1b712c 100644
--- a/tools/mbzoltan/MBZoltan.cpp
+++ b/tools/mbzoltan/MBZoltan.cpp
@@ -621,8 +621,8 @@ ErrorCode MBZoltan::assemble_graph(const int dimension,
 }
 
 #ifdef CGM
-ErrorCode MBZoltan::assemble_graph(const int dimension,
-                                   std::vector<double> &coords,
+ErrorCode MBZoltan::assemble_graph(const int /* dimension */,
+                                   std::vector<double> & /* coords */,
                                    std::vector<int> &moab_ids,
                                    std::vector<int> &adjacencies, 
                                    std::vector<int> &length,
@@ -633,10 +633,6 @@ ErrorCode MBZoltan::assemble_graph(const int dimension,
                                    const double part_geom_mesh_size,
                                    const int n_part) 
 {
-  // To remove the warnings about unused variables
-  if (dimension > 0) {}
-  if (coords.size() > 0) {}
-
   // get body vertex weights
   DLIList<RefEntity*> body_list;
   gti->ref_entity_list("body", body_list, CUBIT_FALSE);
@@ -1696,26 +1692,16 @@ void MBZoltan::mbShowError(int val, const char *s)
 ** call backs
 **********************/
 
-int mbGetNumberOfAssignedObjects(void *userDefinedData, int *err)
+int mbGetNumberOfAssignedObjects(void * /* userDefinedData */, int *err)
 {
-  // To remove the warnings about unused variables
-  if (userDefinedData) {}
-
   *err = 0;
   return NumPoints;
 }
 
-void mbGetObjectList(void *userDefinedData, int numGlobalIds, int numLids,
+void mbGetObjectList(void * /* userDefinedData */, int /* numGlobalIds */, int /* numLids */,
   ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids, int wgt_dim, float *obj_wgts,
   int *err)
 {
-  // To remove the warnings about unused variables
-  if (userDefinedData) {}
-  if (numGlobalIds > 0){}
-  if (numLids > 0) {}
-  if (gids) {}
-  if (lids) {}
-
   for (int i = 0; i < NumPoints; i++) {
     gids[i] = GlobalIds[i];
     lids[i] = i;
@@ -1726,25 +1712,15 @@ void mbGetObjectList(void *userDefinedData, int numGlobalIds, int numLids,
   *err = 0;
 }
 
-int mbGetObjectSize(void *userDefinedData, int *err)
+int mbGetObjectSize(void * /* userDefinedData */, int *err)
 {
-  // To remove the warnings about unused variables
-  if (userDefinedData) {}
-
   *err = 0; 
   return 3;
 }
 
-void mbGetObject(void *userDefinedData, int numGlobalIds, int numLids, int numObjs,
-  ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids, int numDim, double *pts, int *err)
+void mbGetObject(void * /* userDefinedData */, int /* numGlobalIds */, int /* numLids */, int numObjs,
+  ZOLTAN_ID_PTR /* gids */, ZOLTAN_ID_PTR lids, int numDim, double *pts, int *err)
 { 
-  // To remove the warnings about unused variables
-  if (userDefinedData) {}
-  if (numGlobalIds > 0) {}
-  if (numLids > 0) {}
-  if (gids) {}
-  if (lids) {}
-
   int i, id, id3;
   int next = 0;
 
@@ -1769,18 +1745,11 @@ void mbGetObject(void *userDefinedData, int numGlobalIds, int numLids, int numOb
   }
 } 
 
-void mbGetNumberOfEdges(void *userDefinedData, int numGlobalIds, int numLids,
+void mbGetNumberOfEdges(void * /* userDefinedData */, int /* numGlobalIds */, int /* numLids */,
 			int numObjs, 
-			ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids,	int *numEdges,
+			ZOLTAN_ID_PTR /* gids */, ZOLTAN_ID_PTR lids,	int *numEdges,
 			int *err)
 {
-  // To remove the warnings about unused variables
-  if (userDefinedData) {}
-  if (numGlobalIds > 0) {}
-  if (numLids > 0) {}
-  if (gids) {}
-  if (lids) {}
-
   int i, id;
   int next = 0;
 
@@ -1796,20 +1765,12 @@ void mbGetNumberOfEdges(void *userDefinedData, int numGlobalIds, int numLids,
   }
 }
 
-void mbGetEdgeList(void *userDefinedData, int numGlobalIds, int numLids,
+void mbGetEdgeList(void * /* userDefinedData */, int /* numGlobalIds */, int /* numLids */,
 		   int numObjs,
-		   ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids, int *numEdges,
+		   ZOLTAN_ID_PTR /* gids */, ZOLTAN_ID_PTR lids, int * /* numEdges */,
 		   ZOLTAN_ID_PTR nborGlobalIds, int *nborProcs, int wgt_dim,
 		   float *edge_wgts, int *err)
 {
-  // To remove the warnings about unused variables
-  if (userDefinedData) {}
-  if (numGlobalIds > 0) {}
-  if (numLids > 0) {}
-  if (gids) {}
-  if (lids) {}
-  if (numEdges) {}
-
   int i, id, idSum, j;
   int next = 0;
 
@@ -1836,17 +1797,10 @@ void mbGetEdgeList(void *userDefinedData, int numGlobalIds, int numLids,
   }
 }
 
-void mbGetPart(void *userDefinedData, int numGlobalIds, int numLids,
-               int numObjs, ZOLTAN_ID_PTR gids, ZOLTAN_ID_PTR lids,
+void mbGetPart(void * /* userDefinedData */, int /* numGlobalIds */, int /* numLids */,
+               int numObjs, ZOLTAN_ID_PTR /* gids */, ZOLTAN_ID_PTR lids,
                int *part, int *err)
 {
-  // To remove the warnings about unused variables
-  if (userDefinedData) {}
-  if (numGlobalIds > 0) {}
-  if (numLids > 0) {}
-  if (gids) {}
-  if (lids) {}
-
   int i, id;
   int next = 0;

Repository URL: https://bitbucket.org/fathomteam/moab/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the moab-dev mailing list