]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Management of PTScotch/Scotch separetely
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 29 Dec 2017 14:11:18 +0000 (15:11 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 29 Dec 2017 14:11:18 +0000 (15:11 +0100)
src/MEDPartitioner/MEDPARTITIONER_Graph.hxx
src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx
src/MEDPartitioner_Swig/MEDPartitionerCommon.i
src/PyWrapping/TestPyWrapGathered_medcoupling.py

index abf92731014373ad4662414186118261991bfee4..60a5595388cea50931655d27ba27e365c866f543 100644 (file)
@@ -38,7 +38,7 @@ namespace MEDPARTITIONER
   class MEDPARTITIONER_EXPORT Graph
   {
   public:
-    typedef enum {METIS,SCOTCH} splitter_type;
+    typedef enum {METIS,SCOTCH,PTSCOTCH} splitter_type;
 
     Graph();
     //creates a graph from a SKYLINEARRAY- WARNING!! Graph takes ownership of the array.
index 5677d56abe9e1f7731c053b038f96d15e332c9d0..359e9306fa8e41b4fcc69c7b3877e01c79bc2084 100644 (file)
@@ -148,14 +148,14 @@ MEDPARTITIONER::Graph* MEDPARTITIONER::MEDPartitioner::Graph(MEDCoupling::MEDCou
 {
   MEDPARTITIONER::Graph* cellGraph=0;
   // will be destroyed by XXXGraph class:
-  MEDCoupling::MEDCouplingSkyLineArray* arr = MEDCoupling::MEDCouplingSkyLineArray::New(graph->getIndexArray(), graph->getValuesArray());
+  MEDCoupling::MCAuto<MEDCoupling::MEDCouplingSkyLineArray> arr(MEDCoupling::MEDCouplingSkyLineArray::New(graph->getIndexArray(), graph->getValuesArray()));
   switch (split)
     {
     case Graph::METIS:
       if ( !cellGraph )
         {
 #ifdef MED_ENABLE_METIS
-          cellGraph=new METISGraph(arr,edgeweight);
+          cellGraph=new METISGraph(arr.retn(),edgeweight);
 #endif
         }
       if ( !cellGraph )
@@ -163,15 +163,22 @@ MEDPARTITIONER::Graph* MEDPARTITIONER::MEDPartitioner::Graph(MEDCoupling::MEDCou
       break;
     case Graph::SCOTCH:
 #ifdef MED_ENABLE_SCOTCH
-      cellGraph=new SCOTCHGraph(arr,edgeweight);
+      cellGraph=new SCOTCHGraph(arr.retn(),edgeweight);
 #else
+      throw INTERP_KERNEL::Exception("MEDPartitioner::Graph : SCOTCH is not available. Check your products, please.");
+#endif
+      break;
+    case Graph::PTSCOTCH:
+      {
 #ifdef MED_ENABLE_PTSCOTCH
-      cellGraph=new PTSCOTCHGraph(arr,edgeweight,vlbloctab);
+        cellGraph=new PTSCOTCHGraph(arr.retn(),edgeweight,vlbloctab);
 #else
-      throw INTERP_KERNEL::Exception("MEDPartitioner::Graph : PTSCOTCH/SCOTCH is not available. Check your products, please.");
+        throw INTERP_KERNEL::Exception("MEDPartitioner::Graph : PTSCOTCH is not available. Check your products, please.");
 #endif
-#endif
-      break;
+        break;
+      }
+    default:
+      throw INTERP_KERNEL::Exception("MEDPartitioner::Graph : Not managed split type engine !");
     }
   return cellGraph;
 }
index aeb343a2724d6ca3b10ebad18e98c6bb9021ee13..a876aeb70b5dbd18f4fbba9d9489cc65274987d3 100644 (file)
@@ -38,7 +38,7 @@ namespace MEDPARTITIONER
   class Graph
   {
   public:
-    typedef enum {METIS,SCOTCH} splitter_type;
+    typedef enum {METIS,SCOTCH,PTSCOTCH} splitter_type;
   public:
     virtual void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0) throw(INTERP_KERNEL::Exception);
     MEDCoupling::MEDCouplingSkyLineArray *getGraph() const
index 14a2680000d561a5b2ecc2f68ab44b56aeff4648..899823638289c34d4e0eafe9230336da778230ed 100644 (file)
@@ -86,17 +86,16 @@ class medcouplingTest(unittest.TestCase):
 
     @unittest.skipUnless(HasPartitionerExt(),"Requires Partitioner activation")
     def test3(self):
+        algoSelected=eval("Graph.%s"%MEDPartitioner.AvailableAlgorithms()[0].upper())
         arr=DataArrayDouble(10) ; arr.iota()
         m=MEDCouplingCMesh() ; m.setCoords(arr,arr)
         m=m.buildUnstructured() ; m.setName("mesh")
-        m.write("all.med")
         a,b=m.computeNeighborsOfCells()
         sk=MEDCouplingSkyLineArray(b,a)
-        g=MEDPartitioner.Graph(sk)
+        g=MEDPartitioner.Graph(sk,algoSelected)
         g.partGraph(4)
         procIdOnCells=g.getPartition().getValuesArray()
         m0=m[procIdOnCells.findIdsEqual(0)] ; m0.setName("m0")
-        m0.write("part0.med")
         pass
     
     @unittest.skipUnless(HasParallelInterpolatorExt(),"Requires // interpolator activated")
@@ -107,4 +106,12 @@ class medcouplingTest(unittest.TestCase):
     pass
 
 if __name__ == "__main__":
+    if HasParallelInterpolatorExt():
+        try:
+            from mpi4py import MPI # if not imported test3 may failed due to MPI call of partitioner algorithms.
+        except:
+            pass
+        pass
     unittest.main()
+    pass
+