3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-23 12:55:17 +01:00

Merge branch 'unstable' into dev_autodoc

This commit is contained in:
Olivier Parcollet 2019-04-23 16:48:49 -04:00 committed by GitHub
commit e375861950
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 57 additions and 12 deletions

View File

@ -18,7 +18,7 @@ namespace app4triqs {
/** /**
* Construct from integer * Construct from integer
* *
* @param i_ a scalar * @param i_ a scalar :math:`G(\tau)`
*/ */
explicit toto(int i_) : i(i_) {} explicit toto(int i_) : i(i_) {}
@ -35,6 +35,13 @@ namespace app4triqs {
/// Simple accessor /// Simple accessor
int get_i() const { return i; } int get_i() const { return i; }
/**
* A simple function with :math:`G(\tau)`
*
* @param u Nothing useful
*/
int f(int u) { return u;}
/// Arithmetic operations /// Arithmetic operations
toto operator+(toto const &b) const; toto operator+(toto const &b) const;
toto &operator+=(toto const &b); toto &operator+=(toto const &b);
@ -57,8 +64,8 @@ namespace app4triqs {
* *
* Chain the decimal digits of two integers i and j, and return the result * Chain the decimal digits of two integers i and j, and return the result
* *
* @param :math:`i` The first integer * @param i The first integer
* @param :math:`j` The second integer * @param j The second integer
* @return An integer containing the digits of both i and j * @return An integer containing the digits of both i and j
* *
* @remark * @remark

View File

@ -13,8 +13,8 @@ extensions = ['sphinx.ext.autodoc',
'sphinx.ext.todo', 'sphinx.ext.todo',
'sphinx.ext.viewcode', 'sphinx.ext.viewcode',
'sphinx.ext.autosummary', 'sphinx.ext.autosummary',
'plot_directive',
'numpydoc', 'numpydoc',
'plot_directive',
'autorun'] 'autorun']
source_suffix = '.rst' source_suffix = '.rst'

View File

@ -6,6 +6,12 @@ Documentation
Contents Contents
-------- --------
.. math::
(a + b)^2 &= (a + b)(a + b) \\
&= a^2 + 2ab + b^2
.. toctree:: .. toctree::
:maxdepth: 5 :maxdepth: 5
@ -27,6 +33,9 @@ C++ reference manual
Python reference manual Python reference manual
----------------------- -----------------------
.. automodule:: app4triqs
:members:
.. autoclass:: app4triqs.toto_module.toto .. autoclass:: app4triqs.toto_module.toto
:members: :members:

View File

@ -1,11 +1,12 @@
# Generated automatically using the command : # Generated automatically using the command :
# c++2py ../../c++/app4triqs/toto.hpp -p --members_read_only -N app4triqs -a app4triqs -m toto_module -o toto_module -C pytriqs --cxxflags="-std=c++17" # c++2py ../../c++/app4triqs/toto.hpp -p --members_read_only -N app4triqs -a app4triqs -m toto_module -o toto_module -C pytriqs --cxxflags="-std=c++17 "
from cpp2py.wrap_generator import * from cpp2py.wrap_generator import *
# The module # The module
module = module_(full_name = "toto_module", doc = "", app_name = "app4triqs") module = module_(full_name = "toto_module", doc = "", app_name = "app4triqs")
# Imports # Imports
module.add_imports(*[])
# Add here all includes # Add here all includes
module.add_include("app4triqs/toto.hpp") module.add_include("app4triqs/toto.hpp")
@ -23,20 +24,33 @@ using namespace app4triqs;
c = class_( c = class_(
py_type = "Toto", # name of the python class py_type = "Toto", # name of the python class
c_type = "app4triqs::toto", # name of the C++ class c_type = "app4triqs::toto", # name of the C++ class
doc = """A very useful and important class\n\n @note A Useful note""", # doc of the C++ class doc = r"""A very useful and important class""", # doc of the C++ class
hdf5 = True, hdf5 = True,
arithmetic = ("add_only"), arithmetic = ("add_only"),
comparisons = "==", comparisons = "==",
serializable = "tuple", serializable = "tuple"
) )
c.add_constructor("""()""", doc = """""") c.add_constructor("""()""", doc = r"""""")
c.add_constructor("""(int i_)""", doc = """Construct from integer\n\n :param i_: a scalar""") c.add_constructor("""(int i_)""", doc = r"""Construct from integer
Parameters
----------
i_
a scalar :math:`G(\tau)`""")
c.add_method("""int f (int u)""",
doc = r"""A simple function with :math:`G(\tau)`
Parameters
----------
u
Nothing useful""")
c.add_method("""std::string hdf5_scheme ()""", c.add_method("""std::string hdf5_scheme ()""",
is_static = True, is_static = True,
doc = """HDF5""") doc = r"""HDF5""")
c.add_property(name = "i", c.add_property(name = "i",
getter = cfunction("int get_i ()"), getter = cfunction("int get_i ()"),
@ -44,7 +58,22 @@ c.add_property(name = "i",
module.add_class(c) module.add_class(c)
module.add_function ("int app4triqs::chain (int i, int j)", doc = """Chain digits of two integers\n\n Chain the decimal digits of two integers i and j, and return a new \n\n @param :math:`i` The first integer\n @param :math:`j` The second integer \n @return An integer containing the digits of both i and j\n\n @remark""") module.add_function ("int app4triqs::chain (int i, int j)", doc = r"""Chain digits of two integers
Chain the decimal digits of two integers i and j, and return the result
Parameters
----------
i
The first integer
j
The second integer
Returns
-------
out
An integer containing the digits of both i and j""")