revno: 2989
committer: Anton Gladky
branch nick: yade
timestamp: Tue 2012-01-10 10:39:47 +0100
message:
DomainLimiter:
* Delete spheres only
* Add mass calculation
* Add volume calculation
* Add mask-parameter
SpheresFactory:
* Add color parameter
modified:
pkg/dem/DomainLimiter.cpp
pkg/dem/DomainLimiter.hpp
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/DomainLimiter.cpp'
--- pkg/dem/DomainLimiter.cpp 2011-03-24 21:38:33 +
+++ pkg/dem/DomainLimiter.cpp 2012-01-10 09:39:47 +
@@ -10,13 +10,20 @@
void DomainLimiter::action(){
std::list out;
FOREACH(const shared_ptr& b, *scene->bodies){
- if(!b) continue;
- const Vector3r& p(b->state->pos);
- if(p[0]hi[0] || p[1]hi[1] || p[2]hi[2]) out.push_back(b->id);
+ if((!b) or ((mask>0) and ((b->groupMask & mask)==0))) continue;
+ const Sphere* sphere = dynamic_cast(b->shape.get());
+ if (sphere){ //Delete only spheres
+ const Vector3r& p(b->state->pos);
+ if(p[0]hi[0] || p[1]hi[1] || p[2]hi[2]) {
+out.push_back(b->id);
+nDeleted++;
+mDeleted+=b->state->mass;
+Real r = sphere->radius; vDeleted+=(4/3.)*Mathr::PI*pow(r,3);
+ }
+ }
}
FOREACH(Body::id_t id, out){
scene->bodies->erase(id);
- nDeleted++;
}
}
=== modified file 'pkg/dem/DomainLimiter.hpp'
--- pkg/dem/DomainLimiter.hpp 2010-12-12 13:55:12 +
+++ pkg/dem/DomainLimiter.hpp 2012-01-10 09:39:47 +
@@ -1,6 +1,7 @@
#include
#include
+#include
class DomainLimiter: public PeriodicEngine{
public:
@@ -9,6 +10,9 @@
((Vector3r,lo,Vector3r(0,0,0),,"Lower corner of the domain."))
((Vector3r,hi,Vector3r(0,0,0),,"Upper corner of the domain."))
((long,nDeleted,0,Attr::readonly,"Cummulative number of particles deleted."))
+ ((Real,mDeleted,0,,"Mass of deleted particles."))
+ ((Real,vDeleted,0,,"Volume of deleted particles."))
+ ((int,mask,-1,,"If mask is defined, only particles with corresponding groupMask will be deleted."))
);
};
REGISTER_SERIALIZABLE(DomainLimiter);
=== modified file 'pkg/dem/SpheresFactory.cpp'
--- pkg/dem/SpheresFactory.cpp 2011-12-09 13:20:09 +
+++ pkg/dem/SpheresFactory.cpp 2012-01-10 09:39:47 +
@@ -150,6 +150,9 @@
shared_ptr state(material->newAssocState());
sphere->radius=r;
state->pos=state->refPos=c;
+ if (color[0]>=0 and color[1]>=0 and color[2]>=0){
+ sphere->color = color;
+ }
state->vel=initVel;
Real vol=(4/3.)*Mathr::PI*pow(r,3);
=== modified file 'pkg/dem/SpheresFactory.hpp'
--- pkg/dem/SpheresFactory.hpp 2011-12-09 13:29:16 +
+++ pkg/dem/SpheresFactory.hpp 2012-01-10 09:39:47 +
@@ -26,6 +26,7 @@
((Vector3r,normal,Vector3r(NaN,NaN,NaN),,"Spitting direction (and orientation of the region's geometry)."))
((int,materialId,-1,,"Shared material id to use for newly created spheres (can be negative to count from the end)"))
((int,mask,-1,,"groupMask to apply for newly created spheres "))
+ ((Vector3r,color,Vector3r(-1,-1,-1),,"Use the color for newly created particles, if specified"))
((vector,ids,,,"ids of created bodies"))
((Real,totalMass,0,,"Mass of spheres that was produced so far. |yupdate|"))
((Real,totalVolume,0,,"Volume of spheres that was produced so far. |yupdate|"))
@@ -39,8 +40,8 @@
((vector,PSDsizes,,,"PSD-dispersion, sizes of cells, Diameter [m]"))
((vector,PSDcum,,,"PSD-dispersion, cumulative procent meanings [-]"))
((bool,PSDcalculateMass,true,,"PSD-Input is in mass (true), otherwise the number of particles will be considered."))
-((bool,stopIfFailed,true,,"If true, the SpheresFactory stops (sets massFlowRate=0), when maximal number of attempts to insert particle exceed."))
-((bool,exactDiam,true,,"If true, the particles only with the defined in PSDsizes diameters will be created. Otherwise the diameter will be randomly chosen in the range [PSDsizes[i-1]:PSDsizes[i]], in this case the length of PSDsizes should be more on 1, than the length of PSDcum.")),
+ ((bool,stopIfFailed,true,,"If true, the SpheresFactory stops (sets massFlowRate=0), when maximal number of attempts to insert particle exceed."))
+ ((bool,exactDiam,true,,"If true, the particles only with the defined in PSDsizes diameters will be created. Otherwise the diameter will be randomly chosen in the range [PSDsizes[i-1]:PSDsizes[i]], in this case the length of PSDsizes should be more on 1, than the length of PSDcum.")),
PSDuse=false;
);
};
___
Mailing list: https://launchpad.net/~yade-dev
Post to : yade-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yade-dev
More help : https://help.launchpad.net/ListHelp