for(int i=0;i<nbFields;i++)
{
med_int ncomp=MEDnChamp(fid,i+1);
- infos.resize(ncomp);
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);
- for(int i=0;i<ncomp;i++)
- infos[i]=MEDLoaderBase::buildUnionUnit(comp+i*MED_TAILLE_PNOM,unit+i*MED_TAILLE_PNOM);
std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_TAILLE_NOM+1);
- delete [] comp;
- delete [] unit;
if(curFieldName==fieldName)
{
+ infos.resize(ncomp);
+ for(int i=0;i<ncomp;i++)
+ infos[i]=MEDLoaderBase::buildUnionUnit(comp+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM,unit+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
bool found=false;
for(int j=0;j<tabTypeLgth[typeOfOutField] && !found;j++)
{
}
}
}
+ delete [] comp;
+ delete [] unit;
}
MEDfermer(fid);
}
for(int i=0;i<spaceDim;i++)
{
std::string n,u;
- std::string info=MEDLoaderBase::buildUnionUnit(comp+i*MED_TAILLE_PNOM,unit+i*MED_TAILLE_PNOM);
+ std::string info=MEDLoaderBase::buildUnionUnit(comp+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM,unit+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
coords->setInfoOnComponent(i,info.c_str());
}
delete [] comp;
return ret;
}
-std::string MEDLoaderBase::buildUnionUnit(const char *name, const char *unit)
+std::string MEDLoaderBase::buildUnionUnit(const char *name, int nameLgth, const char *unit, int unitLgth)
{
- std::string ret(name);
- if(unit[0]=='\0')
+ std::string ret(buildStringFromFortran(name,nameLgth));
+ std::string unitCpp(buildStringFromFortran(unit,unitLgth));
+ if(unitCpp[0]=='\0')
return ret;
ret+=" (";
- ret+=unit;
+ ret+=unitCpp;
ret+=")";
return ret;
}
public:
static int getStatusOfFile(const char *fileName);
static char *buildEmptyString(int lgth);
- static std::string buildUnionUnit(const char *name, const char *unit);
+ static std::string buildUnionUnit(const char *name, int nameLgth, const char *unit, int unitLgth);
static void splitIntoNameAndUnit(const std::string& s, std::string& name, std::string& unit);
static void strip(std::string& s);
static void safeStrCpy(const char *src, int maxLgth, char *dest, int behaviour) throw(INTERP_KERNEL::Exception);