← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3820: Get max-min coefs in polyhedra_splitter simpler.

 

------------------------------------------------------------
revno: 3820
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Thu 2016-03-24 23:08:26 +0100
message:
  Get max-min coefs in polyhedra_splitter simpler.
modified:
  pkg/dem/Polyhedra_splitter.cpp


--
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 'pkg/dem/Polyhedra_splitter.cpp'
--- pkg/dem/Polyhedra_splitter.cpp	2016-03-24 22:08:26 +0000
+++ pkg/dem/Polyhedra_splitter.cpp	2016-03-24 22:08:26 +0000
@@ -86,14 +86,12 @@
 			//get eigenstresses
 			Symmetrize(stress);
 			Matrix3r I_vect(Matrix3r::Zero()), I_valu(Matrix3r::Zero()); 
-			matrixEigenDecomposition(stress,I_vect,I_valu);	
-			int min_i = 0;
-			if (I_valu(min_i,min_i) > I_valu(1,1)) min_i = 1;
-			if (I_valu(min_i,min_i) > I_valu(2,2)) min_i = 2;	
-			int max_i = 0;
-			if (I_valu(max_i,max_i) < I_valu(1,1)) max_i = 1;
-			if (I_valu(max_i,max_i) < I_valu(2,2)) max_i = 2;
-			
+			matrixEigenDecomposition(stress,I_vect,I_valu);
+
+			Eigen::Matrix3f::Index min_i, max_i;
+			I_valu.diagonal().minCoeff(&min_i);
+			I_valu.diagonal().maxCoeff(&max_i);
+
 			//division of stress by volume
 			const Vector3r dirC = I_vect.col(max_i);
 			const Vector3r dirT = I_vect.col(min_i);