From: nri Date: Thu, 10 Jul 2003 17:49:19 +0000 (+0000) Subject: NRI : Merge from V1_2. X-Git-Tag: V1_2_1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=62775a851c7169abb431b6b05a9f1380c238829f;p=modules%2Fmed.git NRI : Merge from V1_2. --- diff --git a/src/MEDMEM_SWIG/libMEDMEM_Swig.i b/src/MEDMEM_SWIG/libMEDMEM_Swig.i index e35fe911e..480d3a9cc 100644 --- a/src/MEDMEM_SWIG/libMEDMEM_Swig.i +++ b/src/MEDMEM_SWIG/libMEDMEM_Swig.i @@ -115,7 +115,7 @@ typedef enum {MED_REEL64=6, MED_INT32=24, MED_INT64=26, typedef struct { int dt; int it; } DT_IT_; -%addmethods DT_IT_ { +%extend DT_IT_ { int getdt() { return self->dt; @@ -280,7 +280,7 @@ class SUPPORT void getBoundaryElements(); - %addmethods { + %extend { SUPPORT(MESH* Mesh, char * Name="", medEntityMesh Entity=MED_CELL) { return new SUPPORT(Mesh,string(Name),Entity); @@ -354,7 +354,6 @@ class SUPPORT PyObject * result = Py_BuildValue("O", py_list); return result; } - */ PyObject * getNumber(medGeometryElement GeometricType) { @@ -435,7 +434,7 @@ class FAMILY : public SUPPORT int getNumberOfGroups() const; - %addmethods { + %extend { FAMILY(MESH* Mesh, int Identifier, char * Name, int NumberOfAttribute, int *AttributeIdentifier, int *AttributeValue, char * AttributeDescription, int NumberOfGroup, @@ -1745,19 +1744,6 @@ public: strcat(tmp,tmp_str.c_str()); return tmp; } - - void setMeshName(char * meshName) - { - self->setMeshName(string(meshName)); - } - - char * getMeshName() - { - string tmp_str = self->getMeshName(); - char * tmp = new char[strlen(tmp_str.c_str())]; - strcat(tmp,tmp_str.c_str()); - return tmp; - } } }; @@ -1834,19 +1820,6 @@ public: strcat(tmp,tmp_str.c_str()); return tmp; } - - void setMeshName(char * meshName) - { - self->setMeshName(string(meshName)); - } - - char * getMeshName() - { - string tmp_str = self->getMeshName(); - char * tmp = new char[strlen(tmp_str.c_str())]; - strcat(tmp,tmp_str.c_str()); - return tmp; - } } }; @@ -1883,301 +1856,6 @@ public: strcat(tmp,tmp_str.c_str()); return tmp; } - - void setMeshName(char * meshName) - { - self->setMeshName(string(meshName)); - } - - char * getMeshName() - { - string tmp_str = self->getMeshName(); - char * tmp = new char[strlen(tmp_str.c_str())]; - strcat(tmp,tmp_str.c_str()); - return tmp; - } - } -}; - -/* - API du driver MED_FIELDDOUBLE -*/ - -/* -class MED_FIELDDOUBLE_DRIVER -{ -public: - void open(); - - void close(); - - %addmethods { - MED_FIELDDOUBLE_DRIVER(char * fileName, FIELDDOUBLE * ptrField, - med_mode_acces accessMode) - { - return new MED_FIELDDOUBLE_DRIVER(string(fileName), ptrField, - accessMode); - } - - void setFieldName(char * fieldName) - { - self->setFieldName(string(fieldName)); - } - - char * getFieldName() - { - string tmp_str = self->getFieldName(); - char * tmp = new char[strlen(tmp_str.c_str())]; - strcat(tmp,tmp_str.c_str()); - return tmp; - } - } -}; -*/ - -class MED_FIELDDOUBLE_RDONLY_DRIVER : public virtual MED_FIELDDOUBLE_DRIVER -{ -public: - - ~MED_FIELDDOUBLE_RDONLY_DRIVER(); - - void open(); - - void close(); - - void write( void ) const ; - - void read ( void ) ; - - %addmethods { - MED_FIELDDOUBLE_RDONLY_DRIVER(char * fileName, FIELDDOUBLE * ptrField) - { - return new MED_FIELDDOUBLE_RDONLY_DRIVER(string(fileName), ptrField); - } - - void setFieldName(char * fieldName) - { - self->setFieldName(string(fieldName)); - } - - char * getFieldName() - { - string tmp_str = self->getFieldName(); - char * tmp = new char[strlen(tmp_str.c_str())]; - strcat(tmp,tmp_str.c_str()); - return tmp; - } - } -}; - -class MED_FIELDDOUBLE_WRONLY_DRIVER : public virtual MED_FIELDDOUBLE_DRIVER -{ -public: - - ~MED_FIELDDOUBLE_WRONLY_DRIVER(); - - void open(); - - void close(); - - void write( void ) const ; - - void read ( void ) ; - - %addmethods { - MED_FIELDDOUBLE_WRONLY_DRIVER(char * fileName, FIELDDOUBLE * ptrField) - { - return new MED_FIELDDOUBLE_WRONLY_DRIVER(string(fileName), ptrField); - } - - void setFieldName(char * fieldName) - { - self->setFieldName(string(fieldName)); - } - - char * getFieldName() - { - string tmp_str = self->getFieldName(); - char * tmp = new char[strlen(tmp_str.c_str())]; - strcat(tmp,tmp_str.c_str()); - return tmp; - } - } -}; - -class MED_FIELDDOUBLE_RDWR_DRIVER : public virtual MED_FIELDDOUBLE_RDONLY_DRIVER, public virtual MED_FIELDDOUBLE_WRONLY_DRIVER -{ -public: - - ~MED_FIELDDOUBLE_RDWR_DRIVER(); - - void open(); - - void close(); - - void write( void ) const ; - - void read ( void ) ; - - %addmethods { - MED_FIELDDOUBLE_RDWR_DRIVER(char * fileName, FIELDDOUBLE * ptrField) - { - return new MED_FIELDDOUBLE_RDWR_DRIVER(string(fileName), ptrField); - } - - void setFieldName(char * fieldName) - { - self->setFieldName(string(fieldName)); - } - - char * getFieldName() - { - string tmp_str = self->getFieldName(); - char * tmp = new char[strlen(tmp_str.c_str())]; - strcat(tmp,tmp_str.c_str()); - return tmp; - } - } -}; - -/* - API du driver MED_FIELDINT -*/ - -/* -class MED_FIELDINT_DRIVER -{ -public: - void open(); - - void close(); - - %addmethods { - MED_FIELDINT_DRIVER(char * fileName, FIELDINT * ptrField, - med_mode_acces accessMode) - { - return new MED_FIELDINT_DRIVER(string(fileName), ptrField, - accessMode); - } - - void setFieldName(char * fieldName) - { - self->setFieldName(string(fieldName)); - } - - char * getFieldName() - { - string tmp_str = self->getFieldName(); - char * tmp = new char[strlen(tmp_str.c_str())]; - strcat(tmp,tmp_str.c_str()); - return tmp; - } - } -}; -*/ - -class MED_FIELDINT_RDONLY_DRIVER : public virtual MED_FIELDINT_DRIVER -{ -public: - - ~MED_FIELDINT_RDONLY_DRIVER(); - - void open(); - - void close(); - - void write( void ) const ; - - void read ( void ) ; - - %addmethods { - MED_FIELDINT_RDONLY_DRIVER(char * fileName, FIELDINT * ptrField) - { - return new MED_FIELDINT_RDONLY_DRIVER(string(fileName), ptrField); - } - - void setFieldName(char * fieldName) - { - self->setFieldName(string(fieldName)); - } - - char * getFieldName() - { - string tmp_str = self->getFieldName(); - char * tmp = new char[strlen(tmp_str.c_str())]; - strcat(tmp,tmp_str.c_str()); - return tmp; - } - } -}; - -class MED_FIELDINT_WRONLY_DRIVER : public virtual MED_FIELDINT_DRIVER -{ -public: - - ~MED_FIELDINT_WRONLY_DRIVER(); - - void open(); - - void close(); - - void write( void ) const ; - - void read ( void ) ; - - %addmethods { - MED_FIELDINT_WRONLY_DRIVER(char * fileName, FIELDINT * ptrField) - { - return new MED_FIELDINT_WRONLY_DRIVER(string(fileName), ptrField); - } - - void setFieldName(char * fieldName) - { - self->setFieldName(string(fieldName)); - } - - char * getFieldName() - { - string tmp_str = self->getFieldName(); - char * tmp = new char[strlen(tmp_str.c_str())]; - strcat(tmp,tmp_str.c_str()); - return tmp; - } - } -}; - -class MED_FIELDINT_RDWR_DRIVER : public virtual MED_FIELDINT_RDONLY_DRIVER, public virtual MED_FIELDINT_WRONLY_DRIVER -{ -public: - - ~MED_FIELDINT_RDWR_DRIVER(); - - void open(); - - void close(); - - void write( void ) const ; - - void read ( void ) ; - - %addmethods { - MED_FIELDINT_RDWR_DRIVER(char * fileName, FIELDINT * ptrField) - { - return new MED_FIELDINT_RDWR_DRIVER(string(fileName), ptrField); - } - - void setFieldName(char * fieldName) - { - self->setFieldName(string(fieldName)); - } - - char * getFieldName() - { - string tmp_str = self->getFieldName(); - char * tmp = new char[strlen(tmp_str.c_str())]; - strcat(tmp,tmp_str.c_str()); - return tmp; - } } }; diff --git a/src/MEDMEM_SWIG/my_typemap.i b/src/MEDMEM_SWIG/my_typemap.i index f1f5795e4..a9a1b07e6 100644 --- a/src/MEDMEM_SWIG/my_typemap.i +++ b/src/MEDMEM_SWIG/my_typemap.i @@ -55,17 +55,17 @@ { /* typemap in for double * */ /* Check if is a list */ - if (PyList_Check($source)) { - int size = PyList_Size($source); + if (PyList_Check($input)) { + int size = PyList_Size($input); int i = 0; - $target = (double *) malloc(size*sizeof(double)); + $1 = (double *) malloc(size*sizeof(double)); for (i = 0; i < size; i++) { - PyObject *o = PyList_GetItem($source,i); + PyObject *o = PyList_GetItem($input,i); if (PyFloat_Check(o)) - $target[i] = PyFloat_AsDouble(PyList_GetItem($source,i)); + $1[i] = PyFloat_AsDouble(PyList_GetItem($input,i)); else { PyErr_SetString(PyExc_TypeError,"list must contain floats"); - free($target); + free($1); return NULL; } } @@ -81,17 +81,17 @@ { /* typemap in for int * */ /* Check if is a list */ - if (PyList_Check($source)) { - int size = PyList_Size($source); + if (PyList_Check($input)) { + int size = PyList_Size($input); int i = 0; - $target = (int *) malloc(size*sizeof(int)); + $1 = (int *) malloc(size*sizeof(int)); for (i = 0; i < size; i++) { - PyObject *o = PyList_GetItem($source,i); + PyObject *o = PyList_GetItem($input,i); if (PyInt_Check(o)) - $target[i] = PyInt_AsLong(PyList_GetItem($source,i)); + $1[i] = PyInt_AsLong(PyList_GetItem($input,i)); else { PyErr_SetString(PyExc_TypeError,"list must contain integers"); - free($target); + free($1); return NULL; } } @@ -108,17 +108,17 @@ { /* typemap in for medGeometryElement * */ /* Check if is a list */ - if (PyList_Check($source)) { - int size = PyList_Size($source); + if (PyList_Check($input)) { + int size = PyList_Size($input); int i = 0; - $target = (medGeometryElement *) malloc(size*sizeof(int)); + $1 = (medGeometryElement *) malloc(size*sizeof(int)); for (i = 0; i < size; i++) { - PyObject *o = PyList_GetItem($source,i); + PyObject *o = PyList_GetItem($input,i); if (PyInt_Check(o)) - $target[i] = (medGeometryElement) PyInt_AsLong(PyList_GetItem($source,i)); + $1[i] = (medGeometryElement) PyInt_AsLong(PyList_GetItem($input,i)); else { PyErr_SetString(PyExc_TypeError,"list must contain integers"); - free($target); + free($1); return NULL; } } @@ -134,9 +134,9 @@ int i; list::iterator iL; - $target = PyList_New($source->size()); - for (i=0, iL=$source->begin(); iL!=$source->end(); i++, iL++) - PyList_SetItem($target,i,PyString_FromString((*iL).c_str())); + $result = PyList_New($1->size()); + for (i=0, iL=$1->begin(); iL!=$1->end(); i++, iL++) + PyList_SetItem($result,i,PyString_FromString((*iL).c_str())); } %typemap(freearg) int * {