]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Nearly ready to add MEDPartitionner
authorageay <ageay>
Tue, 13 Mar 2012 14:28:19 +0000 (14:28 +0000)
committerageay <ageay>
Tue, 13 Mar 2012 14:28:19 +0000 (14:28 +0000)
src/MEDPartitioner/Test/MEDPARTITIONERTest.cxx
src/MEDPartitioner/Test/MEDPARTITIONERTest.hxx
src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx [new file with mode: 0644]
src/MEDPartitioner/Test/Makefile.am

index 4be16f9181066b39caad1ebbe16a90a93e4c5343..a229cb674d2c406895b9d48a162fd03f47b807cb 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-#include <sstream>
-#include <cmath>
-#include <list>
-#include <stdexcept>
-#include <cstdlib>
-#include <vector>
-
-//#include "MEDPARTITIONERTest.hxx"
-#include <cppunit/TestAssert.h>
-
 #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"
 #include "MEDCouplingMemArray.hxx"
 #include "MEDCouplingMultiFields.hxx"
 
-#include "MEDPARTITIONER_MeshCollection.hxx"
-#include "MEDPARTITIONER_ParallelTopology.hxx"
-#include "MEDPARTITIONER_ParaDomainSelector.hxx"
+#include <cppunit/TestAssert.h>
 
-#include "MEDPARTITIONER_Utils.hxx"
+#include <sstream>
+#include <cmath>
+#include <list>
+#include <stdexcept>
+#include <cstdlib>
+#include <vector>
 
 #ifdef HAVE_MPI2
 #include <mpi.h>
@@ -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<<endl<<cmd<<endl;
-  res=system(cmd.c_str());
-  CPPUNIT_ASSERT_EQUAL(0, res);
-  input=targetName+".xml";
-  
-  MPI_Init(0,0);
-  MPI_Comm_size(MPI_COMM_WORLD, &MyGlobals::_World_Size);
-  MPI_Comm_rank(MPI_COMM_WORLD, &MyGlobals::_Rank);
-
-  MEDPARTITIONER::ParaDomainSelector parallelizer(false);
-  MEDPARTITIONER::MeshCollection collection(input,parallelizer); //cvwat01
-  CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension());
-  std::vector<ParaMEDMEM::MEDCouplingUMesh*>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::vector<ParaMEDMEM::MEDCouplingUMesh*>faceMeshes=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<<endl<<cmd<<endl;
-  res=system(cmd.c_str());
-  CPPUNIT_ASSERT_EQUAL(0, res);
-  
-  string refusedName=targetName+"1.med";
-  ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_meshName.c_str());
-  ParaMEDMEM::MEDCouplingUMesh* refusedCellMesh=refusedMesh->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<const MEDCouplingUMesh *> meshes;
-  std::vector<DataArrayInt *> 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<<endl<<cmd<<endl;
-  res=system(cmd.c_str());
-  CPPUNIT_ASSERT_EQUAL(0, res);
-  input=targetName+".xml";
-  
-  //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<<endl<<cmd<<endl;
-  res=system(cmd.c_str());
-  CPPUNIT_ASSERT_EQUAL(0, res);
-  
-  string refusedName=targetName+"1.med";
-  ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_meshName.c_str());
-  ParaMEDMEM::MEDCouplingUMesh* refusedCellMesh=refusedMesh->getLevel0Mesh(false);
-  
-  CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
-  
-  std::vector<const MEDCouplingUMesh *> meshes;
-  std::vector<DataArrayInt *> 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 : "<<f1->reprZip();
-      cout<<"\nf2 : "<<f2->reprZip(); //field2->advancedRepradvancedRepr();
-      for (int i = 0; i < corr.size(); i++) cout<<"\ncorr "<<i<<" : "<<corr[i]->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<<" "<<p1[i1+j]<<"="<<p2[i2+j];
-        }
-    }
-  CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp, nbequal);
-  
-  for (int i = 0; i < corr.size(); i++) corr[i]->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<<endl<<cmd<<endl;
-  res=system(cmd.c_str());
-  CPPUNIT_ASSERT_EQUAL(0, res);
-  input=targetName+".xml";
-  
-  //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<<endl<<cmd<<endl;
-  res=system(cmd.c_str());
-  CPPUNIT_ASSERT_EQUAL(0, res);
-  
-  string refusedName=targetName+"1.med";
-  ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_meshName.c_str());
-  ParaMEDMEM::MEDCouplingUMesh* refusedCellMesh=refusedMesh->getLevel0Mesh(false);
-  
-  CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
-  
-  std::vector<const MEDCouplingUMesh *> meshes;
-  std::vector<DataArrayInt *> 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 : "<<f1->reprZip(); //123.4 for 12th cell,3rd component, 4th gausspoint
-      cout<<"\nf2 : "<<f2->reprZip(); //field2->advancedRepradvancedRepr();
-      for (int i = 0; i < corr.size(); i++) cout<<"\ncorr "<<i<<" : "<<corr[i]->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<<" "<<p1[i1+j]<<"="<<p2[i2+j];
-        }
-    }
-  CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp*nbptgauss, nbequal);
-  
-  for (int i = 0; i < corr.size(); i++) corr[i]->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<<endl<<cmd<<endl;
-  system(cmd.c_str());  //may be not if debug
-}  
-
-void MEDPARTITIONERTest::launchMedpartitionerOnTestMeshes()
-{
-  
-  /* examples 
-     export INFI=/home/vb144235/resources/blade.med
-     //no need export MESH=Fuse_1
-     export INFI=tmp_testMeshxxx.med
-     //no need export MESH=testMesh
-     mpirun -np 2 medpartitioner_para --input-file=$INFI --output-file=ttmp1_ --ndomains=4
-     mpirun -np 5 medpartitioner_para --input-file=ttmp1_.xml --output-file=ttmp2_ --ndomains=5
-     mpirun -np 2 valgrind  medpartitioner_para --input-file=tmp_testMesh_20x30x50.med  --output-file=ttmp1petit_ --ndomains=4  --dump-cpu-memory --verbose=111
-  */
-  int res;
-  string cmd,execName,sourceName,targetName;
-  
-  res=system("which mpirun 2>/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<<endl<<cmd<<endl;
-  res=system(cmd.c_str());
-  CPPUNIT_ASSERT_EQUAL(0, res);
-  
-  cmd="mpirun -np 3 "+execName+" --ndomains=5 --split-method=metis"; //on less 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<<endl<<cmd<<endl;
-  res=system(cmd.c_str());
-  CPPUNIT_ASSERT_EQUAL(0, res);
-  
-  cmd="mpirun -np 1 "+execName+" --ndomains=1 --split-method=metis";  //on 1 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<<endl<<cmd<<endl;
-  res=system(cmd.c_str());
-  CPPUNIT_ASSERT_EQUAL(0, res);
-
-  cmd="mpirun -np 8 "+execName+" --ndomains=1 --split-method=metis";  //on more 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<<endl<<cmd<<endl;
-  res=system(cmd.c_str());
-  CPPUNIT_ASSERT_EQUAL(0, res);
-}  
-
-void MEDPARTITIONERTest::launchMedpartitionerOnHugeTestMeshes()
-{
-  int res=0;
-  string cmd,execName,sourceName,targetName;
-  execName=getenv("MED_ROOT_DIR");  //.../INSTALL/MED
-  execName+="/bin/salome/medpartitioner_para";
-
-  string snbTarget=IntToStr(_nbTargetHuge);
-  cmd="mpirun -np "+snbTarget+" "+execName+" --ndomains="+snbTarget+" --split-method=metis";  //on same proc
-  sourceName=_fileNameHugeXml;
-  targetName=_fileNameHugeXml;
-  string tmp="_partitionedTo"+snbTarget+"_";
-  targetName.replace(targetName.find(".xml"),4,tmp);
-  cmd+=" --input-file="+sourceName+" --output-file="+targetName+" --verbose="+IntToStr(_verbose);
-  if (_verbose) cout<<endl<<cmd<<endl;
-  res=system(cmd.c_str());
-  CPPUNIT_ASSERT_EQUAL(0, res);
-}  
-
-void MEDPARTITIONERTest::testSmallSize()
-{
-  setSmallSize();
-  createTestMeshes();
-  launchMedpartitionerOnTestMeshes();
-  verifyMedpartitionerOnSmallSizeForMesh();
-  verifyMedpartitionerOnSmallSizeForFieldOnCells();
-  verifyMedpartitionerOnSmallSizeForFieldOnGaussNe();
-}
-
-void MEDPARTITIONERTest::testMedianSize()
-{
-  setMedianSize();
-  createTestMeshes();
-  launchMedpartitionerOnTestMeshes();
-  createHugeTestMesh(_ni, _nj, _nk, 2, 2, 2, 20); //it is now to know how far we are going to test
-  launchMedpartitionerOnHugeTestMeshes();
-}
index 5dfa8e78a069e1e517352fe9aea711a1e437ce83..4d7ec7b0b8a4834ce7d2ded36fa937b880046173 100644 (file)
 #include "MEDCouplingExtrudedMesh.hxx"
 #include "MEDCouplingFieldDouble.hxx"
 
-namespace MEDPARTITIONER {
-  class MESH;
-};
-
 class MEDPARTITIONERTest : public CppUnit::TestFixture
 {
   CPPUNIT_TEST_SUITE( MEDPARTITIONERTest );
diff --git a/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx b/src/MEDPartitioner/Test/MEDPARTITIONERTestPara.cxx
new file mode 100644 (file)
index 0000000..ac6cd98
--- /dev/null
@@ -0,0 +1,436 @@
+// Copyright (C) 2007-2011  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.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#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"
+#include "MEDLoaderBase.hxx"
+#include "MEDCouplingUMesh.hxx"
+#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingFieldDouble.hxx"
+#include "MEDCouplingMemArray.hxx"
+#include "MEDCouplingMultiFields.hxx"
+
+#include <cppunit/TestAssert.h>
+
+#include <sstream>
+#include <cmath>
+#include <list>
+#include <stdexcept>
+#include <cstdlib>
+#include <vector>
+
+#include <mpi.h>
+
+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<<endl<<cmd<<endl;
+  res=system(cmd.c_str());
+  CPPUNIT_ASSERT_EQUAL(0, res);
+  input=targetName+".xml";
+  
+  MPI_Init(0,0);
+  MPI_Comm_size(MPI_COMM_WORLD, &MyGlobals::_World_Size);
+  MPI_Comm_rank(MPI_COMM_WORLD, &MyGlobals::_Rank);
+
+  MEDPARTITIONER::ParaDomainSelector parallelizer(false);
+  MEDPARTITIONER::MeshCollection collection(input,parallelizer); //cvwat01
+  CPPUNIT_ASSERT_EQUAL(3, collection.getMeshDimension());
+  std::vector<ParaMEDMEM::MEDCouplingUMesh*>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::vector<ParaMEDMEM::MEDCouplingUMesh*>faceMeshes=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<<endl<<cmd<<endl;
+  res=system(cmd.c_str());
+  CPPUNIT_ASSERT_EQUAL(0, res);
+  
+  string refusedName=targetName+"1.med";
+  ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_meshName.c_str());
+  ParaMEDMEM::MEDCouplingUMesh* refusedCellMesh=refusedMesh->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<const MEDCouplingUMesh *> meshes;
+  std::vector<DataArrayInt *> 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<<endl<<cmd<<endl;
+  res=system(cmd.c_str());
+  CPPUNIT_ASSERT_EQUAL(0, res);
+  input=targetName+".xml";
+  
+  //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<<endl<<cmd<<endl;
+  res=system(cmd.c_str());
+  CPPUNIT_ASSERT_EQUAL(0, res);
+  
+  string refusedName=targetName+"1.med";
+  ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_meshName.c_str());
+  ParaMEDMEM::MEDCouplingUMesh* refusedCellMesh=refusedMesh->getLevel0Mesh(false);
+  
+  CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
+  
+  std::vector<const MEDCouplingUMesh *> meshes;
+  std::vector<DataArrayInt *> 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 : "<<f1->reprZip();
+      cout<<"\nf2 : "<<f2->reprZip(); //field2->advancedRepradvancedRepr();
+      for (int i = 0; i < corr.size(); i++) cout<<"\ncorr "<<i<<" : "<<corr[i]->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<<" "<<p1[i1+j]<<"="<<p2[i2+j];
+        }
+    }
+  CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp, nbequal);
+  
+  for (int i = 0; i < corr.size(); i++) corr[i]->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<<endl<<cmd<<endl;
+  res=system(cmd.c_str());
+  CPPUNIT_ASSERT_EQUAL(0, res);
+  input=targetName+".xml";
+  
+  //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<<endl<<cmd<<endl;
+  res=system(cmd.c_str());
+  CPPUNIT_ASSERT_EQUAL(0, res);
+  
+  string refusedName=targetName+"1.med";
+  ParaMEDMEM::MEDFileUMesh* refusedMesh=ParaMEDMEM::MEDFileUMesh::New(refusedName.c_str(),_meshName.c_str());
+  ParaMEDMEM::MEDCouplingUMesh* refusedCellMesh=refusedMesh->getLevel0Mesh(false);
+  
+  CPPUNIT_ASSERT_EQUAL(cellMesh->getNumberOfCells(), refusedCellMesh->getNumberOfCells());
+  
+  std::vector<const MEDCouplingUMesh *> meshes;
+  std::vector<DataArrayInt *> 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 : "<<f1->reprZip(); //123.4 for 12th cell,3rd component, 4th gausspoint
+      cout<<"\nf2 : "<<f2->reprZip(); //field2->advancedRepradvancedRepr();
+      for (int i = 0; i < corr.size(); i++) cout<<"\ncorr "<<i<<" : "<<corr[i]->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<<" "<<p1[i1+j]<<"="<<p2[i2+j];
+        }
+    }
+  CPPUNIT_ASSERT_EQUAL(nbcells*nbcomp*nbptgauss, nbequal);
+  
+  for (int i = 0; i < corr.size(); i++) corr[i]->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<<endl<<cmd<<endl;
+  system(cmd.c_str());  //may be not if debug
+}  
+
+void MEDPARTITIONERTest::launchMedpartitionerOnTestMeshes()
+{
+  
+  /* examples 
+     export INFI=/home/vb144235/resources/blade.med
+     //no need export MESH=Fuse_1
+     export INFI=tmp_testMeshxxx.med
+     //no need export MESH=testMesh
+     mpirun -np 2 medpartitioner_para --input-file=$INFI --output-file=ttmp1_ --ndomains=4
+     mpirun -np 5 medpartitioner_para --input-file=ttmp1_.xml --output-file=ttmp2_ --ndomains=5
+     mpirun -np 2 valgrind  medpartitioner_para --input-file=tmp_testMesh_20x30x50.med  --output-file=ttmp1petit_ --ndomains=4  --dump-cpu-memory --verbose=111
+  */
+  int res;
+  string cmd,execName,sourceName,targetName;
+  
+  res=system("which mpirun 2>/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<<endl<<cmd<<endl;
+  res=system(cmd.c_str());
+  CPPUNIT_ASSERT_EQUAL(0, res);
+  
+  cmd="mpirun -np 3 "+execName+" --ndomains=5 --split-method=metis"; //on less 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<<endl<<cmd<<endl;
+  res=system(cmd.c_str());
+  CPPUNIT_ASSERT_EQUAL(0, res);
+  
+  cmd="mpirun -np 1 "+execName+" --ndomains=1 --split-method=metis";  //on 1 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<<endl<<cmd<<endl;
+  res=system(cmd.c_str());
+  CPPUNIT_ASSERT_EQUAL(0, res);
+
+  cmd="mpirun -np 8 "+execName+" --ndomains=1 --split-method=metis";  //on more 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<<endl<<cmd<<endl;
+  res=system(cmd.c_str());
+  CPPUNIT_ASSERT_EQUAL(0, res);
+}  
+
+void MEDPARTITIONERTest::launchMedpartitionerOnHugeTestMeshes()
+{
+  int res=0;
+  string cmd,execName,sourceName,targetName;
+  execName=getenv("MED_ROOT_DIR");  //.../INSTALL/MED
+  execName+="/bin/salome/medpartitioner_para";
+
+  string snbTarget=IntToStr(_nbTargetHuge);
+  cmd="mpirun -np "+snbTarget+" "+execName+" --ndomains="+snbTarget+" --split-method=metis";  //on same proc
+  sourceName=_fileNameHugeXml;
+  targetName=_fileNameHugeXml;
+  string tmp="_partitionedTo"+snbTarget+"_";
+  targetName.replace(targetName.find(".xml"),4,tmp);
+  cmd+=" --input-file="+sourceName+" --output-file="+targetName+" --verbose="+IntToStr(_verbose);
+  if (_verbose) cout<<endl<<cmd<<endl;
+  res=system(cmd.c_str());
+  CPPUNIT_ASSERT_EQUAL(0, res);
+}  
+
+void MEDPARTITIONERTest::testSmallSize()
+{
+  setSmallSize();
+  createTestMeshes();
+  launchMedpartitionerOnTestMeshes();
+  verifyMedpartitionerOnSmallSizeForMesh();
+  verifyMedpartitionerOnSmallSizeForFieldOnCells();
+  verifyMedpartitionerOnSmallSizeForFieldOnGaussNe();
+}
+
+void MEDPARTITIONERTest::testMedianSize()
+{
+  setMedianSize();
+  createTestMeshes();
+  launchMedpartitionerOnTestMeshes();
+  createHugeTestMesh(_ni, _nj, _nk, 2, 2, 2, 20); //it is now to know how far we are going to test
+  launchMedpartitionerOnHugeTestMeshes();
+}
index f4bcdd412b62cfe3508c7e50fda7d47bb05c875e..cd36f53d7303f9f5c847132d3627b868646a80e4 100644 (file)
@@ -23,89 +23,48 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
 lib_LTLIBRARIES = libMEDPARTITIONERTest.la
 
-dist_libMEDPARTITIONERTest_la_SOURCES= \
+dist_libMEDPARTITIONERTest_la_SOURCES = \
        MEDPARTITIONERTest.cxx
-#      MEDPARTITIONERTest_Utils.cxx
 
-#if MED_ENABLE_PARMETIS
-#  dist_libMEDPARTITIONERTest_la_SOURCES+= \
-#      ParaMEDPARTITIONERTest.hxx
-#endif
+if MPI_IS_OK
+  dist_libMEDPARTITIONERTest_la_SOURCES += MEDPARTITIONERTestPara.cxx
+endif
 
 salomeinclude_HEADERS = \
        MEDPARTITIONERTest.hxx
-#      MEDPARTITIONERTest_Utils.hxx
 
-libMEDPARTITIONERTest_la_CPPFLAGS= \
+libMEDPARTITIONERTest_la_CPPFLAGS = \
        @CPPUNIT_INCLUDES@ \
-       $(MED2_INCLUDES) \
+       $(MED3_INCLUDES) \
        $(HDF5_INCLUDES) \
-       @CXXTMPDPTHFLAGS@ \
-       $(BOOST_CPPFLAGS) \
        $(LIBXML_CXXFLAGS) \
+       $(MPI_INCLUDES) \
        -I$(srcdir)/.. \
-       -I$(srcdir)/../../MEDWrapper/V2_1/Core \
-       -I$(srcdir)/../../MEDMEM \
-       -I$(srcdir)/../../MEDMEMCppTest \
        -I$(srcdir)/../../MEDCoupling \
        -I$(srcdir)/../../MEDLoader \
        -I$(srcdir)/../../INTERP_KERNEL/Bases \
        -I$(srcdir)/../../INTERP_KERNEL/GaussPoints \
        -I$(srcdir)/../../INTERP_KERNEL
 
-libMEDPARTITIONERTest_la_LDFLAGS= $(MED2_LIBS) @CPPUNIT_LIBS@
+libMEDPARTITIONERTest_la_LDFLAGS = $(MED3_LIBS_C_ONLY) $(HDF5_LIBS) $(MPI_LIBS) @CPPUNIT_LIBS@
 
-if MED_ENABLE_KERNEL
-    libMEDPARTITIONERTest_la_CPPFLAGS+= ${KERNEL_CXXFLAGS}
-    libMEDPARTITIONERTest_la_LDFLAGS+= ${KERNEL_LDFLAGS} -lSALOMELocalTrace 
-endif
+# Executables targets
 
-if MED_ENABLE_PARMETIS
-  libMEDPARTITIONERTest_la_CPPFLAGS+= $(PARMETIS_CPPFLAGS)
-  libMEDPARTITIONERTest_la_LDFLAGS+= $(PARMETIS_LIBS)
-endif
-if MED_ENABLE_METIS
-  libMEDPARTITIONERTest_la_CPPFLAGS+= $(METIS_CPPFLAGS)
-  libMEDPARTITIONERTest_la_LDFLAGS+= $(METIS_LIBS)
-endif
-if MED_ENABLE_SCOTCH
-  libMEDPARTITIONERTest_la_CPPFLAGS+= $(SCOTCH_CPPFLAGS)
-  libMEDPARTITIONERTest_la_LDFLAGS+= $(SCOTCH_LIBS)
-endif
+dist_salomescript_DATA = 
+UNIT_TEST_PROG =
 
-# Executables targets
-bin_PROGRAMS= TestMEDPARTITIONER
+if MPI_IS_OK
+  bin_PROGRAMS = TestMEDPARTITIONER
 
-TestMEDPARTITIONER_SOURCES= TestMEDPARTITIONER.cxx
+  TestMEDPARTITIONER_SOURCES = TestMEDPARTITIONER.cxx
 
-TestMEDPARTITIONER_CPPFLAGS= $(libMEDPARTITIONERTest_la_CPPFLAGS) 
-TestMEDPARTITIONER_LDADD= \
-       $(MED2_LIBS) \
+  TestMEDPARTITIONER_CPPFLAGS = $(libMEDPARTITIONERTest_la_CPPFLAGS) 
+  TestMEDPARTITIONER_LDADD = \
        $(libMEDPARTITIONERTest_la_LDFLAGS) -lm \
        libMEDPARTITIONERTest.la \
-       ../../MEDWrapper/V2_1/Core/libmed_V2_1.la \
-       ../../MEDMEM/libmedmem.la \
        ../../INTERP_KERNEL/libinterpkernel.la \
        ../libmedpartitioner.la
-
-if MED_ENABLE_KERNEL
-     TestMEDPARTITIONER_LDADD+= -lSALOMEBasics
-endif
-
-dist_salomescript_DATA = 
-#testMEDPARTITIONER.py
-
-UNIT_TEST_PROG = TestMEDPARTITIONER
-
-# parallel exe
-
-if MED_ENABLE_PARMETIS
-#  bin_PROGRAMS+= TestParaMEDPARTITIONER
-#  TestParaMEDPARTITIONER_SOURCES= TestParaMEDPARTITIONER.cxx
-#  TestParaMEDPARTITIONER_CPPFLAGS = $(TestMEDPARTITIONER_CPPFLAGS)
-#  TestParaMEDPARTITIONER_LDADD = $(TestMEDPARTITIONER_LDADD) $(HDF5_LIBS)
-#  dist_salomescript_DATA += testParaMEDPARTITIONER.py
-#  TESTS = TestParaMEDPARTITIONER
+  UNIT_TEST_PROG += TestMEDPARTITIONER
 endif
 
 check: tests