Salome HOME
Fix: getCellsContainingPoints() in case of polyhedron with a face containing colinear...
[tools/medcoupling.git] / src / MEDPartitioner / MEDPARTITIONER_MEDPartitioner.cxx
index 5677d56abe9e1f7731c053b038f96d15e332c9d0..cf75ce81232a743554006cc5107914e077e393dc 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -144,18 +144,18 @@ MEDCoupling::MEDFileData* MEDPARTITIONER::MEDPartitioner::getMEDFileData()
   return _output_collection->retrieveDriver()->getMEDFileData();
 }
 
-MEDPARTITIONER::Graph* MEDPARTITIONER::MEDPartitioner::Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split, int* edgeweight, DataArrayInt *vlbloctab)
+MEDPARTITIONER::Graph* MEDPARTITIONER::MEDPartitioner::Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split, int* edgeweight, DataArrayIdType *vlbloctab)
 {
   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.");
-#endif
+        throw INTERP_KERNEL::Exception("MEDPartitioner::Graph : PTSCOTCH is not available. Check your products, please.");
 #endif
-      break;
+        break;
+      }
+    default:
+      throw INTERP_KERNEL::Exception("MEDPartitioner::Graph : Not managed split type engine !");
     }
   return cellGraph;
 }
@@ -191,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;