← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3567: fix force and torque vtk output for boxes

 

------------------------------------------------------------
revno: 3567
committer: Christian Jakob <jakob@xxxxxxxxxxxxxxxxxxx>
timestamp: Wed 2015-01-21 12:52:02 +0100
message:
  fix force and torque vtk output for boxes
modified:
  pkg/dem/VTKRecorder.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/VTKRecorder.cpp'
--- pkg/dem/VTKRecorder.cpp	2014-11-17 09:21:14 +0000
+++ pkg/dem/VTKRecorder.cpp	2015-01-21 11:52:02 +0000
@@ -701,6 +701,19 @@
 						boxesStressVec->InsertNextTupleValue(s);
 						boxesStressLen->InsertNextValue(stress.norm());
 					}
+					if(recActive[REC_FORCE]){
+						scene->forces.sync();
+						const Vector3r& f = scene->forces.getForce(b->getId());
+						const Vector3r& t = scene->forces.getTorque(b->getId());
+						Real ff[3] = { (Real) f[0], (Real) f[1], (Real) f[2] };
+						Real tt[3] = { (Real) t[0], (Real) t[1], (Real) t[2] };
+						Real fn = f.norm();
+						Real tn = t.norm();
+						boxesForceVec->InsertNextTupleValue(ff);
+						boxesForceLen->InsertNextValue(fn);
+						boxesTorqueVec->InsertNextTupleValue(tt);
+						boxesTorqueLen->InsertNextValue(tn);
+					}
 					if (recActive[REC_MATERIALID]) boxesMaterialId->InsertNextValue(b->material->id);
 					if (recActive[REC_MASK]) boxesMask->InsertNextValue(GET_MASK(b));
 				}
@@ -857,7 +870,7 @@
 			boxesUg->GetCellData()->AddArray(boxesStressVec);
 			boxesUg->GetCellData()->AddArray(boxesStressLen);
 		}
-		if (recActive[REC_FACETS]){
+		if (recActive[REC_FORCE]){
 			boxesUg->GetCellData()->AddArray(boxesForceVec);
 			boxesUg->GetCellData()->AddArray(boxesForceLen);
 			boxesUg->GetCellData()->AddArray(boxesTorqueVec);