+ int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
+ {
+ if(elt0 && PyInt_Check(elt0))
+ {//fmts[3]
+ return PyInt_AS_LONG(elt0);
+ }
+ else if(elt0 && PyString_Check(elt0))
+ return self->getPosFromFieldName(PyString_AsString(elt0));
+ else
+ throw INTERP_KERNEL::Exception("MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !");
+ }
+
+ std::vector<int> getPosOfFields(PyObject *elts) const throw(INTERP_KERNEL::Exception)
+ {
+ if(PyList_Check(elts))
+ {
+ int sz=PyList_Size(elts);
+ std::vector<int> ret(sz);
+ for(int i=0;i<sz;i++)
+ {
+ PyObject *elt=PyList_GetItem(elts,i);
+ ret[i]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elt);
+ }
+ return ret;
+ }
+ else
+ {
+ std::vector<int> ret(1);
+ ret[0]=ParaMEDMEM_MEDFileFields_getPosOfField(self,elts);
+ return ret;
+ }
+ }
+
+ void pushFields(PyObject *fields) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<MEDFileAnyTypeFieldMultiTS *> tmp;
+ convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeFieldMultiTS *>(fields,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeFieldMultiTS,"MEDFileAnyTypeFieldMultiTS",tmp);
+ self->pushFields(tmp);
+ }
+
+ void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
+ {
+ if(elts && PySlice_Check(elts))
+ {
+ Py_ssize_t strt=2,stp=2,step=2;
+ PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
+ GetIndicesOfSlice(oC,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
+ self->destroyFieldsAtPos2(strt,stp,step);
+ }
+ else
+ {
+ std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
+ if(!idsToRemove.empty())
+ self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
+ }
+ }
+ }
+ };
+
+ class MEDFileParameter1TS : public RefCountObject
+ {
+ public:
+ void setIteration(int it);
+ int getIteration() const;
+ void setOrder(int order);
+ int getOrder() const;
+ void setTimeValue(double time);
+ void setTime(int dt, int it, double time);
+ double getTime(int& dt, int& it);
+ double getTimeValue() const;
+ };
+
+ class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
+ {
+ public:
+ void setValue(double val) throw(INTERP_KERNEL::Exception);
+ double getValue() const throw(INTERP_KERNEL::Exception);
+ std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+ }
+ };
+
+ class MEDFileParameterTinyInfo : public MEDFileWritable
+ {
+ public:
+ void setDescription(const std::string& name);
+ std::string getDescription() const;
+ void setTimeUnit(const std::string& unit);
+ std::string getTimeUnit() const;
+ };
+
+ class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
+ {
+ public:
+ static MEDFileParameterDouble1TS *New();
+ static MEDFileParameterDouble1TS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
+ static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception);
+ static MEDFileParameterDouble1TS *New(const std::string& fileName, const std::string& paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
+ virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
+ virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
+ void setName(const std::string& name) throw(INTERP_KERNEL::Exception);
+ std::string getName() const throw(INTERP_KERNEL::Exception);
+ void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDFileParameterDouble1TS()
+ {
+ return MEDFileParameterDouble1TS::New();
+ }
+
+ MEDFileParameterDouble1TS(const std::string& fileName) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileParameterDouble1TS::New(fileName);
+ }
+
+ MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileParameterDouble1TS::New(fileName,paramName);
+ }
+
+ MEDFileParameterDouble1TS(const std::string& fileName, const std::string& paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+
+ PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
+ {
+ std::string what;
+ bool ret0=self->isEqual(other,eps,what);
+ PyObject *res=PyList_New(2);
+ PyObject *ret0Py=ret0?Py_True:Py_False;
+ Py_XINCREF(ret0Py);
+ PyList_SetItem(res,0,ret0Py);
+ PyList_SetItem(res,1,PyString_FromString(what.c_str()));
+ return res;
+ }
+ }
+ };
+
+ class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
+ {
+ public:
+ static MEDFileParameterMultiTS *New();
+ static MEDFileParameterMultiTS *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
+ static MEDFileParameterMultiTS *New(const std::string& fileName, const std::string& paramName) throw(INTERP_KERNEL::Exception);
+ std::string getName() const;
+ void setName(const std::string& name);
+ MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
+ void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
+ std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
+ void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
+ double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+ int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+ int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
+ int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDFileParameterMultiTS()
+ {
+ return MEDFileParameterMultiTS::New();
+ }
+
+ MEDFileParameterMultiTS(const std::string& fileName)
+ {
+ return MEDFileParameterMultiTS::New(fileName);
+ }
+
+ MEDFileParameterMultiTS(const std::string& fileName, const std::string& paramName)
+ {
+ return MEDFileParameterMultiTS::New(fileName,paramName);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+
+ PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
+ {
+ std::string what;
+ bool ret0=self->isEqual(other,eps,what);
+ PyObject *res=PyList_New(2);
+ PyObject *ret0Py=ret0?Py_True:Py_False;
+ Py_XINCREF(ret0Py);
+ PyList_SetItem(res,0,ret0Py);
+ PyList_SetItem(res,1,PyString_FromString(what.c_str()));
+ return res;
+ }
+
+ void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
+ {
+ int sw;
+ int pos1;
+ std::vector<int> pos2;
+ DataArrayInt *pos3=0;
+ DataArrayIntTuple *pos4=0;
+ convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
+ switch(sw)
+ {
+ case 1:
+ {
+ self->eraseTimeStepIds(&pos1,&pos1+1);
+ return;
+ }
+ case 2:
+ {
+ if(pos2.empty())
+ return;
+ self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
+ return ;
+ }
+ case 3:
+ {
+ self->eraseTimeStepIds(pos3->begin(),pos3->end());
+ return ;
+ }
+ default:
+ throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
+ }
+ }
+
+ int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
+ {
+ if(elt0 && PyInt_Check(elt0))
+ {//fmts[3]
+ int pos=InterpreteNegativeInt(PyInt_AS_LONG(elt0),self->getNumberOfTS());
+ return pos;
+ }
+ else if(elt0 && PyTuple_Check(elt0))
+ {
+ if(PyTuple_Size(elt0)==2)
+ {
+ PyObject *o0=PyTuple_GetItem(elt0,0);
+ PyObject *o1=PyTuple_GetItem(elt0,1);
+ if(PyInt_Check(o0) && PyInt_Check(o1))
+ {//fmts(1,-1)
+ int iter=PyInt_AS_LONG(o0);
+ int order=PyInt_AS_LONG(o1);
+ return self->getPosOfTimeStep(iter,order);
+ }
+ else
+ throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
+ }
+ else
+ throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
+ }
+ else if(elt0 && PyFloat_Check(elt0))
+ {
+ double val=PyFloat_AS_DOUBLE(elt0);
+ return self->getPosGivenTime(val);
+ }
+ else
+ throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
+ }
+
+ MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
+ {
+ MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
+ {
+ if(PyList_Check(elts))
+ {
+ int sz=PyList_Size(elts);
+ std::vector<int> ret(sz);
+ for(int i=0;i<sz;i++)
+ {
+ PyObject *elt=PyList_GetItem(elts,i);
+ ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
+ }
+ return ret;
+ }
+ else
+ {
+ std::vector<int> ret(1);
+ ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
+ return ret;
+ }
+ }
+
+ void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
+ if(!idsToRemove.empty())
+ self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
+ }
+
+ MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
+ {
+ MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<int,int> > res=self->getIterations();
+ PyObject *ret=PyList_New(res.size());
+ int rk=0;
+ for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
+ {
+ PyObject *elt=PyTuple_New(2);
+ PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
+ PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
+ PyList_SetItem(ret,rk,elt);
+ }
+ return ret;
+ }
+
+ PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<double> res2;
+ std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
+ PyObject *ret=PyList_New(res.size());
+ int rk=0;
+ for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
+ {
+ PyObject *elt=PyTuple_New(3);
+ PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
+ PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
+ PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
+ PyList_SetItem(ret,rk,elt);
+ }
+ return ret;
+ }
+ }
+ };
+
+ class MEDFileParameters : public RefCountObject, public MEDFileWritable
+ {
+ public:
+ static MEDFileParameters *New();
+ static MEDFileParameters *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
+ MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
+ void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
+ std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
+ void resize(int newSize) throw(INTERP_KERNEL::Exception);
+ void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
+ void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
+ void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
+ int getPosFromParamName(const std::string& paramName) const throw(INTERP_KERNEL::Exception);
+ int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDFileParameters()
+ {
+ return MEDFileParameters::New();
+ }
+
+ MEDFileParameters(const std::string& fileName)
+ {
+ return MEDFileParameters::New(fileName);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+
+ MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ if(PyInt_Check(obj))
+ {
+ MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ else if(PyString_Check(obj))
+ {
+ MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ else
+ throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
+ }
+
+ int __len__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->getNumberOfParams();
+ }
+
+ MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
+ {
+ MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ MEDFileParameterMultiTS *getParamWithName(const std::string& paramName) const throw(INTERP_KERNEL::Exception)
+ {
+ MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
+ {
+ std::string what;
+ bool ret0=self->isEqual(other,eps,what);
+ PyObject *res=PyList_New(2);
+ PyObject *ret0Py=ret0?Py_True:Py_False;
+ Py_XINCREF(ret0Py);
+ PyList_SetItem(res,0,ret0Py);
+ PyList_SetItem(res,1,PyString_FromString(what.c_str()));
+ return res;
+ }
+ }
+ };
+
+ class MEDFileData : public RefCountObject, public MEDFileWritable
+ {
+ public:
+ static MEDFileData *New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
+ static MEDFileData *New();