Chrismarsh / mesher

A multi-objective triangular meshing algorithm
GNU General Public License v3.0
26 stars 15 forks source link

Package #7

Closed r-barnes closed 4 years ago

r-barnes commented 7 years ago

Have you considered bundling this as a python package? It seems like you're pretty close to having something that would be releasable via pip. I can provide example code to help you move forward with that if you're interested.

Chrismarsh commented 7 years ago

Despite using pip I have no familiarity with packaging something for it. Unsure how that all works. Absolutely interested in a template to gauge the feasibility / usefulness of it.

r-barnes commented 7 years ago

CGAL complicates things as it's a rather heavy dependency. My first question would be whether your CGAL dependency can be replaced by something a little more self-contained. If not, it's probably still possible to make a package work. You can use g++ -H to identify the headers you're using and strip out the unnecessary ones.

I'm actively building this right now using PyBind11. If you take a glance at the top-level files (anything not in lib/), I think you'll get the gist of it.

The steps are:

  1. Put Python code in an __init__.py file, use meaningful function names, make some docstrings.
  2. Put C++ code in a src directory, use PyBind11 to expose C++ to Python.
  3. Modify setup.py to build C++ code.
  4. You're pretty much done.

If you decide to explore this, I'm happy to try to provide some guidance.

Chrismarsh commented 7 years ago

My first question would be whether your CGAL dependency can be replaced by something a little more self-contained.

Not really, or at least not easily.

There are not a lot of good Delaunay triangulation mesh generators that have user-supplied functions to determine if a triangle should be further refined or accepted. It is this feature that I use to insert the multi-objective refinement code. The hydrological model that I'm developing (it will be open sourced soon -- can take this off github if you'd like more details) is unstructured mesh based and sits on-top of the CGAL library to use CGAL's topology features. Thus, in addition to the convenience afforded by CGAL for the mesh generation, use of CGAL was also a natural choice.

I will take a look at your template and see if I can make something work. Thanks for the details!

Chrismarsh commented 4 years ago

pip support has now been added for v1.1 in commit e1edd2c983bff59105b1427605bee9bbd897adae

as detailed here https://mesher-hydro.readthedocs.io/en/latest/installation.html