yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #07230
[Branch ~yade-dev/yade/trunk] Rev 2777: 1. Fix TorqueRecorder calculation
------------------------------------------------------------
revno: 2777
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: yade
timestamp: Wed 2011-03-02 10:00:04 +0100
message:
1. Fix TorqueRecorder calculation
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-03-02 08:23:08 +0000
+++ pkg/dem/ForceTorqueRecorder.cpp 2011-03-02 09:00:04 +0000
@@ -17,7 +17,7 @@
CREATE_LOGGER(TorqueRecorder);
void TorqueRecorder::action(){
- totalTorque=Vector3r::Zero();
+ totalTorque=0;
Vector3r tmpAxis = rotationAxis.normalized();
FOREACH(Body::id_t id, ids){
@@ -27,10 +27,10 @@
Vector3r tmpPos = b->state->pos;
Vector3r radiusVector = tmpAxis.cross(tmpAxis.cross(tmpPos - zeroPoint));
- totalTorque+=scene->forces.getTorque(id)+radiusVector.cross(scene->forces.getForce(id));
+ totalTorque+=tmpAxis.dot(scene->forces.getTorque(id)+radiusVector.cross(scene->forces.getForce(id)));
};
//Save data to a file
- out<<scene->iter<<" "<<totalTorque[0]<<" "<<totalTorque[1]<<" "<<totalTorque[2]<<" "<<totalTorque.norm()<<"\n";
+ out<<scene->iter<<" "<<totalTorque<<"\n";
out.close();
}
=== modified file 'pkg/dem/ForceTorqueRecorder.hpp'
--- pkg/dem/ForceTorqueRecorder.hpp 2011-03-02 08:23:08 +0000
+++ pkg/dem/ForceTorqueRecorder.hpp 2011-03-02 09:00:04 +0000
@@ -23,7 +23,7 @@
((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,totalTorque,Vector3r::Zero(),,"Resultant torque, returning by the function.")),
+ ((Real,totalTorque,0,,"Resultant torque, returning by the function.")),
initRun=true;
);
DECLARE_LOGGER;