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 http://openturns.github.io/user_manual/_generated/openturns.OpenTURNSPythonFunction.html?highlight=openturnspython#openturns.OpenTURNSPythonFunction Unfortunately, the documentation is quite poor, so you should have a look at the associated Python unit test https://github.com/openturns/openturns/blob/master/python/test/t_NumericalMathFunction_python.py 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 http://trac.openturns.org/browser/tags/openturns-1.1/wrappers/WrapperTemplates/wrapper_linked_with_C_function 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 http://trac.openturns.org/browser/tags/openturns-1.1/lib/src/Base/Func/wrapper-v2.dtd Then you have to set the environment variable OPENTURNS_WRAPPER_PATH Good luck! Régis >________________________________ > 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 >http://doc.openturns.org/openturns-1.1/openturns-doc-february-2013/html/WrapperGuide/cid1.xhtml > > > > >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; } > > >Thanks, >Doug > > > > > >-- > >Douglas Long >douglaslon...@gmail.com >_______________________________________________ >OpenTURNS users mailing list >users@openturns.org >http://openturns.org/mailman/listinfo/users > > > _______________________________________________ OpenTURNS users mailing list users@openturns.org http://openturns.org/mailman/listinfo/users