Nektar++
Loading...
Searching...
No Matches
Classes | Macros
NekPyConfig.hpp File Reference
#include <memory>
#include <pybind11/numpy.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/stl_bind.h>
#include <LibUtilities/BasicUtils/CppCommandLine.hpp>

Go to the source code of this file.

Classes

struct  PyCppCommandLine
 Helper structure to construct C++ command line argc and argv variables from a Python list. More...
 

Macros

#define PYBIND11_DETAILED_ERROR_MESSAGES
 
#define SIZENAME(s)   SIZE_##s
 
#define NEKPY_WRAP_ENUM(MOD, ENUMNAME, MAPNAME)
 
#define NEKPY_WRAP_ENUM_STRING(MOD, ENUMNAME, MAPNAME)
 
#define NEKPY_WRAP_ENUM_STRING_DOCS(MOD, ENUMNAME, MAPNAME, DOCSTRING)
 

Macro Definition Documentation

◆ NEKPY_WRAP_ENUM

#define NEKPY_WRAP_ENUM (   MOD,
  ENUMNAME,
  MAPNAME 
)
Value:
{ \
py::enum_<ENUMNAME> tmp(MOD, #ENUMNAME); \
for (int a = 0; a < (int)SIZENAME(ENUMNAME); ++a) \
{ \
tmp.value(MAPNAME[a], (ENUMNAME)a); \
} \
tmp.export_values(); \
}
#define SIZENAME(s)

Definition at line 55 of file NekPyConfig.hpp.

56 { \
57 py::enum_<ENUMNAME> tmp(MOD, #ENUMNAME); \
58 for (int a = 0; a < (int)SIZENAME(ENUMNAME); ++a) \
59 { \
60 tmp.value(MAPNAME[a], (ENUMNAME)a); \
61 } \
62 tmp.export_values(); \
63 }

◆ NEKPY_WRAP_ENUM_STRING

#define NEKPY_WRAP_ENUM_STRING (   MOD,
  ENUMNAME,
  MAPNAME 
)
Value:
{ \
py::enum_<ENUMNAME> tmp(MOD, #ENUMNAME); \
for (int a = 0; a < (int)SIZENAME(ENUMNAME); ++a) \
{ \
tmp.value(MAPNAME[a].c_str(), (ENUMNAME)a); \
} \
tmp.export_values(); \
}

Definition at line 64 of file NekPyConfig.hpp.

65 { \
66 py::enum_<ENUMNAME> tmp(MOD, #ENUMNAME); \
67 for (int a = 0; a < (int)SIZENAME(ENUMNAME); ++a) \
68 { \
69 tmp.value(MAPNAME[a].c_str(), (ENUMNAME)a); \
70 } \
71 tmp.export_values(); \
72 }

◆ NEKPY_WRAP_ENUM_STRING_DOCS

#define NEKPY_WRAP_ENUM_STRING_DOCS (   MOD,
  ENUMNAME,
  MAPNAME,
  DOCSTRING 
)
Value:
{ \
py::enum_<ENUMNAME> tmp(MOD, #ENUMNAME); \
for (int a = 0; a < (int)SIZENAME(ENUMNAME); ++a) \
{ \
tmp.value(MAPNAME[a].c_str(), (ENUMNAME)a); \
} \
tmp.export_values(); \
PyTypeObject *pto = reinterpret_cast<PyTypeObject *>(tmp.ptr()); \
PyDict_SetItemString(pto->tp_dict, "__doc__", \
PyUnicode_FromString(DOCSTRING)); \
}

Definition at line 73 of file NekPyConfig.hpp.

74 { \
75 py::enum_<ENUMNAME> tmp(MOD, #ENUMNAME); \
76 for (int a = 0; a < (int)SIZENAME(ENUMNAME); ++a) \
77 { \
78 tmp.value(MAPNAME[a].c_str(), (ENUMNAME)a); \
79 } \
80 tmp.export_values(); \
81 PyTypeObject *pto = reinterpret_cast<PyTypeObject *>(tmp.ptr()); \
82 PyDict_SetItemString(pto->tp_dict, "__doc__", \
83 PyUnicode_FromString(DOCSTRING)); \
84 }

◆ PYBIND11_DETAILED_ERROR_MESSAGES

#define PYBIND11_DETAILED_ERROR_MESSAGES

Definition at line 39 of file NekPyConfig.hpp.

◆ SIZENAME

#define SIZENAME (   s)    SIZE_##s

Definition at line 54 of file NekPyConfig.hpp.