- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=DataArrayInt::New();
- o2n->useArray(&perm[0],false,CPP_DEALLOC,perm.size(),1);
- fs->renumberEntitiesLyingOnMesh(meshname.c_str(),code,code,o2n);
- fs->write(filename_out.c_str(),0);
+ if(fs)
+ {
+ for(int i=0;i<fs->getNumberOfFields();i++)
+ {
+ MEDFileFieldMultiTS *fmts=dynamic_cast<MEDFileFieldMultiTS *>(fs->getFieldAtPos(i));
+ if(!fmts) continue;
+ if(fmts->getMeshName()==meshname)
+ {
+ for(int j=0;j<fmts->getNumberOfTS();j++)
+ {
+ MEDFileField1TS *f1ts=dynamic_cast<MEDFileField1TS*>(fmts->getTimeStepAtPos(j));
+ if(!f1ts) continue;
+ DataArrayDouble *arr=f1ts->getUndergroundDataArray();
+ arr->renumberInPlace(&perm[0]);
+ }
+ }
+ }
+ fs->write(filename_out.c_str(),0);
+ //fs->renumberEntitiesLyingOnMesh(meshname.c_str(),code,code,o2n); bugged
+ }