-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+// Author : Anthony Geay (CEA/DEN)
%module MEDLoader
#include "MEDLoader.hxx"
#include "MEDFileMesh.hxx"
#include "MEDFileField.hxx"
+#include "MEDFileParameter.hxx"
#include "MEDFileData.hxx"
#include "MEDLoaderTypemaps.i"
#include "SauvReader.hxx"
$result=convertMEDFileMesh($1,$owner);
}
+%typemap(out) ParaMEDMEM::MEDFileParameter1TS*
+{
+ $result=convertMEDFileParameter1TS($1,$owner);
+}
+
%newobject MEDLoader::ReadUMeshFromFamilies;
%newobject MEDLoader::ReadUMeshFromGroups;
%newobject MEDLoader::ReadUMeshFromFile;
%newobject MEDLoader::ReadFieldGauss;
%newobject MEDLoader::ReadFieldGaussNE;
%newobject ParaMEDMEM::MEDFileMesh::New;
+%newobject ParaMEDMEM::MEDFileMesh::deepCpy;
+%newobject ParaMEDMEM::MEDFileMesh::shallowCpy;
%newobject ParaMEDMEM::MEDFileMesh::getGenMeshAtLevel;
%newobject ParaMEDMEM::MEDFileMesh::getGroupArr;
%newobject ParaMEDMEM::MEDFileMesh::getGroupsArr;
%newobject ParaMEDMEM::MEDFileUMesh::getLevelM1Mesh;
%newobject ParaMEDMEM::MEDFileUMesh::getLevelM2Mesh;
%newobject ParaMEDMEM::MEDFileUMesh::getLevelM3Mesh;
+%newobject ParaMEDMEM::MEDFileUMesh::zipCoords;
%newobject ParaMEDMEM::MEDFileCMesh::New;
+%newobject ParaMEDMEM::MEDFileCurveLinearMesh::New;
%newobject ParaMEDMEM::MEDFileMeshMultiTS::New;
+%newobject ParaMEDMEM::MEDFileMeshMultiTS::deepCpy;
%newobject ParaMEDMEM::MEDFileMeshMultiTS::getOneTimeStep;
%newobject ParaMEDMEM::MEDFileMeshes::New;
+%newobject ParaMEDMEM::MEDFileMeshes::deepCpy;
%newobject ParaMEDMEM::MEDFileMeshes::getMeshAtPos;
%newobject ParaMEDMEM::MEDFileMeshes::getMeshWithName;
%newobject ParaMEDMEM::MEDFileMeshes::__getitem__;
%newobject ParaMEDMEM::MEDFileMeshes::__iter__;
%newobject ParaMEDMEM::MEDFileFields::New;
+%newobject ParaMEDMEM::MEDFileFields::deepCpy;
%newobject ParaMEDMEM::MEDFileFields::getFieldWithName;
%newobject ParaMEDMEM::MEDFileFields::getFieldAtPos;
%newobject ParaMEDMEM::MEDFileFields::__getitem__;
%newobject ParaMEDMEM::MEDFileFields::__iter__;
%newobject ParaMEDMEM::MEDFileFieldMultiTS::New;
+%newobject ParaMEDMEM::MEDFileFieldMultiTS::deepCpy;
%newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepAtPos;
%newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStep;
%newobject ParaMEDMEM::MEDFileFieldMultiTS::getTimeStepGivenTime;
%newobject ParaMEDMEM::MEDFileFieldMultiTS::getFieldAtLevelOld;
%newobject ParaMEDMEM::MEDFileFieldMultiTS::getUndergroundDataArray;
%newobject ParaMEDMEM::MEDFileField1TS::New;
+%newobject ParaMEDMEM::MEDFileField1TS::deepCpy;
%newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
%newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
%newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel;
%newobject ParaMEDMEM::MEDFileField1TS::getUndergroundDataArray;
%newobject ParaMEDMEM::MEDFileData::New;
+%newobject ParaMEDMEM::MEDFileData::deepCpy;
%newobject ParaMEDMEM::MEDFileData::getMeshes;
%newobject ParaMEDMEM::MEDFileData::getFields;
+%newobject ParaMEDMEM::MEDFileData::getParams;
+
+%newobject ParaMEDMEM::MEDFileParameterDouble1TS::New;
+%newobject ParaMEDMEM::MEDFileParameterDouble1TS::deepCpy;
+%newobject ParaMEDMEM::MEDFileParameterMultiTS::New;
+%newobject ParaMEDMEM::MEDFileParameterMultiTS::deepCpy;
+%newobject ParaMEDMEM::MEDFileParameterMultiTS::getTimeStepAtPos;
+%newobject ParaMEDMEM::MEDFileParameterMultiTS::__getitem__;
+%newobject ParaMEDMEM::MEDFileParameters::New;
+%newobject ParaMEDMEM::MEDFileParameters::deepCpy;
+%newobject ParaMEDMEM::MEDFileParameters::getParamAtPos;
+%newobject ParaMEDMEM::MEDFileParameters::getParamWithName;
+%newobject ParaMEDMEM::MEDFileParameters::__getitem__;
%newobject ParaMEDMEM::SauvWriter::New;
%newobject ParaMEDMEM::SauvReader::New;
%feature("unref") MEDFileField1TS "$this->decrRef();"
%feature("unref") MEDFileFieldMultiTS "$this->decrRef();"
%feature("unref") MEDFileFields "$this->decrRef();"
+%feature("unref") MEDFileParameter1TS "$this->decrRef();"
+%feature("unref") MEDFileParameterDouble1TSWTI "$this->decrRef();"
+%feature("unref") MEDFileParameterDouble1TS "$this->decrRef();"
+%feature("unref") MEDFileParameterMultiTS "$this->decrRef();"
+%feature("unref") MEDFileParameters "$this->decrRef();"
%feature("unref") MEDFileData "$this->decrRef();"
%feature("unref") SauvReader "$this->decrRef();"
%feature("unref") SauvWriter "$this->decrRef();"
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);
+ static MEDFileMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
+ virtual MEDFileMesh *deepCpy() const throw(INTERP_KERNEL::Exception);
+ virtual MEDFileMesh *shallowCpy() const throw(INTERP_KERNEL::Exception);
virtual void clearNonDiscrAttributes() const;
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);
- std::vector<int> getNonEmptyLevels() const;
- std::vector<int> getNonEmptyLevelsExt() const;
+ 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);
//
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 changeAllGroupsContainingFamily(const char *familyNameToChange, const std::vector<std::string>& newFamiliesNames) 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 getMaxFamilyId() const throw(INTERP_KERNEL::Exception);
int getMinFamilyId() const throw(INTERP_KERNEL::Exception);
+ int getTheMaxFamilyId() const throw(INTERP_KERNEL::Exception);
+ int getTheMinFamilyId() 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);
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);
virtual MEDCouplingMesh *getGenMeshAtLevel(int meshDimRelToMax, bool renum=false) 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 DataArrayInt *getFamiliesArr(int meshDimRelToMaxExt, const std::vector<std::string>& fams, bool renum=false) const throw(INTERP_KERNEL::Exception);
virtual DataArrayInt *getGroupsArr(int meshDimRelToMaxExt, const std::vector<std::string>& grps, bool renum=false) const throw(INTERP_KERNEL::Exception);
virtual DataArrayInt *getGroupArr(int meshDimRelToMaxExt, const char *grp, bool renum=false) const throw(INTERP_KERNEL::Exception);
return MEDFileMesh::New(fileName);
}
- MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1)
+ MEDFileMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
{
return MEDFileMesh::New(fileName,mName,dt,it);
}
tmp->incrRef();
return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
+
+ PyObject *getNameFieldAtLevel(int meshDimRelToMaxExt) const throw(INTERP_KERNEL::Exception)
+ {
+ const DataArrayAsciiChar *tmp=self->getNameFieldAtLevel(meshDimRelToMaxExt);
+ if(tmp)
+ tmp->incrRef();
+ return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__DataArrayAsciiChar, SWIG_POINTER_OWN | 0 );
+ }
PyObject *findOrCreateAndGiveFamilyWithId(int id, bool& created) throw(INTERP_KERNEL::Exception)
{
void setFamilyNameAttachedOnId(int id, const std::string& newFamName) throw(INTERP_KERNEL::Exception);
void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
void eraseGroupsAtLevel(int meshDimRelToMaxExt) throw(INTERP_KERNEL::Exception);
- void addNodeGroup(const std::string& name, const std::vector<int>& ids) throw(INTERP_KERNEL::Exception);
+ void addNodeGroup(const DataArrayInt *ids) 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
{
MEDFileUMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
}
};
- class MEDFileCMesh : public MEDFileMesh
+ class MEDFileStructuredMesh : public MEDFileMesh
+ {
+ };
+
+ class MEDFileCMesh : public MEDFileStructuredMesh
{
public:
static MEDFileCMesh *New();
}
};
+ class MEDFileCurveLinearMesh : public MEDFileStructuredMesh
+ {
+ public:
+ static MEDFileCurveLinearMesh *New();
+ static MEDFileCurveLinearMesh *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+ static MEDFileCurveLinearMesh *New(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception);
+ void setMesh(MEDCouplingCurveLinearMesh *m) throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDFileCurveLinearMesh()
+ {
+ return MEDFileCurveLinearMesh::New();
+ }
+
+ MEDFileCurveLinearMesh(const char *fileName) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileCurveLinearMesh::New(fileName);
+ }
+
+ MEDFileCurveLinearMesh(const char *fileName, const char *mName, int dt=-1, int it=-1) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileCurveLinearMesh::New(fileName,mName,dt,it);
+ }
+
+ PyObject *getMesh() const throw(INTERP_KERNEL::Exception)
+ {
+ const MEDCouplingCurveLinearMesh *tmp=self->getMesh();
+ if(tmp)
+ tmp->incrRef();
+ return SWIG_NewPointerObj(SWIG_as_voidptr(tmp),SWIGTYPE_p_ParaMEDMEM__MEDCouplingCurveLinearMesh, SWIG_POINTER_OWN | 0 );
+ }
+ }
+ };
+
class MEDFileMeshMultiTS : public RefCountObject, public MEDFileWritable
{
public:
static MEDFileMeshMultiTS *New();
static MEDFileMeshMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
static MEDFileMeshMultiTS *New(const char *fileName, const char *mName) throw(INTERP_KERNEL::Exception);
+ MEDFileMeshMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
const char *getName() const throw(INTERP_KERNEL::Exception);
void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
void setOneTimeStep(MEDFileMesh *mesh1TimeStep) throw(INTERP_KERNEL::Exception);
public:
static MEDFileMeshes *New();
static MEDFileMeshes *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+ MEDFileMeshes *deepCpy() const throw(INTERP_KERNEL::Exception);
void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
std::vector<std::string> getMeshesNames() const throw(INTERP_KERNEL::Exception);
return MEDFileMeshes::New(fileName);
}
- std::string __str__() const
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
{
return self->simpleRepr();
}
{
public:
void shallowCpyGlobs(const MEDFileFieldGlobsReal& other) throw(INTERP_KERNEL::Exception);
+ void deepCpyGlobs(const MEDFileFieldGlobsReal& other) 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);
PyObject *getLocalizationFromId(int locId) const throw(INTERP_KERNEL::Exception)
{
const MEDFileFieldLoc *loc=&self->getLocalizationFromId(locId);
- loc->incrRef();
+ if(loc)
+ loc->incrRef();
return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
}
PyObject *getLocalization(const char *locName) const throw(INTERP_KERNEL::Exception)
{
const MEDFileFieldLoc *loc=&self->getLocalization(locName);
- loc->incrRef();
+ if(loc)
+ loc->incrRef();
return SWIG_NewPointerObj(SWIG_as_voidptr(loc),SWIGTYPE_p_ParaMEDMEM__MEDFileFieldLoc, SWIG_POINTER_OWN | 0 );
}
{
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();
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);
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);
//
int getDimension() const throw(INTERP_KERNEL::Exception);
int getIteration() const throw(INTERP_KERNEL::Exception);
void setTime(int iteration, int order, double val) 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);
+ }
+
MEDFileField1TS(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
{
return MEDFileField1TS::New(fileName,fieldName,iteration,order);
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);
}
std::string __str__() const throw(INTERP_KERNEL::Exception)
- {
- return self->simpleRepr();
- }
+ {
+ return self->simpleRepr();
+ }
+
+ int __len__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->getNumberOfTS();
+ }
MEDFileField1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
{
public:
static MEDFileFields *New() throw(INTERP_KERNEL::Exception);
static MEDFileFields *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+ MEDFileFields *deepCpy() const 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);
}
};
+ class MEDFileParameter1TS : public RefCountObject
+ {
+ public:
+ void setIteration(int it);
+ int getIteration() const;
+ void setOrder(int order);
+ int getOrder() const;
+ void setTimeValue(double time);
+ void setTime(int dt, int it, double time);
+ double getTime(int& dt, int& it);
+ double getTimeValue() const;
+ };
+
+ class MEDFileParameterDouble1TSWTI : public MEDFileParameter1TS
+ {
+ public:
+ void setValue(double val) throw(INTERP_KERNEL::Exception);
+ double getValue() const throw(INTERP_KERNEL::Exception);
+ std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+ }
+ };
+
+ class MEDFileParameterTinyInfo : public MEDFileWritable
+ {
+ public:
+ void setDescription(const char *name);
+ const char *getDescription() const;
+ void setTimeUnit(const char *unit);
+ const char *getTimeUnit() const;
+ };
+
+ class MEDFileParameterDouble1TS : public MEDFileParameterDouble1TSWTI, public MEDFileParameterTinyInfo
+ {
+ public:
+ static MEDFileParameterDouble1TS *New();
+ static MEDFileParameterDouble1TS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+ static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
+ static MEDFileParameterDouble1TS *New(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception);
+ virtual MEDFileParameter1TS *deepCpy() const throw(INTERP_KERNEL::Exception);
+ virtual std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
+ void setName(const char *name) throw(INTERP_KERNEL::Exception);
+ const char *getName() const throw(INTERP_KERNEL::Exception);
+ void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDFileParameterDouble1TS()
+ {
+ return MEDFileParameterDouble1TS::New();
+ }
+
+ MEDFileParameterDouble1TS(const char *fileName) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileParameterDouble1TS::New(fileName);
+ }
+
+ MEDFileParameterDouble1TS(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileParameterDouble1TS::New(fileName,paramName);
+ }
+
+ MEDFileParameterDouble1TS(const char *fileName, const char *paramName, int dt, int it) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileParameterDouble1TS::New(fileName,paramName,dt,it);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+
+ PyObject *isEqual(const MEDFileParameter1TS *other, double eps) const
+ {
+ std::string what;
+ bool ret0=self->isEqual(other,eps,what);
+ PyObject *res=PyList_New(2);
+ PyObject *ret0Py=ret0?Py_True:Py_False;
+ Py_XINCREF(ret0Py);
+ PyList_SetItem(res,0,ret0Py);
+ PyList_SetItem(res,1,PyString_FromString(what.c_str()));
+ return res;
+ }
+ }
+ };
+
+ class MEDFileParameterMultiTS : public RefCountObject, public MEDFileParameterTinyInfo
+ {
+ public:
+ static MEDFileParameterMultiTS *New();
+ static MEDFileParameterMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+ static MEDFileParameterMultiTS *New(const char *fileName, const char *paramName) throw(INTERP_KERNEL::Exception);
+ const char *getName() const;
+ void setName(const char *name);
+ MEDFileParameterMultiTS *deepCpy() const throw(INTERP_KERNEL::Exception);
+ void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+ std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
+ void appendValue(int dt, int it, double time, double val) throw(INTERP_KERNEL::Exception);
+ double getDoubleValue(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+ int getPosOfTimeStep(int iteration, int order) const throw(INTERP_KERNEL::Exception);
+ int getPosGivenTime(double time, double eps=1e-8) const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDFileParameterMultiTS()
+ {
+ return MEDFileParameterMultiTS::New();
+ }
+
+ MEDFileParameterMultiTS(const char *fileName)
+ {
+ return MEDFileParameterMultiTS::New(fileName);
+ }
+
+ MEDFileParameterMultiTS(const char *fileName, const char *paramName)
+ {
+ return MEDFileParameterMultiTS::New(fileName,paramName);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+
+ PyObject *isEqual(const MEDFileParameterMultiTS *other, double eps) const
+ {
+ std::string what;
+ bool ret0=self->isEqual(other,eps,what);
+ PyObject *res=PyList_New(2);
+ PyObject *ret0Py=ret0?Py_True:Py_False;
+ Py_XINCREF(ret0Py);
+ PyList_SetItem(res,0,ret0Py);
+ PyList_SetItem(res,1,PyString_FromString(what.c_str()));
+ return res;
+ }
+
+ void eraseTimeStepIds(PyObject *ids) throw(INTERP_KERNEL::Exception)
+ {
+ int sw;
+ int pos1;
+ std::vector<int> pos2;
+ DataArrayInt *pos3=0;
+ DataArrayIntTuple *pos4=0;
+ convertObjToPossibleCpp1(ids,sw,pos1,pos2,pos3,pos4);
+ switch(sw)
+ {
+ case 1:
+ {
+ self->eraseTimeStepIds(&pos1,&pos1+1);
+ return;
+ }
+ case 2:
+ {
+ if(pos2.empty())
+ return;
+ self->eraseTimeStepIds(&pos2[0],&pos2[0]+pos2.size());
+ return ;
+ }
+ case 3:
+ {
+ self->eraseTimeStepIds(pos3->begin(),pos3->end());
+ return ;
+ }
+ default:
+ throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::eraseTimeStepIds : unexpected input array type recognized !");
+ }
+ }
+
+ int getTimeStepId(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
+ {
+ if(elt0 && PyInt_Check(elt0))
+ {//fmts[3]
+ int pos=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("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size 2 but two integers are expected in this tuple to request a time steps !");
+ }
+ else
+ throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input param ! input is a tuple of size != 2 ! two integers are expected in this tuple to request a time steps !");
+ }
+ else if(elt0 && PyFloat_Check(elt0))
+ {
+ double val=PyFloat_AS_DOUBLE(elt0);
+ return self->getPosGivenTime(val);
+ }
+ else
+ throw INTERP_KERNEL::Exception("MEDFileParameterMultiTS::getTimeStepId : invalid input params ! expected fmts[int], fmts[int,int] or fmts[double] to request time step !");
+ }
+
+ MEDFileParameter1TS *__getitem__(PyObject *elt0) const throw(INTERP_KERNEL::Exception)
+ {
+ MEDFileParameter1TS *ret=self->getTimeStepAtPos(ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt0));
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ std::vector<int> getTimeStepIds(PyObject *elts) const throw(INTERP_KERNEL::Exception)
+ {
+ if(PyList_Check(elts))
+ {
+ int sz=PyList_Size(elts);
+ std::vector<int> ret(sz);
+ for(int i=0;i<sz;i++)
+ {
+ PyObject *elt=PyList_GetItem(elts,i);
+ ret[i]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elt);
+ }
+ return ret;
+ }
+ else
+ {
+ std::vector<int> ret(1);
+ ret[0]=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepId(self,elts);
+ return ret;
+ }
+ }
+
+ void __delitem__(PyObject *elts) throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<int> idsToRemove=ParaMEDMEM_MEDFileParameterMultiTS_getTimeStepIds(self,elts);
+ if(!idsToRemove.empty())
+ self->eraseTimeStepIds(&idsToRemove[0],&idsToRemove[0]+idsToRemove.size());
+ }
+
+ MEDFileParameter1TS *getTimeStepAtPos(int posId) const throw(INTERP_KERNEL::Exception)
+ {
+ MEDFileParameter1TS *ret=self->getTimeStepAtPos(posId);
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ PyObject *getIterations() const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector< std::pair<int,int> > res=self->getIterations();
+ PyObject *ret=PyList_New(res.size());
+ int rk=0;
+ for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
+ {
+ PyObject *elt=PyTuple_New(2);
+ PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
+ PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
+ PyList_SetItem(ret,rk,elt);
+ }
+ return ret;
+ }
+
+ PyObject *getTimeSteps() const throw(INTERP_KERNEL::Exception)
+ {
+ std::vector<double> res2;
+ std::vector< std::pair<int,int> > res=self->getTimeSteps(res2);
+ PyObject *ret=PyList_New(res.size());
+ int rk=0;
+ for(std::vector< std::pair<int,int> >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++)
+ {
+ PyObject *elt=PyTuple_New(3);
+ PyTuple_SetItem(elt,0,SWIG_From_int((*iter).first));
+ PyTuple_SetItem(elt,1,SWIG_From_int((*iter).second));
+ PyTuple_SetItem(elt,2,SWIG_From_double(res2[rk]));
+ PyList_SetItem(ret,rk,elt);
+ }
+ return ret;
+ }
+ }
+ };
+
+ class MEDFileParameters : public RefCountObject, public MEDFileWritable
+ {
+ public:
+ static MEDFileParameters *New();
+ static MEDFileParameters *New(const char *fileName) throw(INTERP_KERNEL::Exception);
+ MEDFileParameters *deepCpy() const throw(INTERP_KERNEL::Exception);
+ void write(const char *fileName, int mode) const throw(INTERP_KERNEL::Exception);
+ std::vector<std::string> getParamsNames() const throw(INTERP_KERNEL::Exception);
+ std::string simpleRepr() const throw(INTERP_KERNEL::Exception);
+ void resize(int newSize) throw(INTERP_KERNEL::Exception);
+ void pushParam(MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
+ void setParamAtPos(int i, MEDFileParameterMultiTS *param) throw(INTERP_KERNEL::Exception);
+ void destroyParamAtPos(int i) throw(INTERP_KERNEL::Exception);
+ int getPosFromParamName(const char *paramName) const throw(INTERP_KERNEL::Exception);
+ int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
+ %extend
+ {
+ MEDFileParameters()
+ {
+ return MEDFileParameters::New();
+ }
+
+ MEDFileParameters(const char *fileName)
+ {
+ return MEDFileParameters::New(fileName);
+ }
+
+ std::string __str__() const throw(INTERP_KERNEL::Exception)
+ {
+ return self->simpleRepr();
+ }
+
+ MEDFileParameterMultiTS *__getitem__(PyObject *obj) throw(INTERP_KERNEL::Exception)
+ {
+ if(PyInt_Check(obj))
+ {
+ MEDFileParameterMultiTS *ret=self->getParamAtPos((int)PyInt_AS_LONG(obj));
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ else if(PyString_Check(obj))
+ {
+ MEDFileParameterMultiTS *ret=self->getParamWithName(PyString_AsString(obj));
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+ else
+ throw INTERP_KERNEL::Exception("MEDFileParameters::__getitem__ : only integer or string with meshname supported !");
+ }
+
+ MEDFileParameterMultiTS *getParamAtPos(int i) const throw(INTERP_KERNEL::Exception)
+ {
+ MEDFileParameterMultiTS *ret=self->getParamAtPos(i);
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ MEDFileParameterMultiTS *getParamWithName(const char *paramName) const throw(INTERP_KERNEL::Exception)
+ {
+ MEDFileParameterMultiTS *ret=self->getParamWithName(paramName);
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
+ PyObject *isEqual(const MEDFileParameters *other, double eps) const
+ {
+ std::string what;
+ bool ret0=self->isEqual(other,eps,what);
+ PyObject *res=PyList_New(2);
+ PyObject *ret0Py=ret0?Py_True:Py_False;
+ Py_XINCREF(ret0Py);
+ PyList_SetItem(res,0,ret0Py);
+ PyList_SetItem(res,1,PyString_FromString(what.c_str()));
+ return res;
+ }
+ }
+ };
+
class MEDFileData : public RefCountObject, public MEDFileWritable
{
public:
static MEDFileData *New(const char *fileName) throw(INTERP_KERNEL::Exception);
static MEDFileData *New();
+ MEDFileData *deepCpy() const throw(INTERP_KERNEL::Exception);
void setFields(MEDFileFields *fields) throw(INTERP_KERNEL::Exception);
void setMeshes(MEDFileMeshes *meshes) throw(INTERP_KERNEL::Exception);
+ void setParams(MEDFileParameters *params) throw(INTERP_KERNEL::Exception);
int getNumberOfFields() const throw(INTERP_KERNEL::Exception);
int getNumberOfMeshes() const throw(INTERP_KERNEL::Exception);
+ int getNumberOfParams() const throw(INTERP_KERNEL::Exception);
//
bool changeMeshName(const char *oldMeshName, const char *newMeshName) throw(INTERP_KERNEL::Exception);
bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
return ret;
}
+ MEDFileParameters *getParams() const throw(INTERP_KERNEL::Exception)
+ {
+ MEDFileParameters *ret=self->getParams();
+ if(ret)
+ ret->incrRef();
+ return ret;
+ }
+
MEDFileFields *getFields() const throw(INTERP_KERNEL::Exception)
{
MEDFileFields *ret=self->getFields();