Renumbering *renumb=RenumberingFactory(type_renum);
renumb->renumber(graph,graph_index,workMesh->getNumberOfCells(),iperm,perm);
delete renumb;
+ iperm.clear();//erase new2old, we are using only old 2 new
t_compute_graph=clock();
cout << " : " << (t_compute_graph-t_read_st)/(double) CLOCKS_PER_SEC << "s" << endl;
cout.flush();
// Fields
cout << "Reordering fields and writing : " << flush;
MEDFileFields *fs=fd->getFields();
- 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
+ }
t_field=clock();
cout << " : " << (t_field-t_family)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
return 0;