← Back to team overview

yade-users team mailing list archive

[Question #705005]: problem of erasing particle

 

New question #705005 on Yade:
https://answers.launchpad.net/yade/+question/705005

When I try to delete particles, there is an error as follows:

version:Yade 20230129-7023~4e0a483~focal1
my code:

def deletParticle():
    for bid in ParID:
        x=O.bodies[bid].state.pos[0]
        if  (0.2<x<0.3):
            for i in O.bodies[bid].intrs():
                O.interactions.erase(i.id1,i.id2)
            O.bodies.erase(bid)
            ParID.remove(bid)
            print(f'Particle {bid} is deleted.')


sp=pack.SpherePack()
sp.makeCloud([0,0,0],[0.5,0.5,0.5],num=10000)
ParID=[]
for c,r in sp:
    ParID.append(O.bodies.append(sphere(c,r)))

O.engines=[
    ForceResetter(),
    InsertionSortCollider([Bo1_Sphere_Aabb()]),
    InteractionLoop(
        [Ig2_Sphere_Sphere_ScGeom()],
        [Ip2_FrictMat_FrictMat_FrictPhys()],
        [Law2_ScGeom_FrictPhys_CundallStrack()]
    ),
    GlobalStiffnessTimeStepper(),
    NewtonIntegrator(),

]


O.run(20)

deletParticle()
O.run()


error:python3.8: /usr/include/boost/smart_ptr/shared_ptr.hpp:734:typename boost::detail::sp_member_access<T>::type boost::shared_ptr<T>::operator->() const [with T = yade::Body; typename boost::detail::sp_member_access<T>::type = yade::Body*]: Assertion px != 0 failed.


-- 
You received this question notification because your team yade-users is
an answer contact for Yade.