> Thanks, so much. Does doing this, mean that my file CWBoonPlugin.cpp will > have assess to both YADE functions like interaction->id1 and state->pos, as > well as the external C library? In other words, behave like any other > Ig2Functor? > > Another question is this: > The subroutine for the library is Minimize(a,b,C). C is again another > subroutine C(x,y,z), which returns the value of the function and its > derivatives. I cannot pass YADE pointers to it, because I cannot define C as > C(x,y,z, yade pointer). I managed to do it in python by using "from yade > import *". This way, I can assess O.bodies.state.pos any place I like within > the subroutine, without giving it as the input argument. But the python one > is running too slow. How do I do that in C/C++. The equivalent of "from > yade import *"? I assume C is pointer to function, right? You can pass pointer to your own function (careful... it must be static function, since member functions have different prototype (they receive "this" pointer as hidden first argument)). What's the problem? Do you need the C function to get more data than just x,y,z?
In that function (even if it is static), you can use Omega()::instance().getScene() to get shared_ptr<Scene>. (Most libs that take function pointers to custom functions let you pass (void*) pointer to that function, though) v _______________________________________________ Mailing list: https://launchpad.net/~yade-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp

