X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNEL%2FCellModel.cxx;h=acb6c0bfa4e37f8df8a9a81ade01f5badc1e6cfa;hb=714ec20d9675ab2c7d5530ae57656635def4e30f;hp=8b45eaadc306f0b279289ae2e87b51aeb9740f09;hpb=4cdd36386357f46bc80e2d016bf1d471517ebe0e;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/CellModel.cxx b/src/INTERP_KERNEL/CellModel.cxx index 8b45eaadc..acb6c0bfa 100644 --- a/src/INTERP_KERNEL/CellModel.cxx +++ b/src/INTERP_KERNEL/CellModel.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -29,6 +29,8 @@ #include #include +unsigned char MEDCOUPLING2VTKTYPETRADUCER[INTERP_KERNEL::NORM_MAXTYPE+1]={1,3,21,5,9,7,22,34,23,28,35,MEDCOUPLING2VTKTYPETRADUCER_NONE,MEDCOUPLING2VTKTYPETRADUCER_NONE,MEDCOUPLING2VTKTYPETRADUCER_NONE,10,14,13,MEDCOUPLING2VTKTYPETRADUCER_NONE,12,MEDCOUPLING2VTKTYPETRADUCER_NONE,24,MEDCOUPLING2VTKTYPETRADUCER_NONE,16,27,MEDCOUPLING2VTKTYPETRADUCER_NONE,26,MEDCOUPLING2VTKTYPETRADUCER_NONE,29,32,MEDCOUPLING2VTKTYPETRADUCER_NONE,25,42,36,4}; + namespace INTERP_KERNEL { const char *CellModel::CELL_TYPES_REPR[]={"NORM_POINT1", "NORM_SEG2", "NORM_SEG3", "NORM_TRI3", "NORM_QUAD4",// 0->4 @@ -449,29 +451,29 @@ namespace INTERP_KERNEL /*! * Equivalent to getNumberOfSons except that this method deals with dynamic type. */ - unsigned CellModel::getNumberOfSons2(const int *conn, int lgth) const + unsigned CellModel::getNumberOfSons2(const mcIdType *conn, mcIdType lgth) const { if(!isDynamic()) return getNumberOfSons(); if(_dim==2) { if(_type==NORM_POLYGON) - return lgth; + return FromIdType(lgth); else - return lgth/2; + return FromIdType(lgth/2); } else if(_dim==1) - return lgth;//NORM_POLYL + return FromIdType(lgth);//NORM_POLYL else - return std::count(conn,conn+lgth,-1)+1; + return (unsigned)std::count(conn,conn+lgth,-1)+1; } - unsigned CellModel::getNumberOfEdgesIn3D(const int *conn, int lgth) const + unsigned CellModel::getNumberOfEdgesIn3D(const mcIdType *conn, mcIdType lgth) const { if(!isDynamic()) return _nb_of_little_sons; else//polyhedron - return (lgth-std::count(conn,conn+lgth,-1))/2; + return FromIdType(lgth-ToIdType(std::count(conn,conn+lgth,-1)/2)); } /*! @@ -549,7 +551,7 @@ namespace INTERP_KERNEL /*! * \b WARNING this method do not manage correctly types that return true at the call of isDynamic. Use fillSonCellNodalConnectivity2 instead. */ - unsigned CellModel::fillSonCellNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn) const + unsigned CellModel::fillSonCellNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn) const { unsigned nbOfTurnLoop=_nb_of_sons_con[sonId]; const unsigned *sonConn=_sons_con[sonId]; @@ -558,7 +560,7 @@ namespace INTERP_KERNEL return nbOfTurnLoop; } - unsigned CellModel::fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const + unsigned CellModel::fillSonCellNodalConnectivity2(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const { typeOfSon=getSonType2(sonId); if(!isDynamic()) @@ -583,15 +585,15 @@ namespace INTERP_KERNEL } else if(_dim==3) {//polyedron - const int *where=nodalConn; + const mcIdType *where=nodalConn; for(int i=0;iHEXA27 */ - unsigned CellModel::fillSonCellNodalConnectivity4(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const + unsigned CellModel::fillSonCellNodalConnectivity4(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const { if(_type==NORM_HEXA8) { @@ -612,7 +614,7 @@ namespace INTERP_KERNEL return fillSonCellNodalConnectivity2(sonId,nodalConn,lgth,sonNodalConn,typeOfSon); } - unsigned CellModel::fillSonEdgesNodalConnectivity3D(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const + unsigned CellModel::fillSonEdgesNodalConnectivity3D(int sonId, const mcIdType *nodalConn, mcIdType lgth, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const { if(!isDynamic()) { @@ -639,7 +641,7 @@ namespace INTERP_KERNEL /*! * \sa getNumberOfMicroEdges */ - unsigned CellModel::fillMicroEdgeNodalConnectivity(int sonId, const int *nodalConn, int *sonNodalConn, NormalizedCellType& typeOfSon) const + unsigned CellModel::fillMicroEdgeNodalConnectivity(int sonId, const mcIdType *nodalConn, mcIdType *sonNodalConn, NormalizedCellType& typeOfSon) const { if(isQuadratic()) { @@ -680,20 +682,20 @@ namespace INTERP_KERNEL } } - void CellModel::changeOrientationOf2D(int *nodalConn, unsigned int sz) const + void CellModel::changeOrientationOf2D(mcIdType *nodalConn, unsigned int sz) const { if(sz<1) return ; if(!isQuadratic()) { - std::vector tmp(sz-1); + std::vector tmp(sz-1); std::copy(nodalConn+1,nodalConn+sz,tmp.rbegin()); std::copy(tmp.begin(),tmp.end(),nodalConn+1); } else { unsigned int sz2(sz/2); - std::vector tmp0(sz2-1),tmp1(sz2); + std::vector tmp0(sz2-1),tmp1(sz2); std::copy(nodalConn+1,nodalConn+sz2,tmp0.rbegin()); std::copy(nodalConn+sz2,nodalConn+sz,tmp1.rbegin()); std::copy(tmp0.begin(),tmp0.end(),nodalConn+1); @@ -701,7 +703,7 @@ namespace INTERP_KERNEL } } - void CellModel::changeOrientationOf1D(int *nodalConn, unsigned int sz) const + void CellModel::changeOrientationOf1D(mcIdType *nodalConn, unsigned int sz) const { if(!isDynamic()) { @@ -720,7 +722,7 @@ namespace INTERP_KERNEL } else { - std::vector tmp(sz-1); + std::vector tmp(sz-1); std::copy(nodalConn+1,nodalConn+sz,tmp.rbegin()); std::copy(tmp.begin(),tmp.end(),nodalConn+1); } @@ -732,7 +734,7 @@ namespace INTERP_KERNEL */ //================================================================================ - unsigned CellModel::getNumberOfNodesConstituentTheSon2(unsigned sonId, const int *nodalConn, int lgth) const + unsigned CellModel::getNumberOfNodesConstituentTheSon2(unsigned sonId, const mcIdType *nodalConn, mcIdType lgth) const { if(!isDynamic()) return getNumberOfNodesConstituentTheSon(sonId); @@ -746,14 +748,14 @@ namespace INTERP_KERNEL } else if(_dim==3) {//polyedron - const int *where=nodalConn; + const mcIdType *where=nodalConn; for(unsigned int i=0;i tmp(2*lgth); - std::vector::iterator it=std::copy(conn1,conn1+lgth,tmp.begin()); + std::vector tmp(2*lgth); + std::vector::iterator it=std::copy(conn1,conn1+lgth,tmp.begin()); std::copy(conn1,conn1+lgth,it); it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth); if(it==tmp.begin()) return true; if(it!=tmp.end()) return _dim!=1; - std::vector::reverse_iterator it2=std::search(tmp.rbegin(),tmp.rend(),conn2,conn2+lgth); + std::vector::reverse_iterator it2=std::search(tmp.rbegin(),tmp.rend(),conn2,conn2+lgth); if(it2!=tmp.rend()) return false; throw INTERP_KERNEL::Exception("CellModel::getOrientationStatus : Request of orientation status of non equal connectively cells !"); @@ -788,11 +790,11 @@ namespace INTERP_KERNEL { if(_dim!=1) { - std::vector tmp(lgth); - std::vector::iterator it=std::copy(conn1,conn1+lgth/2,tmp.begin()); + std::vector tmp(lgth); + std::vector::iterator it=std::copy(conn1,conn1+lgth/2,tmp.begin()); std::copy(conn1,conn1+lgth/2,it); it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth/2); - int d=std::distance(tmp.begin(),it); + std::size_t d=std::distance(tmp.begin(),it); if(it==tmp.end()) return false; it=std::copy(conn1+lgth/2,conn1+lgth,tmp.begin()); @@ -800,17 +802,17 @@ namespace INTERP_KERNEL it=std::search(tmp.begin(),tmp.end(),conn2,conn2+lgth); if(it==tmp.end()) return false; - int d2=std::distance(tmp.begin(),it); + std::size_t d2=std::distance(tmp.begin(),it); return d==d2; } else { - int p=(lgth+1)/2; - std::vector tmp(2*p); - std::vector::iterator it=std::copy(conn1,conn1+p,tmp.begin()); + mcIdType p=(lgth+1)/2; + std::vector tmp(2*p); + std::vector::iterator it=std::copy(conn1,conn1+p,tmp.begin()); std::copy(conn1,conn1+p,it); it=std::search(tmp.begin(),tmp.end(),conn2,conn2+p); - int d=std::distance(tmp.begin(),it); + std::size_t d=std::distance(tmp.begin(),it); if(it==tmp.end()) return false; tmp.resize(2*p-2); @@ -819,7 +821,7 @@ namespace INTERP_KERNEL it=std::search(tmp.begin(),tmp.end(),conn2+p,conn2+lgth); if(it==tmp.end()) return false; - int d2=std::distance(tmp.begin(),it); + std::size_t d2=std::distance(tmp.begin(),it); return d==d2; } }