Skip to content
Snippets Groups Projects
Commit 2d18068d authored by wgodoy's avatar wgodoy
Browse files

Fixed bug in Python bindings

To do:
Implement overloaded and default-argument class functions
parent c715a4b9
No related branches found
No related tags found
1 merge request!126Python Bindings and their required internal code changes
......@@ -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
......
......@@ -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()
......@@ -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)
{
}
......
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment