← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2493: 1. Some notes on Eigen3 migration

 

------------------------------------------------------------
revno: 2493
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Sun 2010-10-17 10:43:51 +0200
message:
  1. Some notes on Eigen3 migration
modified:
  lib/base/Math.hpp
  pkg/dem/PeriIsoCompressor.cpp


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

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-dev/yade/trunk/+edit-subscription
=== modified file 'lib/base/Math.hpp'
--- lib/base/Math.hpp	2010-10-17 01:06:13 +0000
+++ lib/base/Math.hpp	2010-10-17 08:43:51 +0000
@@ -24,6 +24,8 @@
  */
 // different macros for different versions of eigen:
 //  http://bitbucket.org/eigen/eigen/issue/96/eigen_dont_align-doesnt-exist-in-205-but-appears-in-web
+
+//#define EIGEN2_SUPPORT  //This makes Eigen3 migration easier
 #define EIGEN_DONT_VECTORIZE
 #define EIGEN_DONT_ALIGN
 #define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT

=== modified file 'pkg/dem/PeriIsoCompressor.cpp'
--- pkg/dem/PeriIsoCompressor.cpp	2010-10-17 01:06:13 +0000
+++ pkg/dem/PeriIsoCompressor.cpp	2010-10-17 08:43:51 +0000
@@ -418,7 +418,20 @@
 	// Actual action (see the documentation for more info)
 	const Matrix3r& trsf=scene->cell->trsf;
 	// compute rotational and nonrotational (strain in local coordinates) part of trsf
-	Eigen::SVD<Matrix3r>(trsf).computeUnitaryPositive(&rot,&nonrot); 
+	Eigen::SVD<Matrix3r>(trsf).computeUnitaryPositive(&rot,&nonrot);
+	/*
+	//Eigen3 does not have computeUnitaryPositive() implemented. Next few lines of code replace missing functions. Tested. Anton,
+	Matrix3r mU, mV, mS;
+        Eigen::JacobiSVD<Matrix3r> svd(trsf, Eigen::ComputeThinU | Eigen::ComputeThinV);
+
+        mU = svd.matrixU();
+        mV = svd.matrixV();
+        mS = svd.singularValues().asDiagonal();
+
+        rot = mU * mV.adjoint();
+        nonrot = mV * mS * mV.adjoint(); 
+	*/
+	 
 	// prescribed velocity gradient (strain tensor rate) in global coordinates
 	epsilonRate = strainRate.toMatrix(/*strain=*/true); 
 	/* transformation of prescribed strain rate (computed by predictor) into local cell coordinates,