Closed krober10nd closed 4 years ago
Hi Keith,
Looks like the numpy unsigned 64 int and the cpp unsigned long long can't talk to each other - I don't know why. I've abandoned the idea to interface cgal and python with cython, and we are now using pybind11 for that, see for example here - it 'just' calls the point creation algorithm, but the code is much closer to CGAL examples, and it's easier to setup (less boiler plate) than Cython
If you can look into the __init__.py
file above , you'll see how it is imported like a regular module, provided you build the extension, which is managed in setup.py.
This software represents practically the only package for parallel delaunay triangulation in python!
Yeah I know, I searched too :-/ If you're interested, we could setup an independant package based on pybind11 - just Delaunay triangulation for now, but setting up a clear (modern) workflow to interface CGAL to Python is surely something interesting.
tell me what you think
Best
Guillaume
Hey Guillaume,
Yes, I prefer using pybind11 over cython these days. I was browsing the cgal4py code and noticed it would have taken forever to learn. The amount of boilerplate code is tremendous.
I recently took up a project building 2 and 3D tria. meshes for seismological studies and it requires some pretty large meshes, which is what brought me here. I would definitely be interested in setting up a clear workflow interface to CGAL (to just Dela.).
I guess we could start by following the script you linked to? In general, just simply calling dela. and getting back an element connectivity table would be extremely helpful. In fact MATLAB does this already but we can't see their code.
Also, there's another python package cgal-swig-bindings, but they don't have any way to simply return the element face table and it's also filled with a bunch of extremely complex functionality.
Thanks for the quick response! Let me see what I can do today. I can start a repo and invite you.
Hey Keith,
Cool! Sure go ahead and create a repo! I agree with you that simply passing points as a numpy ndarray and getting connectivity back is already super usefull. Maybe we can copy the structure of scipy's Delaunay class? https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.Delaunay.html#scipy.spatial.Delaunay
I'm aware of the the SWIG bindings, but SWIG is a nightmare to use... I am not sure it is maintained very effectively either...
Sweet, yes, I got the same impression from the CGAL-swig bindings. I followed along your example with using pybind11 and cmake...just the roots here. I will work on it today. I'll give you push permission.
Great, I'll update the README here to point to this project!
I'll check on the code - tell me if you need anything
I finished up for today. Added support for 2d and 3d meshing from python using CGAL. Give it points, returns connectivity table.
Needs some cleaning but it works.
Hey,
I tried getting in contact with Megan, but to not avail. This software represents practically the only package for parallel delaunay triangulation in python!
When building by source on Mac with -std=gnu++14 using gcc, I receive the following error. I suspect it's related to the length of unint64_t and long long on my Mac OSX but it's odd. On my ubuntu machine, it compiles fine.
any idea how to fix it? Thanks
building 'cgal4py.delaunay.delaunay2' extension gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Applications/miniconda3/include -arch x86_64 -I/Applications/miniconda3/include -arch x86_64 -DNPY_NO_DEPRECATED_API -DCGAL_EIGEN3_ENABLED=1 -Icgal4py/delaunay -I./cgal4py/delaunay -I/Applications/miniconda3/lib/python3.7/site-packages/numpy/core/include -I/usr/local/Cellar/eigen/3.3.7/include/eigen3 -I/usr/local/Cellar/boost/1.72.0 -I/Applications/miniconda3/include/python3.7m -c cgal4py/delaunay/delaunay2.cpp -o build/temp.macosx-10.9-x86_64-3.7/cgal4py/delaunay/delaunay2.o -std=gnu++14 cgal4py/delaunay/delaunay2.cpp:22501:44: error: no matching member function for call to 'serialize_info2idx' pyx_v_idx_inf = pyx_v_self->T->serialize_info2idx( pyx_v_n, pyx_v_m, pyx_v_d, (&(*__Pyx_BufPtrStrided2d(pyx_t_5numpy_uint...