Wiki

Clone wiki

PyCA / doxy2swig_notes

To generate the doxygen-generated XML required as input to doxy2swig.py, in your Doxyfile set GENERATE_XML = YES. After running doxygen, the directory 'xml' is generated. The doxy2swig.py script can then be run on documented functions -- in our case the Opers namespace contains much of the documentation we want:

python doxy2swig.py xml/namespacePyCA_1_1Opers.xml Opers.i
Which will generate Opers.i. This file should then be #included in math.i (before the *Oper.h files are %include'd) to add the appropriate documentation. Then, from within ipython, we get:
In [1]: import PyCA.Core as core

In [2]: core.UpwindDiff?
Type:       function
Base Class: <type 'function'>
String Form:<function UpwindDiff at 0x2967668>
Namespace:  Interactive
File:       /local/jsam/python/site-packages/PyCA/Core/PyCA_math.py
Definition: core.UpwindDiff(*args)
Docstring:
UpwindDiff(Image3D a_o, Image3D a_i, Image3D a_speed, DimT dim, 
    StreamT s = 0)
UpwindDiff(Image3D a_o, Image3D a_i, Image3D a_speed, DimT dim)

void
PyCA::Opers::UpwindDiff(Image3D &a_o, const Image3D &a_i, const
Image3D &a_speed, DimT dim, StreamT s=NULL)

returns deriv(h_i), where deriv is upwind derivative based on a_speed
in dimension 'dim' 
where at the end we see the doxygen documentation. However, unfortunately when overloaded methods are encountered (e.g. Mul), only the doxygen documentation from the last instance of Mul that is encountered is included. Ideally, the doxygen docstrings would be appended -- perhaps this is something that could be hacked together.

Updated