2 # distutils: language = c++
3 # distutils: sources = UnitTests.C
6 DAFoam : Discrete Adjoint with OpenFOAM
10 Cython wrapper functions that call OpenFOAM libraries defined
11 in the *.C and *.H files. The python naming convention is to
12 add "py" before the C++ class name
18 # declare cpp functions
19 cdef extern from "UnitTests.H" namespace "Foam":
22 void runDAUtilityTest1(char *, object)
24 # create python wrappers that call cpp functions
25 cdef class pyUnitTests:
27 # define a class pointer for cpp functions
31 # initialize this class pointer with NULL
35 # deallocate the class pointer, and
36 # make sure we don't have memory leak
37 def __dealloc__(self):
38 if self._thisptr != NULL:
41 # point the class pointer to the cpp class constructor
43 self._thisptr = new UnitTests()
45 # wrap all the other member functions in the cpp class
46 def runDAUtilityTest1(self, argsAll, pyOptions):
47 self._thisptr.runDAUtilityTest1(argsAll, pyOptions)