]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
refacto partitioner options
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 29 Dec 2017 15:12:40 +0000 (16:12 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 29 Dec 2017 15:12:40 +0000 (16:12 +0100)
src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx
src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.hxx
src/PyWrapping/TestPyWrapGathered_medcoupling.py
src/PyWrapping/medcoupling.i

index 359e9306fa8e41b4fcc69c7b3877e01c79bc2084..d368cf23658a75ee03093c9fd03a83e8812b816e 100644 (file)
@@ -198,6 +198,33 @@ std::vector<std::string> MEDPARTITIONER::MEDPartitioner::AvailableAlgorithms()
   return ret;
 }
 
+bool MEDPARTITIONER::MEDPartitioner::HasMetisAlg()
+{
+#ifdef MED_ENABLE_METIS
+  return true;
+#else
+  return false;
+#endif
+}
+
+bool MEDPARTITIONER::MEDPartitioner::HasScotchAlg()
+{
+#ifdef MED_ENABLE_SCOTCH
+  return true;
+#else
+  return false;
+#endif
+}
+
+bool MEDPARTITIONER::MEDPartitioner::HasPTScotchAlg()
+{
+#ifdef MED_ENABLE_PTSCOTCH
+  return true;
+#else
+  return false;
+#endif
+}
+
 std::vector<std::string> MEDPARTITIONER::MEDPartitioner::AllAlgorithms()
 {
   std::vector<std::string> ret;
index 7f8b61ea50941215cfb9007f3e34a7860dcebf96..b5fc3cc29278c8753d04f70433d31df5e304f519 100644 (file)
@@ -47,6 +47,9 @@ namespace MEDPARTITIONER
     static MEDPARTITIONER::Graph* Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split=Graph::METIS, int* edgeweight=0, DataArrayInt* vlbloctab=0);
     static std::vector<std::string> AvailableAlgorithms();
     static std::vector<std::string> AllAlgorithms();
+    static bool HasMetisAlg();
+    static bool HasScotchAlg();
+    static bool HasPTScotchAlg();
     void write(const std::string& filename);
     MEDCoupling::MEDFileData* getMEDFileData();
     ~MEDPartitioner();
index 899823638289c34d4e0eafe9230336da778230ed..dd39f8dae1ed16fef1e7744a80fc6bb92077b0e5 100644 (file)
@@ -86,7 +86,19 @@ class medcouplingTest(unittest.TestCase):
 
     @unittest.skipUnless(HasPartitionerExt(),"Requires Partitioner activation")
     def test3(self):
-        algoSelected=eval("Graph.%s"%MEDPartitioner.AvailableAlgorithms()[0].upper())
+        for alg in MEDPartitioner.AvailableAlgorithms():
+            st="Graph.%s"%alg.upper()
+            print(st)
+            self.partitionerTesterHelper(eval(st))
+            pass
+        pass
+    
+    @unittest.skipUnless(HasParallelInterpolatorExt(),"Requires // interpolator activated")
+    def test4(self):
+        interface=CommInterface()
+        pass
+
+    def partitionerTesterHelper(self,algoSelected):
         arr=DataArrayDouble(10) ; arr.iota()
         m=MEDCouplingCMesh() ; m.setCoords(arr,arr)
         m=m.buildUnstructured() ; m.setName("mesh")
@@ -98,11 +110,6 @@ class medcouplingTest(unittest.TestCase):
         m0=m[procIdOnCells.findIdsEqual(0)] ; m0.setName("m0")
         pass
     
-    @unittest.skipUnless(HasParallelInterpolatorExt(),"Requires // interpolator activated")
-    def test4(self):
-        interface=CommInterface()
-        pass
-    
     pass
 
 if __name__ == "__main__":
index 097cbbfd87c07afd7f9e059eb9ca0d5373289f2f..c97318d5b366b7baf6bdee822caa4aa6a5130304 100644 (file)
 #endif
   }
 
+  bool HasScotchPartitionerAlg()
+  {
+#ifdef WITH_PARTITIONER
+    return MEDPartitioner::HasScotchAlg();
+#else
+    return false;
+#endif    
+  }
+
+  bool HasPTScotchPartitionerAlg()
+  {
+#ifdef WITH_PARTITIONER
+    return MEDPartitioner::HasPTScotchAlg();
+#else
+    return false;
+#endif    
+  }
+
+  bool HasMetisPartitionerAlg()
+  {
+#ifdef WITH_PARTITIONER
+    return MEDPartitioner::HasMetisAlg();
+#else
+    return false;
+#endif    
+  }
+  
   bool HasParallelInterpolatorExt()
   {
 #ifdef WITH_PARALLEL_INTERPOLATOR