yade-dev team mailing list archive
-
yade-dev team
-
Mailing list archive
-
Message #07155
[Branch ~yade-dev/yade/trunk] Rev 2761: 1. ForceRecorder renamed to ForceTorqueRecorder
------------------------------------------------------------
revno: 2761
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: yade
timestamp: Thu 2011-02-24 14:56:04 +0100
message:
1. ForceRecorder renamed to ForceTorqueRecorder
2. TorqueRecorder is added
renamed:
pkg/dem/ForceRecorder.cpp => pkg/dem/ForceTorqueRecorder.cpp
pkg/dem/ForceRecorder.hpp => pkg/dem/ForceTorqueRecorder.hpp
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
=== renamed file 'pkg/dem/ForceRecorder.cpp' => 'pkg/dem/ForceTorqueRecorder.cpp'
--- pkg/dem/ForceRecorder.cpp 2010-10-29 10:12:44 +0000
+++ pkg/dem/ForceTorqueRecorder.cpp 2011-02-24 13:56:04 +0000
@@ -1,8 +1,8 @@
-#include"ForceRecorder.hpp"
-
-YADE_PLUGIN((ForceRecorder));
+#include"ForceTorqueRecorder.hpp"
+
+YADE_PLUGIN((ForceRecorder)(TorqueRecorder));
+
CREATE_LOGGER(ForceRecorder);
-
void ForceRecorder::action(){
totalForce=Vector3r::Zero();
FOREACH(Body::id_t id, ids){
@@ -14,3 +14,23 @@
out<<scene->iter<<" "<<totalForce[0]<<" "<<totalForce[1]<<" "<<totalForce[2]<<" "<<totalForce.norm()<<"\n";
out.close();
}
+
+CREATE_LOGGER(TorqueRecorder);
+void TorqueRecorder::action(){
+ totalTorque=Vector3r::Zero();
+ Vector3r tmpAxis = rotationAxis.normalized();
+
+ FOREACH(Body::id_t id, ids){
+ assert(scene->bodies->exists(id));
+ Body* b=Body::byId(id,scene).get();
+
+ Vector3r tmpPos = b->state->pos;
+ Vector3r radiusVector = tmpAxis.cross(tmpAxis.cross(tmpPos - zeroPoint));
+
+ totalTorque+=radiusVector.cross(scene->forces.getForce(id));
+ };
+
+ //Save data to a file
+ out<<scene->iter<<" "<<totalTorque[0]<<" "<<totalTorque[1]<<" "<<totalTorque[2]<<" "<<totalTorque.norm()<<"\n";
+ out.close();
+}
=== renamed file 'pkg/dem/ForceRecorder.hpp' => 'pkg/dem/ForceTorqueRecorder.hpp'
--- pkg/dem/ForceRecorder.hpp 2010-11-12 08:03:16 +0000
+++ pkg/dem/ForceTorqueRecorder.hpp 2011-02-24 13:56:04 +0000
@@ -6,11 +6,26 @@
public:
Vector3r totalForce;
virtual void action();
- YADE_CLASS_BASE_DOC_ATTRS_CTOR(ForceRecorder,Recorder,"Engine saves the resulting force affecting to Subscribed bodies. For instance, can be useful for defining the forces, which affect to _buldozer_ during its work.",
- ((std::vector<int>,ids,,,"Lists of bodies whose state will be measured")),
+ 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")),
initRun=true;
);
DECLARE_LOGGER;
};
-
REGISTER_SERIALIZABLE(ForceRecorder);
+
+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")),
+ initRun=true;
+ );
+ DECLARE_LOGGER;
+};
+
+REGISTER_SERIALIZABLE(TorqueRecorder);
+