← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2776: 1. ForceRecorder.totalForce and TorqueRecorder.totalTorque are now accessible from python interface

 

------------------------------------------------------------
revno: 2776
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: yade
timestamp: Wed 2011-03-02 09:23:08 +0100
message:
  1. ForceRecorder.totalForce and TorqueRecorder.totalTorque are now accessible from python interface
  2. Fix in TorqueRecorder: getTorque is added
modified:
  pkg/dem/ForceTorqueRecorder.cpp
  pkg/dem/ForceTorqueRecorder.hpp


--
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 'pkg/dem/ForceTorqueRecorder.cpp'
--- pkg/dem/ForceTorqueRecorder.cpp	2011-02-24 13:56:04 +0000
+++ pkg/dem/ForceTorqueRecorder.cpp	2011-03-02 08:23:08 +0000
@@ -27,7 +27,7 @@
 		Vector3r tmpPos = b->state->pos;
 		Vector3r radiusVector = tmpAxis.cross(tmpAxis.cross(tmpPos - zeroPoint));
 		
-		totalTorque+=radiusVector.cross(scene->forces.getForce(id));
+		totalTorque+=scene->forces.getTorque(id)+radiusVector.cross(scene->forces.getForce(id));
 	};
 	
 	//Save data to a file

=== modified file 'pkg/dem/ForceTorqueRecorder.hpp'
--- pkg/dem/ForceTorqueRecorder.hpp	2011-02-24 13:56:04 +0000
+++ pkg/dem/ForceTorqueRecorder.hpp	2011-03-02 08:23:08 +0000
@@ -4,11 +4,13 @@
 
 class ForceRecorder: public Recorder {
 	public:
-		Vector3r totalForce;
 		virtual void action();
-	YADE_CLASS_BASE_DOC_ATTRS_CTOR(ForceRecorder,Recorder,"Engine saves the resulting force affecting to bodies, listed in `ids`. For instance, can be useful for defining the forces, which affects to _buldozer_ during its work.",
-		((std::vector<int>,ids,,,"List of bodies whose state will be measured")),
+	YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(ForceRecorder,Recorder,"Engine saves the resultant force affecting to bodies, listed in `ids`. For instance, can be useful for defining the forces, which affects to _buldozer_ during its work.",
+		((std::vector<int>,ids,,,"List of bodies whose state will be measured"))
+		((Vector3r,totalForce,Vector3r::Zero(),,"Resultant force, returning by the function."))
+		,
 		initRun=true;
+		,
 	);
 	DECLARE_LOGGER;
 };
@@ -16,12 +18,12 @@
 
 class TorqueRecorder: public Recorder {
 	public:
-		Vector3r totalTorque;
 		virtual void action();
 	YADE_CLASS_BASE_DOC_ATTRS_CTOR(TorqueRecorder,Recorder,"Engine saves the total torque according to the given axis and ZeroPoint, the force is taken from bodies, listed in `ids`  For instance, can be useful for defining the torque, which affects on ball mill during its work.",
 		((std::vector<int>,ids,,,"List of bodies whose state will be measured"))
 		((Vector3r,rotationAxis,Vector3r::UnitX(),,"Rotation axis"))
-		((Vector3r,zeroPoint,Vector3r::Zero(),,"Point of rotation center")),
+		((Vector3r,zeroPoint,Vector3r::Zero(),,"Point of rotation center"))
+		((Vector3r,totalTorque,Vector3r::Zero(),,"Resultant torque, returning by the function.")),
 		initRun=true;
 	);
 	DECLARE_LOGGER;