Automatic regeneration of SWIG interface
========================================

The SWIG interface of DOLFIN is partly generated automatically. If it
has not been generated it will be generate automatically by the build
system. Whenever you add a file see, below you need to re-generate the
swig interface manually, by running:

  make generate_swig_interface

from the build directory.

Extending the swig interface with new classes or functions
==========================================================

SWIG parses header files to generate the Python interface. To add new
classes or function, the header file that declares the functionality,
needs to be exposed to SWIG. This is done by adding the file as an
#include to the corresponding

  dolfin/{la,function,aso}/dolfin_{la,function,aso}.h

file. Then you need to regenerate the SWIG interface by running
generate-swig-interface.

CMake might have trouble figuring out that something has been added,
so to force a recompilation of the SWIG interface you can remove the
generated files in the build directory.

  rm -rf build/dolfin/swig/modules


Modularized interface
=====================

Submodules
----------

The SWIG interface is divided into several submodules, each corresponding
to the directory structure of DOLFIN. SWIG specialization files resides
in a subdirectory with the same name as the submodule. Most common are
pre.i and post.i files, which are include before and after the header
files of the corresponding module.

  * When ever a dolfin/foo subdirectory is added to DOLFIN a
    corresponding dolfin/swig/foo subdirectory need to be added

Combined modules
----------------

A combined module consist of the interface of one or several modules,
mention above. What modules are included in a combined modules is defined
by the comments in the main dolfin.h file. 

  * If a combined module is added/removed, the corresponding
    subdirectory needs to be added/removed too.

  * If a combined module is added a CMakeList.txt need to be added to
    that directory. These are all module independent so just copy one
    from another directory.
