From: Anthony Geay Date: Mon, 29 May 2017 09:50:16 +0000 (+0200) Subject: Bo be checked by Adrien X-Git-Tag: V8_4_0a1~32 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1beb4793f842bfe30ed58af1f89af125713afd71;p=tools%2Fmedcoupling.git Bo be checked by Adrien --- diff --git a/src/MEDCoupling/MEDCouplingSkyLineArray.cxx b/src/MEDCoupling/MEDCouplingSkyLineArray.cxx index ffb964e1f..f270ddf16 100644 --- a/src/MEDCoupling/MEDCouplingSkyLineArray.cxx +++ b/src/MEDCoupling/MEDCouplingSkyLineArray.cxx @@ -24,7 +24,7 @@ using namespace MEDCoupling; MEDCouplingSkyLineArray::MEDCouplingSkyLineArray(): - _index( DataArrayInt::New() ), _values( DataArrayInt::New() ), _super_index( DataArrayInt::New() ) + _super_index( DataArrayInt::New() ), _index( DataArrayInt::New() ), _values( DataArrayInt::New() ) { } @@ -76,9 +76,9 @@ MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( cons const int * cP(c->begin()), * cIP(cI->begin()); int prev = -1; - if (c->getNbOfElems() != *(cI->end()-1)) + if ((int)c->getNbOfElems() != *(cI->end()-1)) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::BuildFromDynamicConn: misformatted connectivity (wrong nb of tuples)!"); - for (int i=0; i < cI->getNbOfElems(); i++) + for (std::size_t i=0; i < cI->getNbOfElems(); i++) { int j = cIP[i]; if (cIP[i] < prev) @@ -95,7 +95,7 @@ MEDCouplingSkyLineArray * MEDCouplingSkyLineArray::BuildFromPolyhedronConn( cons superIdx.push_back(0); idx.push_back(0); vals.resize(c->getNbOfElems()); // too much because of the type and the -1, but still better than push_back(). - for (int i=0; i < cI->getNbOfElems()-1; i++) + for (std::size_t i=0; i < cI->getNbOfElems()-1; i++) { int start = cIP[i]+1, end = cIP[i+1]; int * work = vals.data() + cnt; @@ -145,7 +145,7 @@ void MEDCouplingSkyLineArray::convertToPolyhedronConn( MCAuto& c, c->alloc(sz, 1); int * cVecP(c->getPointer()); - for (int i=0; i < _super_index->getNbOfElems()-1; i++) + for ( std::size_t i=0; i < _super_index->getNbOfElems()-1; i++) { cIVecP[i]= cnt; int endId = siP[i+1]; @@ -197,18 +197,18 @@ void MEDCouplingSkyLineArray::set3( DataArrayInt* superIndex, DataArrayInt* inde DataArrayInt* MEDCouplingSkyLineArray::getSuperIndexArray() const { - return ((MEDCouplingSkyLineArray*)this)->_super_index; + return const_cast(this)->_super_index; } DataArrayInt* MEDCouplingSkyLineArray::getIndexArray() const { - return ((MEDCouplingSkyLineArray*)this)->_index; + return const_cast(this)->_index; } DataArrayInt* MEDCouplingSkyLineArray::getValuesArray() const { - return ((MEDCouplingSkyLineArray*)this)->_values; + return const_cast(this)->_values; } void MEDCouplingSkyLineArray::checkSuperIndex(const std::string& func) const @@ -223,7 +223,7 @@ void MEDCouplingSkyLineArray::checkSuperIndex(const std::string& func) const void MEDCouplingSkyLineArray::validSuperIndex(const std::string& func, int superIndex) const { - if(superIndex < 0 || superIndex >= _super_index->getNbOfElems()) + if(superIndex < 0 || superIndex >= (int)_super_index->getNbOfElems()) { std::ostringstream oss; oss << "MEDCouplingSkyLineArray::" << func << ": invalid super index!"; @@ -233,7 +233,7 @@ void MEDCouplingSkyLineArray::validSuperIndex(const std::string& func, int super void MEDCouplingSkyLineArray::validIndex(const std::string& func, int idx) const { - if(idx < 0 || idx >= _index->getNbOfElems()) + if(idx < 0 || idx >= (int)_index->getNbOfElems()) { std::ostringstream oss; oss << "MEDCouplingSkyLineArray::" << func << ": invalid index!"; @@ -245,7 +245,7 @@ void MEDCouplingSkyLineArray::validSuperIndexAndIndex(const std::string& func, i { validSuperIndex(func, superIndex); int idx = _super_index->begin()[superIndex] + index; - if(idx < 0 || idx >= _index->getNbOfElems()) + if(idx < 0 || idx >= (int)_index->getNbOfElems()) { std::ostringstream oss; oss << "MEDCouplingSkyLineArray::" << func << ": invalid index!"; @@ -315,7 +315,7 @@ std::string MEDCouplingSkyLineArray::simpleRepr() const */ void MEDCouplingSkyLineArray::getSimplePackSafe(const int absolutePackId, std::vector & pack) const { - if(absolutePackId < 0 || absolutePackId >= _index->getNbOfElems()) + if(absolutePackId < 0 || absolutePackId >= (int)_index->getNbOfElems()) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::getPackSafe: invalid index!"); const int * iP(_index->begin()), *vP(_values->begin()); int sz = iP[absolutePackId+1]-iP[absolutePackId]; @@ -328,7 +328,7 @@ void MEDCouplingSkyLineArray::getSimplePackSafe(const int absolutePackId, std::v */ const int * MEDCouplingSkyLineArray::getSimplePackSafePtr(const int absolutePackId, int & packSize) const { - if(absolutePackId < 0 || absolutePackId >= _index->getNbOfElems()) + if(absolutePackId < 0 || absolutePackId >= (int)_index->getNbOfElems()) throw INTERP_KERNEL::Exception("MEDCouplingSkyLineArray::getPackSafe: invalid index!"); const int * iP(_index->begin()), *vP(_values->begin()); packSize = iP[absolutePackId+1]-iP[absolutePackId]; @@ -404,7 +404,7 @@ void MEDCouplingSkyLineArray::deletePack(const int superIdx, const int idx) iP[ii] -= (end-start); // _super_index - for(int ii = superIdx+1; ii < _super_index->getNbOfElems(); ii++) + for(int ii = superIdx+1; ii < (int)_super_index->getNbOfElems(); ii++) (siP[ii])--; } @@ -438,7 +438,7 @@ void MEDCouplingSkyLineArray::pushBackPack(const int superIdx, const int * packB iP[ii] += sz; // _super_index - for(int ii = superIdx+1; ii < _super_index->getNbOfElems(); ii++) + for(int ii = superIdx+1; ii < (int)_super_index->getNbOfElems(); ii++) (siP[ii])++; } @@ -473,7 +473,7 @@ void MEDCouplingSkyLineArray::replaceSimplePack(const int idx, const int * packB copy(packBg, packEnd, _values->getPointer()+start); // _index - for(int ii = idx+1; ii < _index->getNbOfElems(); ii++) + for(int ii = idx+1; ii < (int)_index->getNbOfElems(); ii++) iP[ii] += deltaSz; } @@ -509,6 +509,6 @@ void MEDCouplingSkyLineArray::replacePack(const int superIdx, const int idx, con copy(packBg, packEnd, _values->getPointer()+start); // _index - for(int ii = siP[superIdx]+idx+1; ii < _index->getNbOfElems(); ii++) + for(int ii = siP[superIdx]+idx+1; ii < (int)_index->getNbOfElems(); ii++) iP[ii] += deltaSz; } diff --git a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx index 61fc0913e..7a6fa9159 100644 --- a/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh_intersection.cxx @@ -1400,7 +1400,7 @@ void MEDCouplingUMesh::buildSubCellsFromCut(const std::vector< std::pair& p=cut3DSurf[desc[offset+j]]; @@ -2123,7 +2123,6 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) if(_types.size() != 1 || *(_types.begin()) != INTERP_KERNEL::NORM_POLYHED) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::conformize3D : This method only works for polyhedrons! Call convertAllToPoly first."); - int *c(getNodalConnectivity()->getPointer()),*cI(getNodalConnectivityIndex()->getPointer()); MCAuto connSla(MEDCouplingSkyLineArray::BuildFromPolyhedronConn(getNodalConnectivity(), getNodalConnectivityIndex())); const double * coo(_coords->begin()); MCAuto ret(DataArrayInt::New()); @@ -2140,8 +2139,8 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) // Build BBTree MCAuto bboxArr(mDesc->getBoundingBoxForBBTree()); - const double *bbox(bboxArr->begin()),*coords(getCoords()->begin()); - int nCell=getNumberOfCells(), nDescCell=mDesc->getNumberOfCells(); + const double *bbox(bboxArr->begin()); getCoords()->begin(); + int nDescCell(mDesc->getNumberOfCells()); BBTree myTree(bbox,0,0,nDescCell,-eps); // Surfaces - handle biggest first MCAuto surfF = mDesc->getMeasureField(true); @@ -2170,11 +2169,11 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) vector candidates, cands2; myTree.getIntersectingElems(bbox+faceIdx*2*SPACEDIM,candidates); // Keep only candidates whose normal matches the normal of current face - for(vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + for(vector::const_iterator it2=candidates.begin();it2!=candidates.end();it2++) { - bool col = INTERP_KERNEL::isColinear3D(normalsP + faceIdx*SPACEDIM, normalsP + *(it)*SPACEDIM, eps); - if (*it != faceIdx && col) - cands2.push_back(*it); + bool col = INTERP_KERNEL::isColinear3D(normalsP + faceIdx*SPACEDIM, normalsP + *(it2)*SPACEDIM, eps); + if (*it2 != faceIdx && col) + cands2.push_back(*it2); } if (!cands2.size()) continue; @@ -2233,9 +2232,9 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) const int * idsGoodPlaneP(idsGoodPlane->begin()); for (const int * ii = ids->begin(); ii != ids->end(); ii++) { - int faceIdx = cands2[idsGoodPlaneP[*ii]]; - hit[faceIdx] = true; - checkSurf += surfs->begin()[faceIdx]; + int faceIdx2 = cands2[idsGoodPlaneP[*ii]]; + hit[faceIdx2] = true; + checkSurf += surfs->begin()[faceIdx2]; } if (fabs(checkSurf - surfs->begin()[faceIdx]) > eps) { @@ -2256,7 +2255,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) connSla->findPackIds(polyIndices, sIdxConn, sIdxConnE, packsIds); // Deletion of old faces int jj=0; - for (vector::const_iterator it=polyIndices.begin(); it!=polyIndices.end(); ++it, ++jj) + for (vector::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2, ++jj) { if (packsIds[jj] == -1) // The below should never happen - if a face is used several times, with a different layout of the nodes @@ -2264,18 +2263,18 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) // faces which are actually used only once, by a single cell. This is different for edges below. throw INTERP_KERNEL::Exception("MEDCouplingUMesh::conformize3D: Could not find face in connectivity! Internal error."); else - connSla->deletePack(*it, packsIds[jj]); + connSla->deletePack(*it2, packsIds[jj]); } // Insertion of new faces: for (const int * ii = ids->begin(); ii != ids->end(); ii++) { // Build pack from the face to insert: - int faceIdx = cands2[idsGoodPlane->getIJ(*ii,0)]; + int faceIdx2 = cands2[idsGoodPlane->getIJ(*ii,0)]; int facePack2Sz; - const int * facePack2 = connSlaDesc->getSimplePackSafePtr(faceIdx, facePack2Sz); // contains the type! + const int * facePack2 = connSlaDesc->getSimplePackSafePtr(faceIdx2, facePack2Sz); // contains the type! // Insert it in all hit polyhedrons: - for (vector::const_iterator it=polyIndices.begin(); it!=polyIndices.end(); ++it) - connSla->pushBackPack(*it, facePack2+1, facePack2+facePack2Sz); // without the type + for (vector::const_iterator it2=polyIndices.begin(); it2!=polyIndices.end(); ++it2) + connSla->pushBackPack(*it2, facePack2+1, facePack2+facePack2Sz); // without the type } } } // end step1 @@ -2288,7 +2287,7 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) { /************************ * STEP 2 -- edges - /************************/ + ************************/ // Now we have a face-conform mesh. // Recompute descending @@ -2341,17 +2340,17 @@ DataArrayInt *MEDCouplingUMesh::conformize3D(double eps) unsigned start = cDesc2[cIDesc2[eIdx]+1], end = cDesc2[cIDesc2[eIdx]+2]; for (int i3=0; i3 < 3; i3++) // TODO: use fillSonCellNodalConnectivity2 or similar? vCurr[i3] = coo[start*SPACEDIM+i3] - coo[end*SPACEDIM+i3]; - for(vector::const_iterator it=candidates.begin();it!=candidates.end();it++) + for(vector::const_iterator it2=candidates.begin();it2!=candidates.end();it2++) { double vOther[3]; - unsigned start2 = cDesc2[cIDesc2[*it]+1], end2 = cDesc2[cIDesc2[*it]+2]; + unsigned start2 = cDesc2[cIDesc2[*it2]+1], end2 = cDesc2[cIDesc2[*it2]+2]; for (int i3=0; i3 < 3; i3++) vOther[i3] = coo[start2*SPACEDIM+i3] - coo[end2*SPACEDIM+i3]; bool col = INTERP_KERNEL::isColinear3D(vCurr, vOther, eps); // Warning: different from faces: we need to keep eIdx in the final list of candidates because we need // to have its nodes inside the sub mesh mPartCand below (needed in OrderPointsAlongLine()) if (col) - cands2.push_back(*it); + cands2.push_back(*it2); } if (cands2.size() == 1 && cands2[0] == eIdx) // see warning above continue;