Add a non regression test of ExportMEDCoupling method

This commit is contained in:
Anthony Geay 2021-05-17 16:08:33 +02:00
parent cc54cd4b94
commit cdd78104f5
2 changed files with 15 additions and 2 deletions

View File

@ -50,4 +50,13 @@ isDone = Mesh_1.Compute()
smesh.SetName(NETGEN_1D_2D_3D.GetAlgorithm(), 'NETGEN 1D-2D-3D') smesh.SetName(NETGEN_1D_2D_3D.GetAlgorithm(), 'NETGEN 1D-2D-3D')
smesh.SetName(Mesh_1.GetMesh(), 'Mesh_1') 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)

View File

@ -356,10 +356,14 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh_Mem::Perform()
std::size_t sz(0); std::size_t sz(0);
Driver_Mesh::Status status = Driver_Mesh::DRS_OK; Driver_Mesh::Status status = Driver_Mesh::DRS_OK;
bool isClosed(false); bool isClosed(false);
TMemFile *tfileInst = nullptr;
{// let braces to flush (call of MED::PWrapper myMed destructor) {// 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); MED::PWrapper myMed = CrWrapperW(myFile, -1, tfileInst);
status = this->PerformInternal<MED::PWrapper>(myMed); status = this->PerformInternal<MED::PWrapper>(myMed);
}
if(tfileInst)
{
ptr = tfileInst->getData(); sz = tfileInst->getSize(); ptr = tfileInst->getData(); sz = tfileInst->getSize();
} }
_data = MEDCoupling::DataArrayByte::New(); _data = MEDCoupling::DataArrayByte::New();