Re: [Yade-dev] : Avoid new contact detection between group of particle

2012-01-10 Thread Anton Gladky
Hi Klaus,

one of  possible solutions is to use "groupMask', which is bitmask.
For example, you have 3 groups of particles. 1 and 2, 2 and 3 should
interact, otherwise
1 and 3 should not. In this case bitmask can be so written:

16 8 4 2 1
1) 1   0 0 1 0=  17
2) 0   1 0 1 1=  11
3) 0   0 1 0 1=  5

When interaction is detected, the collider (I guess) uses bitwise
AND-operation for bitmasks of 2 interacting particles.
And if the sum is more than 0, then interaction is created, otherwise
not. So, if you see an example, the group 1 and 2, 2 and 3
will give the sum 1 and interaction will be created, 1 and 3 gives 0,
so particles will not interact.

Hope that helps.
Anton



On Wed, Jan 11, 2012 at 6:45 AM, Klaus Thoeni  wrote:
> Hi guys,
>
> I have a tricky question. How can I avoid new contact detection between a
> group of particles?
>
> For my WireMP a first create particles which represent the net. Second, I
> create a link between particle since particle interact remotely (there is no
> physical contact between these particles). However, once the link is created I
> want to avoid new contact detection between those particles. I still need
> contact detection between the net and some other particles (e.g. rock block).
>
> Any idea how to implement this? I think it must be done somewhere in the
> collider, or not?
>
> Thanks,
>
> Klaus
>
> ___
> 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

___
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


[Yade-dev] : Avoid new contact detection between group of particle

2012-01-10 Thread Klaus Thoeni
Hi guys,

I have a tricky question. How can I avoid new contact detection between a 
group of particles?

For my WireMP a first create particles which represent the net. Second, I 
create a link between particle since particle interact remotely (there is no 
physical contact between these particles). However, once the link is created I 
want to avoid new contact detection between those particles. I still need 
contact detection between the net and some other particles (e.g. rock block).

Any idea how to implement this? I think it must be done somewhere in the 
collider, or not? 

Thanks,

Klaus

___
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


[Yade-dev] [Branch ~yade-dev/yade/trunk] Rev 2989: DomainLimiter:

2012-01-10 Thread noreply

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