From: Christophe Bourcier Date: Mon, 21 Nov 2022 13:26:17 +0000 (+0100) Subject: Fix for Windows (thanks to Nabil) X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fcbr%2Ffix_dual_mesh_projection;p=modules%2Fsmesh.git Fix for Windows (thanks to Nabil) --- diff --git a/src/SMESH_I/SMESH_Gen_i.cxx b/src/SMESH_I/SMESH_Gen_i.cxx index ffb72b1cd..d76169d0c 100644 --- a/src/SMESH_I/SMESH_Gen_i.cxx +++ b/src/SMESH_I/SMESH_Gen_i.cxx @@ -2861,14 +2861,15 @@ SMESH::SMESH_Mesh_ptr SMESH_Gen_i::CreateDualMesh(SMESH::SMESH_IDSource_ptr mesh ats = "False"; std::string cmd="import salome.smesh.smesh_tools as smt\n"; - cmd +="smt.smesh_create_dual_mesh(\"" + mesh_ior + "\", \"" + + cmd +="smt.smesh_create_dual_mesh(\"" + mesh_ior + "\", r\"" + dual_mesh_file.string() + "\", mesh_name=\"" + mesh_name + "\", adapt_to_shape=" + ats + ")"; MESSAGE(cmd); PyObject *py_main = PyImport_AddModule("__main__"); PyObject *py_dict = PyModule_GetDict(py_main); + PyObject *local_dict = PyDict_New(); - PyRun_String(cmd.c_str(), Py_file_input, py_dict, py_dict); + PyRun_String(cmd.c_str(), Py_file_input, py_dict, local_dict); if (PyErr_Occurred()) { // Restrieving python error diff --git a/test/SMESH_create_dual_mesh_adapt.py b/test/SMESH_create_dual_mesh_adapt.py index ccabb5aa5..e24cafbde 100644 --- a/test/SMESH_create_dual_mesh_adapt.py +++ b/test/SMESH_create_dual_mesh_adapt.py @@ -85,6 +85,8 @@ dual_Mesh_1 = smesh.CreateDualMesh(Mesh_1, 'dual_Mesh_1', True) #Comparing volumes dual_volume = dual_Mesh_1.GetVolume() dual_raw_volume = dual_Mesh_raw_1.GetVolume() +tetra_volume = Mesh_1.GetVolume() +print("tetra_volume: ", tetra_volume) print("dual_volume: ", dual_volume) print("dual_raw_volume: ", dual_raw_volume) diff --git a/test/SMESH_create_dual_mesh_tpipe.py b/test/SMESH_create_dual_mesh_tpipe.py index 3e57e86b1..28bc26a4f 100644 --- a/test/SMESH_create_dual_mesh_tpipe.py +++ b/test/SMESH_create_dual_mesh_tpipe.py @@ -106,7 +106,7 @@ assert dual_Mesh_raw_1.NbPolyhedrons() == dual_Mesh_raw_1.NbVolumes() # Check dual mesh volume dual_raw_volume = dual_Mesh_raw_1.GetVolume() -assert abs(dual_raw_volume-shape_volume)/shape_volume < 0.12 +assert abs(dual_raw_volume-shape_volume)/shape_volume < 0.14 # Check groups dual_Mesh_raw_groups = dual_Mesh_raw_1.GetGroups() @@ -125,7 +125,7 @@ print("dual_volume: ", dual_volume) print("dual_raw_volume: ", dual_raw_volume) assert (dual_volume >= dual_raw_volume) -assert abs(dual_volume-shape_volume)/shape_volume < 0.12 +assert abs(dual_volume-shape_volume)/shape_volume < 0.14 # Check groups dual_Mesh_groups = dual_Mesh_1.GetGroups()