return new MEDFileFieldMultiTS;
}
+MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName) throw(INTERP_KERNEL::Exception)
+{
+ return new MEDFileFieldMultiTS(fileName);
+}
+
MEDFileFieldMultiTS *MEDFileFieldMultiTS::New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
{
return new MEDFileFieldMultiTS(fileName,fieldName);
{
}
+MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
+try:MEDFileFieldMultiTSWithoutDAS(""),MEDFileFieldGlobsReal(fileName)
+{
+ MEDFileUtilities::CheckFileForRead(fileName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ int nbFields=MEDnField(fid);
+ if(nbFields<1)
+ {
+ std::ostringstream oss; oss << "MEDFileFieldMultiTS(const char *fileName) constructor : no fields in file \"" << fileName << "\" !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ med_field_type typcha;
+ int nbstep2=-1;
+ //
+ int ncomp=MEDfieldnComponent(fid,1);
+ INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ INTERP_KERNEL::AutoPtr<char> nomMaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
+ med_bool localMesh;
+ int nbOfStep;
+ MEDfieldInfo(fid,1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep);
+ _name=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE);
+ _field_type=MEDFileUtilities::TraduceFieldType(typcha);
+ _infos.resize(ncomp);
+ for(int j=0;j<ncomp;j++)
+ _infos[j]=MEDLoaderBase::buildUnionUnit((char *)comp+j*MED_SNAME_SIZE,MED_SNAME_SIZE,(char *)unit+j*MED_SNAME_SIZE,MED_SNAME_SIZE);
+ //
+ finishLoading(fid,nbOfStep);
+ loadGlobals(fid);
+}
+catch(INTERP_KERNEL::Exception& e)
+ {
+ throw e;
+ }
+
MEDFileFieldMultiTS::MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
try:MEDFileFieldMultiTSWithoutDAS(fieldName),MEDFileFieldGlobsReal(fileName)
{
{
public:
static MEDFileFieldMultiTS *New();
+ static MEDFileFieldMultiTS *New(const char *fileName) throw(INTERP_KERNEL::Exception);
static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
static MEDFileFieldMultiTS *New(const MEDFileFieldMultiTSWithoutDAS& other);
//
private:
MEDFileFieldMultiTS();
MEDFileFieldMultiTS(const MEDFileFieldMultiTSWithoutDAS& other);
+ MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception);
MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
};
{
public:
static MEDFileFieldMultiTS *New();
+ static MEDFileFieldMultiTS *New(const char *fileName);
static MEDFileFieldMultiTS *New(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception);
//
MEDFileField1TS *getTimeStepAtPos(int pos) const throw(INTERP_KERNEL::Exception);
return MEDFileFieldMultiTS::New();
}
+ MEDFileFieldMultiTS(const char *fileName) throw(INTERP_KERNEL::Exception)
+ {
+ return MEDFileFieldMultiTS::New(fileName);
+ }
+
MEDFileFieldMultiTS(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
{
return MEDFileFieldMultiTS::New(fileName,fieldName);
def testMEDField1(self):
mm=MEDFileMesh.New("Pyfile17.med")
mm.write("Pyfile17_bis.med",2)
- ff=MEDFileFieldMultiTS.New("Pyfile17.med","MeasureOfMesh_Extruded")
+ ff=MEDFileFieldMultiTS("Pyfile17.med")
+ self.assertEqual("MeasureOfMesh_Extruded",ff.getName())
self.assertEqual([3,4],ff[1].getTime()[:-1])
self.assertEqual([3,4],ff[3,4].getTime()[:-1])
self.assertEqual([3,4],ff[0.01].getTime()[:-1])