From d6070a0e14825d91e7b6957ef20dd960f720dcae Mon Sep 17 00:00:00 2001 From: ageay Date: Mon, 2 Jul 2012 14:39:45 +0000 Subject: [PATCH] MEDFileFieldMultiTS with only one parameter. --- src/MEDLoader/MEDFileField.cxx | 42 ++++++++++++++++++++++++++++ src/MEDLoader/MEDFileField.hxx | 2 ++ src/MEDLoader/Swig/MEDLoaderCommon.i | 6 ++++ src/MEDLoader/Swig/MEDLoaderTest3.py | 3 +- 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 54f391f85..cfd72d2ff 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -4006,6 +4006,11 @@ MEDFileFieldMultiTS *MEDFileFieldMultiTS::New() 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); @@ -4162,6 +4167,43 @@ MEDFileFieldMultiTS::MEDFileFieldMultiTS() { } +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 comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE); + INTERP_KERNEL::AutoPtr unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE); + INTERP_KERNEL::AutoPtr dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE); + INTERP_KERNEL::AutoPtr nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); + INTERP_KERNEL::AutoPtr 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