← Back to team overview

yade-users team mailing list archive

Re: How to reset a body's velocity?

 

> 
>> You could make the vector<Vector3r>
>> LeapFrogPositionIntegrator::prevVelocities public, then you could change
>> it from anywhere: reset prevVelocities for particles in question and set
>> velocity of the particle itself to zero as well.

> 
> But this way will be private. In doing so, I must know exactly what integrator 
> is used to find it in the engines list. If I decide to use another integrator 
> (now I use NewtonsDampedLaw), I will have to modify my engines...

No big deal, as there are only few different engines.
No need to change your code each time, you can test in your engines :

loop on engines {
if (engines->name == NewtonsDamped || engines->names == LeapFrog)//there 
is another way to do that is in latest SVN IIRC
	then do it;
}

Actually, the fact that prevVelocities are inside the integrator could 
be considered a flaw in design...

Bruno



> 
> But if we add the resetVelocity flag to ParticlesParameters, then setting the 
> required velocity of a body and setting the flag we say algorithm to 
> initialize difference schemes again. No need to know about integrators...
> 


_______________________________________________
Yade-users mailing list
Yade-users@xxxxxxxxxxxxxxxx
https://lists.berlios.de/mailman/listinfo/yade-users



References