From: ageay Date: Fri, 25 Jan 2013 11:48:39 +0000 (+0000) Subject: checkConsecutiveCellTypesForMEDFileFrmt X-Git-Tag: V6_main_FINAL~413 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=78ca7036b60a0d50bd1659c53be015dbc3ef2308;p=tools%2Fmedcoupling.git checkConsecutiveCellTypesForMEDFileFrmt --- diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 327c593c8..2c7936230 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -5450,6 +5450,17 @@ bool MEDCouplingUMesh::checkConsecutiveCellTypes() const return true; } +/*! + * This method is a specialization of MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder method that is called here. + * The geometric type order is specified by MED file. + * + * \sa MEDCouplingUMesh::checkConsecutiveCellTypesAndOrder + */ +bool MEDCouplingUMesh::checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception) +{ + return checkConsecutiveCellTypesAndOrder(MEDMEM_ORDER,MEDMEM_ORDER+N_MEDMEM_ORDER); +} + /*! * This method performs the same job as checkConsecutiveCellTypes except that the order of types sequence is analyzed to check * that the order is specified in array defined by [orderBg,orderEnd). diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index 534c7c7bc..703881151 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -192,6 +192,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT MEDCouplingUMesh *emulateMEDMEMBDC(const MEDCouplingUMesh *nM1LevMesh, DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *&revDesc, DataArrayInt *&revDescIndx, DataArrayInt *& nM1LevMeshIds, DataArrayInt *&meshnM1Old2New) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT bool checkConsecutiveCellTypes() const; + MEDCOUPLING_EXPORT bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT bool checkConsecutiveCellTypesAndOrder(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const; MEDCOUPLING_EXPORT DataArrayInt *getLevArrPerCellTypes(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd, DataArrayInt *&nbPerType) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT DataArrayInt *getRenumArrForConsecutiveCellTypesSpec(const INTERP_KERNEL::NormalizedCellType *orderBg, const INTERP_KERNEL::NormalizedCellType *orderEnd) const throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index cdae0a4cb..7653ffa90 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -10840,6 +10840,19 @@ class MEDCouplingBasicsTest(unittest.TestCase): pass pass + def testSwigCheckConsecutiveCellTypesForMEDFileFrmt1(self): + m1=MEDCouplingUMesh("",2) ; m1.allocateCells(0) + m1.insertNextCell(NORM_QUAD4,[0,1,2,3]) + m1.insertNextCell(NORM_TRI3,[0,1,2]) + d=DataArrayDouble(4,3) ; d[:]=0. + m1.setCoords(d) + self.assertTrue(m1.checkConsecutiveCellTypes()) + self.assertTrue(not m1.checkConsecutiveCellTypesForMEDFileFrmt()) + m1.renumberCells([1,0]) + self.assertTrue(m1.checkConsecutiveCellTypes()) + self.assertTrue(m1.checkConsecutiveCellTypesForMEDFileFrmt()) + pass + def setUp(self): pass pass diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 41c1e107e..ecd13e555 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -1389,6 +1389,7 @@ namespace ParaMEDMEM DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception); bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception); + bool checkConsecutiveCellTypesForMEDFileFrmt() const throw(INTERP_KERNEL::Exception); DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception); DataArrayInt *sortCellsInMEDFileFrmt() throw(INTERP_KERNEL::Exception); DataArrayInt *convertCellArrayPerGeoType(const DataArrayInt *da) const throw(INTERP_KERNEL::Exception);