From: ageay Date: Mon, 2 Jul 2012 14:39:45 +0000 (+0000) Subject: MEDFileFieldMultiTS with only one parameter. X-Git-Tag: V6_main_FINAL~608 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d6070a0e14825d91e7b6957ef20dd960f720dcae;p=tools%2Fmedcoupling.git MEDFileFieldMultiTS with only one parameter. --- 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