-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include <iostream>
using namespace std;
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
using namespace MED_RENUMBER;
int main(int argc, char** argv)
}
// Reading file structure
cout << "Reading : " << flush;
- MEDCouplingAutoRefCountObjectPtr<MEDFileData> fd=MEDFileData::New(filename_in.c_str());
- MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname.c_str());
+ MCAuto<MEDFileData> fd(MEDFileData::New(filename_in));
+ MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname);
MEDFileUMesh *mc=dynamic_cast<MEDFileUMesh *>(m);
if(!mc)
{
t_read_st=clock();
cout << (t_read_st-t_begin)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
// Reading mesh
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> workMesh=mc->getMeshAtLevel(0);
+ MCAuto<MEDCouplingUMesh> workMesh=mc->getMeshAtLevel(0);
std::vector<int> code=workMesh->getDistributionOfTypes();
cout << "Building the graph : " << flush;
DataArrayInt *neighb=0,*neighbI=0;
workMesh->computeNeighborsOfCells(neighb,neighbI);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe;
+ MCAuto<DataArrayInt> neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe;
const int *graph=neighbSafe->begin();
const int *graph_index=neighbISafe->begin();
// Compute permutation iperm->new2old perm->old2new
const DataArrayInt *famField=mc->getFamilyFieldAtLevel(0);
if(famField)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> famField2=famField->renumber(perm->begin());
+ MCAuto<DataArrayInt> famField2=famField->renumber(perm->begin());
mc->setFamilyFieldArr(0,famField2);
}
- mc->write(filename_out.c_str(),2);
+ mc->write(filename_out,2);
t_family=clock();
cout << " : " << (t_family-t_compute_graph)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
// Fields
for(int i=0;i<fs->getNumberOfFields();i++)
{
MEDFileFieldMultiTS *fmts=dynamic_cast<MEDFileFieldMultiTS *>(fs->getFieldAtPos(i));
- if(!fmts) continue;
+ 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;
+ if(!f1ts) continue;
DataArrayDouble *arr=f1ts->getUndergroundDataArray();
arr->renumberInPlace(perm->begin());
}
}
}
- fs->write(filename_out.c_str(),0);
- //fs->renumberEntitiesLyingOnMesh(meshname.c_str(),code,code,o2n); bugged
+ fs->write(filename_out,0);
+ //fs->renumberEntitiesLyingOnMesh(meshname,code,code,o2n); bugged
}
t_field=clock();
cout << " : " << (t_field-t_family)/(double) CLOCKS_PER_SEC << "s" << endl << flush;