Peano
Wrapper.py
Go to the documentation of this file.
1 import ctypes
2 from ctypes import Structure, c_double
3 from pathlib import Path
4 import sys
5 
6 
7 try:
8  _script_dir = Path(__file__).parent
9 except NameError:
10  _script_dir = Path(sys.argv[0]).parent if len(sys.argv) > 0 else Path.cwd()
11 
12 
13 _lib_path = _script_dir / "build" / "libmylib.so"
14 _lib = ctypes.CDLL(str(_lib_path))
15 
16 
17 class Pair(Structure):
18  _fields_ = [
19  ("first", c_double),
20  ("second", c_double),
21  ]
22 
23 
24 _lib.ellipsoidTransform.argtypes = (c_double, c_double)
25 _lib.ellipsoidTransform.restype = Pair
26 _lib.ellipsoidTransformInverse.argtypes = (c_double, c_double)
27 _lib.ellipsoidTransformInverse.restype = Pair
28 
29 _lib.sphereTransform.argtypes = (c_double, c_double)
30 _lib.sphereTransform.restype = Pair
31 _lib.sphereTransformInverse.argtypes = (c_double, c_double)
32 _lib.sphereTransformInverse.restype = Pair
33 
34 ellipsoidTransform = _lib.ellipsoidTransform
35 ellipsoidTransformInverse = _lib.ellipsoidTransformInverse
36 
37 sphereTransform = _lib.sphereTransform
38 sphereTransformInverse = _lib.sphereTransformInverse
str
Definition: ccz4.py:55