SIGMA

Scalable Interfaces for Geometry and Mesh based Applications

MeshKit Python

Posted by in Meshkit

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)

%include "meshkit/MyNewAlgorithm.hpp"

algs_factory.i
#include "meshkit/MyNewAlgorithm.hpp"

%factory(MeshKit::MeshOp * MeshKit::MKCore::construct_meshop,

MeshKit::MyNewAlgorithm);
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.

  1. Install SWIG 1.3 using your preferred method (e.g. Synaptic)
  2. Build CGM, MOAB, and Lasso with –enable-shared
  3. 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>
    1. Run “python setup.py install”
    2. Run “python setup.py install_headers”
    3. For more information about this, consult the  documentation on the MOAB wiki.
  4. Build MeshKit with –enable-shared, –enable-python, and –with-camal
  5. 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”
  6. cd into meshkit/python and run “python setup.py install”.
    1. Note: You may need to run this twice, due to a bug in how SWIG extensions get built.
  7. Run some examples from meshkit/python/examples to make sure that installation worked

Copyright © 2014--2023 SIGMA. All Rights Reserved.