$result=convertMEDFileParameter1TS($1,$owner);
}
+%typemap(out) ParaMEDMEM::MEDFileAnyTypeFieldMultiTS*
+{
+ $result=convertMEDFileFieldMultiTS($1,$owner);
+}
+
+%typemap(out) ParaMEDMEM::MEDFileAnyTypeField1TS*
+{
+ $result=convertMEDFileField1TS($1,$owner);
+}
+
%newobject MEDLoader::ReadUMeshFromFamilies;
%newobject MEDLoader::ReadUMeshFromGroups;
%newobject MEDLoader::ReadUMeshFromFile;
%newobject MEDLoader::ReadFieldGauss;
%newobject MEDLoader::ReadFieldGaussNE;
%newobject ParaMEDMEM::MEDFileMesh::New;
+%newobject ParaMEDMEM::MEDFileMesh::createNewEmpty;
%newobject ParaMEDMEM::MEDFileMesh::deepCpy;
%newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
%newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
%newobject ParaMEDMEM::MEDFileMesh::getNodeFamilyArr;
%newobject ParaMEDMEM::MEDFileMesh::getNodeFamiliesArr;
%newobject ParaMEDMEM::MEDFileMesh::getAllFamiliesIdsReferenced;
+%newobject ParaMEDMEM::MEDFileMesh::computeAllFamilyIdsInUse;
%newobject ParaMEDMEM::MEDFileUMesh::New;
%newobject ParaMEDMEM::MEDFileUMesh::getCoords;
%newobject ParaMEDMEM::MEDFileUMesh::getGroup;
%newobject ParaMEDMEM::MEDFileFields::New;
%newobject ParaMEDMEM::MEDFileFields::deepCpy;
+%newobject ParaMEDMEM::MEDFileFields::shallowCpy;
%newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
%newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
-%newobject ParaMEDMEM::MEDFileFields::__getitem__;
+%newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedMeshName;
+%newobject ParaMEDMEM::MEDFileFields::partOfThisLyingOnSpecifiedTimeSteps;
+%newobject ParaMEDMEM::MEDFileFields::partOfThisNotLyingOnSpecifiedTimeSteps;
%newobject ParaMEDMEM::MEDFileFields::__iter__;
+
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::New;
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::deepCpy;
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::shallowCpy;
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepAtPos;
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStep;
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::getTimeStepGivenTime;
+%newobject ParaMEDMEM::MEDFileAnyTypeFieldMultiTS::__iter__;
%newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
-%newobject ParaMEDMEM::MEDFileFieldMultiTS::deepCpy;
-%newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepAtPos;
-%newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStep;
-%newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepGivenTime;
-%newobject ParaMEDMEM::MEDFileFieldMultiTS::__getitem__;
-%newobject ParaMEDMEM::MEDFileFieldMultiTS::__iter__;
%newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevel;
%newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtTopLevel;
%newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldOnMeshAtLevel;
%newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
%newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
+%newobject ParaMEDMEM::MEDFileFieldMultiTS::convertToInt;
+%newobject ParaMEDMEM::MEDFileIntFieldMultiTS::New;
+%newobject ParaMEDMEM::MEDFileIntFieldMultiTS::getUndergroundDataArray;
+%newobject ParaMEDMEM::MEDFileIntFieldMultiTS::convertToDouble;
+
+%newobject ParaMEDMEM::MEDFileAnyTypeField1TS::New;
+%newobject ParaMEDMEM::MEDFileAnyTypeField1TS::shallowCpy;
+%newobject ParaMEDMEM::MEDFileAnyTypeField1TS::deepCpy;
%newobject ParaMEDMEM::MEDFileField1TS::New;
-%newobject ParaMEDMEM::MEDFileField1TS::deepCpy;
%newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
%newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
%newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
%newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld;
%newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
+%newobject ParaMEDMEM::MEDFileField1TS::convertToInt;
+%newobject ParaMEDMEM::MEDFileIntField1TS::New;
+%newobject ParaMEDMEM::MEDFileIntField1TS::getUndergroundDataArray;
+%newobject ParaMEDMEM::MEDFileIntField1TS::convertToDouble;
%newobject ParaMEDMEM::MEDFileData::New;
%newobject ParaMEDMEM::MEDFileData::deepCpy;
%feature("unref") MEDFileMeshMultiTS "$this->decrRef();"
%feature("unref") MEDFileMeshes "$this->decrRef();"
%feature("unref") MEDFileFieldLoc "$this->decrRef();"
+%feature("unref") MEDFileAnyTypeField1TS "$this->decrRef();"
%feature("unref") MEDFileField1TS "$this->decrRef();"
+%feature("unref") MEDFileIntField1TS "$this->decrRef();"
+%feature("unref") MEDFileAnyTypeFieldMultiTS "$this->decrRef();"
%feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
+%feature("unref") MEDFileIntFieldMultiTS "$this->decrRef();"
%feature("unref") MEDFileFields "$this->decrRef();"
%feature("unref") MEDFileParameter1TS "$this->decrRef();"
%feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
class MEDLoader
{
public:
- static void setEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
- static void setCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
- static void setTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
+ static void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
+ static void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
+ static void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception);
static std::vector<std::string> GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception);
static std::vector<std::string> GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
return ret;
}
- static PyObject *GetAllFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+ static PyObject *GetAllFieldIterations(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
{
- std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,meshName,fieldName);
+ std::vector< std::pair< std::pair<int,int>, double> > res=MEDLoader::GetAllFieldIterations(fileName,fieldName);
PyObject *ret=PyList_New(res.size());
int rk=0;
for(std::vector< std::pair< std::pair<int,int>, double> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
public:
static MEDFileMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
+ virtual MEDFileMesh *createNewEmpty() const throw(INTERP_KERNEL::Exception);
virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
- virtual void clearNonDiscrAttributes() const;
+ virtual void clearNonDiscrAttributes() const throw(INTERP_KERNEL::Exception);
void setName(const char *name);
const char *getName();
- void setUnivName(const char *name);
const char *getUnivName() const;
+ bool getUnivNameWrStatus() const;
+ void setUnivNameWrStatus(bool newStatus);
void setDescription(const char *name);
const char *getDescription() const;
void setOrder(int order);
void setTimeUnit(const char *unit);
const char *getTimeUnit() const;
virtual int getNumberOfNodes() const throw(INTERP_KERNEL::Exception);
+ virtual std::vector<int> getFamArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
+ virtual std::vector<int> getNumArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
+ virtual std::vector<int> getNameArrNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
std::vector<int> getNonEmptyLevels() const throw(INTERP_KERNEL::Exception);
std::vector<int> getNonEmptyLevelsExt() const throw(INTERP_KERNEL::Exception);
void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
int getSizeAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception);
//
- bool existsGroup(const char *groupName) const;
- bool existsFamily(int famId) const;
- bool existsFamily(const char *familyName) const;
- void setFamilyId(const char *familyName, int id);
+ bool existsGroup(const char *groupName) const throw(INTERP_KERNEL::Exception);
+ bool existsFamily(int famId) const throw(INTERP_KERNEL::Exception);
+ bool existsFamily(const char *familyName) const throw(INTERP_KERNEL::Exception);
+ void setFamilyId(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
void setFamilyIdUnique(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
void addFamily(const char *familyName, int id) throw(INTERP_KERNEL::Exception);
void addFamilyOnGrp(const char *grpName, const char *famName) throw(INTERP_KERNEL::Exception);
virtual void createGroupOnAll(int meshDimRelToMaxExt, const char *groupName) throw(INTERP_KERNEL::Exception);
virtual bool keepFamIdsOnlyOnLevs(const std::vector<int>& famIds, const std::vector<int>& levs) throw(INTERP_KERNEL::Exception);
- void copyFamGrpMapsFrom(const MEDFileMesh& other);
- const std::map<std::string,int>& getFamilyInfo() const;
- const std::map<std::string, std::vector<std::string> >& getGroupInfo() const;
+ void copyFamGrpMapsFrom(const MEDFileMesh& other) throw(INTERP_KERNEL::Exception);
+ const std::map<std::string,int>& getFamilyInfo() const throw(INTERP_KERNEL::Exception);
+ const std::map<std::string, std::vector<std::string> >& getGroupInfo() const throw(INTERP_KERNEL::Exception);
std::vector<std::string> getFamiliesOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
std::vector<std::string> getFamiliesOnGroups(const std::vector<std::string>& grps) const throw(INTERP_KERNEL::Exception);
std::vector<int> getFamiliesIdsOnGroup(const char *name) const throw(INTERP_KERNEL::Exception);
void setFamiliesIdsOnGroup(const char *name, const std::vector<int>& famIds) throw(INTERP_KERNEL::Exception);
std::vector<std::string> getGroupsOnFamily(const char *name) const throw(INTERP_KERNEL::Exception);
void setGroupsOnFamily(const char *famName, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception);
- std::vector<std::string> getGroupsNames() const;
- std::vector<std::string> getFamiliesNames() const;
+ std::vector<std::string> getGroupsNames() const throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> getFamiliesNames() const throw(INTERP_KERNEL::Exception);
void assignFamilyNameWithGroupName() throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> removeEmptyGroups() throw(INTERP_KERNEL::Exception);
void removeGroup(const char *name) throw(INTERP_KERNEL::Exception);
void removeFamily(const char *name) throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> removeOrphanGroups() throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> removeOrphanFamilies() throw(INTERP_KERNEL::Exception);
void changeGroupName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
void changeFamilyName(const char *oldName, const char *newName) throw(INTERP_KERNEL::Exception);
void changeFamilyId(int oldId, int newId) throw(INTERP_KERNEL::Exception);
void setFamilyInfo(const std::map<std::string,int>& info);
void setGroupInfo(const std::map<std::string, std::vector<std::string> >&info);
int getFamilyId(const char *name) const throw(INTERP_KERNEL::Exception);
+ int getMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
int getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
+ int getTheMaxAbsFamilyId() const throw(INTERP_KERNEL::Exception);
int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
int getTheMinFamilyId() const throw(INTERP_KERNEL::Exception);
+ virtual int getMaxAbsFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
virtual int getMaxFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
virtual int getMinFamilyIdInArrays() const throw(INTERP_KERNEL::Exception);
DataArrayInt *getAllFamiliesIdsReferenced() const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *computeAllFamilyIdsInUse() const throw(INTERP_KERNEL::Exception);
std::vector<int> getFamiliesIds(const std::vector<std::string>& famNames) const throw(INTERP_KERNEL::Exception);
std::string getFamilyNameGivenId(int id) const throw(INTERP_KERNEL::Exception);
bool ensureDifferentFamIdsPerLevel() throw(INTERP_KERNEL::Exception);
void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
- void setMeshAtLevelGen(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld) throw(INTERP_KERNEL::Exception);
- void setGroupsFromScratch(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms) throw(INTERP_KERNEL::Exception);
- void setGroupsOnSetMesh(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum) throw(INTERP_KERNEL::Exception);
void optimizeFamilies() throw(INTERP_KERNEL::Exception);
DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
%extend
self->setGroupsAtLevel(meshDimRelToMaxExt,grps,renum);
}
+ void setMeshes(PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<const MEDCouplingUMesh *> ms;
+ convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
+ self->setMeshes(ms,renum);
+ }
+
+ void setGroupsFromScratch(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<const MEDCouplingUMesh *> ms;
+ convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
+ self->setGroupsFromScratch(meshDimRelToMax,ms,renum);
+ }
+
+ void setGroupsOnSetMesh(int meshDimRelToMax, PyObject *li, bool renum=false) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<const MEDCouplingUMesh *> ms;
+ convertFromPyObjVectorOfObj<const ParaMEDMEM::MEDCouplingUMesh *>(li,SWIGTYPE_p_ParaMEDMEM__MEDCouplingUMesh,"MEDCouplingUMesh",ms);
+ self->setGroupsOnSetMesh(meshDimRelToMax,ms,renum);
+ }
+
DataArrayDouble *getCoords() const throw(INTERP_KERNEL::Exception)
{
DataArrayDouble *ret=self->getCoords();
{
return self->iterator();
}
+
+ int __len__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->getNumberOfMeshes();
+ }
MEDFileMesh *getMeshAtPos(int i) const throw(INTERP_KERNEL::Exception)
{
const std::vector<double>& getRefCoords() const;
const std::vector<double>& getGaussCoords() const;
const std::vector<double>& getGaussWeights() const;
- bool isEqual(const MEDFileFieldLoc& other, double eps) const;
+ bool isEqual(const MEDFileFieldLoc& other, double eps) const throw(INTERP_KERNEL::Exception);
%extend
{
std::string __str__() const throw(INTERP_KERNEL::Exception)
class MEDFileFieldGlobsReal
{
public:
+ void resetContent();
void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
void deepCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
+ void shallowCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
+ void deepCpyOnlyUsedGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
+ void appendGlobs(const MEDFileFieldGlobsReal& other, double eps) throw(INTERP_KERNEL::Exception);
+ void checkGlobsCoherency() const throw(INTERP_KERNEL::Exception);
+ void checkGlobsPflsPartCoherency() const throw(INTERP_KERNEL::Exception);
+ void checkGlobsLocsPartCoherency() const throw(INTERP_KERNEL::Exception);
std::vector<std::string> getPfls() const throw(INTERP_KERNEL::Exception);
std::vector<std::string> getLocs() const throw(INTERP_KERNEL::Exception);
bool existsPfl(const char *pflName) const throw(INTERP_KERNEL::Exception);
std::vector< std::pair<std::vector<std::string>, std::string > > v=convertVecPairVecStFromPy(li);
self->changeLocsNamesInStruct(v);
}
+
+ std::string simpleReprGlobs() const throw(INTERP_KERNEL::Exception)
+ {
+ std::ostringstream oss;
+ self->simpleReprGlobs(oss);
+ return oss.str();
+ }
}
};
- class MEDFileField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
+ class MEDFileAnyTypeField1TS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
{
public:
- static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
- static MEDFileField1TS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
- static MEDFileField1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
- static MEDFileField1TS *New();
+ static MEDFileAnyTypeField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileAnyTypeField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
- //
- void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
- void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
- void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
- void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
- void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
- MEDFileField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
- //
+ void loadArrays() throw(INTERP_KERNEL::Exception);
+ void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
+ void releaseArrays() throw(INTERP_KERNEL::Exception);
int getDimension() const throw(INTERP_KERNEL::Exception);
int getIteration() const throw(INTERP_KERNEL::Exception);
int getOrder() const throw(INTERP_KERNEL::Exception);
void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
bool isDealingTS(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+ void setInfo(const std::vector<std::string>& infos) throw(INTERP_KERNEL::Exception);
const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
void setTime(int iteration, int order, double val) throw(INTERP_KERNEL::Exception);
+ virtual MEDFileAnyTypeField1TS *shallowCpy() const throw(INTERP_KERNEL::Exception);
+ MEDFileAnyTypeField1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
+ std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
+ void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
%extend
- {
- MEDFileField1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
- {
- return MEDFileField1TS::New(fileName);
- }
-
- MEDFileField1TS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
- {
- return MEDFileField1TS::New(fileName,fieldName);
- }
+ {
+ PyObject *getTime() throw(INTERP_KERNEL::Exception)
+ {
+ int tmp1,tmp2;
+ double tmp0=self->getTime(tmp1,tmp2);
+ PyObject *res = PyList_New(3);
+ PyList_SetItem(res,0,SWIG_From_int(tmp1));
+ PyList_SetItem(res,1,SWIG_From_int(tmp2));
+ PyList_SetItem(res,2,SWIG_From_double(tmp0));
+ return res;
+ }
- MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
- {
- return MEDFileField1TS::New(fileName,fieldName,iteration,order);
- }
+ PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
+ {
+ std::pair<int,int> res=self->getDtIt();
+ PyObject *elt=PyTuple_New(2);
+ PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
+ PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
+ return elt;
+ }
- MEDFileField1TS()
- {
- return MEDFileField1TS::New();
- }
-
- std::string __str__() const throw(INTERP_KERNEL::Exception)
- {
- return self->simpleRepr();
- }
+ void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
+ {
+ self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
+ }
+
+ void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
+ {
+ self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
+ }
- 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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
+ bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
+ return self->changeMeshNames(modifTab);
+ }
+
+ PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
+ PyObject *ret2=PyList_New(ret.size());
+ for(int i=0;i<(int)ret.size();i++)
+ PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
+ return ret2;
+ }
- void setProfileNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
- {
- self->setProfileNameOnLeaf(0,typ,locId,newPflName,forceRenameOnGlob);
- }
-
- void setLocNameOnLeaf(INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception)
- {
- self->setLocNameOnLeaf(0,typ,locId,newLocName,forceRenameOnGlob);
- }
+ PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> ret1;
+ int ret0=self->getNonEmptyLevels(mname,ret1);
+ PyObject *elt=PyTuple_New(2);
+ PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
+ PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
+ return elt;
+ }
- PyObject *getTime() throw(INTERP_KERNEL::Exception)
- {
- int tmp1,tmp2;
- double tmp0=self->getTime(tmp1,tmp2);
- PyObject *res = PyList_New(3);
- PyList_SetItem(res,0,SWIG_From_int(tmp1));
- PyList_SetItem(res,1,SWIG_From_int(tmp2));
- PyList_SetItem(res,2,SWIG_From_double(tmp0));
- return res;
- }
-
- PyObject *getDtIt() const throw(INTERP_KERNEL::Exception)
- {
- std::pair<int,int> res=self->getDtIt();
- PyObject *elt=PyTuple_New(2);
- PyTuple_SetItem(elt,0,SWIG_From_int(res.first));
- PyTuple_SetItem(elt,1,SWIG_From_int(res.second));
- return elt;
- }
-
- PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
- {
- std::vector<TypeOfField> ret=self->getTypesOfFieldAvailable();
- PyObject *ret2=PyList_New(ret.size());
- for(int i=0;i<(int)ret.size();i++)
- PyList_SetItem(ret2,i,SWIG_From_int(ret[i]));
- return ret2;
- }
-
- PyObject *getNonEmptyLevels(const char *mname=0) const throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> ret1;
- int ret0=self->getNonEmptyLevels(mname,ret1);
- PyObject *elt=PyTuple_New(2);
- PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
- PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
- return elt;
- }
-
- PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
- {
- std::vector<INTERP_KERNEL::NormalizedCellType> types;
- std::vector< std::vector<TypeOfField> > typesF;
- std::vector< std::vector<std::string> > pfls;
- std::vector< std::vector<std::string> > locs;
- std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
- int sz=ret.size();
- PyObject *ret2=PyList_New(sz);
+ PyObject *getFieldSplitedByType(const char *mname=0) const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<INTERP_KERNEL::NormalizedCellType> types;
+ std::vector< std::vector<TypeOfField> > typesF;
+ std::vector< std::vector<std::string> > pfls;
+ std::vector< std::vector<std::string> > locs;
+ std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(mname,types,typesF,pfls,locs);
+ int sz=ret.size();
+ PyObject *ret2=PyList_New(sz);
for(int i=0;i<sz;i++)
{
const std::vector< std::pair<int,int> >& dadsI=ret[i];
PyList_SetItem(ret2,i,elt);
}
return ret2;
+ }
+
+ PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeField1TS > > ret=self->splitComponents();
+ std::size_t sz=ret.size();
+ PyObject *retPy=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(retPy,i,convertMEDFileField1TS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
+ return retPy;
+ }
+ }
+ };
+
+ class MEDFileField1TS : public MEDFileAnyTypeField1TS
+ {
+ public:
+ static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileField1TS *New();
+ ParaMEDMEM::MEDFileIntField1TS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ MEDCouplingFieldDouble *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ //
+ void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
+ void setFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+ void setProfileNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newPflName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
+ void setLocNameOnLeaf(const char *mName, INTERP_KERNEL::NormalizedCellType typ, int locId, const char *newLocName, bool forceRenameOnGlob=false) throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDFileField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileField1TS::New(fileName,loadAll);
+ }
+
+ MEDFileField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileField1TS::New(fileName,fieldName,loadAll);
+ }
+
+ MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileField1TS::New(fileName,fieldName,iteration,order,loadAll);
+ }
+
+ MEDFileField1TS()
+ {
+ return MEDFileField1TS::New();
+ }
+
+ void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
+ {
+ const DataArrayDouble *arr=0;
+ if(field)
+ arr=field->getArray();
+ self->copyTinyInfoFrom(field,arr);
+ }
+
+ 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)
+ {
+ 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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
}
PyObject *getFieldSplitedByType2(const char *mname=0) const throw(INTERP_KERNEL::Exception)
PyTuple_SetItem(ret,1,elt);
return ret;
}
-
- bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
- return self->changeMeshNames(modifTab);
- }
}
};
- class MEDFileFieldMultiTSIterator
+ class MEDFileIntField1TS : public MEDFileAnyTypeField1TS
+ {
+ public:
+ static MEDFileIntField1TS *New();
+ static MEDFileIntField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ ParaMEDMEM::MEDFileField1TS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+ //
+ void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
+ void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDFileIntField1TS() throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileIntField1TS::New();
+ }
+
+ MEDFileIntField1TS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileIntField1TS::New(fileName,loadAll);
+ }
+
+ MEDFileIntField1TS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileIntField1TS::New(fileName,fieldName,loadAll);
+ }
+
+ MEDFileIntField1TS(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileIntField1TS::New(fileName,fieldName,iteration,order,loadAll);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+
+ PyObject *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,meshDimRelToMax,ret1,renumPol);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,ret1,renumPol);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *getFieldOnMeshAtLevel(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,meshDimRelToMax,mesh,ret1,renumPol);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,mesh,ret1,renumPol);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *getFieldAtLevelOld(TypeOfField type, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,mname,meshDimRelToMax,ret1,renumPol);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ 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_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ DataArrayInt *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret=self->getUndergroundDataArray();
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ }
+ };
+
+ class MEDFileAnyTypeFieldMultiTSIterator
{
public:
%extend
{
PyObject *next() throw(INTERP_KERNEL::Exception)
{
- MEDFileField1TS *ret=self->nextt();
+ MEDFileAnyTypeField1TS *ret=self->nextt();
if(ret)
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileField1TS,SWIG_POINTER_OWN | 0);
+ return convertMEDFileField1TS(ret, SWIG_POINTER_OWN | 0 );
else
{
PyErr_SetString(PyExc_StopIteration,"No more data.");
}
};
- class MEDFileFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
+ class MEDFileAnyTypeFieldMultiTS : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
{
public:
- static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
- static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
- static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
- MEDFileFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
- //
- MEDFileField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
- MEDFileField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
- MEDFileField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
- //
- void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
- MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
- 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 char *mname, int iteration, int order, 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);
- //
- int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
- void eraseEmptyTS() 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);
+ static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileAnyTypeFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ MEDFileAnyTypeFieldMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
+ virtual MEDFileAnyTypeFieldMultiTS *shallowCpy() const throw(INTERP_KERNEL::Exception);
std::string getName() const throw(INTERP_KERNEL::Exception);
void setName(const char *name) throw(INTERP_KERNEL::Exception);
+ std::string getDtUnit() const throw(INTERP_KERNEL::Exception);
+ void setDtUnit(const char *dtUnit) throw(INTERP_KERNEL::Exception);
std::string getMeshName() const throw(INTERP_KERNEL::Exception);
void setMeshName(const char *newMeshName) throw(INTERP_KERNEL::Exception);
const std::vector<std::string>& getInfo() const throw(INTERP_KERNEL::Exception);
+ int getNumberOfComponents() const throw(INTERP_KERNEL::Exception);
+ int getNumberOfTS() const throw(INTERP_KERNEL::Exception);
+ void eraseEmptyTS() 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);
+ void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+ void loadArrays() throw(INTERP_KERNEL::Exception);
+ void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
+ void releaseArrays() throw(INTERP_KERNEL::Exception);
+ //
+ virtual MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
+ MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+ MEDFileAnyTypeField1TS *getTimeStepGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
+ void pushBackTimeStep(MEDFileAnyTypeField1TS *f1ts) throw(INTERP_KERNEL::Exception);
+ void synchronizeNameScope() throw(INTERP_KERNEL::Exception);
%extend
- {
- MEDFileFieldMultiTS()
- {
- return MEDFileFieldMultiTS::New();
- }
-
- MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
- {
- return MEDFileFieldMultiTS::New(fileName);
- }
+ {
+ int __len__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->getNumberOfTS();
+ }
- MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
- {
- return MEDFileFieldMultiTS::New(fileName,fieldName);
- }
-
- std::string __str__() const throw(INTERP_KERNEL::Exception)
- {
- return self->simpleRepr();
- }
+ int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
+ {
+ if(elt0 && PyInt_Check(elt0))
+ {//fmts[3]
+ int pos=PyInt_AS_LONG(elt0);
+ 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("MEDFileAnyTypeFieldMultiTS::__getitem__ : 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("MEDFileAnyTypeFieldMultiTS::__getitem__ : 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("MEDFileAnyTypeFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
+ }
+
+ 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> ret1;
+ std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
+ std::size_t sz=ret.size();
+ PyObject *ret2=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ {
+ PyObject *elt=PyTuple_New(3);
+ PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
+ PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
+ PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
+ PyList_SetItem(ret2,i,elt);
+ }
+ return ret2;
+ }
+
+ PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
+ PyObject *ret2=PyList_New(ret.size());
+ for(int i=0;i<(int)ret.size();i++)
+ {
+ const std::vector<TypeOfField>& rett=ret[i];
+ PyObject *ret3=PyList_New(rett.size());
+ for(int j=0;j<(int)rett.size();j++)
+ PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
+ PyList_SetItem(ret2,i,ret3);
+ }
+ return ret2;
+ }
+
+ PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> ret1;
+ int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
+ PyObject *elt=PyTuple_New(2);
+ PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
+ PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
+ return elt;
+ }
+
+ PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<INTERP_KERNEL::NormalizedCellType> types;
+ std::vector< std::vector<TypeOfField> > typesF;
+ std::vector< std::vector<std::string> > pfls;
+ std::vector< std::vector<std::string> > locs;
+ std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
+ int sz=ret.size();
+ PyObject *ret2=PyList_New(sz);
+ for(int i=0;i<sz;i++)
+ {
+ const std::vector< std::pair<int,int> >& dadsI=ret[i];
+ const std::vector<TypeOfField>& typesFI=typesF[i];
+ const std::vector<std::string>& pflsI=pfls[i];
+ const std::vector<std::string>& locsI=locs[i];
+ PyObject *elt=PyTuple_New(2);
+ PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
+ int sz2=ret[i].size();
+ PyObject *elt2=PyList_New(sz2);
+ for(int j=0;j<sz2;j++)
+ {
+ PyObject *elt3=PyTuple_New(4);
+ PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
+ PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
+ PyTuple_SetItem(elt3,1,elt4);
+ PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
+ PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
+ PyList_SetItem(elt2,j,elt3);
+ }
+ PyTuple_SetItem(elt,1,elt2);
+ PyList_SetItem(ret2,i,elt);
+ }
+ return ret2;
+ }
- int __len__() const throw(INTERP_KERNEL::Exception)
- {
- return self->getNumberOfTS();
- }
+ std::vector<int> getTimeIds(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_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elt);
+ }
+ return ret;
+ }
+ else
+ {
+ std::vector<int> ret(1);
+ ret[0]=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeId(self,elts);
+ return ret;
+ }
+ }
+
+ void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
+ {
+ if(PySlice_Check(elts))
+ {
+ Py_ssize_t strt=2,stp=2,step=2;
+ PySliceObject *oC=reinterpret_cast<PySliceObject *>(elts);
+ if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
+ {
+ self->eraseTimeStepIds2(strt,stp,step);
+ }
+ else
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__delitem__ : error in input slice !");
+ }
+ else
+ {
+ std::vector<int> idsToRemove=ParaMEDMEM_MEDFileAnyTypeFieldMultiTS_getTimeIds(self,elts);
+ if(!idsToRemove.empty())
+ self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
+ }
+ }
+
+ void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ int sw;
+ int pos1;
+ std::vector<int> pos2;
+ DataArrayInt *pos3=0;
+ DataArrayIntTuple *pos4=0;
+ convertObjToPossibleCpp1(li,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("MEDFileAnyTypeFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
+ }
+ }
- MEDFileField1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
- {
- if(elt0 && PyInt_Check(elt0))
- {//fmts[3]
- int pos=PyInt_AS_LONG(elt0);
- return self->getTimeStepAtPos(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->getTimeStep(iter,order);
- }
- else
- throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : 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("MEDFileFieldMultiTS::__getitem__ : 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->getTimeStepGivenTime(val);
- }
- else
- throw INTERP_KERNEL::Exception("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
- }
+ MEDFileAnyTypeFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
+ {
+ return self->iterator();
+ }
- MEDFileFieldMultiTSIterator *__iter__() throw(INTERP_KERNEL::Exception)
- {
- return self->iterator();
- }
+ PyObject *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
+ {
+ if(elt0 && PyList_Check(elt0))
+ {
+ int sz=PyList_Size(elt0);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
+ int *pt=da->getPointer();
+ for(int i=0;i<sz;i++,pt++)
+ {
+ PyObject *elt1=PyList_GetItem(elt0,i);
+ *pt=MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt1);
+ }
+ return convertMEDFileFieldMultiTS(self->buildSubPart(da->begin(),da->end()),SWIG_POINTER_OWN | 0);
+ }
+ else if(elt0 && PySlice_Check(elt0))
+ {
+ Py_ssize_t strt=2,stp=2,step=2;
+ PySliceObject *oC=reinterpret_cast<PySliceObject *>(elt0);
+ if(PySlice_GetIndices(oC,self->getNumberOfTS(),&strt,&stp,&step)==0)
+ return convertMEDFileFieldMultiTS(self->buildSubPartSlice(strt,stp,step),SWIG_POINTER_OWN | 0);
+ else
+ throw INTERP_KERNEL::Exception("MEDFileAnyTypeFieldMultiTS.__getitem__ : error in input slice !");
+ }
+ else
+ return convertMEDFileField1TS(self->getTimeStepAtPos(MEDFileAnyTypeFieldMultiTSgetitemSingleTS__(self,elt0)),SWIG_POINTER_OWN | 0);
+ }
- PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
- {
- DataArrayInt *ret1=0;
- DataArrayDouble *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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- return ret;
- }
+ bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
+ return self->changeMeshNames(modifTab);
+ }
+
+ PyObject *splitComponents() const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > ret=self->splitComponents();
+ std::size_t sz=ret.size();
+ PyObject *retPy=PyList_New(sz);
+ for(std::size_t i=0;i<sz;i++)
+ PyList_SetItem(retPy,i,convertMEDFileFieldMultiTS(ret[i].retn(), SWIG_POINTER_OWN | 0 ));
+ return retPy;
+ }
+
+ void pushBackTimeSteps(PyObject *li) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<MEDFileAnyTypeField1TS *> tmp;
+ convertFromPyObjVectorOfObj<ParaMEDMEM::MEDFileAnyTypeField1TS *>(li,SWIGTYPE_p_ParaMEDMEM__MEDFileAnyTypeField1TS,"MEDFileAnyTypeField1TS",tmp);
+ self->pushBackTimeSteps(tmp);
+ }
+ }
+ };
- PyObject *getIterations() const
+ class MEDFileFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
+ {
+ public:
+ static MEDFileFieldMultiTS *New() throw(INTERP_KERNEL::Exception);
+ static MEDFileFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ //
+ MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
+ 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 char *mname, int iteration, int order, 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);
+ ParaMEDMEM::MEDFileIntFieldMultiTS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDFileFieldMultiTS()
{
- 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;
+ return MEDFileFieldMultiTS::New();
}
- PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
- {
- std::vector<double> ret1;
- std::vector< std::pair<int,int> > ret=self->getTimeSteps(ret1);
- std::size_t sz=ret.size();
- PyObject *ret2=PyList_New(sz);
- for(std::size_t i=0;i<sz;i++)
- {
- PyObject *elt=PyTuple_New(3);
- PyTuple_SetItem(elt,0,SWIG_From_int(ret[i].first));
- PyTuple_SetItem(elt,1,SWIG_From_int(ret[i].second));
- PyTuple_SetItem(elt,2,SWIG_From_double(ret1[i]));
- PyList_SetItem(ret2,i,elt);
- }
- return ret2;
- }
-
- PyObject *getTypesOfFieldAvailable() const throw(INTERP_KERNEL::Exception)
+ MEDFileFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
{
- std::vector< std::vector<TypeOfField> > ret=self->getTypesOfFieldAvailable();
- PyObject *ret2=PyList_New(ret.size());
- for(int i=0;i<(int)ret.size();i++)
- {
- const std::vector<TypeOfField>& rett=ret[i];
- PyObject *ret3=PyList_New(rett.size());
- for(int j=0;j<(int)rett.size();j++)
- PyList_SetItem(ret3,j,SWIG_From_int(rett[j]));
- PyList_SetItem(ret2,i,ret3);
- }
- return ret2;
+ return MEDFileFieldMultiTS::New(fileName,loadAll);
}
- PyObject *getNonEmptyLevels(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
+ MEDFileFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
{
- std::vector<int> ret1;
- int ret0=self->getNonEmptyLevels(iteration,order,mname,ret1);
- PyObject *elt=PyTuple_New(2);
- PyTuple_SetItem(elt,0,SWIG_From_int(ret0));
- PyTuple_SetItem(elt,1,convertIntArrToPyList2(ret1));
- return elt;
+ return MEDFileFieldMultiTS::New(fileName,fieldName,loadAll);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
}
- PyObject *getFieldSplitedByType(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
+ PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
{
- std::vector<INTERP_KERNEL::NormalizedCellType> types;
- std::vector< std::vector<TypeOfField> > typesF;
- std::vector< std::vector<std::string> > pfls;
- std::vector< std::vector<std::string> > locs;
- std::vector< std::vector< std::pair<int,int> > > ret=self->getFieldSplitedByType(iteration,order,mname,types,typesF,pfls,locs);
- int sz=ret.size();
- PyObject *ret2=PyList_New(sz);
- for(int i=0;i<sz;i++)
- {
- const std::vector< std::pair<int,int> >& dadsI=ret[i];
- const std::vector<TypeOfField>& typesFI=typesF[i];
- const std::vector<std::string>& pflsI=pfls[i];
- const std::vector<std::string>& locsI=locs[i];
- PyObject *elt=PyTuple_New(2);
- PyTuple_SetItem(elt,0,SWIG_From_int(types[i]));
- int sz2=ret[i].size();
- PyObject *elt2=PyList_New(sz2);
- for(int j=0;j<sz2;j++)
- {
- PyObject *elt3=PyTuple_New(4);
- PyTuple_SetItem(elt3,0,SWIG_From_int(typesFI[j]));
- PyObject *elt4=PyTuple_New(2); PyTuple_SetItem(elt4,0,SWIG_From_int(dadsI[j].first)); PyTuple_SetItem(elt4,1,SWIG_From_int(dadsI[j].second));
- PyTuple_SetItem(elt3,1,elt4);
- PyTuple_SetItem(elt3,2,PyString_FromString(pflsI[j].c_str()));
- PyTuple_SetItem(elt3,3,PyString_FromString(locsI[j].c_str()));
- PyList_SetItem(elt2,j,elt3);
- }
- PyTuple_SetItem(elt,1,elt2);
- PyList_SetItem(ret2,i,elt);
- }
- return ret2;
+ DataArrayInt *ret1=0;
+ DataArrayDouble *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_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
}
PyObject *getFieldSplitedByType2(int iteration, int order, const char *mname=0) const throw(INTERP_KERNEL::Exception)
ret->incrRef();
return ret;
}
+
PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception)
{
std::vector< std::pair<std::pair<INTERP_KERNEL::NormalizedCellType,int>,std::pair<int,int> > > elt1Cpp;
PyTuple_SetItem(ret,1,elt);
return ret;
}
-
- int getTimeId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
- {
- if(elt0 && PyInt_Check(elt0))
- {//fmts[3]
- int pos=PyInt_AS_LONG(elt0);
- 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("MEDFileFieldMultiTS::__getitem__ : 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("MEDFileFieldMultiTS::__getitem__ : 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("MEDFileFieldMultiTS::__getitem__ : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
- }
-
- std::vector<int> getTimeIds(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_MEDFileFieldMultiTS_getTimeId(self,elt);
- }
- return ret;
- }
- else
- {
- std::vector<int> ret(1);
- ret[0]=ParaMEDMEM_MEDFileFieldMultiTS_getTimeId(self,elts);
- return ret;
- }
- }
-
- void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFieldMultiTS_getTimeIds(self,elts);
- if(!idsToRemove.empty())
- self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
- }
-
- void eraseTimeStepIds(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- int sw;
- int pos1;
- std::vector<int> pos2;
- DataArrayInt *pos3=0;
- DataArrayIntTuple *pos4=0;
- convertObjToPossibleCpp1(li,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("MEDFileFieldMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
- }
- }
-
- bool changeMeshNames(PyObject *li) throw(INTERP_KERNEL::Exception)
- {
- std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
- return self->changeMeshNames(modifTab);
- }
}
};
{
PyObject *next() throw(INTERP_KERNEL::Exception)
{
- MEDFileFieldMultiTS *ret=self->nextt();
+ MEDFileAnyTypeFieldMultiTS *ret=self->nextt();
if(ret)
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldMultiTS,SWIG_POINTER_OWN | 0);
+ return convertMEDFileFieldMultiTS(ret, SWIG_POINTER_OWN | 0 );
else
{
PyErr_SetString(PyExc_StopIteration,"No more data.");
}
};
+ class MEDFileIntFieldMultiTS : public MEDFileAnyTypeFieldMultiTS
+ {
+ public:
+ static MEDFileIntFieldMultiTS *New();
+ static MEDFileIntFieldMultiTS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ static MEDFileIntFieldMultiTS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
+ //
+ void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
+ void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
+ ParaMEDMEM::MEDFileFieldMultiTS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDFileIntFieldMultiTS()
+ {
+ return MEDFileIntFieldMultiTS::New();
+ }
+
+ MEDFileIntFieldMultiTS(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileIntFieldMultiTS::New(fileName,loadAll);
+ }
+
+ MEDFileIntFieldMultiTS(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileIntFieldMultiTS::New(fileName,fieldName,loadAll);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+
+ PyObject *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ MEDCouplingFieldDouble *ret0=self->getFieldAtLevel(type,iteration,order,meshDimRelToMax,ret1,renumPol);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *getFieldAtTopLevel(TypeOfField type, int iteration, int order, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ MEDCouplingFieldDouble *ret0=self->getFieldAtTopLevel(type,iteration,order,ret1,renumPol);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,meshDimRelToMax,mesh,ret1,renumPol);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *getFieldOnMeshAtLevel(TypeOfField type, int iteration, int order, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ MEDCouplingFieldDouble *ret0=self->getFieldOnMeshAtLevel(type,iteration,order,mesh,ret1,renumPol);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *getFieldAtLevelOld(TypeOfField type, int iteration, int order, const char *mname, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ MEDCouplingFieldDouble *ret0=self->getFieldAtLevelOld(type,iteration,order,mname,meshDimRelToMax,ret1,renumPol);
+ PyObject *ret=PyTuple_New(2);
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__MEDCouplingFieldDouble, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ PyObject *getFieldWithProfile(TypeOfField type, int iteration, int order, int meshDimRelToMax, const MEDFileMesh *mesh) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret1=0;
+ DataArrayInt *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_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ return ret;
+ }
+
+ DataArrayInt *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception)
+ {
+ DataArrayInt *ret=self->getUndergroundDataArray(iteration,order);
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ }
+ };
+
class MEDFileFields : public RefCountObject, public MEDFileFieldGlobsReal, public MEDFileWritable
{
public:
static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
- static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+ static MEDFileFields *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
MEDFileFields *deepCpy() const throw(INTERP_KERNEL::Exception);
+ MEDFileFields *shallowCpy() const throw(INTERP_KERNEL::Exception);
+ void loadArrays() throw(INTERP_KERNEL::Exception);
+ void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
+ void releaseArrays() throw(INTERP_KERNEL::Exception);
void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
int getNumberOfFields() const;
std::vector<std::string> getFieldsNames() const throw(INTERP_KERNEL::Exception);
std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
//
void resize(int newSize) throw(INTERP_KERNEL::Exception);
- void pushField(MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
- void setFieldAtPos(int i, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
- MEDFileFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
- MEDFileFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
+ void pushField(MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
+ void setFieldAtPos(int i, MEDFileAnyTypeFieldMultiTS *field) throw(INTERP_KERNEL::Exception);
+ int getPosFromFieldName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
+ MEDFileAnyTypeFieldMultiTS *getFieldAtPos(int i) const throw(INTERP_KERNEL::Exception);
+ MEDFileAnyTypeFieldMultiTS *getFieldWithName(const char *fieldName) const throw(INTERP_KERNEL::Exception);
+ MEDFileFields *partOfThisLyingOnSpecifiedMeshName(const char *meshName) const throw(INTERP_KERNEL::Exception);
void destroyFieldAtPos(int i) throw(INTERP_KERNEL::Exception);
%extend
{
return MEDFileFields::New();
}
- MEDFileFields(const char *fileName) throw(INTERP_KERNEL::Exception)
+ MEDFileFields(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception)
{
- return MEDFileFields::New(fileName);
+ return MEDFileFields::New(fileName,loadAll);
}
std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->simpleRepr();
}
-
- MEDFileFieldMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+
+ PyObject *getCommonIterations() const throw(INTERP_KERNEL::Exception)
{
- if(PyInt_Check(obj))
+ bool ret1;
+ std::vector< std::pair<int,int> > ret0=self->getCommonIterations(ret1);
+ PyObject *ret=PyTuple_New(2);
+ PyObject *ret_0=PyList_New(ret0.size());
+ int rk=0;
+ for(std::vector< std::pair<int,int> >::const_iterator iter=ret0.begin();iter!=ret0.end();iter++,rk++)
{
- return self->getFieldAtPos((int)PyInt_AS_LONG(obj));
+ 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_0,rk,elt);
}
- else if(PyString_Check(obj))
+ PyTuple_SetItem(ret,0,ret_0);
+ PyObject *ret_1=ret1?Py_True:Py_False; Py_XINCREF(ret_1);
+ PyTuple_SetItem(ret,1,ret_1);
+ return ret;
+ }
+
+ MEDFileFields *partOfThisLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
+ return self->partOfThisLyingOnSpecifiedTimeSteps(ts);
+ }
+
+ MEDFileFields *partOfThisNotLyingOnSpecifiedTimeSteps(PyObject *timeSteps) const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<int,int> > ts=convertTimePairIdsFromPy(timeSteps);
+ return self->partOfThisNotLyingOnSpecifiedTimeSteps(ts);
+ }
+
+ PyObject *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ if(obj && PyList_Check(obj))
{
- return self->getFieldWithName(PyString_AsString(obj));
+ int sz=PyList_Size(obj);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> da=DataArrayInt::New(); da->alloc(sz,1);
+ int *pt=da->getPointer();
+ for(int i=0;i<sz;i++,pt++)
+ {
+ PyObject *elt1=PyList_GetItem(obj,i);
+ *pt=MEDFileFieldsgetitemSingleTS__(self,elt1);
+ }
+ return SWIG_NewPointerObj(SWIG_as_voidptr(self->buildSubPart(da->begin(),da->end())),SWIGTYPE_p_ParaMEDMEM__MEDFileFields, SWIG_POINTER_OWN | 0 );
}
else
- throw INTERP_KERNEL::Exception("MEDFileFields::__getitem__ : only integer or string with fieldname supported !");
+ return convertMEDFileFieldMultiTS(self->getFieldAtPos(MEDFileFieldsgetitemSingleTS__(self,obj)), SWIG_POINTER_OWN | 0 );
}
MEDFileFields *__setitem__(int obj, MEDFileFieldMultiTS *field) throw(INTERP_KERNEL::Exception)
return self;
}
+ int __len__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->getNumberOfFields();
+ }
+
MEDFileFieldsIterator *__iter__() throw(INTERP_KERNEL::Exception)
{
return self->iterator();
std::vector< std::pair<std::string,std::string> > modifTab=convertVecPairStStFromPy(li);
return self->changeMeshNames(modifTab);
}
+
+ 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);
+ if(PySlice_GetIndices(oC,self->getNumberOfFields(),&strt,&stp,&step)==0)
+ self->destroyFieldsAtPos2(strt,stp,step);
+ else
+ throw INTERP_KERNEL::Exception("MEDFileFields.__delitem__ : error in input slice !");
+ }
+ else
+ {
+ std::vector<int> idsToRemove=ParaMEDMEM_MEDFileFields_getPosOfFields(self,elts);
+ if(!idsToRemove.empty())
+ self->destroyFieldsAtPos(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
+ }
+ }
}
};
return self->simpleRepr();
}
- PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
+ PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const throw(INTERP_KERNEL::Exception)
{
std::string what;
bool ret0=self->isEqual(other,eps,what);
return self->simpleRepr();
}
- PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
+ PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const throw(INTERP_KERNEL::Exception)
{
std::string what;
bool ret0=self->isEqual(other,eps,what);
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)
{
return ret;
}
- PyObject *isEqual(const MEDFileParameters *other, double eps) const
+ PyObject *isEqual(const MEDFileParameters *other, double eps) const throw(INTERP_KERNEL::Exception)
{
std::string what;
bool ret0=self->isEqual(other,eps,what);