← Back to team overview

yade-dev team mailing list archive

Creating clumps using C [error]

 

I managed to create clumps in python successfully, but not in C.   I was referring to yadeWrapper.cpp and modifying the deprecated ClumpTestGen.cpp.  The code in C is this:

shared_ptr<FrictMat> mat(new FrictMat);
shared_ptr<Body> sphere = Shop::sphere(Vector3r(1.0,1.0,1.0),2.0,mat);
body_id_t lastId=(body_id_t)rootBody->bodies->insert(sphere);
shared_ptr<Clump> clump=shared_ptr<Clump>(new Clump());
shared_ptr<Body> clumpAsBody=static_pointer_cast<Body>(clump);
clump->isDynamic=true;
rootBody->bodies->insert(clumpAsBody);
clump->add(lastId);
clump->updateProperties(false);

If I comment out "clump->add(...)."  It will run fine.  Why?

SIGSEGV/SIGABRT handler called; gdb batch file is `/tmp/yade-zJ3B0H/tmp-0'
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 0x7f1e174776f0 (LWP 5304)]
[New Thread 0x7f1df8eaa950 (LWP 5308)]
[New Thread 0x7f1dfb1e5950 (LWP 5307)]
[New Thread 0x7f1dfc4d5950 (LWP 5306)]
[New Thread 0x7f1dfccd6950 (LWP 5305)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
warning: Lowest section in /usr/lib/libicudata.so.38 is .hash at 0000000000000158
0x00007f1e16527742 in select () from /lib/libc.so.6
No symbol "info" in current context.

Thread 5 (Thread 0x7f1dfccd6950 (LWP 5305)):
#0  0x00007f1e16527742 in select () from /lib/libc.so.6
#1  0x00000000004f3783 in ?? ()
#2  0x00000000004a2b03 in PyEval_EvalFrameEx ()
#3  0x00000000004a4649 in PyEval_EvalCodeEx ()
#4  0x00000000005329ad in ?? ()
#5  0x000000000041d3bd in PyObject_Call ()
#6  0x0000000000424f48 in ?? ()
#7  0x000000000041d3bd in PyObject_Call ()
#8  0x000000000049cd46 in PyEval_CallObjectWithKeywords ()
#9  0x00000000004d3b3d in ?? ()
#10 0x00007f1e170663ba in start_thread () from /lib/libpthread.so.0
#11 0x00007f1e1652efcd in clone () from /lib/libc.so.6
#12 0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7f1dfc4d5950 (LWP 5306)):
#0  0x00007f1e16527742 in select () from /lib/libc.so.6
#1  0x00000000004f3783 in ?? ()
#2  0x00000000004a2b03 in PyEval_EvalFrameEx ()
#3  0x00000000004a4649 in PyEval_EvalCodeEx ()
#4  0x00000000005329ad in ?? ()
#5  0x000000000041d3bd in PyObject_Call ()
#6  0x0000000000424f48 in ?? ()
#7  0x000000000041d3bd in PyObject_Call ()
#8  0x000000000049cd46 in PyEval_CallObjectWithKeywords ()
#9  0x00000000004d3b3d in ?? ()
#10 0x00007f1e170663ba in start_thread () from /lib/libpthread.so.0
#11 0x00007f1e1652efcd in clone () from /lib/libc.so.6
#12 0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7f1dfb1e5950 (LWP 5307)):
#0  0x00007f1e16527742 in select () from /lib/libc.so.6
#1  0x00007f1e137f1add in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#2  0x00007f1e13857ec1 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#3  0x00007f1e13857d82 in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#4  0x00007f1e154414de in boost::function0<void, std::allocator<boost::function_base>>::operator() () from /usr/lib/libboost_thread-gcc42-mt-1_34_1.so.1.34.1
#5  0x00007f1e15441162 in ?? () from /usr/lib/libboost_thread-gcc42-mt-1_34_1.so.1.34.1
#6  0x00007f1e170663ba in start_thread () from /lib/libpthread.so.0
#7  0x00007f1e1652efcd in clone () from /lib/libc.so.6
#8  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7f1df8eaa950 (LWP 5308)):
#0  0x00007f1e164f092f in waitpid () from /lib/libc.so.6
#1  0x00007f1e164882d1 in ?? () from /lib/libc.so.6
#2  0x00007f1e1648864c in system () from /lib/libc.so.6
#3  0x00007f1e15afb0c2 in crashHandler (sig=11) at core/main/pyboot.cpp:45
#4  <signal handler called>
#5  Clump::add (this=0x1723860, subId=0) at /usr/include/boost/shared_ptr.hpp:131
#6  0x00007f1e03f6d21e in ClumpTestGen::generate (this=0x171bf00) at /home/chiab/yadeNew/Branch7/pkg/dem/PreProcessor/ClumpTestGen.cpp:285
#7  0x00007f1e11747284 in FileGenerator::generateAndSave (this=0x171bf00) at /home/chiab/yadeNew/Branch7/core/FileGenerator.cpp:50
#8  0x00007f1e1174830e in FileGenerator::singleAction (this=0x171bf00) at /home/chiab/yadeNew/Branch7/core/FileGenerator.cpp:96
#9  0x00007f1e11743f75 in ThreadWorker::callSingleAction (this=0x171bf18) at /home/chiab/yadeNew/Branch7/core/ThreadWorker.cpp:71
#10 0x00007f1e11744571 in ThreadRunner::call (this=0x170b570) at /home/chiab/yadeNew/Branch7/core/ThreadRunner.cpp:53
#11 0x00007f1e154414de in boost::function0<void, std::allocator<boost::function_base>>::operator() () from /usr/lib/libboost_thread-gcc42-mt-1_34_1.so.1.34.1
#12 0x00007f1e15441162 in ?? () from /usr/lib/libboost_thread-gcc42-mt-1_34_1.so.1.34.1
#13 0x00007f1e170663ba in start_thread () from /lib/libpthread.so.0
#14 0x00007f1e1652efcd in clone () from /lib/libc.so.6
#15 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f1e174776f0 (LWP 5304)):
#0  0x00007f1e16527742 in select () from /lib/libc.so.6
#1  0x00007f1df9f79a76 in ?? () from /usr/lib/python2.6/lib-dynload/readline.so
#2  0x0000000000520662 in PyOS_Readline ()
#3  0x0000000000498cc3 in ?? ()
#4  0x00000000004a2b03 in PyEval_EvalFrameEx ()
#5  0x00000000004a4649 in PyEval_EvalCodeEx ()
#6  0x00000000004a2cb0 in PyEval_EvalFrameEx ()
#7  0x00000000004a4649 in PyEval_EvalCodeEx ()
#8  0x00000000004a2cb0 in PyEval_EvalFrameEx ()
#9  0x00000000004a4649 in PyEval_EvalCodeEx ()
#10 0x00000000004a2cb0 in PyEval_EvalFrameEx ()
#11 0x00000000004a4649 in PyEval_EvalCodeEx ()
#12 0x00000000005329ad in ?? ()
#13 0x000000000041d3bd in PyObject_Call ()
#14 0x0000000000424f48 in ?? ()
#15 0x000000000041d3bd in PyObject_Call ()
#16 0x0000000000425be2 in ?? ()
#17 0x000000000041d3bd in PyObject_Call ()
#18 0x00000000004a000f in PyEval_EvalFrameEx ()
#19 0x00000000004a4649 in PyEval_EvalCodeEx ()
#20 0x00000000004a4762 in PyEval_EvalCode ()
#21 0x00000000004c4c3c in PyRun_FileExFlags ()
#22 0x00000000004c4f6b in PyRun_SimpleFileExFlags ()
#23 0x00000000004189ce in Py_Main ()
#24 0x00007f1e164675a6 in __libc_start_main () from /lib/libc.so.6
#25 0x0000000000417ae9 in _start ()
#0  0x00007f1e16527742 in select () from /lib/libc.so.6


I've spent the whole day trying to find the error...

CWBoon
 		 	   		  
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969


Follow ups