FML
FML
MakePythonWrapper
test.py
Go to the documentation of this file.
1
import
MyLibrary
as
mylib
2
import
numpy
as
np
3
4
# Call the first C++ function we defined in Main.cpp
5
mylib.test(123)
6
7
# Example of how to pass more complex data from C++ to Python
8
# We allocate a struct with a double* and an int and provide
9
# in the InterfaceFile.i how to extract this in python
10
data = mylib.getData(10)
11
for
i
in
range(10):
12
print
( data.get_x(i) )
13
14
# Free up memory we allocated in C++ (if you feel like it)
15
mylib.freeData(data)
16
17
# Pass numpy arrays to C++ and use them there
18
x = np.linspace(1,3,3)
19
y = np.linspace(1,5,5)
20
mylib.getNumpyArray(x,y)
21
print
void print()
Definition:
Main.cpp:11
Generated by
1.9.3