From: ageay Date: Tue, 13 Mar 2012 14:28:19 +0000 (+0000) Subject: Nearly ready to add MEDPartitionner X-Git-Tag: V6_main_FINAL~798 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=96369c3c0c02745aed25851131ad7300d4fefded;p=tools%2Fmedcoupling.git Nearly ready to add MEDPartitionner --- diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx index 4be16f918..a229cb674 100644 --- a/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx +++ b/src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx @@ -17,18 +17,13 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include -#include -#include -#include -#include -#include - -//#include "MEDPARTITIONERTest.hxx" -#include - #include "MEDPARTITIONERTest.hxx" +#include "MEDPARTITIONER_MeshCollection.hxx" +#include "MEDPARTITIONER_ParallelTopology.hxx" +#include "MEDPARTITIONER_ParaDomainSelector.hxx" +#include "MEDPARTITIONER_Utils.hxx" + #include "CellModel.hxx" #include "MEDFileMesh.hxx" #include "MEDLoader.hxx" @@ -39,11 +34,14 @@ #include "MEDCouplingMemArray.hxx" #include "MEDCouplingMultiFields.hxx" -#include "MEDPARTITIONER_MeshCollection.hxx" -#include "MEDPARTITIONER_ParallelTopology.hxx" -#include "MEDPARTITIONER_ParaDomainSelector.hxx" +#include -#include "MEDPARTITIONER_Utils.hxx" +#include +#include +#include +#include +#include +#include #ifdef HAVE_MPI2 #include @@ -709,389 +707,3 @@ void MEDPARTITIONERTest::verifyTestMeshWithVecFieldOnNodes() } mf->decrRef(); } - -void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForMesh() -{ - int res; - string fileName,cmd,execName,sourceName,targetName,input; - execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED - execName+="/bin/salome/medpartitioner_para"; - fileName=_fileNameWithFaces; - - ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_meshName.c_str()); - ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false); - ParaMEDMEM::MEDCouplingUMesh* faceMesh=initialMesh->getLevelM1Mesh(false); - - cmd="mpirun -np 5 "+execName+" --ndomains=5 --split-method=metis"; //on same proc - sourceName=fileName; - targetName=fileName; - targetName.replace(targetName.find(".med"),4,"_partitionedTo5_"); - cmd+=" --input-file="+sourceName+" --output-file="+targetName+" --verbose="+IntToStr(_verbose); - if (_verbose) cout<cellMeshes=collection.getMesh(); - CPPUNIT_ASSERT_EQUAL(5, (int) cellMeshes.size()); - int nbcells=0; - for (int i = 0; i < cellMeshes.size(); i++) nbcells+=cellMeshes[i]->getNumberOfCells(); - CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); - - std::vectorfaceMeshes=collection.getFaceMesh(); - CPPUNIT_ASSERT_EQUAL(5, (int) faceMeshes.size()); - int nbfaces=0; - for (int i = 0; i < faceMeshes.size(); i++) nbfaces+=faceMeshes[i]->getNumberOfCells(); - CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), nbfaces); - - //merge split meshes and test equality - cmd="mpirun -np 1 "+execName+" --ndomains=1 --split-method=metis"; //on same proc - sourceName=targetName+".xml"; - targetName=fileName; - targetName.replace(targetName.find(".med"),4,"_remergedFrom5_"); - cmd+=" --input-file="+sourceName+" --output-file="+targetName+" --verbose="+IntToStr(_verbose); - if (_verbose) cout<getLevel0Mesh(false); - ParaMEDMEM::MEDCouplingUMesh* refusedFaceMesh=refusedMesh->getLevelM1Mesh(false); - - CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); - CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), refusedFaceMesh->getNumberOfCells()); - - /*not the good job - ParaMEDMEM::MEDCouplingMesh* mergeCell=cellMesh->mergeMyselfWith(refusedCellMesh); - CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), mergeCell->getNumberOfCells()); - - ParaMEDMEM::MEDCouplingMesh* mergeFace=faceMesh->mergeMyselfWith(refusedFaceMesh); - CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), mergeFace->getNumberOfCells()); - - CPPUNIT_ASSERT(faceMesh->isEqual(refusedFaceMesh,1e-12)); - */ - - std::vector meshes; - std::vector corr; - meshes.push_back(cellMesh); - refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9); - meshes.push_back(refusedCellMesh); - MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); - CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); - - meshes.resize(0); - for (int i = 0; i < corr.size(); i++) corr[i]->decrRef(); - corr.resize(0); - meshes.push_back(faceMesh); - refusedFaceMesh->tryToShareSameCoordsPermute(*faceMesh, 1e-9); - meshes.push_back(refusedFaceMesh); - MEDCouplingUMesh* fusedFace=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); - CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), fusedFace->getNumberOfCells()); - - for (int i = 0; i < corr.size(); i++) corr[i]->decrRef(); - fusedFace->decrRef(); - refusedFaceMesh->decrRef(); - faceMesh->decrRef(); - fusedCell->decrRef(); - refusedCellMesh->decrRef(); - cellMesh->decrRef(); - //done in ~collection - //for (int i = 0; i < faceMeshes.size(); i++) faceMeshes[i]->decrRef(); - //for (int i = 0; i < cellMeshes.size(); i++) cellMeshes[i]->decrRef(); -} - -void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnCells() -{ - int res; - string fileName,cmd,execName,sourceName,targetName,input; - execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED - execName+="/bin/salome/medpartitioner_para"; - fileName=_fileName; - fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnCells.med"); - - ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_meshName.c_str()); - ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false); - - cmd="mpirun -np 5 "+execName+" --ndomains=5 --split-method=metis"; //on same proc - sourceName=fileName; - targetName=fileName; - targetName.replace(targetName.find(".med"),4,"_partitionedTo5_"); - cmd+=" --input-file="+sourceName+" --output-file="+targetName+" --verbose="+IntToStr(_verbose); - if (_verbose) cout<getLevel0Mesh(false); - - CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); - - std::vector meshes; - std::vector corr; - meshes.push_back(cellMesh); - refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9); - meshes.push_back(refusedCellMesh); - MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); - CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); - - MEDCouplingFieldDouble* field1=MEDLoader::ReadFieldCell(fileName.c_str(),initialMesh->getName(),0,"VectorFieldOnCells",0,1); - MEDCouplingFieldDouble* field2=MEDLoader::ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName(),0,"VectorFieldOnCells",0,1); - - int nbcells=corr[1]->getNumberOfTuples(); - CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); - //use corr to test equality of field - DataArrayDouble* f1=field1->getArray(); - DataArrayDouble* f2=field2->getArray(); - if (_verbose) - { - cout<<"\nf1 : "<reprZip(); - cout<<"\nf2 : "<reprZip(); //field2->advancedRepradvancedRepr(); - for (int i = 0; i < corr.size(); i++) cout<<"\ncorr "<reprZip(); - - } - int nbequal=0; - int nbcomp=field1->getNumberOfComponents(); - double* p1=f1->getPointer(); - double* p2=f2->getPointer(); - int* pc=corr[1]->getPointer(); - for (int i = 0; i < nbcells; i++) - { - int i1=pc[i]*nbcomp; - int i2=i*nbcomp; - for (int j = 0; j < nbcomp; j++) - { - if (p1[i1+j]==p2[i2+j]) nbequal++; - //cout<<" "<decrRef(); - field1->decrRef(); - field2->decrRef(); - fusedCell->decrRef(); - refusedCellMesh->decrRef(); - cellMesh->decrRef(); -} - -void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnGaussNe() -{ - int res; - string fileName,cmd,execName,sourceName,targetName,input; - execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED - execName+="/bin/salome/medpartitioner_para"; - fileName=_fileName; - fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnGaussNe.med"); - - ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_meshName.c_str()); - ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false); - - cmd="mpirun -np 5 "+execName+" --ndomains=5 --split-method=metis"; //on same proc - sourceName=fileName; - targetName=fileName; - targetName.replace(targetName.find(".med"),4,"_partitionedTo5_"); - cmd+=" --input-file="+sourceName+" --output-file="+targetName+" --verbose="+IntToStr(_verbose); - if (_verbose) cout<getLevel0Mesh(false); - - CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); - - std::vector meshes; - std::vector corr; - meshes.push_back(cellMesh); - refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9); - meshes.push_back(refusedCellMesh); - MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); - CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); - - MEDCouplingFieldDouble* field1=MEDLoader::ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName(),0,"MyFieldOnGaussNE",5,6); - MEDCouplingFieldDouble* field2=MEDLoader::ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName(),0,"MyFieldOnGaussNE",5,6); - - int nbcells=corr[1]->getNumberOfTuples(); - CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); - //use corr to test equality of field - DataArrayDouble* f1=field1->getArray(); - DataArrayDouble* f2=field2->getArray(); - if (_verbose) - { - cout<<"\nf1 : "<reprZip(); //123.4 for 12th cell,3rd component, 4th gausspoint - cout<<"\nf2 : "<reprZip(); //field2->advancedRepradvancedRepr(); - for (int i = 0; i < corr.size(); i++) cout<<"\ncorr "<reprZip(); - - } - int nbequal=0; - int nbptgauss=8; - int nbcomp=field1->getNumberOfComponents(); - double* p1=f1->getPointer(); - double* p2=f2->getPointer(); - int* pc=corr[1]->getPointer(); - for (int i = 0; i < nbcells; i++) - { - int i1=pc[i]*nbcomp*nbptgauss; - int i2=i*nbcomp*nbptgauss; - for (int j = 0; j < nbcomp*nbptgauss; j++) - { - if (p1[i1+j]==p2[i2+j]) nbequal++; - //cout<<" "<decrRef(); - field1->decrRef(); - field2->decrRef(); - fusedCell->decrRef(); - refusedCellMesh->decrRef(); - cellMesh->decrRef(); -} - -void MEDPARTITIONERTest::createTestMeshes() -{ - createTestMeshWithoutField(); - createTestMeshWithVecFieldOnCells(); - createTestMeshWithVecFieldOnNodes(); -} - - -void MEDPARTITIONERTest::deleteTestMeshes() -{ - string cmd="rm *tmp_testMesh*"; - if (_verbose) cout</dev/null 1>/dev/null"); //no trace - CPPUNIT_ASSERT_EQUAL(0, res); - - execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED - execName+="/bin/salome/medpartitioner_para"; - - cmd="which "+execName+" 2>/dev/null 1>/dev/null"; //no trace - res=system(cmd.c_str()); - CPPUNIT_ASSERT_EQUAL(0, res); - - cmd="mpirun -np 2 "+execName+" --ndomains=2 --split-method=metis"; //on same proc - sourceName=_fileName; - targetName=_fileName; - targetName.replace(targetName.find(".med"),4,"_partitionedTo2_"); - cmd+=" --input-file="+sourceName+" --output-file="+targetName+" --verbose="+IntToStr(_verbose); - if (_verbose) cout< + +#include +#include +#include +#include +#include +#include + +#include + +using namespace std; +using namespace ParaMEDMEM; +using namespace MEDPARTITIONER; + +void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForMesh() +{ + int res; + string fileName,cmd,execName,sourceName,targetName,input; + execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED + execName+="/bin/salome/medpartitioner_para"; + fileName=_fileNameWithFaces; + + ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_meshName.c_str()); + ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false); + ParaMEDMEM::MEDCouplingUMesh* faceMesh=initialMesh->getLevelM1Mesh(false); + + cmd="mpirun -np 5 "+execName+" --ndomains=5 --split-method=metis"; //on same proc + sourceName=fileName; + targetName=fileName; + targetName.replace(targetName.find(".med"),4,"_partitionedTo5_"); + cmd+=" --input-file="+sourceName+" --output-file="+targetName+" --verbose="+IntToStr(_verbose); + if (_verbose) cout<cellMeshes=collection.getMesh(); + CPPUNIT_ASSERT_EQUAL(5, (int) cellMeshes.size()); + int nbcells=0; + for (int i = 0; i < cellMeshes.size(); i++) nbcells+=cellMeshes[i]->getNumberOfCells(); + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); + + std::vectorfaceMeshes=collection.getFaceMesh(); + CPPUNIT_ASSERT_EQUAL(5, (int) faceMeshes.size()); + int nbfaces=0; + for (int i = 0; i < faceMeshes.size(); i++) nbfaces+=faceMeshes[i]->getNumberOfCells(); + CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), nbfaces); + + //merge split meshes and test equality + cmd="mpirun -np 1 "+execName+" --ndomains=1 --split-method=metis"; //on same proc + sourceName=targetName+".xml"; + targetName=fileName; + targetName.replace(targetName.find(".med"),4,"_remergedFrom5_"); + cmd+=" --input-file="+sourceName+" --output-file="+targetName+" --verbose="+IntToStr(_verbose); + if (_verbose) cout<getLevel0Mesh(false); + ParaMEDMEM::MEDCouplingUMesh* refusedFaceMesh=refusedMesh->getLevelM1Mesh(false); + + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); + CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), refusedFaceMesh->getNumberOfCells()); + + /*not the good job + ParaMEDMEM::MEDCouplingMesh* mergeCell=cellMesh->mergeMyselfWith(refusedCellMesh); + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), mergeCell->getNumberOfCells()); + + ParaMEDMEM::MEDCouplingMesh* mergeFace=faceMesh->mergeMyselfWith(refusedFaceMesh); + CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), mergeFace->getNumberOfCells()); + + CPPUNIT_ASSERT(faceMesh->isEqual(refusedFaceMesh,1e-12)); + */ + + std::vector meshes; + std::vector corr; + meshes.push_back(cellMesh); + refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9); + meshes.push_back(refusedCellMesh); + MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); + + meshes.resize(0); + for (int i = 0; i < corr.size(); i++) corr[i]->decrRef(); + corr.resize(0); + meshes.push_back(faceMesh); + refusedFaceMesh->tryToShareSameCoordsPermute(*faceMesh, 1e-9); + meshes.push_back(refusedFaceMesh); + MEDCouplingUMesh* fusedFace=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); + CPPUNIT_ASSERT_EQUAL(faceMesh->getNumberOfCells(), fusedFace->getNumberOfCells()); + + for (int i = 0; i < corr.size(); i++) corr[i]->decrRef(); + fusedFace->decrRef(); + refusedFaceMesh->decrRef(); + faceMesh->decrRef(); + fusedCell->decrRef(); + refusedCellMesh->decrRef(); + cellMesh->decrRef(); + //done in ~collection + //for (int i = 0; i < faceMeshes.size(); i++) faceMeshes[i]->decrRef(); + //for (int i = 0; i < cellMeshes.size(); i++) cellMeshes[i]->decrRef(); +} + +void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnCells() +{ + int res; + string fileName,cmd,execName,sourceName,targetName,input; + execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED + execName+="/bin/salome/medpartitioner_para"; + fileName=_fileName; + fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnCells.med"); + + ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_meshName.c_str()); + ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false); + + cmd="mpirun -np 5 "+execName+" --ndomains=5 --split-method=metis"; //on same proc + sourceName=fileName; + targetName=fileName; + targetName.replace(targetName.find(".med"),4,"_partitionedTo5_"); + cmd+=" --input-file="+sourceName+" --output-file="+targetName+" --verbose="+IntToStr(_verbose); + if (_verbose) cout<getLevel0Mesh(false); + + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); + + std::vector meshes; + std::vector corr; + meshes.push_back(cellMesh); + refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9); + meshes.push_back(refusedCellMesh); + MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); + + MEDCouplingFieldDouble* field1=MEDLoader::ReadFieldCell(fileName.c_str(),initialMesh->getName(),0,"VectorFieldOnCells",0,1); + MEDCouplingFieldDouble* field2=MEDLoader::ReadFieldCell(refusedName.c_str(),refusedCellMesh->getName(),0,"VectorFieldOnCells",0,1); + + int nbcells=corr[1]->getNumberOfTuples(); + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); + //use corr to test equality of field + DataArrayDouble* f1=field1->getArray(); + DataArrayDouble* f2=field2->getArray(); + if (_verbose) + { + cout<<"\nf1 : "<reprZip(); + cout<<"\nf2 : "<reprZip(); //field2->advancedRepradvancedRepr(); + for (int i = 0; i < corr.size(); i++) cout<<"\ncorr "<reprZip(); + + } + int nbequal=0; + int nbcomp=field1->getNumberOfComponents(); + double* p1=f1->getPointer(); + double* p2=f2->getPointer(); + int* pc=corr[1]->getPointer(); + for (int i = 0; i < nbcells; i++) + { + int i1=pc[i]*nbcomp; + int i2=i*nbcomp; + for (int j = 0; j < nbcomp; j++) + { + if (p1[i1+j]==p2[i2+j]) nbequal++; + //cout<<" "<decrRef(); + field1->decrRef(); + field2->decrRef(); + fusedCell->decrRef(); + refusedCellMesh->decrRef(); + cellMesh->decrRef(); +} + +void MEDPARTITIONERTest::verifyMedpartitionerOnSmallSizeForFieldOnGaussNe() +{ + int res; + string fileName,cmd,execName,sourceName,targetName,input; + execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED + execName+="/bin/salome/medpartitioner_para"; + fileName=_fileName; + fileName.replace(fileName.find(".med"),4,"_WithVecFieldOnGaussNe.med"); + + ParaMEDMEM::MEDFileUMesh* initialMesh=ParaMEDMEM::MEDFileUMesh::New(fileName.c_str(),_meshName.c_str()); + ParaMEDMEM::MEDCouplingUMesh* cellMesh=initialMesh->getLevel0Mesh(false); + + cmd="mpirun -np 5 "+execName+" --ndomains=5 --split-method=metis"; //on same proc + sourceName=fileName; + targetName=fileName; + targetName.replace(targetName.find(".med"),4,"_partitionedTo5_"); + cmd+=" --input-file="+sourceName+" --output-file="+targetName+" --verbose="+IntToStr(_verbose); + if (_verbose) cout<getLevel0Mesh(false); + + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells()); + + std::vector meshes; + std::vector corr; + meshes.push_back(cellMesh); + refusedCellMesh->tryToShareSameCoordsPermute(*cellMesh, 1e-9); + meshes.push_back(refusedCellMesh); + MEDCouplingUMesh* fusedCell=MEDCouplingUMesh::FuseUMeshesOnSameCoords(meshes,0,corr); + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), fusedCell->getNumberOfCells()); + + MEDCouplingFieldDouble* field1=MEDLoader::ReadField(ON_GAUSS_NE,fileName.c_str(),initialMesh->getName(),0,"MyFieldOnGaussNE",5,6); + MEDCouplingFieldDouble* field2=MEDLoader::ReadField(ON_GAUSS_NE,refusedName.c_str(),refusedCellMesh->getName(),0,"MyFieldOnGaussNE",5,6); + + int nbcells=corr[1]->getNumberOfTuples(); + CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), nbcells); + //use corr to test equality of field + DataArrayDouble* f1=field1->getArray(); + DataArrayDouble* f2=field2->getArray(); + if (_verbose) + { + cout<<"\nf1 : "<reprZip(); //123.4 for 12th cell,3rd component, 4th gausspoint + cout<<"\nf2 : "<reprZip(); //field2->advancedRepradvancedRepr(); + for (int i = 0; i < corr.size(); i++) cout<<"\ncorr "<reprZip(); + + } + int nbequal=0; + int nbptgauss=8; + int nbcomp=field1->getNumberOfComponents(); + double* p1=f1->getPointer(); + double* p2=f2->getPointer(); + int* pc=corr[1]->getPointer(); + for (int i = 0; i < nbcells; i++) + { + int i1=pc[i]*nbcomp*nbptgauss; + int i2=i*nbcomp*nbptgauss; + for (int j = 0; j < nbcomp*nbptgauss; j++) + { + if (p1[i1+j]==p2[i2+j]) nbequal++; + //cout<<" "<decrRef(); + field1->decrRef(); + field2->decrRef(); + fusedCell->decrRef(); + refusedCellMesh->decrRef(); + cellMesh->decrRef(); +} + +void MEDPARTITIONERTest::createTestMeshes() +{ + createTestMeshWithoutField(); + createTestMeshWithVecFieldOnCells(); + createTestMeshWithVecFieldOnNodes(); +} + + +void MEDPARTITIONERTest::deleteTestMeshes() +{ + string cmd="rm *tmp_testMesh*"; + if (_verbose) cout</dev/null 1>/dev/null"); //no trace + CPPUNIT_ASSERT_EQUAL(0, res); + + execName=getenv("MED_ROOT_DIR"); //.../INSTALL/MED + execName+="/bin/salome/medpartitioner_para"; + + cmd="which "+execName+" 2>/dev/null 1>/dev/null"; //no trace + res=system(cmd.c_str()); + CPPUNIT_ASSERT_EQUAL(0, res); + + cmd="mpirun -np 2 "+execName+" --ndomains=2 --split-method=metis"; //on same proc + sourceName=_fileName; + targetName=_fileName; + targetName.replace(targetName.find(".med"),4,"_partitionedTo2_"); + cmd+=" --input-file="+sourceName+" --output-file="+targetName+" --verbose="+IntToStr(_verbose); + if (_verbose) cout<