Hi Douglas,

First of all, thanks for using OpenTURNS.

It looks like you are using a quite old version of OpenTURNS (1.1 if I refer to 
the documentation you mention), many things have change since then. The most 
important one concerning your demand is that we don't support compiled 
functions anymore, so if you intend to use your code with a recent version of 
OpenTURNS (>=1.7) it will not work, so you should consider the use of the 
Python interface, see

Unfortunately, the documentation is quite poor, so you should have a look at 
the associated Python unit test

and see how to couple a pure C function with Python. If your function has a 
significant computational cost, the best method is probably to build an 
executable from your function and interact with it using eg. the command line 
or data files, then to use a system call from Python to use it.

If you must use the old wrapping capabilities, see
It presents a simple template based on the autotools, but you can use any 
building system you want. You have to produce a dynamic library and an XML file 
that conforms to the OpenTURNS wrapper DTD

Then you have to set the environment variable 

Good luck!


> De : Douglas Long <douglaslon...@gmail.com>
>À : users@openturns.org 
>Envoyé le : Vendredi 14 octobre 2016 20h19
>Objet : [ot-users] Benchmark of Library Wrapper - running C Function
>Hi folks,
>I am trying to run a C function for a ot.NumericalMathFunction,
>I am referring to the example here
>I have placed a sample script below. Anyone know how to run the C function 
>using Openturns?
>import openturns as ot
>simcount = int(1e6)
>big_sample = ot.Normal(2).getSample(simcount)
>model = ot.NumericalMathFunction( 'wcode' )
>out_sample = model(big_sample)
>#include <math.h>
int myCFunction( const double * X, unsigned long N,  double * Y, unsigned long 
P )
  Y[0] = cos(pow(X[0]+1, 2)) - sin(X[1]);
  return 0;
>Douglas Long
>OpenTURNS users mailing list
OpenTURNS users mailing list

Reply via email to