typedef struct { int dt; int it; } DT_IT_;
-%addmethods DT_IT_ {
+%extend DT_IT_ {
int getdt()
{
return self->dt;
void getBoundaryElements();
- %addmethods {
+ %extend {
SUPPORT(MESH* Mesh, char * Name="", medEntityMesh Entity=MED_CELL)
{
return new SUPPORT(Mesh,string(Name),Entity);
PyObject * result = Py_BuildValue("O", py_list);
return result;
}
- */
PyObject * getNumber(medGeometryElement GeometricType)
{
int getNumberOfGroups() const;
- %addmethods {
+ %extend {
FAMILY(MESH* Mesh, int Identifier, char * Name, int NumberOfAttribute,
int *AttributeIdentifier, int *AttributeValue,
char * AttributeDescription, int NumberOfGroup,
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;
- }
}
};
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;
- }
}
};
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;
- }
}
};
{
/* 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;
}
}
{
/* 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;
}
}
{
/* 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;
}
}
int i;
list<string>::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 * {