2018-03-22 18:11:39 +01:00
|
|
|
# Generated automatically using the command :
|
2019-09-24 20:50:54 +02:00
|
|
|
# c++2py ../../c++/app4triqs/app4triqs.hpp -p --members_read_only -N app4triqs -a app4triqs -m app4triqs_module -o app4triqs_module --moduledoc="The app4triqs python module" -C pytriqs --cxxflags="-std=c++17" --target_file_only
|
2018-03-22 18:11:39 +01:00
|
|
|
from cpp2py.wrap_generator import *
|
|
|
|
|
|
|
|
# The module
|
2019-10-09 22:23:25 +02:00
|
|
|
module = module_(full_name = "app4triqs_module", doc = r"The app4triqs python module", app_name = "app4triqs")
|
2018-03-22 18:11:39 +01:00
|
|
|
|
|
|
|
# Imports
|
|
|
|
|
|
|
|
# Add here all includes
|
2019-09-04 23:34:00 +02:00
|
|
|
module.add_include("app4triqs/app4triqs.hpp")
|
2018-03-22 18:11:39 +01:00
|
|
|
|
|
|
|
# Add here anything to add in the C++ code at the start, e.g. namespace using
|
|
|
|
module.add_preamble("""
|
|
|
|
#include <cpp2py/converters/string.hpp>
|
|
|
|
|
|
|
|
using namespace app4triqs;
|
|
|
|
""")
|
|
|
|
|
|
|
|
|
|
|
|
# The class toto
|
|
|
|
c = class_(
|
|
|
|
py_type = "Toto", # name of the python class
|
|
|
|
c_type = "app4triqs::toto", # name of the C++ class
|
2019-04-23 19:33:57 +02:00
|
|
|
doc = r"""A very useful and important class""", # doc of the C++ class
|
2018-03-22 18:11:39 +01:00
|
|
|
hdf5 = True,
|
2019-04-23 18:58:11 +02:00
|
|
|
arithmetic = ("add_only"),
|
|
|
|
comparisons = "==",
|
|
|
|
serializable = "tuple"
|
2018-03-22 18:11:39 +01:00
|
|
|
)
|
|
|
|
|
2019-04-23 19:33:57 +02:00
|
|
|
c.add_constructor("""()""", doc = r"""""")
|
2018-03-22 18:11:39 +01:00
|
|
|
|
2019-04-23 19:33:57 +02:00
|
|
|
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""")
|
2018-03-22 18:11:39 +01:00
|
|
|
|
2020-04-03 22:20:03 +02:00
|
|
|
c.add_method("""std::string hdf5_format ()""",
|
2018-03-22 18:11:39 +01:00
|
|
|
is_static = True,
|
2019-04-23 19:33:57 +02:00
|
|
|
doc = r"""HDF5""")
|
2018-03-22 18:11:39 +01:00
|
|
|
|
|
|
|
c.add_property(name = "i",
|
|
|
|
getter = cfunction("int get_i ()"),
|
2019-09-04 23:34:00 +02:00
|
|
|
doc = r"""Simple accessor""")
|
2018-03-22 18:11:39 +01:00
|
|
|
|
|
|
|
module.add_class(c)
|
|
|
|
|
2019-04-23 19:33:57 +02:00
|
|
|
module.add_function ("int app4triqs::chain (int i, int j)", doc = r"""Chain digits of two integers
|
|
|
|
|
|
|
|
Parameters
|
|
|
|
----------
|
|
|
|
i
|
|
|
|
The first integer
|
|
|
|
|
|
|
|
j
|
|
|
|
The second integer
|
|
|
|
|
|
|
|
Returns
|
|
|
|
-------
|
|
|
|
out
|
|
|
|
An integer containing the digits of both i and j""")
|
2018-03-22 18:11:39 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-23 19:33:57 +02:00
|
|
|
module.generate_code()
|