return ret;
}
+std::vector<std::string> MEDLoader::GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+{
+ CheckFileForRead(fileName);
+ std::vector<std::string> ret;
+ med_idt fid=MEDouvrir((char *)fileName,MED_LECTURE);
+ med_int nbFields=MEDnChamp(fid,0);
+ //
+ med_type_champ typcha;
+ //med_int nbpdtnor=0,pflsize,*pflval,lnsize;
+ med_int ngauss=0;
+ med_int numdt=0,numo=0,nbrefmaa;
+ med_float dt=0.0;
+ med_booleen local;
+ //char pflname[MED_TAILLE_NOM+1]="";
+ //char locname[MED_TAILLE_NOM+1]="";
+ char *maa_ass=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+ char *dt_unit=MEDLoaderBase::buildEmptyString(MED_TAILLE_PNOM);
+ char *nomcha=MEDLoaderBase::buildEmptyString(MED_TAILLE_NOM);
+ //
+ for(int i=0;i<nbFields;i++)
+ {
+ med_int ncomp=MEDnChamp(fid,i+1);
+ char *comp=new char[ncomp*MED_TAILLE_PNOM+1];
+ char *unit=new char[ncomp*MED_TAILLE_PNOM+1];
+ MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
+ std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
+ delete [] comp;
+ delete [] unit;
+ if(curFieldName==fieldName)
+ {
+ bool found=false;
+ for(int j=0;j<MED_NBR_GEOMETRIE_MAILLE+2 && !found;j++)
+ {
+ med_int nbPdt=MEDnPasdetemps(fid,nomcha,MED_MAILLE,typmai[j]);
+ for(int k=0;k<nbPdt;k++)
+ {
+ MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typmai[j],k+1, &ngauss, &numdt, &numo, dt_unit,&dt, maa_ass, &local, &nbrefmaa);
+ std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_TAILLE_NOM+1);
+ if(std::find(ret.begin(),ret.end(),curMeshName)==ret.end())
+ ret.push_back(curMeshName);
+ }
+ }
+ }
+ }
+ delete [] maa_ass;
+ delete [] dt_unit;
+ delete [] nomcha;
+ MEDfermer(fid);
+ return ret;
+}
+
std::vector<std::string> MEDLoader::GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
{
CheckFileForRead(fileName);
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);
static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
static std::vector<std::string> GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception);
f1.setTime(10.55,28,29);
f1.getArray().setIJ(0,0,3*VAL1);
MEDLoader.WriteField(fileName,f1,False);
+ vec=MEDLoader.GetMeshNamesOnField(fileName,name1);
+ self.assertEqual(2,len(vec));
+ self.assertTrue(vec[0]==name3);
+ self.assertTrue(vec[1]==name2);
f1.setTime(10.66,38,39);
f1.getArray().setIJ(0,0,3*VAL2);
MEDLoader.WriteFieldUsingAlreadyWrittenMesh(fileName,f1);
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);
static std::vector<std::string> GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
static std::vector<std::string> GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
static std::vector<std::string> GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
f1->setTime(10.55,28,29);
tmp[0]=3*VAL1;
MEDLoader::WriteField(fileName,f1,false);
+ std::vector<std::string> vec=MEDLoader::GetMeshNamesOnField(fileName,name1);
+ CPPUNIT_ASSERT_EQUAL(2,(int)vec.size());
+ CPPUNIT_ASSERT(vec[0]==name3);
+ CPPUNIT_ASSERT(vec[1]==name2);
f1->setTime(10.66,38,39);
tmp[0]=3*VAL2;
MEDLoader::WriteFieldUsingAlreadyWrittenMesh(fileName,f1);