DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
EulerP_Physics_bind.hpp
Go to the documentation of this file.
1/**
2 * @file EulerP_Physics_bind.hpp
3 * @brief Pybind11 bindings for the EulerP Physics class.
4 *
5 * Exposes the @c Physics class to Python with:
6 * - Default constructor
7 * - @c to_dict() for JSON-compatible dict serialization
8 * - @c from_dict() static factory for constructing Physics from a Python dict
9 */
10#pragma once
11
12#include "EulerP_Physics.hpp"
13#include "DNDS/Defines_bind.hpp"
14#include <pybind11_json/pybind11_json.hpp>
15
16namespace DNDS::EulerP
17{
18 /**
19 * @brief Registers pybind11 bindings for the Physics class.
20 *
21 * Exposes Physics as a shared_ptr-held class with:
22 * - @c Physics() default constructor
23 * - @c to_dict() → Python dict (via nlohmann_json serialization)
24 * - @c Physics.from_dict(dict) → Physics (static factory via JSON deserialization)
25 *
26 * @param m Pybind11 module to register bindings into.
27 */
28 inline void pybind11_Physics_bind(py::module_ &m)
29 {
30 auto Physics_ = py_class_ssp<Physics>(
31 m, "Physics");
32
33 Physics_.def(py::init());
34
35 Physics_
36 .def("to_dict",
37 [](Physics &self)
38 {
39 return py::dict(nlohmann::json(self));
40 })
41 .def_static("from_dict",
42 [](const py::dict &d)
43 {
44 return Physics(nlohmann::json(d));
45 });
46 }
47}
Shared pybind11 plumbing used by every *_bind.hpp in DNDS (buffer-protocol type check,...
Physics model definitions for the EulerP module: gas properties, state conversions,...
Namespace for the EulerP alternative evaluator module with GPU support.
Definition EulerP.hpp:29
void pybind11_Physics_bind(py::module_ &m)
Registers pybind11 bindings for the Physics class.
py::classh< T > py_class_ssp
Host-side physics object managing gas parameters and device-transferable reference values.