Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
pybindaliases.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
23
26#include <pybind11/pybind11.h>
27
29namespace py = pybind11;
30
32using fct_sig = std::function<void(py::module &)>;
33
36
45#define _internal_register_pybind_init(funcname, lambda_name, varname) \
46 static void funcname(py::module &varname); \
47 static shambase::call_lambda lambda_name([]() { \
48 register_pybind_init_func(funcname); \
49 }); \
50 static void funcname(py::module &varname)
51
69#define ON_PYTHON_INIT \
70 _internal_register_pybind_init( \
71 __shamrock_unique_name(pybind_), __shamrock_unique_name(pybind_class_obj_), root_module)
Call a lambda at static or local scope construction time.
std::function< void(py::module &)> fct_sig
alias to pybind11 namespace
void register_pybind_init_func(fct_sig)
Register a python module init function to be ran on init.
Provides macros for generating unique identifiers at compile time.