From 2d18068db9b9bd0ba348285f1034c3a6266e851f Mon Sep 17 00:00:00 2001 From: wgodoy <wgodoy@wgodoy-desktop> Date: Fri, 9 Jun 2017 06:51:17 -0400 Subject: [PATCH] Fixed bug in Python bindings To do: Implement overloaded and default-argument class functions --- bindings/python/Makefile | 2 +- bindings/python/helloBPWriter.py | 6 +++--- bindings/python/source/VariablePy.cpp | 2 +- bindings/python/source/gluePyBind11.cpp | 14 +++++++------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bindings/python/Makefile b/bindings/python/Makefile index d7f98bb07..2f9f607d7 100644 --- a/bindings/python/Makefile +++ b/bindings/python/Makefile @@ -19,7 +19,7 @@ ADIOS2_INC:= /usr/local/include ADIOS2_LIB:= /usr/local/lib # PyBind11 -PyBind11_INC:= /home/wfg/workspace/ADIOS2/thirdparty/pybind11/include +PyBind11_INC:= ../../thirdparty/pybind11/include CFLAGS:=-c -Wall -fPIC -O0 -g -std=c++11 -Wno-deprecated-declarations diff --git a/bindings/python/helloBPWriter.py b/bindings/python/helloBPWriter.py index f5f90c5ca..fb39e326c 100644 --- a/bindings/python/helloBPWriter.py +++ b/bindings/python/helloBPWriter.py @@ -12,15 +12,15 @@ import numpy as np # User data -myArray = np.array([1, 2, 3, 4]) +myArray = np.array([1., 2., 3., 4., 5.]) -print "Read " + str(Read) +print "Read " + str(adiosRead) adios = ADIOS(MPI.COMM_WORLD, True) bpIO = adios.DeclareIO("BPN2N") ioArray = bpIO.DefineVariable("bpArray", [myArray.size], [0], [myArray.size], True) -bpFileWriter = bpIO.Open("myArray.bp", Write) +bpFileWriter = bpIO.Open("myArray.bp", adiosWrite) bpFileWriter.Write(ioArray, myArray) bpFileWriter.Close() diff --git a/bindings/python/source/VariablePy.cpp b/bindings/python/source/VariablePy.cpp index 76813c6cd..a8da68e6c 100644 --- a/bindings/python/source/VariablePy.cpp +++ b/bindings/python/source/VariablePy.cpp @@ -16,7 +16,7 @@ namespace adios VariablePy::VariablePy(const std::string &name, const pyList shape, const pyList start, const pyList count, const bool isConstantDims, const bool debugMode) -: m_Name(name), m_Shape(shape), m_Start(count), m_Count(count), +: m_Name(name), m_Shape(shape), m_Start(start), m_Count(count), m_IsConstantDims(isConstantDims), m_DebugMode(debugMode) { } diff --git a/bindings/python/source/gluePyBind11.cpp b/bindings/python/source/gluePyBind11.cpp index aaf903399..0c4aa097f 100644 --- a/bindings/python/source/gluePyBind11.cpp +++ b/bindings/python/source/gluePyBind11.cpp @@ -45,13 +45,13 @@ PYBIND11_PLUGIN(adios2py) } pybind11::module m("adios2py", "ADIOS2 Python bindings using pybind11"); - m.attr("DebugON") = true; - m.attr("DebugOFF") = false; - m.attr("Write") = static_cast<int>(adios::OpenMode::Write); - m.attr("Read") = static_cast<int>(adios::OpenMode::Read); - m.attr("Append") = static_cast<int>(adios::OpenMode::Append); - m.attr("ReadWrite") = static_cast<int>(adios::OpenMode::ReadWrite); - m.def("ADIOS", &ADIOSPyInit, "Function that creates an ADIOS object"); + m.attr("adiosDebugON") = true; + m.attr("adiosDebugOFF") = false; + m.attr("adiosWrite") = static_cast<int>(adios::OpenMode::Write); + m.attr("adiosRead") = static_cast<int>(adios::OpenMode::Read); + m.attr("adiosAppend") = static_cast<int>(adios::OpenMode::Append); + m.attr("adiosReadWrite") = static_cast<int>(adios::OpenMode::ReadWrite); + m.def("ADIOS", &ADIOSPyInit, "Function that creates an ADIOS class object"); pybind11::class_<adios::ADIOSPy>(m, "ADIOSPy") .def("DeclareIO", &adios::ADIOSPy::DeclareIO); -- GitLab