← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2405: 1. Analyze of specimen diametr is added to PSD engine. VTK and Rock were updated relatively.

 

------------------------------------------------------------
revno: 2405
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-08-17 15:34:22 +0200
message:
  1. Analyze of specimen diametr is added to PSD engine. VTK and Rock were updated relatively.
modified:
  pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.cpp
  pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.hpp
  pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp
  pkg/dem/meta/RockPM.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/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.cpp'
--- pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.cpp	2010-08-16 21:31:08 +0000
+++ pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.cpp	2010-08-17 13:34:22 +0000
@@ -13,6 +13,7 @@
 		if (!b) continue;
 		YADE_PTR_CAST<RpmState>(b->state)->specimenNumber = 0;
 		YADE_PTR_CAST<RpmState>(b->state)->specimenMass = 0;
+		YADE_PTR_CAST<RpmState>(b->state)->maxDiametrParticle = 0;
 	}
 	
 	//Check all interactions
@@ -143,6 +144,31 @@
 		}
 	}
 	
+	
+	//Find maximal distance between spheres of one specimen
+	FOREACH(const shared_ptr<Body>& b1, *scene->bodies){
+		if (!b1) continue;
+		FOREACH(const shared_ptr<Body>& b2, *scene->bodies){
+			if (!b2) continue;
+			const Sphere* sphere1 = dynamic_cast<Sphere*>(b1->shape.get());							//Check, whether it is a sphere
+			const Sphere* sphere2 = dynamic_cast<Sphere*>(b2->shape.get());
+			int specimenNumberId1 = YADE_PTR_CAST<RpmState>(b1->state)->specimenNumber;	//Get specimenNumberId
+			int specimenNumberId2 = YADE_PTR_CAST<RpmState>(b2->state)->specimenNumber;
+			
+			if (((sphere1)&&(sphere2))&&(b1 != b2)&&(specimenNumberId1==specimenNumberId2)) {
+				Real distBetweenSpheres = (b1->state->pos - b2->state->pos).norm() + sphere1->radius + sphere2->radius;
+				for (unsigned int i=0; i<arrayIdentIds.size(); i++) {
+					if ((arrayIdentIds[i].id1 == specimenNumberId1) or (arrayIdentIds[i].id1 == specimenNumberId2)) {
+						if (arrayIdentIds[i].maxDistanceBetweenSpheres<distBetweenSpheres) {
+							arrayIdentIds[i].maxDistanceBetweenSpheres = distBetweenSpheres;
+							break;
+						}
+					}
+				}
+			}
+		}
+	}
+	
 	//Update specimen masses
 	FOREACH(const shared_ptr<Body>& b, *scene->bodies){
 		if (!b) continue;
@@ -152,6 +178,10 @@
 			for (unsigned int i=0; i<arrayIdentIds.size(); i++) {
 				if (arrayIdentIds[i].id1 == specimenNumberId) {
 					YADE_PTR_CAST<RpmState>(b->state)->specimenMass = arrayIdentIds[i].mass;		//Each particle will contain now the mass of specimen, to which it belongs to
+					if (arrayIdentIds[i].maxDistanceBetweenSpheres==0) {
+						arrayIdentIds[i].maxDistanceBetweenSpheres=sphere->radius;
+					}
+					YADE_PTR_CAST<RpmState>(b->state)->maxDiametrParticle = arrayIdentIds[i].maxDistanceBetweenSpheres;		//Each particle will contain now the maximal diametr of the specimen, to which it belongs to
 					break;
 				}
 			}
@@ -164,9 +194,9 @@
 	out<<"**********\n";
 	out<<"iter totalMass numSpecimen\n";
 	out<<scene->iter<<" "<<totalMass<<" "<<arrayIdentIds.size()<<"\n";
-	out<<"id mass\n";
+	out<<"id mass maxDistanceBetweenSph\n";
 	for (unsigned int i=0; i<arrayIdentIds.size(); i++) {
-		out<<arrayIdentIds[i].id1<<" "<<arrayIdentIds[i].mass<<"\n";
+		out<<arrayIdentIds[i].id1<<" "<<arrayIdentIds[i].mass<<" "<<arrayIdentIds[i].maxDistanceBetweenSpheres<<"\n";
 	}
 	out.close();
 }

=== modified file 'pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.hpp'
--- pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.hpp	2010-07-27 12:37:10 +0000
+++ pkg/dem/Engine/GlobalEngine/ParticleSizeDistrbutionRPMRecorder.hpp	2010-08-17 13:34:22 +0000
@@ -19,15 +19,15 @@
 	DECLARE_LOGGER;
 };
 
-
 struct identicalIds{
 	int id1, id2;
-	Real mass;
+	Real mass, maxDistanceBetweenSpheres;
 	identicalIds (int id1r, int id2r, Real massr){
 		assert(id1r<id2r);
 		id1 = id1r;
 		id2 = id2r;
 		mass = massr;
+		maxDistanceBetweenSpheres = 0;
 	}
 	static bool sortArrayIdentIds (identicalIds i, identicalIds d) {return i.mass>d.mass;}
 };

=== modified file 'pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp'
--- pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp	2010-08-16 21:31:08 +0000
+++ pkg/dem/Engine/GlobalEngine/VTKRecorder.cpp	2010-08-17 13:34:22 +0000
@@ -176,7 +176,9 @@
 	vtkSmartPointer<vtkFloatArray> rpmSpecMass = vtkSmartPointer<vtkFloatArray>::New();
 	rpmSpecMass->SetNumberOfComponents(1);
 	rpmSpecMass->SetName("rpmSpecMass");
-	
+	vtkSmartPointer<vtkFloatArray> rpmSpecDiam = vtkSmartPointer<vtkFloatArray>::New();
+	rpmSpecDiam->SetNumberOfComponents(1);
+	rpmSpecDiam->SetName("rpmSpecDiam");
 
 	if(recActive[REC_INTR]){
 		// save body positions, referenced by ids by vtkLine
@@ -261,6 +263,7 @@
 				if (recActive[REC_RPM]){
 					rpmSpecNum->InsertNextValue(YADE_PTR_CAST<RpmState>(b->state)->specimenNumber);
 					rpmSpecMass->InsertNextValue(YADE_PTR_CAST<RpmState>(b->state)->specimenMass);
+					rpmSpecDiam->InsertNextValue(YADE_PTR_CAST<RpmState>(b->state)->maxDiametrParticle);
 				}
 				
 				if (recActive[REC_MATERIALID]) spheresMaterialId->InsertNextValue(b->material->id);
@@ -332,6 +335,7 @@
 		if (recActive[REC_RPM]){
 			spheresUg->GetPointData()->AddArray(rpmSpecNum);
 			spheresUg->GetPointData()->AddArray(rpmSpecMass);
+			spheresUg->GetPointData()->AddArray(rpmSpecDiam);
 		}
 
 		if (recActive[REC_MATERIALID]) spheresUg->GetPointData()->AddArray(spheresMaterialId);

=== modified file 'pkg/dem/meta/RockPM.hpp'
--- pkg/dem/meta/RockPM.hpp	2010-07-27 12:37:10 +0000
+++ pkg/dem/meta/RockPM.hpp	2010-08-17 13:34:22 +0000
@@ -18,7 +18,8 @@
 class RpmState: public State {
 	YADE_CLASS_BASE_DOC_ATTRS_CTOR(RpmState,State,"State information about Rpm body.",
 		((int,specimenNumber,0,"The variable is used for particle size distribution analyze. Indicates, to which part of specimen belongs para of particles."))
-		((Real,specimenMass,0,"Indicates the mass of the whole stone, which owns the particle.")),
+		((Real,specimenMass,0,"Indicates the mass of the whole stone, which owns the particle."))
+		((Real,maxDiametrParticle,0,"Indicates the maximal diametr of the specimen.")),
 		/*ctor*/ createIndex();
 	);
 	REGISTER_CLASS_INDEX(RpmState,State);