← Back to team overview

yade-dev team mailing list archive

Re: How to use a plugin

 

> 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?

Yes, you will have access to all functions.

It is up to you to figure out how to find the interaction object when
that function is called, since getScene() only gives you the whole
scene. You could in principle set some static variables before passing
the pointer to the optimization library, but that would break badly if
you did it in parallel section (Ig2 functors are executed in parallel).
[you could in principle have static array of pointers and set
omp_get_thread_num()'th item each time, that would guarantee that eeach
thread uses pointers that are its own]

v





Follow ups

References