From bc815fe93de3284ce94632a8fd76acc281c6373e Mon Sep 17 00:00:00 2001 From: ageay Date: Wed, 8 Jan 2014 15:09:19 +0000 Subject: [PATCH] + Field::cellToNode implementation + fast reverseNodal computation for structured mesh. --- src/MEDCoupling/MEDCouplingExtrudedMesh.cxx | 6 + src/MEDCoupling/MEDCouplingExtrudedMesh.hxx | 1 + src/MEDCoupling/MEDCouplingFieldDouble.cxx | 44 +++++ src/MEDCoupling/MEDCouplingFieldDouble.hxx | 1 + src/MEDCoupling/MEDCouplingMesh.hxx | 1 + src/MEDCoupling/MEDCouplingPointSet.hxx | 1 - src/MEDCoupling/MEDCouplingStructuredMesh.cxx | 155 ++++++++++++++++++ src/MEDCoupling/MEDCouplingStructuredMesh.hxx | 4 + src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 84 ++++++++++ src/MEDCoupling_Swig/MEDCouplingCommon.i | 24 +-- 10 files changed, 309 insertions(+), 12 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx index 3658b43be..862532670 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.cxx @@ -766,6 +766,12 @@ DataArrayDouble *MEDCouplingExtrudedMesh::computeIsoBarycenterOfNodesPerCell() c throw INTERP_KERNEL::Exception("MEDCouplingExtrudedMesh::computeIsoBarycenterOfNodesPerCell: not yet implemented !"); } +void MEDCouplingExtrudedMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const +{ + MEDCouplingAutoRefCountObjectPtr m(buildUnstructured()); + m->getReverseNodalConnectivity(revNodal,revNodalIndx); +} + void MEDCouplingExtrudedMesh::computeExtrusionAlg(const MEDCouplingUMesh *mesh3D) { _mesh3D_ids->alloc(mesh3D->getNumberOfCells(),1); diff --git a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx index ebceee9c3..6902eeda9 100644 --- a/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx +++ b/src/MEDCoupling/MEDCouplingExtrudedMesh.hxx @@ -97,6 +97,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT DataArrayDouble *getCoordinatesAndOwner() const; MEDCOUPLING_EXPORT DataArrayDouble *getBarycenterAndOwner() const; MEDCOUPLING_EXPORT DataArrayDouble *computeIsoBarycenterOfNodesPerCell() const; + MEDCOUPLING_EXPORT void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const; //Serialization unserialisation MEDCOUPLING_EXPORT void getTinySerializationInformation(std::vector& tinyInfoD, std::vector& tinyInfo, std::vector& littleStrings) const; MEDCOUPLING_EXPORT void resizeForUnserialization(const std::vector& tinyInfo, DataArrayInt *a1, DataArrayDouble *a2, std::vector& littleStrings) const; diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.cxx b/src/MEDCoupling/MEDCouplingFieldDouble.cxx index 097e3a788..4b3fad76b 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.cxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.cxx @@ -273,6 +273,50 @@ MEDCouplingFieldDouble *MEDCouplingFieldDouble::nodeToCellDiscretization() const return ret.retn(); } +/*! + * This method converts a field on cell (\a this) to a node field (returned field). The convertion is a \b non \b conservative remapping ! + * This method is useful only for users that need a fast convertion from cell to node spatial discretization. The algorithm applied is simply to attach + * to each node the average of values on cell sharing this node. If \a this lies on a mesh having orphan nodes the values applied on them will be NaN (division by 0.). + * + * \return MEDCouplingFieldDouble* - a new instance of MEDCouplingFieldDouble. The + * caller is to delete this field using decrRef() as it is no more needed. The returned field will share the same mesh object object than those in \a this. + * \throw If \a this spatial discretization is empty or not ON_CELLS. + * \throw If \a this is not coherent (see MEDCouplingFieldDouble::checkCoherency). + * + * \warning This method is a \b non \b conservative method of remapping from cell spatial discretization to node spatial discretization. + * If a conservative method of interpolation is required ParaMEDMEM::MEDCouplingRemapper class should be used instead with "P0P1" method. + */ +MEDCouplingFieldDouble *MEDCouplingFieldDouble::cellToNodeDiscretization() const +{ + checkCoherency(); + TypeOfField tf(getTypeOfField()); + if(tf!=ON_CELLS) + throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::cellToNodeDiscretization : this field is expected to be on ON_CELLS !"); + MEDCouplingAutoRefCountObjectPtr ret(clone(false)); + MEDCouplingAutoRefCountObjectPtr nsp(new MEDCouplingFieldDiscretizationP1); + ret->setDiscretization(nsp); + const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkCoherency call + int nbCells(m->getNumberOfCells()),nbNodes(m->getNumberOfNodes()); + MEDCouplingAutoRefCountObjectPtr rn(DataArrayInt::New()),rni(DataArrayInt::New()); + m->getReverseNodalConnectivity(rn,rni); + MEDCouplingAutoRefCountObjectPtr rni2(rni->deltaShiftIndex()); + MEDCouplingAutoRefCountObjectPtr rni3(rni2->convertToDblArr()); rni2=0; + std::vector arrs(getArrays()); + std::size_t sz(arrs.size()); + std::vector< MEDCouplingAutoRefCountObjectPtr > outArrsSafe(sz); std::vector outArrs(sz); + for(std::size_t j=0;jgetNumberOfComponents()); + MEDCouplingAutoRefCountObjectPtr tmp(arrs[j]->selectByTupleIdSafe(rn->begin(),rn->end())); + outArrsSafe[j]=(tmp->accumulatePerChunck(rni->begin(),rni->end())); tmp=0; + outArrsSafe[j]->divideEqual(rni3); + outArrsSafe[j]->copyStringInfoFrom(*arrs[j]); + outArrs[j]=outArrsSafe[j]; + } + ret->setArrays(outArrs); + return ret.retn(); +} + /*! * Copies tiny info (component names, name and description) from an \a other field to * \a this one. diff --git a/src/MEDCoupling/MEDCouplingFieldDouble.hxx b/src/MEDCoupling/MEDCouplingFieldDouble.hxx index b64819edc..8b2c5e22f 100644 --- a/src/MEDCoupling/MEDCouplingFieldDouble.hxx +++ b/src/MEDCoupling/MEDCouplingFieldDouble.hxx @@ -64,6 +64,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT MEDCouplingFieldDouble *cloneWithMesh(bool recDeepCpy) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCopy) const; MEDCOUPLING_EXPORT MEDCouplingFieldDouble *nodeToCellDiscretization() const; + MEDCOUPLING_EXPORT MEDCouplingFieldDouble *cellToNodeDiscretization() const; MEDCOUPLING_EXPORT TypeOfTimeDiscretization getTimeDiscretization() const; MEDCOUPLING_EXPORT void checkCoherency() const; MEDCOUPLING_EXPORT void setNature(NatureOfField nat); diff --git a/src/MEDCoupling/MEDCouplingMesh.hxx b/src/MEDCoupling/MEDCouplingMesh.hxx index c8203c56b..57de33976 100644 --- a/src/MEDCoupling/MEDCouplingMesh.hxx +++ b/src/MEDCoupling/MEDCouplingMesh.hxx @@ -128,6 +128,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT virtual MEDCouplingMesh *buildPartRangeAndReduceNodes(int beginCellIds, int endCellIds, int stepCellIds, int& beginOut, int& endOut, int& stepOut, DataArrayInt*& arr) const; MEDCOUPLING_EXPORT virtual MEDCouplingUMesh *buildUnstructured() const = 0; MEDCOUPLING_EXPORT virtual DataArrayInt *simplexize(int policy) = 0; + MEDCOUPLING_EXPORT virtual void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const = 0; MEDCOUPLING_EXPORT virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const; MEDCOUPLING_EXPORT static MEDCouplingMesh *MergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2); MEDCOUPLING_EXPORT static MEDCouplingMesh *MergeMeshes(std::vector& meshes); diff --git a/src/MEDCoupling/MEDCouplingPointSet.hxx b/src/MEDCoupling/MEDCouplingPointSet.hxx index aa5622b19..f63360d3f 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.hxx +++ b/src/MEDCoupling/MEDCouplingPointSet.hxx @@ -136,7 +136,6 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) = 0; MEDCOUPLING_EXPORT virtual DataArrayInt *zipCoordsTraducer(); MEDCOUPLING_EXPORT virtual DataArrayInt *zipConnectivityTraducer(int compType, int startCellId=0); - MEDCOUPLING_EXPORT virtual void getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const = 0; //tools public: MEDCOUPLING_EXPORT bool areCellsFrom2MeshEqual(const MEDCouplingPointSet *other, int cellId, double prec) const; diff --git a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx index 011c49dea..c51f02b92 100644 --- a/src/MEDCoupling/MEDCouplingStructuredMesh.cxx +++ b/src/MEDCoupling/MEDCouplingStructuredMesh.cxx @@ -375,6 +375,161 @@ MEDCouplingFieldDouble *MEDCouplingStructuredMesh::buildOrthogonalField() const return ret; } +void MEDCouplingStructuredMesh::getReverseNodalConnectivity(DataArrayInt *revNodal, DataArrayInt *revNodalIndx) const +{ + std::vector ngs(getNodeGridStructure()); + int dim(getMeshDimension()); + switch(dim) + { + case 1: + return GetReverseNodalConnectivity1(ngs,revNodal,revNodalIndx); + case 2: + return GetReverseNodalConnectivity2(ngs,revNodal,revNodalIndx); + case 3: + return GetReverseNodalConnectivity3(ngs,revNodal,revNodalIndx); + default: + throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::getReverseNodalConnectivity : only dimensions 1, 2 and 3 are supported !"); + } +} + +void MEDCouplingStructuredMesh::GetReverseNodalConnectivity1(const std::vector& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx) +{ + int nbNodes(ngs[0]); + revNodalIndx->alloc(nbNodes+1,1); + if(nbNodes==0) + { revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; } + if(nbNodes==1) + { revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); revNodalIndx->setIJ(1,0,0); return ; } + revNodal->alloc(2*(nbNodes-1),1); + int *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer()); + *rni++=0; *rni=1; *rn++=0; + for(int i=1;i& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx) +{ + int nbNodesX(ngs[0]),nbNodesY(ngs[1]); + int nbNodes(nbNodesX*nbNodesY); + if(nbNodesX==0 || nbNodesY==0) + { revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; } + if(nbNodesX==1 || nbNodesY==1) + { std::vector ngs2(1); ngs2[0]=std::max(nbNodesX,nbNodesY); return GetReverseNodalConnectivity1(ngs2,revNodal,revNodalIndx); } + revNodalIndx->alloc(nbNodes+1,1); + int nbCellsX(nbNodesX-1),nbCellsY(nbNodesY-1); + revNodal->alloc(4*(nbNodesX-2)*(nbNodesY-2)+2*2*(nbNodesX-2)+2*2*(nbNodesY-2)+4,1); + int *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer()); + *rni++=0; *rni=1; *rn++=0; + for(int i=1;i& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx) +{ + int nbNodesX(ngs[0]),nbNodesY(ngs[1]),nbNodesZ(ngs[2]); + int nbNodes(nbNodesX*nbNodesY*nbNodesZ); + if(nbNodesX==0 || nbNodesY==0 || nbNodesZ==0) + { revNodal->alloc(0,1); revNodalIndx->setIJ(0,0,0); return ; } + if(nbNodesX==1 || nbNodesY==1 || nbNodesZ==1) + { + std::vector ngs2(2); + int pos(0); + bool pass(false); + for(int i=0;i<3;i++) + { + if(pass) + { ngs2[pos++]=ngs[i]; } + else + { + pass=ngs[i]==1; + if(!pass) + { ngs2[pos++]=ngs[i]; } + } + } + return GetReverseNodalConnectivity2(ngs2,revNodal,revNodalIndx); + } + revNodalIndx->alloc(nbNodes+1,1); + int nbCellsX(nbNodesX-1),nbCellsY(nbNodesY-1),nbCellsZ(nbNodesZ-1); + revNodal->alloc(8*(nbNodesX-2)*(nbNodesY-2)*(nbNodesZ-2)+4*(2*(nbNodesX-2)*(nbNodesY-2)+2*(nbNodesX-2)*(nbNodesZ-2)+2*(nbNodesY-2)*(nbNodesZ-2))+2*4*(nbNodesX-2)+2*4*(nbNodesY-2)+2*4*(nbNodesZ-2)+8,1); + int *rn(revNodal->getPointer()),*rni(revNodalIndx->getPointer()); + *rni=0; + for(int k=0;k=1 && j>=1 && i>=1) + *rn++=off00+i-1; + if(k>=1 && j>=1 && i=1 && j=1) + *rn++=off01+i-1; + if(k>=1 && j=1 && i>=1) + *rn++=off10+i-1; + if(k=1 && i=1) + *rn++=off11+i-1; + if(k& st, const std::vector< std::pair >& partCompactFormat); MEDCOUPLING_EXPORT static DataArrayInt *Build1GTNodalConnectivity(const int *nodeStBg, const int *nodeStEnd); private: + static void GetReverseNodalConnectivity1(const std::vector& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx); + static void GetReverseNodalConnectivity2(const std::vector& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx); + static void GetReverseNodalConnectivity3(const std::vector& ngs, DataArrayInt *revNodal, DataArrayInt *revNodalIndx); static DataArrayInt *Build1GTNodalConnectivity1D(const int *nodeStBg); static DataArrayInt *Build1GTNodalConnectivity2D(const int *nodeStBg); static DataArrayInt *Build1GTNodalConnectivity3D(const int *nodeStBg); diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index f9337b2b3..2acf8e0dc 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -14045,6 +14045,90 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertTrue(DataArrayDouble(MEDCouplingFieldDiscretizationGaussNE.GetLocsFromGeometricType(NORM_TRI3)).isEqual(DataArrayDouble([0.16666666666666666,0.16666666666666666,0.6666666666666667,0.16666666666666666,0.16666666666666666,0.6666666666666667]),1e-12)) pass + def testSwigReverseNodalConnOnStructuredMesh(self): + # 1D - standard + c=MEDCouplingCMesh() ; arr=DataArrayDouble(10) ; arr.iota() + c.setCoordsAt(0,arr) + rn,rni=c.getReverseNodalConnectivity() + rn2,rni2=c.buildUnstructured().getReverseNodalConnectivity() + self.assertTrue(rn.isEqual(DataArrayInt([0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8]))) + self.assertTrue(rni.isEqual(DataArrayInt([0,1,3,5,7,9,11,13,15,17,18]))) + self.assertTrue(rn.isEqual(rn2)) ; self.assertTrue(rni.isEqual(rni2)) + # 1D - limit + c=MEDCouplingCMesh() ; arr=DataArrayDouble(1) ; arr.iota() + c.setCoordsAt(0,arr) + rn,rni=c.getReverseNodalConnectivity() + rn2,rni2=c.buildUnstructured().getReverseNodalConnectivity() + self.assertTrue(rn.isEqual(DataArrayInt([]))) + self.assertTrue(rni.isEqual(DataArrayInt([0,0]))) + self.assertTrue(rn.isEqual(rn2)) ; self.assertTrue(rni.isEqual(rni2)) + # 1D - limit + c=MEDCouplingCMesh() ; arr=DataArrayDouble(0) ; arr.iota() + c.setCoordsAt(0,arr) + rn,rni=c.getReverseNodalConnectivity() + rn.isEqual(DataArrayInt([])) + rni.isEqual(DataArrayInt([0])) + # 2D - standard + c=MEDCouplingCMesh() ; arr=DataArrayDouble(5) ; arr.iota() ; arr2=DataArrayDouble(4) ; arr.iota() + c.setCoords(arr,arr2) + rn,rni=c.getReverseNodalConnectivity() + rn2,rni2=c.buildUnstructured().getReverseNodalConnectivity() + self.assertTrue(rn.isEqual(DataArrayInt([0,0,1,1,2,2,3,3,0,4,0,1,4,5,1,2,5,6,2,3,6,7,3,7,4,8,4,5,8,9,5,6,9,10,6,7,10,11,7,11,8,8,9,9,10,10,11,11]))) + self.assertTrue(rni.isEqual(DataArrayInt([0,1,3,5,7,8,10,14,18,22,24,26,30,34,38,40,41,43,45,47,48]))) + self.assertTrue(rn.isEqual(rn2)) ; self.assertTrue(rni.isEqual(rni2)) + # 2D - limit + c=MEDCouplingCMesh() ; arr=DataArrayDouble(10) ; arr.iota() ; arr2=DataArrayDouble(1) ; arr.iota() + c.setCoords(arr,arr2) + rn,rni=c.getReverseNodalConnectivity() + self.assertTrue(rn.isEqual(DataArrayInt([0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8]))) + self.assertTrue(rni.isEqual(DataArrayInt([0,1,3,5,7,9,11,13,15,17,18]))) + # 2D - limit + c=MEDCouplingCMesh() ; arr=DataArrayDouble(10) ; arr.iota() ; arr2=DataArrayDouble(1) ; arr.iota() + c.setCoords(arr2,arr) + rn,rni=c.getReverseNodalConnectivity() + self.assertTrue(rn.isEqual(DataArrayInt([0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8]))) + self.assertTrue(rni.isEqual(DataArrayInt([0,1,3,5,7,9,11,13,15,17,18]))) + # 3D - standard + c=MEDCouplingCMesh() ; arr0=DataArrayDouble(5) ; arr0.iota() ; arr1=DataArrayDouble(3) ; arr1.iota() ; arr2=DataArrayDouble(4) ; arr2.iota() + c.setCoords(arr0,arr1,arr2) + rn,rni=c.getReverseNodalConnectivity() + self.assertTrue(rn.isEqual(DataArrayInt([0,0,1,1,2,2,3,3,0,4,0,1,4,5,1,2,5,6,2,3,6,7,3,7,4,4,5,5,6,6,7,7,0,8,0,1,8,9,1,2,9,10,2,3,10,11,3,11,0,4,8,12,0,1,4,5,8,9,12,13,1,2,5,6,9,10,13,14,2,3,6,7,10,11,14,15,3,7,11,15,4,12,4,5,12,13,5,6,13,14,6,7,14,15,7,15,8,16,8,9,16,17,9,10,17,18,10,11,18,19,11,19,8,12,16,20,8,9,12,13,16,17,20,21,9,10,13,14,17,18,21,22,10,11,14,15,18,19,22,23,11,15,19,23,12,20,12,13,20,21,13,14,21,22,14,15,22,23,15,23,16,16,17,17,18,18,19,19,16,20,16,17,20,21,17,18,21,22,18,19,22,23,19,23,20,20,21,21,22,22,23,23]))) + self.assertTrue(rni.isEqual(DataArrayInt([0,1,3,5,7,8,10,14,18,22,24,25,27,29,31,32,34,38,42,46,48,52,60,68,76,80,82,86,90,94,96,98,102,106,110,112,116,124,132,140,144,146,150,154,158,160,161,163,165,167,168,170,174,178,182,184,185,187,189,191,192]))) + rn2,rni2=c.buildUnstructured().getReverseNodalConnectivity() + self.assertTrue(rn.isEqual(rn2)) ; self.assertTrue(rni.isEqual(rni2)) + pass + + def testSwig2CellToNodeDiscretization1(self): + m=MEDCouplingCMesh() ; arr0=DataArrayDouble(5) ; arr0.iota() ; arr1=DataArrayDouble(4) ; arr1.iota() ; m.setCoords(arr0,arr1) + f=MEDCouplingFieldDouble(ON_CELLS) ; f.setMesh(m) ; f.setTime(1.1,5,6) + arr=DataArrayDouble(12) ; arr.iota() + arr=DataArrayDouble.Meld(arr,arr+100.) ; arr.setInfoOnComponents(["aaa","bbb"]) + f.setArray(arr) + f.checkCoherency() + # + ref=DataArrayDouble([0.,0.5,1.5,2.5,3.,2.,2.5,3.5,4.5,5.,6.,6.5,7.5,8.5,9.,8.,8.5,9.5,10.5,11.]) + ref=DataArrayDouble.Meld(ref,ref+100.) ; ref.setInfoOnComponents(["aaa","bbb"]) + f2=f.cellToNodeDiscretization() + f2.checkCoherency() + self.assertEqual(f2.getTime()[1:],[5,6]) + self.assertAlmostEqual(f2.getTime()[0],1.1,15) + self.assertEqual(f2.getMesh().getHiddenCppPointer(),m.getHiddenCppPointer()) + self.assertTrue(f2.getArray().isEqual(ref,1e-12)) + rn,rni=m.getReverseNodalConnectivity() + rni2=(rni.deltaShiftIndex()).convertToDblArr() + arr2=(f.getArray()[rn]).accumulatePerChunck(rni)/rni2 + self.assertTrue(f2.getArray().isEqual(arr2,1e-12)) + del f2 + # + u=m.buildUnstructured() ; f.setMesh(u) ; del m + f3=f.cellToNodeDiscretization() + f3.checkCoherency() + self.assertEqual(f3.getTime()[1:],[5,6]) + self.assertAlmostEqual(f3.getTime()[0],1.1,15) + self.assertEqual(f3.getMesh().getHiddenCppPointer(),u.getHiddenCppPointer()) + self.assertTrue(f3.getArray().isEqual(ref,1e-12)) + pass + def setUp(self): pass pass diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 984571254..adf980fe1 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -183,6 +183,7 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingFieldDouble::deepCpy; %newobject ParaMEDMEM::MEDCouplingFieldDouble::buildNewTimeReprFromThis; %newobject ParaMEDMEM::MEDCouplingFieldDouble::nodeToCellDiscretization; +%newobject ParaMEDMEM::MEDCouplingFieldDouble::cellToNodeDiscretization; %newobject ParaMEDMEM::MEDCouplingFieldDouble::getValueOnMulti; %newobject ParaMEDMEM::MEDCouplingFieldTemplate::New; %newobject ParaMEDMEM::MEDCouplingMesh::deepCpy; @@ -554,6 +555,17 @@ namespace ParaMEDMEM return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ); } + virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception) + { + MEDCouplingAutoRefCountObjectPtr d0=DataArrayInt::New(); + MEDCouplingAutoRefCountObjectPtr d1=DataArrayInt::New(); + self->getReverseNodalConnectivity(d0,d1); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); + return ret; + } + void renumberCells(PyObject *li, bool check=true) throw(INTERP_KERNEL::Exception) { int sw,sz(-1); @@ -1172,17 +1184,6 @@ namespace ParaMEDMEM } } - virtual PyObject *getReverseNodalConnectivity() const throw(INTERP_KERNEL::Exception) - { - MEDCouplingAutoRefCountObjectPtr d0=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr d1=DataArrayInt::New(); - self->getReverseNodalConnectivity(d0,d1); - PyObject *ret=PyTuple_New(2); - PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); - PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1.retn()),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); - return ret; - } - virtual PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception) { DataArrayInt *v0=0,*v1=0; @@ -3121,6 +3122,7 @@ namespace ParaMEDMEM MEDCouplingFieldDouble *deepCpy() const; MEDCouplingFieldDouble *buildNewTimeReprFromThis(TypeOfTimeDiscretization td, bool deepCpy) const throw(INTERP_KERNEL::Exception); MEDCouplingFieldDouble *nodeToCellDiscretization() const throw(INTERP_KERNEL::Exception); + MEDCouplingFieldDouble *cellToNodeDiscretization() const throw(INTERP_KERNEL::Exception); TypeOfTimeDiscretization getTimeDiscretization() const throw(INTERP_KERNEL::Exception); double getIJ(int tupleId, int compoId) const throw(INTERP_KERNEL::Exception); double getIJK(int cellId, int nodeIdInCell, int compoId) const throw(INTERP_KERNEL::Exception); -- 2.30.2