From c1a99376f5e8a6804d29ea0b42057ac87fd9890c Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Thu, 23 Feb 2017 09:25:16 +0100 Subject: [PATCH] Voronoi deal with quadratic meshes + FieldDouble::convertQuadToLinear works with GAUSS_PT + bug correction on MEDCouplingUMesh::clipSingle3DCellByPlane --- src/INTERP_KERNEL/GaussPoints/CleanUpGauss.py | 78 ++++ .../GaussPoints/InterpKernelGaussCoords.cxx | 411 ++++++++++-------- .../GaussPoints/InterpKernelGaussCoords.hxx | 13 +- src/MEDCoupling/MEDCouplingFieldDouble.cxx | 86 +++- src/MEDCoupling/MEDCouplingUMesh.cxx | 10 +- .../MEDCouplingBasicsTest5.py | 69 ++- 6 files changed, 470 insertions(+), 197 deletions(-) create mode 100644 src/INTERP_KERNEL/GaussPoints/CleanUpGauss.py diff --git a/src/INTERP_KERNEL/GaussPoints/CleanUpGauss.py b/src/INTERP_KERNEL/GaussPoints/CleanUpGauss.py new file mode 100644 index 000000000..3e1b43a65 --- /dev/null +++ b/src/INTERP_KERNEL/GaussPoints/CleanUpGauss.py @@ -0,0 +1,78 @@ +# Copyright (C) 2007-2017 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 +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# Author : Anthony Geay (EDF R&D) + +import re + +s1=1080 +s2=1104 +f=file("InterpKernelGaussCoords.cxx","r") +lines=[elt[:-1] for elt in f.readlines()[s1:s2]] +pat0=re.compile("void[\s]+GaussInfo\:\:([^\(]+)\([\s]*\)[\s]*$") +pat1=re.compile("[\s]*\{[\s]*$") +pat2=re.compile("[\s]+LOCAL_COORD_MACRO_BEGIN[\s]*\;[\s]*$") +m0=pat0.match(lines[0]) +m1=pat1.match(lines[1]) +m2=pat2.match(lines[2]) +if (not m0) or (not m1) or (not m2): + raise Exception("Invalid first lines") +offsetLines=3 +patEnd=re.compile("[\s]+LOCAL_COORD_MACRO_END[\s]*\;[\s]*$") +mEnd=patEnd.match(lines[-1]) +if not mEnd: + raise Exception("Invalid end lines") +# +nbLines=len(lines)-4 +casePat=re.compile("[\s]+case[\s]+([\d]+)\:[\s]*$") +entries=filter(lambda (i,x): casePat.match(x),enumerate(lines[offsetLines:-1])) +# +nbPts=len(entries) +if nbLines%nbPts!=0: + raise Exception("Invalid lines nb !") +dim=nbLines/nbPts-2 +if dim<1 or dim>3: + raise Exception("Ooops invalid dim !") +entries=[(i,int(casePat.match(elt).group(1))) for i,elt in entries] +assert(set([elt[1] for elt in entries])==set(range(nbPts))) +# +partEndEntries=re.compile("[\s]*break[\s]*\;[\s]*$") +zePat=re.compile("[\s]+coords\[([\d]+)\][\s]*=[\s]*([\d]+[\.]?[\d]*)[\s]*\;[\s]*$") +zeTab=(nbPts*dim)*[None] +for lineId,ptId in entries: + endLine=lines[offsetLines+lineId+1+dim] + assert(partEndEntries.match(endLine)) + for j in xrange(dim): + curLine=lines[offsetLines+lineId+1+j] + m=zePat.match(curLine) + assert(m) + assert(int(m.group(1))==j) + zeTab[ptId*dim+j]=m.group(2) + pass + pass +assert(None not in zeTab) +patInit="Init" +assert(m0.group(1)[-len(patInit):]==patInit) +varName="%s_REF"%((m0.group(1)[:-len(patInit)]).upper()) +print("const double %s[%d]={%s};"%(varName,len(zeTab),", ".join(zeTab))) +for i in xrange(nbPts): + print(" case %d:"%(i)) + for j in xrange(dim): + print(" coords[%d] = %s[%d];"%(j,varName,i*dim+j)) + pass + print(" break;") + diff --git a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx index 357e92093..bc39b9d30 100644 --- a/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx +++ b/src/INTERP_KERNEL/GaussPoints/InterpKernelGaussCoords.cxx @@ -28,6 +28,15 @@ using namespace INTERP_KERNEL; +const double GaussInfo::TETRA4A_REF[12]={0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0}; + +const double GaussInfo::TETRA4B_REF[12]={0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0}; + +const double GaussInfo::TETRA10A_REF[30]={0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.5, 0.0, 0.5, 0.0, 0.5, 0.5, 0.0, 0.0}; + +const double GaussInfo::TETRA10B_REF[30]={0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.5, 0.0, 0.5, 0.5, 0.5, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.0, 0.5}; + + //Define common part of the code in the MACRO //--------------------------------------------------------------- #define LOCAL_COORD_MACRO_BEGIN \ @@ -159,6 +168,42 @@ int GaussInfo::getNbRef() const return _my_nb_ref; } +GaussInfo GaussInfo::convertToLinear() const +{ + switch(_my_geometry) + { + case NORM_TETRA10: + { + std::vector a(TETRA10A_REF,TETRA10A_REF+30),b(TETRA10B_REF,TETRA10B_REF+30); + if(IsSatisfy(a,_my_reference_coord)) + { + std::vector c(TETRA4A_REF,TETRA4A_REF+12); + return GaussInfo(NORM_TETRA4,_my_gauss_coord,getNbGauss(),c,4); + } + if(IsSatisfy(b,_my_reference_coord)) + { + std::vector c(TETRA4B_REF,TETRA4B_REF+12); + return GaussInfo(NORM_TETRA4,_my_gauss_coord,getNbGauss(),c,4); + } + throw INTERP_KERNEL::Exception("GaussInfo::convertToLinear : not recognized pattern for TETRA10 !"); + } + default: + throw INTERP_KERNEL::Exception("GaussInfo::convertToLinear : not implemented yet for other types than TETRA10 !"); + } +} + + +bool GaussInfo::IsSatisfy(const std::vector& ref1, const std::vector& ref2) +{ + std::size_t sz(ref1.size()); + if(sz!=ref2.size()) + return false; + for(std::size_t i=0;i NormalizeCoordinatesIfNecessary(NormalizedCellType ct, int inputDim, const std::vector& inputArray); - protected: + public: + static const double TETRA4A_REF[12]; + static const double TETRA4B_REF[12]; + static const double TETRA10A_REF[30]; + static const double TETRA10B_REF[30]; + protected: + static bool IsSatisfy(const std::vector& ref1, const std::vector& ref2); bool isSatisfy(); void point1Init(); diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index e5b4a4711..c4841f062 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -30,6 +30,7 @@ #include "MEDCouplingNatureOfField.hxx" #include "InterpKernelAutoPtr.hxx" +#include "InterpKernelGaussCoords.hxx" #include #include @@ -2264,8 +2265,70 @@ MCAuto MEDCouplingFieldDouble::convertQuadraticCellsToLi ret->copyAllTinyAttrFrom(this); return ret; } + case ON_GAUSS_PT: + { + const MEDCouplingMesh *mesh(getMesh()); + if(!mesh) + throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::convertQuadraticCellsToLinear : null mesh !"); + MCAuto umesh(mesh->buildUnstructured()); + std::set gt(umesh->getAllGeoTypes()); + MCAuto ret(MEDCouplingFieldDouble::New(ON_GAUSS_PT)); + // + const MEDCouplingFieldDiscretization *disc(getDiscretization()); + const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast(disc)); + if(!disc2) + throw INTERP_KERNEL::Exception("convertQuadraticCellsToLinear : Not a ON_GAUSS_PT field"); + std::set gt2(umesh->getAllGeoTypes()); + const DataArrayDouble *arr(getArray()); + std::vector< MCAuto > cellIdsV; + std::vector< MCAuto > meshesV; + std::vector< MEDCouplingGaussLocalization > glV; + bool isZipReq(false); + for(std::set::const_iterator it=gt.begin();it!=gt.end();it++) + { + const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(*it)); + MCAuto cellIds(umesh->giveCellsWithType(*it)); + cellIdsV.push_back(cellIds); + MCAuto part(umesh->buildPartOfMySelf(cellIds->begin(),cellIds->end())); + int id(disc2->getGaussLocalizationIdOfOneType(*it)); + const MEDCouplingGaussLocalization& gl(disc2->getGaussLocalization(id)); + if(!cm.isQuadratic()) + { + glV.push_back(gl); + } + else + { + isZipReq=true; + part->convertQuadraticCellsToLinear(); + INTERP_KERNEL::GaussInfo gi(*it,gl.getGaussCoords(),gl.getNumberOfGaussPt(),gl.getRefCoords(),gl.getNumberOfPtsInRefCell()); + INTERP_KERNEL::GaussInfo gi2(gi.convertToLinear()); + MEDCouplingGaussLocalization gl2(gi2.getGeoType(),gi2.getRefCoords(),gi2.getGaussCoords(),gl.getWeights()); + glV.push_back(gl2); + } + meshesV.push_back(part); + } + // + { + std::vector< const MEDCouplingUMesh * > meshesPtr(VecAutoToVecOfCstPt(meshesV)); + umesh=MEDCouplingUMesh::MergeUMeshesOnSameCoords(meshesPtr); + std::vector< const DataArrayInt * > zeCellIds(VecAutoToVecOfCstPt(cellIdsV)); + MCAuto zeIds(DataArrayInt::Aggregate(zeCellIds)); + umesh->renumberCells(zeIds->begin()); + umesh->setName(mesh->getName()); + } + // + if(isZipReq) + umesh->zipCoords(); + ret->setArray(const_cast(getArray())); + ret->setMesh(umesh); + for(std::vector< MEDCouplingGaussLocalization >::const_iterator it=glV.begin();it!=glV.end();it++) + ret->setGaussLocalizationOnType((*it).getType(),(*it).getRefCoords(),(*it).getGaussCoords(),(*it).getWeights()); + ret->copyAllTinyAttrFrom(this); + ret->checkConsistencyLight(); + return ret; + } default: - throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::convertQuadraticCellsToLinear : Only available for fields on nodes !"); + throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::convertQuadraticCellsToLinear : Only available for fields on nodes and on cells !"); } } @@ -3140,9 +3203,20 @@ MCAuto MEDCouplingFieldDouble::voronoizeGen(const Voroni checkConsistencyLight(); if(!vor) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::voronoizeGen : null pointer !"); - const MEDCouplingMesh *inpMesh(getMesh()); + MCAuto fieldToWO; + const MEDCouplingMesh *inpMeshBase(getMesh()); + MCAuto inpMesh(inpMeshBase->buildUnstructured()); + std::string meshName(inpMesh->getName()); + if(!inpMesh->isPresenceOfQuadratic()) + fieldToWO=clone(false); + else + { + fieldToWO=convertQuadraticCellsToLinear(); + inpMeshBase=fieldToWO->getMesh(); + inpMesh=inpMeshBase->buildUnstructured(); + } int nbCells(inpMesh->getNumberOfCells()); - const MEDCouplingFieldDiscretization *disc(getDiscretization()); + const MEDCouplingFieldDiscretization *disc(fieldToWO->getDiscretization()); const MEDCouplingFieldDiscretizationGauss *disc2(dynamic_cast(disc)); if(!disc2) throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::voronoize2D : Not a ON_GAUSS_PT field"); @@ -3165,8 +3239,7 @@ MCAuto MEDCouplingFieldDouble::voronoizeGen(const Voroni MCAuto ptsInReal; disc2->getCellIdsHavingGaussLocalization(i,ids); { - MCAuto tmp4(inpMesh->buildUnstructured()); - MCAuto subMesh(tmp4->buildPartOfMySelf(&ids[0],&ids[0]+ids.size())); + MCAuto subMesh(inpMesh->buildPartOfMySelf(&ids[0],&ids[0]+ids.size())); ptsInReal=gl.localizePtsInRefCooForEachCell(vorCellsForCurDisc->getCoords(),subMesh); } int nbPtsPerCell(vorCellsForCurDisc->getNumberOfNodes()); @@ -3180,10 +3253,11 @@ MCAuto MEDCouplingFieldDouble::voronoizeGen(const Voroni } std::vector< const MEDCouplingUMesh * > cellsPtr(VecAutoToVecOfCstPt(cells)); MCAuto outMesh(MEDCouplingUMesh::MergeUMeshes(cellsPtr)); + outMesh->setName(meshName); MCAuto onCells(MEDCouplingFieldDouble::New(ON_CELLS)); onCells->setMesh(outMesh); { - MCAuto arr(getArray()->deepCopy()); + MCAuto arr(fieldToWO->getArray()->deepCopy()); onCells->setArray(arr); } onCells->setTimeUnit(getTimeUnit()); diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 31d99c69d..2757c52ae 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -3628,7 +3628,12 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double std::vector cut3DCurve(mDesc1->getNumberOfCells(),-2); for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++) cut3DCurve[*it]=-1; - mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve); + bool sameNbNodes; + { + int oldNbNodes(mDesc1->getNumberOfNodes()); + mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve); + sameNbNodes=(mDesc1->getNumberOfNodes()==oldNbNodes); + } std::vector< std::pair > cut3DSurf(mDesc2->getNumberOfCells()); AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,mDesc2->getNodalConnectivity()->begin(),mDesc2->getNodalConnectivityIndex()->begin(), mDesc1->getNodalConnectivity()->begin(),mDesc1->getNodalConnectivityIndex()->begin(), @@ -3644,7 +3649,7 @@ MCAuto MEDCouplingUMesh::clipSingle3DCellByPlane(const double std::vector > res; buildSubCellsFromCut(cut3DSurf,desc2->begin(),descIndx2->begin(),mDesc1->getCoords()->begin(),eps,res); std::size_t sz(res.size()); - if(res.size()==mDesc1->getNumberOfCells()) + if(res.size()==mDesc1->getNumberOfCells() && sameNbNodes) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::clipSingle3DCellByPlane : cell is not clipped !"); for(std::size_t i=0;i MEDCouplingUMesh::clipSingle3DCellByPlane(const double conn2I->pushBackSilent(conn2->getNumberOfTuples()); ret2->setConnectivity(conn2,conn2I,true); ret2->checkConsistencyLight(); - ret2->writeVTK("ret2.vtu"); ret2->orientCorrectlyPolyhedrons(); return ret2; } diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py index bb4c1e205..e86056ca3 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest5.py @@ -4704,10 +4704,11 @@ class MEDCouplingBasicsTest5(unittest.TestCase): # fieldOnCell=field.voronoize(1e-12) # hot point fieldOnCell.checkConsistencyLight() + fieldOnCell.writeVTK("tt.vtu") self.assertEqual(fieldOnCell.getMesh().getNumberOfCells(),7) - self.assertEqual(fieldOnCell.getMesh().getNumberOfNodes(),32) + self.assertEqual(fieldOnCell.getMesh().getNumberOfNodes(),34) self.assertTrue(fieldOnCell.getArray().isEqual(field.getArray(),1e-12)) - meaRef=DataArrayDouble([1.3,1.0,1.1975,1.36,1.4775,0.8,0.865]) + meaRef=DataArrayDouble([1.3,0.9421428571428572,1.1975,1.36,1.4775,0.8,0.922857142857143]) mea=fieldOnCell.getMesh().getMeasureField(True).getArray() self.assertTrue(mea.isEqual(meaRef,1e-12))# the first important test is here self.assertEqual(field.getDiscretization().getNbOfGaussLocalization(),1) @@ -4718,7 +4719,7 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertTrue(a.isIota(7))# the second important test is here ! Check that Gauss points are inside the associated cell in fieldOnCell ! self.assertTrue(b.isIota(8)) # - self.assertEqual(fieldOnCell.getMesh().buildDescendingConnectivity()[0].getNumberOfCells(),2*7+22)# last little test to reduce chance of errors. For humans there 21 but last tiny edge is split into 2 subedges due to alg + self.assertEqual(fieldOnCell.getMesh().buildDescendingConnectivity()[0].getNumberOfCells(),2*7+21) pass def testVoronoi3DSurf_1(self): @@ -4875,6 +4876,68 @@ class MEDCouplingBasicsTest5(unittest.TestCase): self.assertEqual(m2.getName(),"Mesh") pass + def testVoronoi3D_3(self): + """Non regression test to check MEDCouplingUMesh::clipSingle3DCellByPlane""" + coo=DataArrayDouble([0.,1.,0.,0.,0.,0.,0.,0.,1.,1.,0.,0.],4,3) + m=MEDCouplingUMesh("mesh",3) + m.setCoords(coo) ; m.allocateCells() + m.insertNextCell(NORM_TETRA4,[0,2,3,1]) + f=MEDCouplingFieldDouble(ON_GAUSS_PT) + f.setMesh(m) ; f.setName("field") + f.setGaussLocalizationOnType(NORM_TETRA4,[0.,1.,0.,0.,0.,0.,0.,0.,1.,1.,0.,0.],[0.1381966011250105, 0.1381966011250105, 0.1381966011250105, 0.1381966011250105, 0.1381966011250105, 0.5854101966249685, 0.1381966011250105, 0.5854101966249685, 0.1381966011250105, 0.5854101966249685, 0.1381966011250105, 0.1381966011250105], [0.041667,0.041667,0.041667,0.041667]) + f.setArray(DataArrayDouble([0,1,2,3])) + f3=f.voronoize(1e-12) + ref=DataArrayDouble([0.047256836610416179,0.03980327668541684,0.039803276685416833,0.039803276685416833]) + self.assertTrue(f3.getMesh().getMeasureField(False).getArray().isEqual(ref,1e-12)) + self.assertTrue(f3.getArray().isEqual(DataArrayDouble([0,1,2,3]),1e-12)) + pass + + def testVoronoi3D_4(self): + """Idem testVoronoi3D_3 except that here quadratic cells are considered""" + coo=DataArrayDouble([0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.5,0.0,0.0,0.0,0.5,0.0,0.5,0.5,0.5,0.5,0.0,0.5,0.0,0.0,0.5,0.0,0.5],10,3) + m=MEDCouplingUMesh("mesh",3) + m.setCoords(coo) ; m.allocateCells() + m.insertNextCell(NORM_TETRA10,[0,1,2,3,4,5,6,7,8,9]) + f=MEDCouplingFieldDouble(ON_GAUSS_PT) + f.setMesh(m) ; f.setName("field") + f.setGaussLocalizationOnType(NORM_TETRA10,[0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.5,0.0,0.0,0.0,0.5,0.0,0.5,0.5,0.5,0.5,0.0,0.5,0.0,0.0,0.5,0.0,0.5],[0.1381966011250105, 0.1381966011250105, 0.1381966011250105, 0.1381966011250105, 0.1381966011250105, 0.5854101966249685, 0.1381966011250105, 0.5854101966249685, 0.1381966011250105, 0.5854101966249685, 0.1381966011250105, 0.1381966011250105], [0.041667,0.041667,0.041667,0.041667]) + f.setArray(DataArrayDouble([0,1,2,3])) + f3=f.voronoize(1e-12) + ref=DataArrayDouble([0.047256836610416179,0.03980327668541684,0.039803276685416833,0.039803276685416833]) + self.assertTrue(f3.getMesh().getMeasureField(False).getArray().isEqual(ref,1e-12)) + self.assertTrue(f3.getArray().isEqual(DataArrayDouble([0,1,2,3]),1e-12)) + pass + + def testConvertQuadToLin4Gauss_1(self): + coo=DataArrayDouble([0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.5,0.0,0.0,0.0,0.5,0.0,0.5,0.5,0.5,0.5,0.0,0.5,0.0,0.0,0.5,0.0,0.5],10,3) + m=MEDCouplingUMesh("mesh",3) + m.setCoords(coo) ; m.allocateCells() + m.insertNextCell(NORM_TETRA10,[0,1,2,3,4,5,6,7,8,9]) + f=MEDCouplingFieldDouble(ON_GAUSS_PT) + f.setMesh(m) ; f.setName("field") + aaaa=[0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0,0.0,0.5,0.0,0.0,0.0,0.5,0.0,0.5,0.5,0.5,0.5,0.0,0.5,0.0,0.0,0.5,0.0,0.5] + bbbb=[0.1381966011250105,0.1381966011250105,0.1381966011250105,0.1381966011250105,0.1381966011250105,0.5854101966249685,0.1381966011250105,0.5854101966249685,0.1381966011250105,0.5854101966249685,0.1381966011250105,0.1381966011250105] + cccc=[0.041667,0.041667,0.041667,0.041667] + f.setGaussLocalizationOnType(NORM_TETRA10,aaaa,bbbb,cccc) + f.setArray(DataArrayDouble([0,1,2,3])) + f.setTime(1.,2,3) + # + mcpy=m.deepCopy() ; mcpy.convertQuadraticCellsToLinear() ; mcpy.zipCoords() + # + f2=f.convertQuadraticCellsToLinear() + f2.checkConsistencyLight() + self.assertTrue(f2.getMesh().isEqual(mcpy,1e-12)) + self.assertTrue(f2.getArray().isEqual(DataArrayDouble([0,1,2,3]),1e-12)) + self.assertEqual(f2.getNbOfGaussLocalization(),1) + gl=f2.getGaussLocalization(0) + self.assertEqual(gl.getType(),NORM_TETRA4) + self.assertTrue(DataArrayDouble(gl.getRefCoords()).isEqual(DataArrayDouble([0.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,1.0,0.0,0.0]),1e-12)) + self.assertTrue(DataArrayDouble(gl.getGaussCoords()).isEqual(DataArrayDouble(bbbb),1e-12)) + self.assertTrue(DataArrayDouble(gl.getWeights()).isEqual(DataArrayDouble(cccc),1e-12)) + self.assertEqual(f2.getName(),"field") + self.assertEqual(f2.getTime(),[1.,2,3]) + pass + pass if __name__ == '__main__': -- 2.39.2