← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2005: 1. ForceRecorder added.

 

------------------------------------------------------------
revno: 2005
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2010-02-03 15:55:04 +0100
message:
  1. ForceRecorder added.
  2. Some minor changes.
added:
  pkg/dem/Engine/GlobalEngine/ForceRecorder.cpp
  pkg/dem/Engine/GlobalEngine/ForceRecorder.hpp
modified:
  core/PartialEngine.hpp
  pkg/common/Engine/PartialEngine/PressTestEngine.cpp
  pkg/common/Engine/PartialEngine/PressTestEngine.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 'core/PartialEngine.hpp'
--- core/PartialEngine.hpp	2010-01-22 21:07:37 +0000
+++ core/PartialEngine.hpp	2010-02-03 14:55:04 +0000
@@ -16,7 +16,7 @@
 /*! \brief Abstract interface for all dii ex machina.
 
 	All kinematic engines must derived from this class. A kinematic engine is used to modify the state of an object
-	(position,veloity ...) according to a predefined law (mathematical function, stored data ...) and not according
+	(position,velocity ...) according to a predefined law (mathematical function, stored data ...) and not according
 	to a dynamic law as dynamic engines do. A kinematic engine contains a list of bodies to act on, and bodies can
 	subscribe to several dii ex machina.
 */

=== modified file 'pkg/common/Engine/PartialEngine/PressTestEngine.cpp'
--- pkg/common/Engine/PartialEngine/PressTestEngine.cpp	2009-12-25 14:46:48 +0000
+++ pkg/common/Engine/PartialEngine/PressTestEngine.cpp	2010-02-03 14:55:04 +0000
@@ -8,10 +8,10 @@
 		if (curentDirection==forward) { 										 ///<Forward direction of the press
 			FOREACH(body_id_t id, subscribedBodies){
 				assert(ncb->bodies->exists(id));
-				currentVerticalForce = ncb->forces.getForce(id)[2]; ///<Define current vertical force
-				minimalForce = maxVerticalForce*0.1;						 ///<Define minimal edge of the force (10% from Maximal)
-				minimalPredictedForce = predictedForce*0.1;			 ///<Define minimal edge of the Predicted force (10% from Predicted)
-				if (currentVerticalForce > maxVerticalForce) {	 ///<Force increasing. Press is working normally
+				currentVerticalForce = ncb->forces.getForce(id)[2]; 	///<Define current vertical force
+				minimalForce = maxVerticalForce*0.1;									///<Define minimal edge of the force (10% from Maximal)
+				minimalPredictedForce = predictedForce*0.1;						///<Define minimal edge of the Predicted force (10% from Predicted)
+				if (currentVerticalForce > maxVerticalForce) {				///<Force increasing. Press is working normally
 					maxVerticalForce = currentVerticalForce;
 				} else if ((currentVerticalForce<=(minimalForce))&&(maxVerticalForce>minimalPredictedForce)) {
 					/**

=== modified file 'pkg/common/Engine/PartialEngine/PressTestEngine.hpp'
--- pkg/common/Engine/PartialEngine/PressTestEngine.hpp	2010-02-03 10:23:02 +0000
+++ pkg/common/Engine/PartialEngine/PressTestEngine.hpp	2010-02-03 14:55:04 +0000
@@ -18,7 +18,7 @@
 		int pressVelocityForw2Back;
 		virtual ~PressTestEngine(){};
 		virtual void applyCondition(Scene*);
-		YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(PressTestEngine,TranslationEngine,"This engines simulates the _press-test_ for uniaxial tests.",((long int,numberIterationAfterDestruction,0,"The number of iterations, which will be carry out after destruction [-]"))
+		YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(PressTestEngine,TranslationEngine,"This class simulates the simple press work When the press cracks the solid brittle material, it returns back to the initial position and stops the simulation loop.",((long int,numberIterationAfterDestruction,0,"The number of iterations, which will be carry out after destruction [-]"))
 			((Real,predictedForce,0,"The minimal force, after what the engine will look for a destruction [N]"))
 			((long int,riseUpPressHigher,1,"After destruction press rises up. This is the relationship between initial press velocity and _returning back_ velocity [-]")),curentDirection=forward;currentVerticalForce=0;maxVerticalForce=0;minimalForce=0;minimalPredictedForce=0;currentIterationAfterDestruction=0;pressVelocityForw2Back=25;,);
 			

=== added file 'pkg/dem/Engine/GlobalEngine/ForceRecorder.cpp'
--- pkg/dem/Engine/GlobalEngine/ForceRecorder.cpp	1970-01-01 00:00:00 +0000
+++ pkg/dem/Engine/GlobalEngine/ForceRecorder.cpp	2010-02-03 14:55:04 +0000
@@ -0,0 +1,16 @@
+#include"ForceRecorder.hpp"
+
+YADE_PLUGIN((ForceRecorder));
+CREATE_LOGGER(ForceRecorder);
+
+void ForceRecorder::action(Scene * ncb){
+	totalForce=Vector3r::ZERO;
+	FOREACH(body_id_t id, subscribedBodies){
+		assert(ncb->bodies->exists(id)); 
+		totalForce+=ncb->forces.getForce(id);
+	};
+	
+	//Save data to a file
+	out<<Omega::instance().getCurrentIteration()<<" "<<totalForce[0]<<" "<<totalForce[1]<<" "<<totalForce[2]<<" "<<totalForce.Length()<<"\n";
+	out.close();
+}

=== added file 'pkg/dem/Engine/GlobalEngine/ForceRecorder.hpp'
--- pkg/dem/Engine/GlobalEngine/ForceRecorder.hpp	1970-01-01 00:00:00 +0000
+++ pkg/dem/Engine/GlobalEngine/ForceRecorder.hpp	2010-02-03 14:55:04 +0000
@@ -0,0 +1,14 @@
+#pragma once
+#include <yade/pkg-common/Recorder.hpp>
+#include <yade/core/Scene.hpp>
+
+class ForceRecorder: public Recorder {
+	public:
+		Vector3r totalForce;
+		virtual void action(Scene*);
+	YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(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>,subscribedBodies,,"Lists of bodies whose state will be measured")),,);
+	DECLARE_LOGGER;
+};
+
+REGISTER_SERIALIZABLE(ForceRecorder);