From 0a68c72a271c88d7d9f558de71acf3940bd1dd4f Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Mon, 6 Feb 2017 08:52:20 +0100 Subject: [PATCH] Management of 3D surf voronoi for Gauss --- src/MEDCoupling/MEDCouplingFieldDouble.cxx | 15 +++---- .../MEDCouplingGaussLocalization.cxx | 8 ++-- .../MEDCouplingBasicsTest5.py | 41 +++++++++++++++++++ 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index 96e977352..2b51bd607 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -2212,16 +2212,13 @@ MCAuto MEDCouplingFieldDouble::voronoize(double eps) con checkConsistencyLight(); const MEDCouplingMesh *mesh(getMesh()); INTERP_KERNEL::AutoCppPtr vor; - if(mesh->getSpaceDimension()==2 && mesh->getSpaceDimension()==2) - { - vor=new Voronizer2D; - } - else if(mesh->getSpaceDimension()==3 && mesh->getSpaceDimension()==3) - { - vor=new Voronizer3D; - } + int meshDim(mesh->getMeshDimension()),spaceDim(mesh->getSpaceDimension()); + if(meshDim==2 && (spaceDim==2 || spaceDim==3)) + vor=new Voronizer2D; + else if(meshDim==3 && spaceDim==3) + vor=new Voronizer3D; else - throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::voronoize : only 2D and 3D are supported for the moment !"); + throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::voronoize : only 2D, 3D surf, and 3D are supported for the moment !"); return voronoizeGen(vor,eps); } diff --git a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx index f75cd82a8..6c69fa0c6 100644 --- a/src/MEDCoupling/MEDCouplingGaussLocalization.cxx +++ b/src/MEDCoupling/MEDCouplingGaussLocalization.cxx @@ -218,9 +218,9 @@ MCAuto MEDCouplingGaussLocalization::localizePtsInRefCooForEach // int nbPts(ptsInRefCoo->getNumberOfTuples()); INTERP_KERNEL::NormalizedCellType typ(getType()); - int dim(INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension()); + int dim(INTERP_KERNEL::CellModel::GetCellModel(typ).getDimension()),outDim(mesh->getSpaceDimension()); MCAuto ret(DataArrayDouble::New()); - ret->alloc(nbPts*nbCells,dim); + ret->alloc(nbPts*nbCells,outDim); double *retPtr(ret->getPointer()); if(dim!=ptsInRefCoo->getNumberOfComponents()) throw INTERP_KERNEL::Exception("MEDCouplingGaussLocalization::localizePtsInRefCooForEachCell : number of components of input coo is not equal to dim of element !"); @@ -228,8 +228,8 @@ MCAuto MEDCouplingGaussLocalization::localizePtsInRefCooForEach INTERP_KERNEL::GaussCoords calculator; calculator.addGaussInfo(typ,dim, ptsInRefCoo->begin(),nbPts,&_ref_coord[0],getNumberOfPtsInRefCell()); // - for(int i=0;i