mirror of
https://github.com/CoolProp/CoolProp.git
synced 2026-04-23 03:00:17 -04:00
Add config keys to pybind11 interface; closes #1299
This commit is contained in:
@@ -139,3 +139,23 @@ void set_config_as_json_string(const std::string &s){
|
||||
|
||||
}
|
||||
|
||||
#if defined(PYBIND11)
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
namespace py = pybind11;
|
||||
|
||||
// Add Configuration variables to pybind11 wrapper
|
||||
void init_CoolProp_Configuration_constants(py::module &m)
|
||||
{
|
||||
// See http://stackoverflow.com/a/148610 and http://stackoverflow.com/questions/147267/easy-way-to-use-variables-of-enum-types-as-string-in-c#202511
|
||||
|
||||
py::enum_<configuration_keys>(m, "configuration_keys")
|
||||
#define X(Enum, String, Default, Desc) \
|
||||
.value(String, configuration_keys::Enum)
|
||||
CONFIGURATION_KEYS_ENUM
|
||||
#undef X
|
||||
.export_values();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ CoolProp::AbstractState * factory(const std::string &backend, const std::string
|
||||
return CoolProp::AbstractState::factory(backend, fluid_names);
|
||||
}
|
||||
|
||||
void init_CoolProp_Configuration_constants(py::module &m);
|
||||
|
||||
void init_CoolProp(py::module &m){
|
||||
using namespace CoolProp;
|
||||
|
||||
@@ -372,6 +374,8 @@ void init_CoolProp(py::module &m){
|
||||
m.def("get_mixture_binary_pair_data", &get_mixture_binary_pair_data);
|
||||
m.def("set_mixture_binary_pair_data", &set_mixture_binary_pair_data);
|
||||
m.def("apply_simple_mixing_rule", &apply_simple_mixing_rule);
|
||||
|
||||
init_CoolProp_Configuration_constants(m);
|
||||
}
|
||||
|
||||
#if defined(COOLPROP_PYBIND11_MODULE)
|
||||
|
||||
Reference in New Issue
Block a user