Skip to content

Commit d934c84

Browse files
committed
Updated to more generic python path. Matching latest StylES-PyTorch version
1 parent 173df30 commit d934c84

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

  • examples/hasegawa-wakatani

examples/hasegawa-wakatani/hw.cxx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
#include <bout/physicsmodel.hxx>
1111
#include <bout/smoothing.hxx>
1212

13-
1413
#include <chrono>
1514
using namespace std::chrono;
1615

17-
1816
void initPythonModule(PyObject **pModule, PyObject **pInitFlow, PyObject **pFindLESTerms) {
1917

2018

@@ -25,7 +23,19 @@ void initPythonModule(PyObject **pModule, PyObject **pInitFlow, PyObject **pFind
2523

2624
// set Python system path
2725
PyObject *sys_path = PySys_GetObject("path");
28-
PyList_Append(sys_path, PyUnicode_FromString("../../../../StylES/bout_interfaces/"));
26+
27+
PyObject *repr = PyObject_Repr(sys_path); // sys_path -> string object
28+
//const char *str = PyUnicode_AsUTF8(repr); // get UTF-8 C string
29+
//printf("current sys_path %s\n", str);
30+
Py_XDECREF(repr);
31+
32+
PyList_Append(sys_path,
33+
PyUnicode_FromString("/lus/lfs1aip2/home/u5ai/jcastagna.u5ai/Turbulence_with_Style/PhaseV_FCL1/codes/StylES-PyTorch/bout_interfaces/"));
34+
35+
repr = PyObject_Repr(sys_path);
36+
//str = PyUnicode_AsUTF8(repr);
37+
//printf("modified sys_path %s\n", str);
38+
Py_XDECREF(repr);
2939

3040
// Import Python module
3141
*pModule = PyImport_ImportModule("pBOUT");
@@ -54,14 +64,17 @@ void initPythonModule(PyObject **pModule, PyObject **pInitFlow, PyObject **pFind
5464
fprintf(stderr, "Python function not found!\n");
5565
}
5666

57-
5867
return;
5968

6069
}
6170

6271

6372

6473

74+
75+
76+
77+
6578
double* initFlow(double dx, double dy, Field3D n, Field3D phi, Field3D vort, PyObject *pModule, PyObject *pInitFlow) {
6679

6780
// local variables

0 commit comments

Comments
 (0)