Building New MeshKit Algorithm to Python
To bind a MeshKit algorithm to Python, you’ll need to add some SWIG code to meshkit/python/algs.i and meshkit/python/algs_factory.i. Specifically:
algs.i (near the bottom)
%factory(MeshKit::MeshOp * MeshKit::MKCore::construct_meshop,
If this doesn’t work, you may need to add bindings for other classes that your algorithm depends on (e.g. MeshKit::CopyMesh requires MeshKit::Transform). If this *still* doesn’t work, you’ll have to consult the SWIG documentation, or ask the MeshKit list for assistance.
Building and Installing MeshKit with Python Bindings
The following steps describe how to get the Python bindings for MeshKit up and running. This will hopefully become simpler in the future as various installation bugs are worked out.
- Install SWIG 1.3 using your preferred method (e.g. Synaptic)
- Build CGM, MOAB, and Lasso with –enable-shared
- Download and untar PyTAPS from < http://pypi.python.org/pypi/PyTAPS>, or get the latest source from < https://svn.mcs.anl.gov/repos/ITAPS/python/trunk>
- Run “python setup.py install”
- Run “python setup.py install_headers”
- For more information about this, consult the documentation on the MOAB wiki.
- Build MeshKit with –enable-shared, –enable-python, and –with-camal
- Make sure the headers from (3b) are in your CPATH, e.g. if your headers were installed to “/usr/include/python/PyTAPS/<file>.h”, your CPATH should contain “/usr/include/python”
- cd into meshkit/python and run “python setup.py install”.
- Note: You may need to run this twice, due to a bug in how SWIG extensions get built.
- Run some examples from meshkit/python/examples to make sure that installation worked