← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3535: Minor fix of using of std::abs function.

 

------------------------------------------------------------
revno: 3535
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Mon 2014-11-17 14:06:46 +0100
message:
  Minor fix of using of std::abs function.
modified:
  lib/computational-geometry/Hull2d.hpp
  pkg/dem/SpherePack.hpp


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'lib/computational-geometry/Hull2d.hpp'
--- lib/computational-geometry/Hull2d.hpp	2009-05-31 09:09:14 +0000
+++ lib/computational-geometry/Hull2d.hpp	2014-11-17 13:06:46 +0000
@@ -1,5 +1,6 @@
 // 2009 © Václav Šmilauer <eudoxos@xxxxxxxx> 
 
+#include <cmath>
 
 /*! Computing convex hull of a 2d cloud of points passed to the constructor,
 	using Graham scan algorithm.
@@ -65,7 +66,7 @@
 	Real ret=0.; size_t n=P.size();
 	for(size_t i=0; i<n-1; i++) { ret+=P[i][0]*P[i+1][1]-P[i+1][0]*P[i][1];}
 	ret+=P[n-1][0]*P[0][1]-P[0][0]*P[n-1][1];
-	return abs(ret/2.);
+	return std::abs(ret/2.);
 }
 
 

=== modified file 'pkg/dem/SpherePack.hpp'
--- pkg/dem/SpherePack.hpp	2014-10-15 06:44:01 +0000
+++ pkg/dem/SpherePack.hpp	2014-11-17 13:06:46 +0000
@@ -2,7 +2,6 @@
 
 #pragma once
 
-
 #include<lib/base/Logging.hpp>
 #include<lib/base/Math.hpp>
 
@@ -110,11 +109,14 @@
     }
 		FOREACH(Sph& s, pack) s.c=rot*s.c;
 	}
-	void scale(Real scale){ Vector3r mid=midPt(); cellSize*=scale; FOREACH(Sph& s, pack) {s.c=scale*(s.c-mid)+mid; s.r*=abs(scale); } }
-	#if 0
-		void shrinkMaxRelOverlap(Real maxRelOverlap);
-		Real maxRelOverlap();
-	#endif
+	void scale(Real scale){ 
+		Vector3r mid=midPt(); 
+		cellSize*=scale; 
+		FOREACH(Sph& s, pack) {
+			s.c=scale*(s.c-mid)+mid; 
+			s.r*=std::abs(scale); 
+		}
+	}
 
 	// iteration 
 	size_t len() const{ return pack.size(); }