From: Anthony Geay Date: Fri, 29 Dec 2017 15:12:40 +0000 (+0100) Subject: refacto partitioner options X-Git-Tag: V9_0_0~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=39bfcdccbfaafc8aaf70d57a8d2535a65cfa272b;p=tools%2Fmedcoupling.git refacto partitioner options --- diff --git a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx index 359e9306f..d368cf236 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx @@ -198,6 +198,33 @@ std::vector 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 MEDPARTITIONER::MEDPartitioner::AllAlgorithms() { std::vector ret; diff --git a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.hxx b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.hxx index 7f8b61ea5..b5fc3cc29 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.hxx @@ -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 AvailableAlgorithms(); static std::vector AllAlgorithms(); + static bool HasMetisAlg(); + static bool HasScotchAlg(); + static bool HasPTScotchAlg(); void write(const std::string& filename); MEDCoupling::MEDFileData* getMEDFileData(); ~MEDPartitioner(); diff --git a/src/PyWrapping/TestPyWrapGathered_medcoupling.py b/src/PyWrapping/TestPyWrapGathered_medcoupling.py index 899823638..dd39f8dae 100644 --- a/src/PyWrapping/TestPyWrapGathered_medcoupling.py +++ b/src/PyWrapping/TestPyWrapGathered_medcoupling.py @@ -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__": diff --git a/src/PyWrapping/medcoupling.i b/src/PyWrapping/medcoupling.i index 097cbbfd8..c97318d5b 100644 --- a/src/PyWrapping/medcoupling.i +++ b/src/PyWrapping/medcoupling.i @@ -92,6 +92,33 @@ #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