← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-dev/yade/trunk] Rev 2982: Add maxMass parameter to Spheresfactory

 

------------------------------------------------------------
revno: 2982
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
branch nick: yade
timestamp: Fri 2011-12-09 14:20:09 +0100
message:
  Add maxMass parameter to Spheresfactory
modified:
  pkg/dem/SpheresFactory.cpp
  pkg/dem/SpheresFactory.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/SpheresFactory.cpp'
--- pkg/dem/SpheresFactory.cpp	2011-07-26 12:38:18 +0000
+++ pkg/dem/SpheresFactory.cpp	2011-12-09 13:20:09 +0000
@@ -81,8 +81,13 @@
 	normal.normalize();
 
 	LOG_TRACE("totalMass="<<totalMass<<", goalMass="<<goalMass);
-
-	while(totalMass<goalMass && (maxParticles<0 || numParticles<maxParticles)){
+	
+	if (maxMass>0 && maxParticles>0) {
+		LOG_WARN("Both maxMass and maxParticles cannot be > 0; Setting maxMass=-1)");
+		maxMass = -1;
+	}
+	
+	while(totalMass<goalMass && (maxParticles<0 || numParticles<maxParticles) && (maxMass<0 || totalMass<maxMass)){
 		Real r=0.0;
 		
 		Real maxdiff=0.0;		//This and next variable are for PSD-distribution

=== modified file 'pkg/dem/SpheresFactory.hpp'
--- pkg/dem/SpheresFactory.hpp	2011-07-26 12:38:18 +0000
+++ pkg/dem/SpheresFactory.hpp	2011-12-09 13:20:09 +0000
@@ -30,7 +30,8 @@
 		((Real,totalMass,0,,"Mass of spheres that was produced so far. |yupdate|"))
 		((Real,totalVolume,0,,"Volume of spheres that was produced so far. |yupdate|"))
 		((Real,goalMass,0,,"Total mass that should be attained at the end of the current step. |yupdate|"))
-		((int,maxParticles,100,,"The number of particles at which to stop generating new ones (regardless of massFlowRate"))
+		((int,maxParticles,100,,"The number of particles at which to stop generating new ones regardless of massFlowRate. if maxParticles=-1 - ignore this parameter."))
+		((Real,maxMass,-1,,"Maximal mass at which to stop generating new particles regardless of massFlowRate. if maxMass=-1 - ignore this parameter."))
 		((int,numParticles,0,,"Cummulative number of particles produces so far |yupdate|"))
 		((int,maxAttempt,5000 ,,"Maximum number of attempts to position a new sphere randomly."))
 		((bool,silent,false ,,"If true no complain about excessing maxAttempt but disable the factory (by set massFlowRate=0)."))