From: Anthony Geay Date: Fri, 24 Jan 2020 17:04:41 +0000 (+0100) Subject: Avoid regression on Voronoi cell computation X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7398df68f6c6cfb0c1ab02203cc1f729d63ad0c8;p=tools%2Fmedcoupling.git Avoid regression on Voronoi cell computation --- diff --git a/src/MEDCoupling/MEDCouplingVoronoi.cxx b/src/MEDCoupling/MEDCouplingVoronoi.cxx index 80e1b0e3d..16dbe2e58 100755 --- a/src/MEDCoupling/MEDCouplingVoronoi.cxx +++ b/src/MEDCoupling/MEDCouplingVoronoi.cxx @@ -21,6 +21,7 @@ #include "MEDCouplingVoronoi.hxx" #include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingCMesh.hxx" +#include "MEDCouplingFieldDouble.hxx" #include "MCAuto.txx" #include "MEDCouplingNormalizedUnstructuredMesh.txx" @@ -90,6 +91,11 @@ MCAuto ComputeBigCellFrom(const double pt1[2], const double pt throw INTERP_KERNEL::Exception("ComputeBigCellFrom : expected single element !"); MCAuto ret(sp2->buildPartOfMySelfSlice(ccp[0],ccp[0]+1,1,true)); ret->zipCoords(); + { + MCAuto tmp(ret->getMeasureField(false)); + if(tmp->getArray()->getIJ(0,0)<0) + ret->invertOrientationOfAllCells(); + } return ret; } @@ -424,6 +430,11 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * newVorCell->zipCoords(); MCAuto modifiedCell(a->buildPartOfMySelf(part->begin(),part->end())); modifiedCell->zipCoords(); + { + MCAuto tmp(modifiedCell->getMeasureField(false)); + if(tmp->getArray()->getIJ(0,0)<0) + modifiedCell->invertOrientationOfAllCells(); + } l0[poly]=modifiedCell; // MCAuto ids; @@ -455,7 +466,13 @@ MCAuto MEDCoupling::Voronizer2D::doIt(const MEDCouplingUMesh * } newVorCells.push_back(newVorCell); } - l0.push_back(MergeVorCells(newVorCells,eps)); + MCAuto mergedVorCell(MergeVorCells(newVorCells,eps)); + { + MCAuto tmp(mergedVorCell->getMeasureField(false)); + if(tmp->getArray()->getIJ(0,0)<0) + mergedVorCell->invertOrientationOfAllCells(); + } + l0.push_back(mergedVorCell); } std::vector< const MEDCouplingUMesh * > l0Bis(VecAutoToVecOfCstPt(l0)); MCAuto ret(MEDCouplingUMesh::MergeUMeshes(l0Bis));