Skip to content

Commit

Permalink
Python support: use Pythonic names for our OpenCOR Python module.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Dec 5, 2019
1 parent 06c9b5c commit f1d124f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions models/tests/python/lorenz.py
Expand Up @@ -7,9 +7,9 @@ def run_simulation(file_name_or_url):
print(' - Open file...')

if file_name_or_url.startswith('https://'):
simulation = oc.openSimulation(file_name_or_url)
simulation = oc.open_simulation(file_name_or_url)
else:
simulation = oc.openSimulation(os.path.dirname(__file__) + '/' + file_name_or_url)
simulation = oc.open_simulation(os.path.dirname(__file__) + '/' + file_name_or_url)

print(' - Run file...')

Expand All @@ -29,7 +29,7 @@ def run_simulation(file_name_or_url):
y = states['main/y'].values()
z = states['main/z'].values()

oc.closeSimulation(simulation)
oc.close_simulation(simulation)


print('---------------------------------------')
Expand Down
2 changes: 1 addition & 1 deletion src/misc/closesimulation.cpp.inl
Expand Up @@ -4,7 +4,7 @@ static PyObject * closeSimulation(PyObject *pSelf, PyObject *pArgs)

// Close a simulation

if (PyTuple_Size(pArgs) > 0) {
if (PyTuple_Size(pArgs) == 1) {
#include "pythonbegin.h"
PythonQtInstanceWrapper *wrappedSimulation = PythonQtSupport::getInstanceWrapper(PyTuple_GET_ITEM(pArgs, 0)); // NOLINT(cppcoreguidelines-pro-type-cstyle-cast)
#include "pythonend.h"
Expand Down
Expand Up @@ -145,8 +145,8 @@ SimulationExperimentViewPythonWrapper::SimulationExperimentViewPythonWrapper(voi

static std::array<PyMethodDef, 4> PythonSimulationExperimentViewMethods = {{
{ "simulation", simulation, METH_VARARGS, "The current simulation." },
{ "openSimulation", openSimulation, METH_VARARGS, "Open a simulation." },
{ "closeSimulation", closeSimulation, METH_VARARGS, "Close a simulation." },
{ "open_simulation", openSimulation, METH_VARARGS, "Open a simulation." },
{ "close_simulation", closeSimulation, METH_VARARGS, "Close a simulation." },
{ nullptr, nullptr, 0, nullptr }
}};

Expand Down
Expand Up @@ -218,8 +218,8 @@ SimulationSupportPythonWrapper::SimulationSupportPythonWrapper(void *pModule,
// Add some Python wrappers

static std::array<PyMethodDef, 4> PythonSimulationSupportMethods = {{
{ "openSimulation", openSimulation, METH_VARARGS, "Open a simulation." },
{ "closeSimulation", closeSimulation, METH_VARARGS, "Close a simulation." },
{ "open_simulation", openSimulation, METH_VARARGS, "Open a simulation." },
{ "close_simulation", closeSimulation, METH_VARARGS, "Close a simulation." },
{ nullptr, nullptr, 0, nullptr }
}};

Expand Down

0 comments on commit f1d124f

Please sign in to comment.