From: Anthony Geay Date: Tue, 30 May 2017 20:39:22 +0000 (+0200) Subject: On the road X-Git-Tag: V8_4_0a1~25^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8d510346a2b5a5ec2db2a475eb818f50bff1bb07;p=tools%2Fmedcoupling.git On the road --- diff --git a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx index f7f48b9db..83871ddad 100644 --- a/src/MEDCoupling/MEDCoupling1GTUMesh.cxx +++ b/src/MEDCoupling/MEDCoupling1GTUMesh.cxx @@ -108,7 +108,7 @@ DataArrayInt *MEDCoupling1GTUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCe /*! * Returns nb of cells having the geometric type \a type. No throw if no cells in \a this has the geometric type \a type. */ -int MEDCoupling1GTUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +std::size_t MEDCoupling1GTUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { return type==getCellModelEnum()?getNumberOfCells():0; } @@ -119,7 +119,7 @@ int MEDCoupling1GTUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellT * \return INTERP_KERNEL::NormalizedCellType - enumeration item describing the cell type. * \throw If \a cellId is invalid. Valid range is [0, \a this->getNumberOfCells() ). */ -INTERP_KERNEL::NormalizedCellType MEDCoupling1GTUMesh::getTypeOfCell(int cellId) const +INTERP_KERNEL::NormalizedCellType MEDCoupling1GTUMesh::getTypeOfCell(std::size_t cellId) const { if(cellId>=0 && cellId getAllGeoTypes() const; MEDCOUPLING_EXPORT std::vector getDistributionOfTypes() const; MEDCOUPLING_EXPORT void splitProfilePerType(const DataArrayInt *profile, std::vector& code, std::vector& idsInPflPerType, std::vector& idsPerType) const; diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx index 6ae0ed5bb..ded630630 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.cxx @@ -246,15 +246,15 @@ void MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith(const MEDCou throw INTERP_KERNEL::Exception("MEDCouplingMappedExtrudedMesh::checkDeepEquivalOnSameNodesWith : not implemented yet !"); } -INTERP_KERNEL::NormalizedCellType MEDCouplingMappedExtrudedMesh::getTypeOfCell(int cellId) const +INTERP_KERNEL::NormalizedCellType MEDCouplingMappedExtrudedMesh::getTypeOfCell(std::size_t cellId) const { const int *ids(_mesh3D_ids->begin()); - int nbOf3DCells(_mesh3D_ids->getNumberOfTuples()); + std::size_t nbOf3DCells(_mesh3D_ids->getNumberOfTuples()); const int *where(std::find(ids,ids+nbOf3DCells,cellId)); if(where==ids+nbOf3DCells) throw INTERP_KERNEL::Exception("Invalid cellId specified >= getNumberOfCells() !"); - int nbOfCells2D(_mesh2D->getNumberOfCells()); - int locId(((int)std::distance(ids,where))%nbOfCells2D); + std::size_t nbOfCells2D(_mesh2D->getNumberOfCells()); + std::size_t locId((std::distance(ids,where))%nbOfCells2D); INTERP_KERNEL::NormalizedCellType tmp(_mesh2D->getTypeOfCell(locId)); return INTERP_KERNEL::CellModel::GetCellModel(tmp).getExtrudedType(); } @@ -322,11 +322,11 @@ DataArrayInt *MEDCouplingMappedExtrudedMesh::computeEffectiveNbOfNodesPerCell() return computeNbOfNodesPerCell(); } -int MEDCouplingMappedExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +std::size_t MEDCouplingMappedExtrudedMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { - int ret(0); - int nbOfCells2D(_mesh2D->getNumberOfCells()); - for(int i=0;igetNumberOfCells()); + for(std::size_t i=0;igetTypeOfCell(i)); if(INTERP_KERNEL::CellModel::GetCellModel(t).getExtrudedType()==type) diff --git a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx index 82b6ace4b..e682dbf2e 100644 --- a/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMappedExtrudedMesh.hxx @@ -57,13 +57,13 @@ namespace MEDCoupling DataArrayInt *&cellCor, DataArrayInt *&nodeCor) const; MEDCOUPLING_EXPORT void checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec, DataArrayInt *&cellCor) const; - MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const; + MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const; MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const; MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const; MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const; - MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector& conn) const; MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector& coo) const; MEDCOUPLING_EXPORT std::string simpleRepr() const; diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index f8edc42fe..531e3add8 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -97,8 +97,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual DataArrayInt *computeNbOfNodesPerCell() const = 0; MEDCOUPLING_EXPORT virtual DataArrayInt *computeEffectiveNbOfNodesPerCell() const = 0; MEDCOUPLING_EXPORT virtual DataArrayInt *computeNbOfFacesPerCell() const = 0; - MEDCOUPLING_EXPORT virtual int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0; - MEDCOUPLING_EXPORT virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const = 0; + MEDCOUPLING_EXPORT virtual std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const = 0; + MEDCOUPLING_EXPORT virtual INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const = 0; MEDCOUPLING_EXPORT virtual std::set getAllGeoTypes() const = 0; MEDCOUPLING_EXPORT virtual void getNodeIdsOfCell(int cellId, std::vector& conn) const = 0; MEDCOUPLING_EXPORT virtual DataArrayInt *getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const; diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx index e9b4047ca..e12fcc546 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -56,7 +56,7 @@ bool MEDCouplingStructuredMesh::isEqualIfNotWhy(const MEDCouplingMesh *other, do return MEDCouplingMesh::isEqualIfNotWhy(other,prec,reason); } -INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::getTypeOfCell(int cellId) const +INTERP_KERNEL::NormalizedCellType MEDCouplingStructuredMesh::getTypeOfCell(std::size_t cellId) const { return GetGeoTypeGivenMeshDimension(getMeshDimension()); } @@ -85,12 +85,12 @@ std::set MEDCouplingStructuredMesh::getAllGeo return ret2; } -int MEDCouplingStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +std::size_t MEDCouplingStructuredMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { - int ret=getNumberOfCells(); + std::size_t ret(getNumberOfCells()); if(type==getTypeOfCell(0)) return ret; - const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0)); + const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(getTypeOfCell(0))); std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getNumberOfCellsWithType : no specified type ! Type available is " << cm.getRepr() << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.hxx b/src/MEDCoupling/MEDCouplingStructuredMesh.hxx index bcb47ee75..eefebd185 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.hxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.hxx @@ -31,9 +31,9 @@ namespace MEDCoupling class MEDCouplingStructuredMesh : public MEDCouplingMesh { public: - MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const; + MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(std::size_t cellId) const; MEDCOUPLING_EXPORT std::set getAllGeoTypes() const; - MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; + MEDCOUPLING_EXPORT std::size_t getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; MEDCOUPLING_EXPORT DataArrayInt *giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const; MEDCOUPLING_EXPORT DataArrayInt *computeNbOfNodesPerCell() const; MEDCOUPLING_EXPORT DataArrayInt *computeNbOfFacesPerCell() const; diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 33f9e9993..ce3bb6436 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -16,7 +16,7 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// Author : Anthony Geay (CEA/DEN) +// Author : Anthony Geay (EDF R&D) #include "MEDCouplingUMesh.hxx" #include "MEDCouplingCMesh.hxx" @@ -2775,11 +2775,10 @@ DataArrayInt *MEDCouplingUMesh::getCellsInBoundingBox(const INTERP_KERNEL::Direc * \return INTERP_KERNEL::NormalizedCellType - enumeration item describing the cell type. * \throw If \a cellId is invalid. Valid range is [0, \a this->getNumberOfCells() ). */ -INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::getTypeOfCell(int cellId) const +INTERP_KERNEL::NormalizedCellType MEDCouplingUMesh::getTypeOfCell(std::size_t cellId) const { - const int *ptI=_nodal_connec_index->getConstPointer(); - const int *pt=_nodal_connec->getConstPointer(); - if(cellId>=0 && cellId<(int)_nodal_connec_index->getNbOfElems()-1) + const int *ptI(_nodal_connec_index->begin()),*pt(_nodal_connec->begin()); + if(cellId>=0 && cellId<_nodal_connec_index->getNbOfElems()-1) return (INTERP_KERNEL::NormalizedCellType) pt[ptI[cellId]]; else { @@ -2821,13 +2820,11 @@ DataArrayInt *MEDCouplingUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellT /*! * Returns nb of cells having the geometric type \a type. No throw if no cells in \a this has the geometric type \a type. */ -int MEDCouplingUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const +std::size_t MEDCouplingUMesh::getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const { - const int *ptI=_nodal_connec_index->getConstPointer(); - const int *pt=_nodal_connec->getConstPointer(); - int nbOfCells=getNumberOfCells(); - int ret=0; - for(int i=0;ibegin()),*pt(_nodal_connec->begin()); + std::size_t nbOfCells(getNumberOfCells()),ret(0); + for(std::size_t i=0;i& conn) const; MEDCOUPLING_EXPORT std::string simpleRepr() const; MEDCOUPLING_EXPORT std::string advancedRepr() const; diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx index 6438ecb38..94db55df8 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx @@ -2406,7 +2406,7 @@ void MEDCouplingBasicsTest1::testCMesh1() CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,mesh1->getTypeOfCell(1)); CPPUNIT_ASSERT_EQUAL(INTERP_KERNEL::NORM_HEXA8,*((mesh1->getAllGeoTypes()).begin())); - CPPUNIT_ASSERT_EQUAL(27,mesh1->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); + CPPUNIT_ASSERT_EQUAL(27,(int)mesh1->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); CPPUNIT_ASSERT_THROW(mesh1->getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4),INTERP_KERNEL::Exception); std::vector coo; @@ -2502,7 +2502,7 @@ void MEDCouplingBasicsTest1::testCMesh2() MEDCouplingUMesh *partMesh1= dynamic_cast(mesh1->buildPart(cells1,cells1+4)); CPPUNIT_ASSERT(partMesh1); - CPPUNIT_ASSERT_EQUAL(4,partMesh1->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); + CPPUNIT_ASSERT_EQUAL(4,(int)partMesh1->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); CPPUNIT_ASSERT_EQUAL(64,mesh1->getNumberOfNodes()); CPPUNIT_ASSERT_EQUAL(64,partMesh1->getNumberOfNodes()); @@ -2511,7 +2511,7 @@ void MEDCouplingBasicsTest1::testCMesh2() MEDCouplingCMesh *partMesh2= dynamic_cast(mesh1->buildPartAndReduceNodes(cells2,cells2+2,arr1)); CPPUNIT_ASSERT(partMesh2); - CPPUNIT_ASSERT_EQUAL(2,partMesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); + CPPUNIT_ASSERT_EQUAL(2,(int)partMesh2->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); CPPUNIT_ASSERT_EQUAL(12,partMesh2->getNumberOfNodes()); int cells3[2]={2,3}; @@ -2519,7 +2519,7 @@ void MEDCouplingBasicsTest1::testCMesh2() MEDCouplingUMesh *partMesh3= dynamic_cast(partMesh1->buildPartAndReduceNodes(cells3,cells3+2,arr2)); CPPUNIT_ASSERT(partMesh3); - CPPUNIT_ASSERT_EQUAL(2,partMesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); + CPPUNIT_ASSERT_EQUAL(2,(int)partMesh3->getNumberOfCellsWithType(INTERP_KERNEL::NORM_HEXA8)); CPPUNIT_ASSERT_EQUAL(12,partMesh3->getNumberOfNodes()); CPPUNIT_ASSERT_THROW(mesh1->simplexize(0),INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx index b13aeac40..32d63dd9b 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx @@ -1403,8 +1403,8 @@ void MEDCouplingBasicsTest3::testExtrudedMesh5() i->checkConsistencyLight(); CPPUNIT_ASSERT_EQUAL(36,(int)i->getNumberOfCells()); CPPUNIT_ASSERT_EQUAL(37,i->getNumberOfNodes()); - CPPUNIT_ASSERT_EQUAL(12,i->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TRI3)); - CPPUNIT_ASSERT_EQUAL(24,i->getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4)); + CPPUNIT_ASSERT_EQUAL(12,(int)i->getNumberOfCellsWithType(INTERP_KERNEL::NORM_TRI3)); + CPPUNIT_ASSERT_EQUAL(24,(int)i->getNumberOfCellsWithType(INTERP_KERNEL::NORM_QUAD4)); const double expected1[3]={0.25,0.75,2.0625}; MEDCouplingFieldDouble *j=i->getMeasureField(true); for(int ii=0;ii<12;ii++) diff --git a/src/MEDLoader/Test/SauvLoaderTest.cxx b/src/MEDLoader/Test/SauvLoaderTest.cxx index 22f86515c..9d24ecaf9 100644 --- a/src/MEDLoader/Test/SauvLoaderTest.cxx +++ b/src/MEDLoader/Test/SauvLoaderTest.cxx @@ -251,11 +251,11 @@ void SauvLoaderTest::testMed2Sauv() CPPUNIT_ASSERT( std::find(groups.begin(),groups.end(),"maa1") != groups.end() ); CPPUNIT_ASSERT_EQUAL(16,m->getSizeAtLevel(0)); MCAuto um0 = m->getMeshAtLevel(0); - CPPUNIT_ASSERT_EQUAL(12, um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TETRA4 )); - CPPUNIT_ASSERT_EQUAL(2, um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PYRA5 )); - CPPUNIT_ASSERT_EQUAL(2, um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_HEXA8 )); + CPPUNIT_ASSERT_EQUAL(12, (int)um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TETRA4 )); + CPPUNIT_ASSERT_EQUAL(2, (int)um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_PYRA5 )); + CPPUNIT_ASSERT_EQUAL(2, (int)um0->getNumberOfCellsWithType( INTERP_KERNEL::NORM_HEXA8 )); MCAuto um1 = m->getMeshAtLevel(-1); - CPPUNIT_ASSERT_EQUAL(1, um1->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 )); + CPPUNIT_ASSERT_EQUAL(1, (int)um1->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 )); //CPPUNIT_ASSERT_EQUAL(2, um1->getNumberOfCellsWithType( INTERP_KERNEL::NORM_TRI3 )); MCAuto pointeUM0 = static_cast( pointeMedMesh->getMeshAtLevel(0));