//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-// Author : Anthony Geay (CEA/DEN)
+// Author : Anthony Geay (EDF R&D)
%module MEDLoader
%newobject MEDCoupling::MEDFileMesh::getNodeGroupsArr;
%newobject MEDCoupling::MEDFileMesh::getNodeFamilyArr;
%newobject MEDCoupling::MEDFileMesh::getNodeFamiliesArr;
+%newobject MEDCoupling::MEDFileMesh::getGlobalNumFieldAtLevel;
%newobject MEDCoupling::MEDFileMesh::getAllFamiliesIdsReferenced;
%newobject MEDCoupling::MEDFileMesh::computeAllFamilyIdsInUse;
%newobject MEDCoupling::MEDFileMesh::getEquivalences;
%newobject MEDCoupling::MEDFileFieldMultiTS::getFieldAtLevelOld;
%newobject MEDCoupling::MEDFileFieldMultiTS::getUndergroundDataArray;
%newobject MEDCoupling::MEDFileFieldMultiTS::convertToInt;
+
%newobject MEDCoupling::MEDFileIntFieldMultiTS::New;
%newobject MEDCoupling::MEDFileIntFieldMultiTS::field;
%newobject MEDCoupling::MEDFileIntFieldMultiTS::LoadSpecificEntities;
%newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldOnMeshAtLevel;
%newobject MEDCoupling::MEDFileIntFieldMultiTS::getFieldAtLevelOld;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::New;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::field;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::LoadSpecificEntities;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::getUndergroundDataArray;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::convertToDouble;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevel;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtTopLevel;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldOnMeshAtLevel;
+%newobject MEDCoupling::MEDFileFloatFieldMultiTS::getFieldAtLevelOld;
+
%newobject MEDCoupling::MEDFileAnyTypeField1TS::New;
%newobject MEDCoupling::MEDFileAnyTypeField1TS::NewAdv;
%newobject MEDCoupling::MEDFileAnyTypeField1TS::shallowCpy;
%newobject MEDCoupling::MEDFileIntField1TS::getUndergroundDataArray;
%newobject MEDCoupling::MEDFileIntField1TS::convertToDouble;
+%newobject MEDCoupling::MEDFileFloatField1TS::New;
+%newobject MEDCoupling::MEDFileFloatField1TS::field;
+%newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevel;
+%newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtTopLevel;
+%newobject MEDCoupling::MEDFileFloatField1TS::getFieldOnMeshAtLevel;
+%newobject MEDCoupling::MEDFileFloatField1TS::getFieldAtLevelOld;
+%newobject MEDCoupling::MEDFileFloatField1TS::getUndergroundDataArray;
+%newobject MEDCoupling::MEDFileFloatField1TS::convertToDouble;
+
%newobject MEDCoupling::MEDFileData::New;
%newobject MEDCoupling::MEDFileData::deepCopy;
%newobject MEDCoupling::MEDFileData::getMeshes;
%newobject MEDCoupling::MEDFileJointCorrespondence::New;
%newobject MEDCoupling::MEDFileJointCorrespondence::deepCopy;
%newobject MEDCoupling::MEDFileJointCorrespondence::shallowCpy;
+%newobject MEDCoupling::MEDFileJointCorrespondence::getCorrespondence;
%newobject MEDCoupling::MEDFileJointOneStep::New;
%newobject MEDCoupling::MEDFileJointOneStep::deepCopy;
%newobject MEDCoupling::MEDFileJointOneStep::shallowCpy;
+%newobject MEDCoupling::MEDFileJointOneStep::getCorrespondenceAtPos;
+%newobject MEDCoupling::MEDFileJointOneStep::__getitem__;
%newobject MEDCoupling::MEDFileJoint::New;
%newobject MEDCoupling::MEDFileJoint::deepCopy;
%newobject MEDCoupling::MEDFileJoint::shallowCpy;
+%newobject MEDCoupling::MEDFileJoint::getStepAtPos;
+%newobject MEDCoupling::MEDFileJoint::__getitem__;
%newobject MEDCoupling::MEDFileJoints::New;
%newobject MEDCoupling::MEDFileJoints::deepCopy;
%newobject MEDCoupling::MEDFileJoints::getJointAtPos;
%feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
%feature("unref") MEDFileField1TS "$this->decrRef();"
%feature("unref") MEDFileIntField1TS "$this->decrRef();"
+%feature("unref") MEDFileFloatField1TS "$this->decrRef();"
%feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
%feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
%feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
+%feature("unref") MEDFileFloatFieldMultiTS "$this->decrRef();"
%feature("unref") MEDFileMeshSupports "$this->decrRef();"
%feature("unref") MEDFileStructureElements "$this->decrRef();"
%feature("unref") MEDFileFields "$this->decrRef();"
void setRemoteGeometryType(INTERP_KERNEL::NormalizedCellType type);
INTERP_KERNEL::NormalizedCellType getRemoteGeometryType() const;
void setCorrespondence(DataArrayInt *corr) throw(INTERP_KERNEL::Exception);
- const DataArrayInt *getCorrespondence() const throw(INTERP_KERNEL::Exception);
void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName, int order, int iteration) const throw(INTERP_KERNEL::Exception);
std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
%extend
{
return self->simpleRepr();
}
+
+ DataArrayInt *getCorrespondence() const throw(INTERP_KERNEL::Exception)
+ {
+ const DataArrayInt *ret(self->getCorrespondence());
+ if(ret)
+ ret->incrRef();
+ return const_cast<DataArrayInt *>(ret);
+ }
}
};
int getIteration() const;
void pushCorrespondence(MEDFileJointCorrespondence* correspondence);
int getNumberOfCorrespondences() const;
- MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const;
void write(const std::string& fileName, int mode, const std::string& localMeshName, const std::string& jointName) const throw(INTERP_KERNEL::Exception);
std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
%extend
{
return self->simpleRepr();
}
+
+ MEDFileJointCorrespondence *getCorrespondenceAtPos(int i) const throw(INTERP_KERNEL::Exception)
+ {
+ MEDFileJointCorrespondence *ret(self->getCorrespondenceAtPos(i));
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ MEDFileJointCorrespondence *__getitem__(int i) const throw(INTERP_KERNEL::Exception)
+ {
+ return MEDCoupling_MEDFileJointOneStep_getCorrespondenceAtPos(self,i);
+ }
}
};
public:
static MEDFileJoint *New() throw(INTERP_KERNEL::Exception);
static MEDFileJoint *New(const std::string& fileName, const std::string& mName, int num) throw(INTERP_KERNEL::Exception);
- static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum ) throw(INTERP_KERNEL::Exception);
+ static MEDFileJoint *New(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum) throw(INTERP_KERNEL::Exception);
MEDFileJoint *deepCopy() const;
MEDFileJoint *shallowCpy() const;
bool isEqual(const MEDFileJoint *other) const;
int getDomainNumber() const;
void pushStep(MEDFileJointOneStep* step);
int getNumberOfSteps() const;
- MEDFileJointOneStep *getStepAtPos(int i) const;
std::string simpleRepr() const;
%extend
{
return MEDFileJoint::New(fileName,mName,num);
}
+ MEDFileJoint(const std::string& jointName, const std::string& locMeshName, const std::string& remoteMeshName, int remoteMeshNum) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileJoint::New(jointName,locMeshName,remoteMeshName,remoteMeshNum);
+ }
+
std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->simpleRepr();
}
+
+ MEDFileJointOneStep *getStepAtPos(int i) const throw(INTERP_KERNEL::Exception)
+ {
+ MEDFileJointOneStep *ret(self->getStepAtPos(i));
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ MEDFileJointOneStep *__getitem__(int i) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDCoupling_MEDFileJoint_getStepAtPos(self,i);
+ }
}
};
MEDFileJoint *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
+ static const char msg[]="MEDFileJoints::__getitem__ : only integer or string with meshname supported !";
if(PyInt_Check(obj))
{
MEDFileJoint *ret=self->getJointAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfJoints()));
ret->incrRef();
return ret;
}
- else if(PyString_Check(obj))
- {
- MEDFileJoint *ret=self->getJointWithName(PyString_AsString(obj));
- if(ret)
- ret->incrRef();
- return ret;
- }
- else
- throw INTERP_KERNEL::Exception("MEDFileJoints::__getitem__ : only integer or string with meshname supported !");
+ MEDFileJoint *ret(self->getJointWithName(convertPyObjectToStr(obj,msg)));
+ if(ret)
+ ret->incrRef();
+ return ret;
}
int __len__() const throw(INTERP_KERNEL::Exception)
virtual void setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception);
virtual void setRenumFieldArr(int meshDimRelToMaxExt, DataArrayInt *renumArr) throw(INTERP_KERNEL::Exception);
virtual void setNameFieldAtLevel(int meshDimRelToMaxExt, DataArrayAsciiChar *nameArr) throw(INTERP_KERNEL::Exception);
+ virtual void setGlobalNumFieldAtLevel(int meshDimRelToMaxExt, DataArrayInt *globalNumArr) throw(INTERP_KERNEL::Exception);
virtual void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
virtual void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
virtual DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
if(ret) ret->incrRef();
return ret;
}
+
+ virtual DataArrayInt *getGlobalNumFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
+ {
+ MCAuto<DataArrayInt> ret(self->getGlobalNumFieldAtLevel(meshDimRelToMaxExt));
+ return ret.retn();
+ }
}
};
MEDFileMesh *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
- if(PyInt_Check(obj))
+ static const char msg[]="MEDFileMeshes::__getitem__ : only integer or string with meshname supported !";
+ if(PyInt_Check(obj))
{
MEDFileMesh *ret=self->getMeshAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfMeshes()));
if(ret)
ret->incrRef();
return ret;
}
- else if(PyString_Check(obj))
- {
- MEDFileMesh *ret=self->getMeshWithName(PyString_AsString(obj));
- if(ret)
- ret->incrRef();
- return ret;
- }
- else
- throw INTERP_KERNEL::Exception("MEDFileMeshes::__getitem__ : only integer or string with meshname supported !");
+ MEDFileMesh *ret(self->getMeshWithName(convertPyObjectToStr(obj,msg)));
+ if(ret)
+ ret->incrRef();
+ return ret;
}
MEDFileMeshes *__setitem__(int obj, MEDFileMesh *mesh) throw(INTERP_KERNEL::Exception)
PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
{
- DataArrayInt *ret1=0;
- DataArrayDouble *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
+ return MEDFileField1TS_getFieldWithProfile<double>(self,type,meshDimRelToMax,mesh);
}
PyObject *getFieldSplitedByType2(const std::string& mname=std::string()) const throw(INTERP_KERNEL::Exception)
PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
{
- DataArrayInt *ret1=0;
- DataArrayInt *ret0=self->getFieldWithProfile(type,meshDimRelToMax,mesh,ret1);
- PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
+ return MEDFileField1TS_getFieldWithProfile<int>(self,type,meshDimRelToMax,mesh);
}
DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
}
};
+ class MEDFileFloatField1TS : public MEDFileAnyTypeField1TS
+ {
+ public:
+ static MEDFileFloatField1TS *New();
+ static MEDFileFloatField1TS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileFloatField1TS *New(DataArrayByte *db) throw(INTERP_KERNEL::Exception);
+ static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileFloatField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ MEDCoupling::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+ //
+ void setFieldNoProfileSBT(const MEDCouplingFieldFloat *field) throw(INTERP_KERNEL::Exception);
+ void setFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *field(const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDFileFloatField1TS() throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileFloatField1TS::New();
+ }
+
+ MEDFileFloatField1TS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileFloatField1TS::New(fileName,loadAll);
+ }
+
+ MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileFloatField1TS::New(fileName,fieldName,loadAll);
+ }
+
+ MEDFileFloatField1TS(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileFloatField1TS::New(fileName,fieldName,iteration,order,loadAll);
+ }
+
+ MEDFileFloatField1TS(DataArrayByte *db) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileFloatField1TS::New(db);
+ }
+
+ // serialization
+ static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
+ {
+ return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileFloatField1TS");
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+
+ PyObject *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileField1TS_getFieldWithProfile<float>(self,type,meshDimRelToMax,mesh);
+ }
+
+ DataArrayFloat *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayFloat *ret=self->getUndergroundDataArray();
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ }
+ };
+
class MEDFileAnyTypeFieldMultiTSIterator
{
public:
if(PySlice_Check(elts))
{
Py_ssize_t strt=2,stp=2,step=2;
- PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
- GetIndicesOfSlice(oC,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
+ GetIndicesOfSlice(elts,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
self->eraseTimeStepIds2(strt,stp,step);
}
else
std::vector<int> pos2;
DataArrayInt *pos3=0;
DataArrayIntTuple *pos4=0;
- convertObjToPossibleCpp1(li,sw,pos1,pos2,pos3,pos4);
+ convertIntStarLikePyObjToCpp(li,sw,pos1,pos2,pos3,pos4);
switch(sw)
{
case 1:
else if(elt0 && PySlice_Check(elt0))
{
Py_ssize_t strt=2,stp=2,step=2;
- PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
- GetIndicesOfSlice(oC,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
+ GetIndicesOfSlice(elt0,self->getNumberOfTS(),&strt,&stp,&step,"MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
}
else
}
};
+ class MEDFileIntFieldMultiTS;
+
class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
{
public:
MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const std::string& mname, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
//
void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
- MEDCoupling::MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+ MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
%extend
{
MEDFileFieldMultiTS()
void appendFieldNoProfileSBT(const MEDCouplingFieldInt *field) throw(INTERP_KERNEL::Exception);
void appendFieldProfile(const MEDCouplingFieldInt *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *field(int iteration, int order, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldInt *field(int iteration, int order, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldInt *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldInt *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldInt *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
static MEDFileIntFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
{
std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
- std::size_t sz(tmp.size());
- std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(sz);
- for(std::size_t i=0;i<sz;i++)
- {
- entitiesCpp[i].first=(TypeOfField)tmp[i].first;
- entitiesCpp[i].second=(INTERP_KERNEL::NormalizedCellType)tmp[i].second;
- }
+ std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
return MEDFileIntFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
}
}
}
};
+
+ class MEDFileFloatFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
+ {
+ public:
+ static MEDFileFloatFieldMultiTS *New();
+ static MEDFileFloatFieldMultiTS *New(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileFloatFieldMultiTS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileFloatFieldMultiTS *New(DataArrayByte *db) throw(INTERP_KERNEL::Exception);
+ //
+ void appendFieldNoProfileSBT(const MEDCouplingFieldFloat *field) throw(INTERP_KERNEL::Exception);
+ void appendFieldProfile(const MEDCouplingFieldFloat *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+ MEDCoupling::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *field(int iteration, int order, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldFloat *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const std::string& mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDFileFloatFieldMultiTS()
+ {
+ return MEDFileFloatFieldMultiTS::New();
+ }
+
+ MEDFileFloatFieldMultiTS(const std::string& fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileFloatFieldMultiTS::New(fileName,loadAll);
+ }
+
+ MEDFileFloatFieldMultiTS(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileFloatFieldMultiTS::New(fileName,fieldName,loadAll);
+ }
+
+ MEDFileFloatFieldMultiTS(DataArrayByte *db) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileFloatFieldMultiTS::New(db);
+ }
+
+ // serialization
+ static PyObject *___new___(PyObject *cls, PyObject *args) throw(INTERP_KERNEL::Exception)
+ {
+ return NewMethWrapCallInitOnlyIfDictWithSingleEltInInput(cls,args,"MEDFileFloatFieldMultiTS");
+ }
+
+ static MEDFileFloatFieldMultiTS *LoadSpecificEntities(const std::string& fileName, const std::string& fieldName, PyObject *entities, bool loadAll=true)
+ {
+ std::vector<std::pair<int,int> > tmp(convertTimePairIdsFromPy(entities));
+ std::vector< std::pair<TypeOfField,INTERP_KERNEL::NormalizedCellType> > entitiesCpp(convertVecPairIntToVecPairTOFCT(tmp));
+ return MEDFileFloatFieldMultiTS::LoadSpecificEntities(fileName,fieldName,entitiesCpp,loadAll);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+
+ PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ DataArrayFloat *ret0=self->getFieldWithProfile(type,iteration,order,meshDimRelToMax,mesh,ret1);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_MEDCoupling__DataArrayFloat, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_MEDCoupling__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ DataArrayFloat *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayFloat *ret=self->getUndergroundDataArray(iteration,order);
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ }
+ };
class MEDFileMeshSupports : public RefCountObject, public MEDFileWritableStandAlone
{
int getPosOfField(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
{
- if(elt0 && PyInt_Check(elt0))
+ static const char msg[]="MEDFileFields::getPosOfField : invalid input params ! expected fields[int], fields[string_of_field_name] !";
+ if(!elt0)
+ throw INTERP_KERNEL::Exception(msg);
+ if(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] !");
+ return self->getPosFromFieldName(convertPyObjectToStr(elt0,msg));
}
std::vector<int> getPosOfFields(PyObject *elts) const 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 !");
+ GetIndicesOfSlice(elts,self->getNumberOfFields(),&strt,&stp,&step,"MEDFileFields.__delitem__ : error in input slice !");
self->destroyFieldsAtPos2(strt,stp,step);
}
else
std::vector<int> pos2;
DataArrayInt *pos3=0;
DataArrayIntTuple *pos4=0;
- convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
+ convertIntStarLikePyObjToCpp(ids,sw,pos1,pos2,pos3,pos4);
switch(sw)
{
case 1:
MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
{
+ static const char msg[]="MEDFileParameters::__getitem__ : only integer or string with meshname supported !";
if(PyInt_Check(obj))
{
MEDFileParameterMultiTS *ret=self->getParamAtPos(InterpreteNegativeInt((int)PyInt_AS_LONG(obj),self->getNumberOfParams()));
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 !");
+ MEDFileParameterMultiTS *ret(self->getParamWithName(convertPyObjectToStr(obj,msg)));
+ if(ret)
+ ret->incrRef();
+ return ret;
}
int __len__() const throw(INTERP_KERNEL::Exception)