yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #20652
[Question #683856]: Segmentation fault (core dumped) after erase some bodies
New question #683856 on Yade:
https://answers.launchpad.net/yade/+question/683856
Hi,
I'd like to delete particles which has connection to other particles, I read some answers and follows the suggestion in [1].
The outcome is unstable, when I use "example one" to generate particles, Segmentation fault (core dumped) occurs. While when I comment "example one" and use "example two" to generate particles, it works well. Here is the MWE:
from yade import pack, plot
########## example one which leads to Segmentation fault#####
for i in range(10):
O.bodies.append(sphere((0, 0, i), radius=1, color=[1, 1, 1]))
O.bodies.append(sphere((5,5,5),radius=1,color=[1,1,1]))
######## example two which works well #####
# O.bodies.append(sphere((0,0,0),radius=1,color=[1,1,1]))
# O.bodies.append(sphere((0,1,0),radius=1,color=[1,1,1]))
# O.bodies.append(sphere((0,2,0),radius=1,color=[1,1,1]))
# O.bodies.append(sphere((3,0,0),radius=1,color=[1,1,1]))
# O.bodies.append(sphere((3,1,1),radius=1,color=[1,1,1]))
# O.bodies.append(sphere((5,5,5),radius=1,color=[1,1,1]))
O.engines=[
ForceResetter(),
InsertionSortCollider([Bo1_Sphere_Aabb()]),
InteractionLoop(
[Ig2_Sphere_Sphere_ScGeom()],
[Ip2_FrictMat_FrictMat_FrictPhys()],
[Law2_ScGeom_FrictPhys_CundallStrack()]
),
NewtonIntegrator(damping=0.4),
]
Ids=[]
for i in O.bodies:
Ids.append(i.id)
O.step()
BodiesToBeDel=[]
def findBodiesToBeDel():
for i in Ids:
for j in Ids:
if i>=j:
continue
else:
if O.interactions.has(i,j):
BodiesToBeDel.append(O.bodies[i])
BodiesToBeDel.append(O.bodies[j])
findBodiesToBeDel()
def eraseOverlapBodies():
for i in BodiesToBeDel:
O.bodies.erase(i.id)
eraseOverlapBodies()
My yade version is 2018.02b on Ubuntu 18.04.
Do you know what is the problem?
many thanks
Leonard
[1]https://answers.launchpad.net/yade/+question/211937
--
You received this question notification because your team yade-users is
an answer contact for Yade.