3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 13:53:40 +01:00
dft_tools/pytriqs/random_generator/random_generator_desc.py
Olivier Parcollet 243d4a798b wrapper: add use_module
- a module can use the converters used by another
  with the use_module('A') command.
  In which case :
    - the generate converter header for A will be included.
    - the header, at the top, now contains a simple list of all
      wrapped types, which is then included in the wrapped_types
      of the module for proper code generation.
- simplify the code generation : just generate_code.
- all arguments are analyzed from sys.argv at the import of the
  wrap_generator module. In any case, the xx_desc.py will be called from the corresponding
  cmake command, hence with the right arguments.
- Added a dependencies in my_module_B of wrap_test to show how to make
  the dependencies in the cmake file, if needed.
2014-05-30 19:34:13 +02:00

46 lines
1.5 KiB
Python

from wrap_generator import *
module = module_(full_name = "pytriqs.random_generator", doc = "")
module.add_include("<triqs/mc_tools/random_generator.hpp>")
module.add_using("namespace triqs::mc_tools")
# Not needed. Reorganize the hpp wrapper tool
module.add_include("<triqs/h5.hpp>")
module.add_include("<triqs/arrays.hpp>")
# --------- RandomGenerator ----------------------------------
r = class_(py_type = "RandomGenerator",
c_type = "random_generator",
c_type_absolute = "triqs::mc_tools::random_generator",
)
r.add_constructor(signature = "(std::string name, int seed)",
doc =
"""
This is a random number generator class based on boost.
name Name of the random number generator
seed Random number seed
""")
r.add_call(signature = "int(int N)", doc = """Generate an integer random number in [0,N-1]""")
r.add_call(signature = "double()", doc = """Generate a float random number in [0,1[""")
module.add_class(r)
# --------- Module functions ----------------------------------
module.add_function(name = "random_generator_names_list",
signature = "std::vector<std::string>()",
doc = """Get a list of available random generator names"""
)
########################
## Code generation
########################
if __name__ == '__main__' :
module.generate_code()