error shared_ptr.hpp:734: typename boost

Asked by Mahdeyeh

Hello dear

I use yadedaily:
Yade 20210909-5909~5b11526~focal1
Using python version: 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0]

Ubuntu 20.04

when I define a function ("extrction()") in the 'live' Yade console, this error show:

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.
Aborted (core dumped)

I write this function: "extrction()" in the 'live' Yade console.

And the function is:

def extrction(): # run when a bucket has wanted to remove
        clrOre=[0.1,0.5,0.2]
        clrWaste=[0.8,0.9,0.9]
        M_o1=0 # total ore of model befor deleting volume of bucket
        M_w1=0 # total waste of model befor deleting volume of bucket
        for b in O.bodies:
            if b.shape.color==clrOre:
                M_o1 +=b.state.mass
            if b.shape.color==clrWaste:
                M_w1 +=b.state.mass

            if b.state.pos[0]>(-11.5) and b.state.pos[0]<1.58 and b.state.pos[1]>0 and b.state.pos[1]<3.8:
                if O.bodies[b.id].isClump or O.bodies[b.id].isClumpMember:
                    iter1=O.iter
                    ids=open("iter removedids.txt","a")
                    ids.write(repr(iter1)+' '+repr(b.id)+' '"\n")
                    ids.close()
                O.bodies.erase(b.id,True)
        M_o2=0 # total ore of model after deleting volume of bucket
        M_w2=0 # total waste of model after deleting volume of bucket
        for b in O.bodies:
            if b.shape.color==clrOre:
                M_o2 +=b.state.mass
            if b.shape.color==clrWaste:
                M_w2 +=b.state.mass

        m_o = M_o1 - M_o2
        m_w = M_w1 - M_w2
   # print M_o1 , M_o2 , m_o , m_w
        iter1=O.iter
        Mass=open("Mass iter massore masswaste.txt","a")
        Mass.write(repr(iter1)+' '+repr(m_o)+' '+repr(m_w)+' '"\n")
        Mass.close()

 My script has 2 files as input data .The below link shows my scrip and clump data files:
https://www.filemail.com/d/xrqjjzwakjinvib

Please help me about this error.
Best regards,

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
Mahdeyeh
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hello,

> when I define a function ("extrction()") in the 'live' Yade console, this error show:

what if you define in a script?

> Aborted (core dumped)

what is the output of
catchsegv yade script.py
?
yade script.py is the dommand you use to run the script (could be e.g. yadedaily simulation.py)
Not sure if it works for "live console".

> The below link shows my scrip and clump data files

it would be nice, if you prepared a MWE [1], M=minimum (minimum running time, minimum code size, minimum input file size, ...) and if you followed the section [1],"Please, no external links!".
Here for example, my browser do not allow me to download the zip file with a message that it is dangerous...

> O.bodies[b.id]

why not using just b?

> O.bodies.erase(b.id,True)

this is probably the source of the problem. Some yade code does not work for erased bodies.
The relevant place would be revealed by catchsegv.

Cheers
Jan

[1] https://www.yade-dem.org/wiki/Howtoask

Revision history for this message
Mahdeyeh (mahdiye.sky) said :
#2

Thank you Jan
I run script with this : "yadedaily -j6 test.py"

sometimes when script is running, I need to "Extrction()" function, so I write it in yade live console .

Problem solved : with stopping run and then write "Extrction()"in yade live console and after it continue run