← Back to team overview

yade-dev team mailing list archive

Re: better python wrapping

 

One more question. I have tried to modify Recorder.hpp and its derived
CohesiveStateRPMRecorder.
It seems, I have done everything right, it compiles, but when I start YADe,
I get:

_______________________________________________________________________________________
<http://www.gnu.org/software/gdb/bugs/>.
[Thread debugging using libthread_db enabled]
0x00007f453fe69b0e in __libc_waitpid (pid=<value optimized out>,
    stat_loc=0x7ffff8983d8c, options=<value optimized out>)
    at ../sysdeps/unix/sysv/linux/waitpid.c:32
32    ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
    in ../sysdeps/unix/sysv/linux/waitpid.c
No symbol "info" in current context.

Thread 1 (Thread 0x7f4540de56f0 (LWP 32627)):
#0  0x00007f453fe69b0e in __libc_waitpid (pid=<value optimized out>,
stat_loc=0x7ffff8983d8c, options=<value optimized out>) at
../sysdeps/unix/sysv/linux/waitpid.c:32
#1  0x00007f453fe071f9 in do_system (line=<value optimized out>) at
../sysdeps/posix/system.c:149
#2  0x00007f453f4515d8 in crashHandler (sig=11) at core/main/pyboot.cpp:43
#3  <signal handler called>
#4  0x0000000000000038 in ?? ()
#5  0x00007f453b4c1b15 in
log4cxx::helpers::ObjectPtrT<log4cxx::Logger>::~ObjectPtrT() () from
/usr/lib/liblog4cxx.so.10
#6  0x00007f453b4f2859 in std::_Rb_tree<std::string, std::pair<std::string
const, log4cxx::helpers::ObjectPtrT<log4cxx::Logger> >,
std::_Select1st<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >, std::less<std::string>,
std::allocator<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >
>::_M_erase(std::_Rb_tree_node<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >*) () from
/usr/lib/liblog4cxx.so.10
#7  0x00007f453b4f284c in std::_Rb_tree<std::string, std::pair<std::string
const, log4cxx::helpers::ObjectPtrT<log4cxx::Logger> >,
std::_Select1st<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >, std::less<std::string>,
std::allocator<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >
>::_M_erase(std::_Rb_tree_node<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >*) () from
/usr/lib/liblog4cxx.so.10
#8  0x00007f453b4f284c in std::_Rb_tree<std::string, std::pair<std::string
const, log4cxx::helpers::ObjectPtrT<log4cxx::Logger> >,
std::_Select1st<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >, std::less<std::string>,
std::allocator<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >
>::_M_erase(std::_Rb_tree_node<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >*) () from
/usr/lib/liblog4cxx.so.10
#9  0x00007f453b4f284c in std::_Rb_tree<std::string, std::pair<std::string
const, log4cxx::helpers::ObjectPtrT<log4cxx::Logger> >,
std::_Select1st<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >, std::less<std::string>,
std::allocator<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >
>::_M_erase(std::_Rb_tree_node<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >*) () from
/usr/lib/liblog4cxx.so.10
#10 0x00007f453b4f284c in std::_Rb_tree<std::string, std::pair<std::string
const, log4cxx::helpers::ObjectPtrT<log4cxx::Logger> >,
std::_Select1st<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >, std::less<std::string>,
std::allocator<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >
>::_M_erase(std::_Rb_tree_node<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >*) () from
/usr/lib/liblog4cxx.so.10
#11 0x00007f453b4f284c in std::_Rb_tree<std::string, std::pair<std::string
const, log4cxx::helpers::ObjectPtrT<log4cxx::Logger> >,
std::_Select1st<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >, std::less<std::string>,
std::allocator<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >
>::_M_erase(std::_Rb_tree_node<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >*) () from
/usr/lib/liblog4cxx.so.10
#12 0x00007f453b4f284c in std::_Rb_tree<std::string, std::pair<std::string
const, log4cxx::helpers::ObjectPtrT<log4cxx::Logger> >,
std::_Select1st<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >, std::less<std::string>,
std::allocator<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >
>::_M_erase(std::_Rb_tree_node<std::pair<std::string const,
log4cxx::helpers::ObjectPtrT<log4cxx::Logger> > >*) () from
/usr/lib/liblog4cxx.so.10
#13 0x00007f453b4f0e3a in log4cxx::Hierarchy::~Hierarchy() () from
/usr/lib/liblog4cxx.so.10
#14 0x00007f453b5095e6 in
log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector() ()
from /usr/lib/liblog4cxx.so.10
#15 0x00007f453b5094ec in
log4cxx::helpers::ObjectPtrT<log4cxx::spi::RepositorySelector>::~ObjectPtrT()
() from /usr/lib/liblog4cxx.so.10
#16 0x00007f453fdfec12 in __run_exit_handlers (status=1) at exit.c:78
#17 *__GI_exit (status=1) at exit.c:100
#18 0x00007f453fde4ac4 in __libc_start_main (main=<value optimized out>,
argc=<value optimized out>, ubp_av=<value optimized out>, init=<value
optimized out>, fini=<value optimized out>, rtld_fini=<value optimized out>,
stack_end=0x7ffff89844d8) at libc-start.c:252
#19 0x0000000000417ca9 in _start () at ../sysdeps/x86_64/elf/start.S:113
Segmentation fault
_______________________________________________________________________________________

What can it be? The problem is definitely in CohesiveStateRPMRecorder

I do not want to commit changed CohesiveStateRPMRecorder, because I will
brake a trunk. The diff is here:

_______________________________________________________________________________________


bzr diff
=== modified file 'pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.cpp'
--- pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.cpp    2009-12-04
23:07:34 +0000
+++ pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.cpp    2010-01-28
14:23:17 +0000
@@ -3,11 +3,6 @@
 YADE_PLUGIN((CohesiveStateRPMRecorder));
 CREATE_LOGGER(CohesiveStateRPMRecorder);

-CohesiveStateRPMRecorder::CohesiveStateRPMRecorder():Recorder(){
-    initRun=true;                                        //We want to save
the data in the beginning
-    numberCohesiveContacts=0;
-}
-
 CohesiveStateRPMRecorder::~CohesiveStateRPMRecorder() {
 }


=== modified file 'pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.hpp'
--- pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.hpp    2009-12-04
23:07:34 +0000
+++ pkg/dem/Engine/GlobalEngine/CohesiveStateRPMRecorder.hpp    2010-01-28
14:23:31 +0000
@@ -9,8 +9,6 @@

 class CohesiveStateRPMRecorder: public Recorder {
     public:
-        int numberCohesiveContacts;
-        CohesiveStateRPMRecorder();
         ~CohesiveStateRPMRecorder();
         void init(Scene*);
         virtual void action(Scene*);
@@ -18,9 +16,12 @@
     private:
         std::ofstream outFile;

-    REGISTER_ATTRIBUTES(Recorder,(numberCohesiveContacts));
-    REGISTER_CLASS_AND_BASE(CohesiveStateRPMRecorder,Recorder);
+
     DECLARE_LOGGER;
+
YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(CohesiveStateRPMRecorder,Recorder,"CohesiveStateRPMRecorder
outputs into the file the total number of interactions, which have a flag
`cohesive`",
+        ((int,numberCohesiveContacts,0,"The current number of cohesive
interactions")),
+        initRun=true;                                    //We want to save
the data in the beginning
+        ,);
 };
 REGISTER_SERIALIZABLE(CohesiveStateRPMRecorder);


_______________________________________________________________________________________

What do you see wrong here? Thank you.

______________________________

Anton Gladkyy


2010/1/27 Václav Šmilauer <eudoxos@xxxxxxxx>

> Anton Gladky napsal(a):
>
>  I have a small problem with that.
>>
>> I want to add this macros to my Law2_Dem3DofGeom_RockPMPhys_Rpm
>> But I do not have there no variables, which can be described.
>>
>> What syntax should be?
>>
>> This one is not working,
>>
>> YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(Law2_Dem3DofGeom_RockPMPhys_Rpm,LawFunctor,"Constitutive
>> law for the Rpm model",
>>        (),
>>        /*ctor*/,/*py*/);
>>
>
> Should work if you don't put anything between the commas, like
>
> YADE_CLASS_BASE_DOC_ATTRDECL_CTOR_PY(Law2_Dem3DofGeom_RockPMPhys_Rpm,LawFunctor,"Constitutive
> law for the Rpm model",,,);
>
> (BTW you don't need the _PY part, that just adds the last argument, so you
> can then write
>
> YADE_CLASS_BASE_DOC_ATTRDECL_CTOR(Law2_Dem3DofGeom_RockPMPhys_Rpm,LawFunctor,"Constitutive
> law for the Rpm model",,);
>
> )
>
> Cheers, v.
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-dev<https://launchpad.net/%7Eyade-dev>
> Post to     : yade-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-dev<https://launchpad.net/%7Eyade-dev>
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References