← Back to team overview

yade-dev team mailing list archive

Re: How to use a plugin

 

So I could abuse Omega()::instance().getScene(), without passing any YADE pointers to the subroutine?  All I need to do is #include <yade/core/Omega.hpp>

The previous question:
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?


Yours,

Boon
----------------------------------------
> From: eudoxos@xxxxxxxx
> To: yade-dev@xxxxxxxxxxxxxxxxxxx
> Date: Mon, 5 Apr 2010 15:56:30 +0200
> Subject: Re: [Yade-dev] How to use a plugin
>
>
>> 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.
>
> (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 : yade-dev@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-dev
> More help : https://help.launchpad.net/ListHelp
 		 	   		  
_________________________________________________________________
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969


Follow ups

References