Salome HOME
projects
/
tools
/
medcoupling.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[EDF21269] : Reproduce PTScotch graph split between independant runs
[tools/medcoupling.git]
/
src
/
RENUMBER
/
renumbering.cxx
diff --git
a/src/RENUMBER/renumbering.cxx
b/src/RENUMBER/renumbering.cxx
index ce86bde6e44e2c638b89ce2e8a4959c6ae8caeee..8b2a7782cc9bb693625259f2fe37808d07bb45e8 100644
(file)
--- a/
src/RENUMBER/renumbering.cxx
+++ b/
src/RENUMBER/renumbering.cxx
@@
-1,9
+1,9
@@
-// Copyright (C) 2007-201
3
CEA/DEN, EDF R&D
+// Copyright (C) 2007-201
9
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
//
// 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
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-32,13
+32,13
@@
#include <iostream>
using namespace std;
#include <iostream>
using namespace std;
-using namespace
ParaMEDMEM
;
+using namespace
MEDCoupling
;
using namespace MED_RENUMBER;
int main(int argc, char** argv)
{
double t_begin,t_read_st,t_compute_graph,t_family,t_field;
using namespace MED_RENUMBER;
int main(int argc, char** argv)
{
double t_begin,t_read_st,t_compute_graph,t_family,t_field;
- t_begin=clock();
+ t_begin=
(double)
clock();
if (argc <5)
{
cerr << "Usage : " << argv[0]
if (argc <5)
{
cerr << "Usage : " << argv[0]
@@
-57,46
+57,47
@@
int main(int argc, char** argv)
}
// Reading file structure
cout << "Reading : " << flush;
}
// Reading file structure
cout << "Reading : " << flush;
- M
EDCouplingAutoRefCountObjectPtr<MEDFileData> fd=MEDFileData::New(filename_in.c_str(
));
- MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname
.c_str()
);
+ M
CAuto<MEDFileData> fd(MEDFileData::New(filename_in
));
+ MEDFileMesh *m=fd->getMeshes()->getMeshWithName(meshname);
MEDFileUMesh *mc=dynamic_cast<MEDFileUMesh *>(m);
if(!mc)
{
std::ostringstream oss; oss << "In file \"" << filename_in << "\" the mesh name \"" << meshname<< "\" exists but is not unstructured !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
MEDFileUMesh *mc=dynamic_cast<MEDFileUMesh *>(m);
if(!mc)
{
std::ostringstream oss; oss << "In file \"" << filename_in << "\" the mesh name \"" << meshname<< "\" exists but is not unstructured !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- t_read_st=clock();
+ t_read_st=
(double)
clock();
cout << (t_read_st-t_begin)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
// Reading mesh
cout << (t_read_st-t_begin)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
// Reading mesh
- M
EDCouplingAutoRefCountObjectPtr
<MEDCouplingUMesh> workMesh=mc->getMeshAtLevel(0);
-
std::vector<int
> code=workMesh->getDistributionOfTypes();
+ M
CAuto
<MEDCouplingUMesh> workMesh=mc->getMeshAtLevel(0);
+
//std::vector<mcIdType
> code=workMesh->getDistributionOfTypes();
cout << "Building the graph : " << flush;
cout << "Building the graph : " << flush;
- DataArrayI
nt
*neighb=0,*neighbI=0;
+ DataArrayI
dType
*neighb=0,*neighbI=0;
workMesh->computeNeighborsOfCells(neighb,neighbI);
workMesh->computeNeighborsOfCells(neighb,neighbI);
- M
EDCouplingAutoRefCountObjectPtr<DataArrayInt> neighbSafe(neighb),neighbISafe(neighbI)
;
- const
int
*graph=neighbSafe->begin();
- const
int
*graph_index=neighbISafe->begin();
+ M
CAuto<DataArrayIdType> neighbSafe(neighb),neighbISafe(neighbI),ipermSafe,permSafe
;
+ const
mcIdType
*graph=neighbSafe->begin();
+ const
mcIdType
*graph_index=neighbISafe->begin();
// Compute permutation iperm->new2old perm->old2new
// Compute permutation iperm->new2old perm->old2new
-
vector<int> iperm,perm
;
+
DataArrayIdType *iperm(0),*perm(0)
;
Renumbering *renumb=RenumberingFactory(type_renum);
renumb->renumber(graph,graph_index,workMesh->getNumberOfCells(),iperm,perm);
Renumbering *renumb=RenumberingFactory(type_renum);
renumb->renumber(graph,graph_index,workMesh->getNumberOfCells(),iperm,perm);
+ ipermSafe=iperm; permSafe=perm;
delete renumb;
delete renumb;
- iperm
.clear()
;//erase new2old, we are using only old 2 new
- t_compute_graph=clock();
+ iperm
Safe=0
;//erase new2old, we are using only old 2 new
+ t_compute_graph=
(double)
clock();
cout << " : " << (t_compute_graph-t_read_st)/(double) CLOCKS_PER_SEC << "s" << endl;
cout.flush();
// Connectivity
cout << "Reordering connectivity & families and writing : " << flush;
cout << " : " << (t_compute_graph-t_read_st)/(double) CLOCKS_PER_SEC << "s" << endl;
cout.flush();
// Connectivity
cout << "Reordering connectivity & families and writing : " << flush;
- workMesh->renumberCells(
&perm[0]
,false);
+ workMesh->renumberCells(
perm->begin()
,false);
mc->setMeshAtLevel(0,workMesh);
mc->setMeshAtLevel(0,workMesh);
- const DataArrayI
nt
*famField=mc->getFamilyFieldAtLevel(0);
+ const DataArrayI
dType
*famField=mc->getFamilyFieldAtLevel(0);
if(famField)
{
if(famField)
{
- M
EDCouplingAutoRefCountObjectPtr<DataArrayInt> famField2=famField->renumber(&perm[0]
);
+ M
CAuto<DataArrayIdType> famField2=famField->renumber(perm->begin()
);
mc->setFamilyFieldArr(0,famField2);
}
mc->setFamilyFieldArr(0,famField2);
}
- mc->write(filename_out
.c_str()
,2);
- t_family=clock();
+ mc->write(filename_out,2);
+ t_family=
(double)
clock();
cout << " : " << (t_family-t_compute_graph)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
// Fields
cout << "Reordering fields and writing : " << flush;
cout << " : " << (t_family-t_compute_graph)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
// Fields
cout << "Reordering fields and writing : " << flush;
@@
-106,22
+107,22
@@
int main(int argc, char** argv)
for(int i=0;i<fs->getNumberOfFields();i++)
{
MEDFileFieldMultiTS *fmts=dynamic_cast<MEDFileFieldMultiTS *>(fs->getFieldAtPos(i));
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(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();
DataArrayDouble *arr=f1ts->getUndergroundDataArray();
- arr->renumberInPlace(
&perm[0]
);
+ 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();
+ t_field=
(double)
clock();
cout << " : " << (t_field-t_family)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
return 0;
}
cout << " : " << (t_field-t_family)/(double) CLOCKS_PER_SEC << "s" << endl << flush;
return 0;
}