From cdd78104f527ec730f69a3b3c19e80b60e4b31ad Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 17 May 2021 16:08:33 +0200 Subject: [PATCH] Add a non regression test of ExportMEDCoupling method --- .../examples/basic_geom_smesh_without_session.py | 11 ++++++++++- src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx | 6 +++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/salome/examples/basic_geom_smesh_without_session.py b/doc/salome/examples/basic_geom_smesh_without_session.py index d10a23cee..9626ff9eb 100644 --- a/doc/salome/examples/basic_geom_smesh_without_session.py +++ b/doc/salome/examples/basic_geom_smesh_without_session.py @@ -50,4 +50,13 @@ isDone = Mesh_1.Compute() smesh.SetName(NETGEN_1D_2D_3D.GetAlgorithm(), 'NETGEN 1D-2D-3D') smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1') -assert(Mesh_1.GetMesh().NbTetras()>=5) +nbOfTetraExp = 5 + +assert(Mesh_1.GetMesh().NbTetras()>=nbOfTetraExp) + +#Mesh_1.ExportMED("toto.med") + +import medcoupling as mc + +mv_mm = Mesh_1.ExportMEDCoupling() +assert(mc.MEDCoupling1SGTUMesh(mv_mm[0]).getNumberOfCells()>=nbOfTetraExp) diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx index 1f503ab06..458156813 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx @@ -356,10 +356,14 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh_Mem::Perform() std::size_t sz(0); Driver_Mesh::Status status = Driver_Mesh::DRS_OK; bool isClosed(false); + TMemFile *tfileInst = nullptr; {// let braces to flush (call of MED::PWrapper myMed destructor) - TMemFile *tfileInst = new TMemFile(&isClosed); + tfileInst = new TMemFile(&isClosed); MED::PWrapper myMed = CrWrapperW(myFile, -1, tfileInst); status = this->PerformInternal(myMed); + } + if(tfileInst) + { ptr = tfileInst->getData(); sz = tfileInst->getSize(); } _data = MEDCoupling::DataArrayByte::New(); -- 2.39.2