[MOAB-dev] commit/MOAB: danwu: Fix compile warnings from some header files in src/moab/point_locater

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Sep 5 16:50:39 CDT 2013


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/7f48c43b9254/
Changeset:   7f48c43b9254
Branch:      master
User:        danwu
Date:        2013-09-05 23:50:27
Summary:     Fix compile warnings from some header files in src/moab/point_locater

Affected #:  6 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 069d4c8..829addb 100644
--- a/src/moab/point_locater/element_maps/linear_hex_map.hpp
+++ b/src/moab/point_locater/element_maps/linear_hex_map.hpp
@@ -36,7 +36,10 @@ class Linear_hex_map {
     //Constructor
     Linear_hex_map() {}
     //Copy constructor
-    Linear_hex_map( const Self & f ) {}
+    Linear_hex_map( const Self & f ) {
+      // Remove the warning about unused parameter
+      if (NULL != &f) {}
+    }
 
  public:
     //Natural coordinates
@@ -46,19 +49,23 @@ class Linear_hex_map {
 					const Entity_handle & h, 
 					const Points & v, 
 					const Point & p, 
-					const double tol=1.e-6) const{
-	Point result(3, 0.0);
-	solve_inverse( p, result, v);
-	bool point_found = solve_inverse( p, result, v, tol) && 
-						is_contained( result, tol);
-	return std::make_pair( point_found, result);
+					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) &&
+                is_contained( result, tol);
+      return std::make_pair( point_found, result);
     }
 
   private:
     //This is a hack to avoid a .cpp file and C++11
     //reference_points(i,j) will be a 1 or -1;
     //This should unroll..
-    inline const double reference_points( const std::size_t& i, 
+    inline double reference_points( const std::size_t& i,
           				  const std::size_t& j) const{
     const double rpts[8][3] = { { -1, -1, -1 },
                                 {  1, -1, -1 },

diff --git a/src/moab/point_locater/element_maps/linear_tet_map.hpp b/src/moab/point_locater/element_maps/linear_tet_map.hpp
index d48c63b..dedb8ed 100644
--- a/src/moab/point_locater/element_maps/linear_tet_map.hpp
+++ b/src/moab/point_locater/element_maps/linear_tet_map.hpp
@@ -18,14 +18,17 @@ class Linear_tet_map {
     //Natural coordinates
     template< typename Moab, typename Points, typename Point>
     std::pair< bool, Point> operator()( const Moab & moab,
-					const Entity_handle eh, 
+					const Entity_handle _eh,
 				        const Points & v, 
 					const Point & p, 
 					const double tol=1e-6) {
-	set_tet( eh, v); 
-	//TODO: Make sure this is correct
-	Point result = Tinv*p;
-	return std::make_pair( is_contained( result, tol), result);
+      // Remove the warning about unused parameter
+      if (NULL != &moab) {}
+
+      set_tet( _eh, v);
+      //TODO: Make sure this is correct
+      Point result = Tinv*p;
+      return std::make_pair( is_contained( result, tol), result);
     }
   
     private:

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 1f8b84d..92ea3ed 100644
--- a/src/moab/point_locater/element_maps/quadratic_hex_map.hpp
+++ b/src/moab/point_locater/element_maps/quadratic_hex_map.hpp
@@ -57,18 +57,22 @@ class Quadratic_hex_map {
 					const Entity_handle & h, 
 					const Points & v, 
 					const Point & p, 
-					const double tol=1.e-6) const{
-	Point result(3, 0.0);
-	bool point_found = solve_inverse( p, result, v, tol) && 
-						is_contained( result, tol);
-	return std::make_pair( point_found, result);
+					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);
+      return std::make_pair( point_found, result);
     }
 
   private:
     //This is a hack to avoid a .cpp file and C++11
     //reference_points(i,j) will be a 1 or -1;
     //This should unroll..
-    inline const double reference_points( const std::size_t& i, 
+    inline double reference_points( const std::size_t& i,
           				  const std::size_t& j) const{
     const double rpts[27][3] = {
     	{ -1, -1, -1 },
@@ -196,24 +200,27 @@ class Quadratic_hex_map {
     }
 
     template< typename Point, typename 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]),
+    Matrix& jacobian( const Point & p, const Points & points, Matrix & J) const {
+    // Remove the warning about unused parameter
+    if (NULL != &points) {}
+
+    J = Matrix(0.0);
+    for (int i = 0; i < 27; i++) {
+      const double sh[3] = { SH(reference_points(i,0), p[0]),
                        		           SH(reference_points(i,1), p[1]),
                        		           SH(reference_points(i,2), p[2]) };
-  		  const double dsh[3] = { DSH(reference_points(i,0), p[0]),
+ 	    const double dsh[3] = { DSH(reference_points(i,0), p[0]),
                         		  DSH(reference_points(i,1), p[1]),
                         	   	  DSH(reference_points(i,2), p[2]) };
-  	    for (int j=0; j<3; j++) {
-		// dxj/dr first column
-    		J(j,0)+=dsh[0]*sh[1]*sh[2]*reference_points(i,j); 
-    		J(j,1)+= sh[0]*dsh[1]*sh[2]*reference_points(i,j); // dxj/ds
-    		J(j,2)+= sh[0]*sh[1]*dsh[2]*reference_points(i,j); // dxj/dt
-  	    }
-	}
-	return J;
-   }
+      for (int j = 0; j < 3; j++) {
+        // dxj/dr first column
+        J(j, 0) += dsh[0]*sh[1]*sh[2]*reference_points(i, j);
+        J(j, 1) += sh[0]*dsh[1]*sh[2]*reference_points(i, j); // dxj/ds
+        J(j, 2) += sh[0]*sh[1]*dsh[2]*reference_points(i, j); // dxj/dt
+      }
+    }
+    return J;
+  }
   private:
 }; //Class Quadratic_hex_map
 

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 1b01dca..c255545 100644
--- a/src/moab/point_locater/element_maps/spectral_hex_map.hpp
+++ b/src/moab/point_locater/element_maps/spectral_hex_map.hpp
@@ -66,15 +66,19 @@ class Spectral_hex_map {
 					const Points & v, 
 					const Point & p, 
 					const double tol=1.e-6) {
-	Point result(3, 0.0);
-	/*
-      	moab.tag_get_by_ptr(_xm1Tag, &eh, 1,(const void **) &_xyz[ 0] );
-      	moab.tag_get_by_ptr(_ym1Tag, &eh, 1,(const void **) &_xyz[ 1] );
-      	moab.tag_get_by_ptr(_zm1Tag, &eh, 1,(const void **) &_xyz[ 2] );
-	*/
-	bool point_found = solve_inverse( p, result, v, tol) && 
-						is_contained( result, tol);
-	return std::make_pair( point_found, result);
+        // Remove the warnings about unused parameters
+        if (NULL != &moab) {}
+        if (NULL != &h) {}
+
+        Point result(3, 0.0);
+        /*
+        moab.tag_get_by_ptr(_xm1Tag, &eh, 1,(const void **) &_xyz[ 0] );
+        moab.tag_get_by_ptr(_ym1Tag, &eh, 1,(const void **) &_xyz[ 1] );
+        moab.tag_get_by_ptr(_zm1Tag, &eh, 1,(const void **) &_xyz[ 2] );
+        */
+        bool point_found = solve_inverse( p, result, v, tol) &&
+                  is_contained( result, tol);
+        return std::make_pair( point_found, result);
     }
 
   private:
@@ -143,16 +147,19 @@ class Spectral_hex_map {
 
     template< typename Point, typename 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,
-			_ld[1].J, _ld[1].n,
-			_ld[2].J, _ld[2].n,
-			_xyz[ d],
-			_odwork);
-	}
-    	return f;
-   }
+      // Remove the warning about unused parameter
+      if (NULL != &points) {}
+
+      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,
+        _ld[1].J, _ld[1].n,
+        _ld[2].J, _ld[2].n,
+        _xyz[ d],
+        _odwork);
+      }
+      return f;
+    }
 
    template< typename Point, typename Field>
    double   evaluate_scalar_field(const Point & p, const Field & field) const {
@@ -190,7 +197,8 @@ class Spectral_hex_map {
          double wj= _ld[1].J[j];
          double wi= _ld[0].J[i];
          Matrix3 J(0.);
-	 for(int i = 0; i < 8; ++i){ J(i/3, i%3) = _data.jac[ i];}
+         for (int n = 0; n < 8; n++)
+           J(n/3, n%3) = _data.jac[n];
          double bm = wk*wj*wi* J.determinant();
          integral+= bm*field[index++];
          //volume +=bm;
@@ -201,23 +209,27 @@ class Spectral_hex_map {
    return integral;
  }
 
-   template< typename Point, typename Points>
-   Matrix& jacobian( const Point & p, const Points & points, Matrix & J) {
+  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) {}
+
    	real x[ 3];
-       for(int i = 0; i < 3; ++i){ _data.elx[ i] = _xyz[ i]; }
-       opt_vol_set_intp_3(& _data,x);
-       for(int i = 0; i < 9; ++i){ J(i%3, i/3) = _data.jac[ i]; }
-       return J;
-   }
-    
+    for (int i = 0; i < 3; ++i) { _data.elx[ i] = _xyz[ i]; }
+    opt_vol_set_intp_3(& _data, x);
+    for (int i = 0; i < 9; ++i) { J(i%3, i/3) = _data.jac[ i]; }
+    return J;
+  }
+
   private:
-	bool _init;
-	int _n;
-	real * _z[ 3];
-	lagrange_data _ld[ 3];
-	opt_data_3 _data;
-	real * _odwork;
-	real * _xyz[ 3];
+  bool _init;
+  int _n;
+  real * _z[ 3];
+  lagrange_data _ld[ 3];
+  opt_data_3 _data;
+  real * _odwork;
+  real * _xyz[ 3];
 }; //Class Spectral_hex_map
 
 }// namespace element_utility

diff --git a/src/moab/point_locater/tree/bvh_tree.hpp b/src/moab/point_locater/tree/bvh_tree.hpp
index 266d784..2f92b19 100644
--- a/src/moab/point_locater/tree/bvh_tree.hpp
+++ b/src/moab/point_locater/tree/bvh_tree.hpp
@@ -503,7 +503,7 @@ void find_split(const Iterator & begin,
 		const Iterator & end, Split_data & data) const{
 	typedef typename Iterator::value_type Map_iterator;
 	typedef typename Map_iterator::value_type::second_type Box_data;
-	typedef typename Box_data::first_type Bounding_box;
+	typedef typename Box_data::first_type _Bounding_box; // Note, not global typedef moab::common_tree::Box< double> Bounding_box;
 	typedef typename std::vector< Split_data> Split_list;
 	typedef typename std::vector< Split_list> Splits;
 	typedef typename Splits::iterator Split_iterator;
@@ -512,7 +512,7 @@ void find_split(const Iterator & begin,
 	Buckets buckets( NUM_DIM, Bucket_list( NUM_BUCKETS) );
 	Splits splits( NUM_DIM, Split_list( NUM_SPLITS, data));
 	
-	const Bounding_box interval = data.bounding_box;
+	const _Bounding_box interval = data.bounding_box;
 	establish_buckets( begin, end, interval, buckets);
 	initialize_splits( splits, buckets, data);
 	choose_best_split( splits, data);

diff --git a/src/moab/point_locater/tree/element_tree.hpp b/src/moab/point_locater/tree/element_tree.hpp
index 2b0b86c..261c4a5 100644
--- a/src/moab/point_locater/tree/element_tree.hpp
+++ b/src/moab/point_locater/tree/element_tree.hpp
@@ -45,7 +45,7 @@ bool operator()(const Value & a, const Value & b){
 template< typename Data>
 struct Split_comparator {
   //we minimizes ||left| - |right|| + |middle|^2 
-  const double split_objective( const Data & a) const {
+  double split_objective( const Data & a) const {
 	if (a.second.sizes[ 2]==0 || a.second.sizes[ 0] == 0){
 		return std::numeric_limits< std::size_t>::max();
 	}

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