From 545868b94c2ec3d92fc2d328857f3b6e98342e03 Mon Sep 17 00:00:00 2001 From: abn Date: Tue, 15 Sep 2015 09:34:00 +0200 Subject: [PATCH] Using std::vector instead of new bool[] --- src/MEDCoupling/MEDCouplingUMesh.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 887ea5eca..96d4b34ea 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -2490,17 +2490,16 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On MEDCouplingAutoRefCountObjectPtr neigh00(tmp0); MEDCouplingAutoRefCountObjectPtr neighI00(tmp1); - // For each initial connex part of the sub-mesh (or said differently for each independent crack): int seed = 0, nIter = 0; int nIterMax = nCells2+1; // Safety net for the loop - bool * hitCells = new bool[nCells2]; - for (int iii=0; iii hitCells(nCells2); + hitCells.assign(nCells2, false); MEDCouplingAutoRefCountObjectPtr cellsToModifyConn0_torenum = DataArrayInt::New(); cellsToModifyConn0_torenum->alloc(0,1); while (nIter < nIterMax) { - if (std::find(hitCells, hitCells+nCells2, false) == hitCells+nCells2) + if (std::find(hitCells.begin(), hitCells.end(), false) == hitCells.end()) break; // Connex zone without the crack (to compute the next seed really) int dnu; @@ -2516,7 +2515,6 @@ void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1On seed = comple->getIJ(0,0); nIter++; } - delete[] hitCells; if (nIter >= nIterMax) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findNodesToDuplicate(): internal error - too many iterations."); -- 2.39.2