FML
test.py
Go to the documentation of this file.
1import MyLibrary as mylib
2import numpy as np
3
4# Call the first C++ function we defined in Main.cpp
5mylib.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
10data = mylib.getData(10)
11for i in range(10):
12 print( data.get_x(i) )
13
14# Free up memory we allocated in C++ (if you feel like it)
15mylib.freeData(data)
16
17# Pass numpy arrays to C++ and use them there
18x = np.linspace(1,3,3)
19y = np.linspace(1,5,5)
20mylib.getNumpyArray(x,y)
21
void print()
Definition: Main.cpp:11