← Back to team overview

yade-users team mailing list archive

Particle displacement during a simulation


I would like to change coordinates of a discrete element during a 
simulation (for example after 3 seconds of calculation).
The problem is I didn't manage to initialize the velocity on the same 
time whereas there is not any worry to change the coordinates. I give 
you the class I wrote for this purpose :


ElementTeleportation::ElementTeleportation() : StandAloneEngine()
    ballId = 1;
    iterChange = 0;
    newPosition = Vector3r(2,0.06,0);
    //newVelocity = Vector3r(0,0,0);


void ElementTeleportation::registerAttributes()

void ElementTeleportation::action(Body * body)
    MetaBody * ncb = dynamic_cast<MetaBody*>(body);

    if( Omega::instance().getCurrentIteration() == iterChange)
        BodyContainer::iterator bi    = ncb->bodies->begin();
        BodyContainer::iterator biEnd = ncb->bodies->end();
        for(  ; bi!=biEnd ; ++bi )
            shared_ptr<Body> body = *bi;

            if (body->getId() == ballId)
                    ParticleParameters* pp = 

                    body->physicalParameters->se3.position[1] = 1.0;
                    pp->velocity[1] = 2;


Moreover I put this class in 
do you think that's a good choice, actually I think I didn't really 
understood what was the difference between different kind of engines.
I have to face another problem, I tried also to eliminate a discrete 
element during a simulation, but when the particle is deleted Yade is 
closed by the computer and I can read "segmentation fault". I used the 
code "BodyContainer->erase(body->getId())" to do it.

Here are the question, and I hope the manual to come soon...


Yade-users mailing list

Follow ups