Commit e3e7d6ab authored by Michael Buehlmann's avatar Michael Buehlmann
Browse files

update to pybind11 2.6.1

parent 1fb1423c
......@@ -5,7 +5,7 @@ include(FetchContent)
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v2.5
GIT_TAG v2.6.1
)
FetchContent_GetProperties(pybind11)
......
......@@ -84,21 +84,21 @@ public:
);
if (varp != variables.end()) {
// extra space
size_t readsize = num_elem + requestedExtraSpace()/(*varp).ElementSize;
py::ssize_t readsize = num_elem + requestedExtraSpace()/(*varp).ElementSize;
if((*varp).IsFloat && (*varp).ElementSize == 4) {
result[var_name] = py::array_t<float>(size_t(readsize));
result[var_name] = py::array_t<float>(readsize);
addVariable(*varp, result[var_name].mutable_data(), gio::GenericIO::VarHasExtraSpace);
} else if((*varp).IsFloat && (*varp).ElementSize == 8) {
result[var_name] = py::array_t<double>(size_t(readsize));
result[var_name] = py::array_t<double>(readsize);
addVariable(*varp, result[var_name].mutable_data(), gio::GenericIO::VarHasExtraSpace);
} else if(!(*varp).IsFloat && (*varp).ElementSize == 4) {
result[var_name] = py::array_t<int32_t>(size_t(readsize));
result[var_name] = py::array_t<int32_t>(readsize);
addVariable(*varp, result[var_name].mutable_data(), gio::GenericIO::VarHasExtraSpace);
} else if(!(*varp).IsFloat && (*varp).ElementSize == 8) {
result[var_name] = py::array_t<int64_t>(size_t(readsize));
result[var_name] = py::array_t<int64_t>(readsize);
addVariable(*varp, result[var_name].mutable_data(), gio::GenericIO::VarHasExtraSpace);
} else if(!(*varp).IsFloat && (*varp).ElementSize == 2) {
result[var_name] = py::array_t<uint16_t>(size_t(readsize));
result[var_name] = py::array_t<uint16_t>(readsize);
addVariable(*varp, result[var_name].mutable_data(), gio::GenericIO::VarHasExtraSpace);
}
}
......@@ -197,8 +197,10 @@ PYBIND11_MODULE(pygio, m) {
m.def("_init_mpi", [](){
int initialized;
MPI_Initialized(&initialized);
if(!initialized)
MPI_Init(nullptr, nullptr);
if(!initialized) {
int level_provided;
MPI_Init_thread(nullptr, nullptr, MPI_THREAD_SINGLE, &level_provided);
}
});
#endif
......@@ -214,7 +216,6 @@ PYBIND11_MODULE(pygio, m) {
.value("MismatchDisallowed", PyGenericIO::MismatchBehavior::MismatchDisallowed)
.value("MismatchRedistribute", PyGenericIO::MismatchBehavior::MismatchRedistribute);
pyGenericIO.def(py::init<std::string, PyGenericIO::FileIO, PyGenericIO::MismatchBehavior>(), py::arg("filename"), py::arg("method")=PyGenericIO::FileIO::FileIOPOSIX, py::arg("redistribute")=PyGenericIO::MismatchBehavior::MismatchRedistribute)
.def("inspect", &PyGenericIO::inspect, "Print variable infos and size of GenericIO file")
.def("get_variables", &PyGenericIO::get_variables, "Get a list of VariableInformations defined in the GenericIO file")
......@@ -224,8 +225,6 @@ PYBIND11_MODULE(pygio, m) {
.def("read_phys_scale", &PyGenericIO::read_phys_scale)
.def("read", &PyGenericIO::read, py::arg("variables")=nullptr);
py::class_<gio::GenericIO::VariableInfo>(pyGenericIO, "VariableInfo")
.def_readonly("name", &gio::GenericIO::VariableInfo::Name)
.def_readonly("size", &gio::GenericIO::VariableInfo::Size)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment