From: ageay Date: Wed, 1 Dec 2010 14:57:55 +0000 (+0000) Subject: cleaning swigging X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e00c27c2008670d40811ba2f02b3c8278f142631;p=tools%2Fmedcoupling.git cleaning swigging --- diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index afc4f6f21..64515da85 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -4089,6 +4089,9 @@ class MEDCouplingBasicsTest(unittest.TestCase): pos1=[5.,30.,2.] self.assertEqual(16,m.getCellContainingPoint(pos1,1e-12)); # + elems=m2.giveElemsInBoundingBox([3.5,6.,12.2,25.,0.,1.5],1e-7) + self.assertEqual([1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17],elems) + # pt=[2.4,12.7,-3.4] m.scale(pt,3.7); m3=m.buildUnstructured(); diff --git a/src/MEDCoupling_Swig/libMEDCoupling_Swig.i b/src/MEDCoupling_Swig/libMEDCoupling_Swig.i index 9a49e4f04..9c0ca044b 100644 --- a/src/MEDCoupling_Swig/libMEDCoupling_Swig.i +++ b/src/MEDCoupling_Swig/libMEDCoupling_Swig.i @@ -245,7 +245,6 @@ namespace ParaMEDMEM virtual MEDCouplingFieldDouble *getMeasureFieldOnNode(bool isAbs) const = 0; virtual MEDCouplingFieldDouble *fillFromAnalytic(TypeOfField t, int nbOfComp, const char *func) const throw(INTERP_KERNEL::Exception); virtual MEDCouplingFieldDouble *buildOrthogonalField() const = 0; - virtual void rotate(const double *center, const double *vector, double angle) = 0; virtual MEDCouplingMesh *mergeMyselfWith(const MEDCouplingMesh *other) const throw(INTERP_KERNEL::Exception) = 0; virtual bool areCompatibleForMerge(const MEDCouplingMesh *other) const; static MEDCouplingMesh *mergeMeshes(const MEDCouplingMesh *mesh1, const MEDCouplingMesh *mesh2); @@ -338,6 +337,20 @@ namespace ParaMEDMEM self->translate(v); delete [] v; } + + void rotate(PyObject *center, PyObject *vector, double alpha) + { + int sz; + double *c=convertPyToNewDblArr2(center,&sz); + if(!c) + return ; + double *v=convertPyToNewDblArr2(vector,&sz); + if(!v) + { delete [] c; return ; } + self->rotate(c,v,alpha); + delete [] c; + delete [] v; + } } }; } @@ -365,7 +378,6 @@ namespace ParaMEDMEM static DataArrayDouble *mergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2); static MEDCouplingPointSet *buildInstanceFromMeshType(MEDCouplingMeshType type); virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const = 0; - virtual void renumberNodes(const int *newNodeNumbers, int newNbOfNodes); virtual bool isEmptyMesh(const std::vector& tinyInfo) const = 0; //! size of returned tinyInfo must be always the same. void getTinySerializationInformation(std::vector& tinyInfo, std::vector& littleStrings) const; @@ -373,7 +385,6 @@ namespace ParaMEDMEM void serialize(DataArrayInt *&a1, DataArrayDouble *&a2) const; void unserialization(const std::vector& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2, const std::vector& littleStrings); - virtual void giveElemsInBoundingBox(const double *bbox, double eps, std::vector& elems) = 0; virtual void giveElemsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps, std::vector& elems) = 0; virtual DataArrayInt *zipCoordsTraducer() = 0; %extend @@ -439,19 +450,6 @@ namespace ParaMEDMEM self->findBoundaryNodes(nodes); return convertIntArrToPyList2(nodes); } - void rotate(PyObject *center, PyObject *vector, double alpha) - { - int sz; - double *c=convertPyToNewDblArr2(center,&sz); - if(!c) - return ; - double *v=convertPyToNewDblArr2(vector,&sz); - if(!v) - { delete [] c; return ; } - self->rotate(c,v,alpha); - delete [] c; - delete [] v; - } void renumberNodes(PyObject *li, int newNbOfNodes) { int size; @@ -519,6 +517,16 @@ namespace ParaMEDMEM return ret; } + PyObject *giveElemsInBoundingBox(PyObject *bbox, double eps) + { + std::vector elems; + int size; + double *tmp=convertPyToNewDblArr2(bbox,&size); + self->giveElemsInBoundingBox(tmp,eps,elems); + delete [] tmp; + return convertIntArrToPyList2(elems); + } + static void rotate2DAlg(PyObject *center, double angle, int nbNodes, PyObject *coords) { int sz;