Salome HOME
MEDCoupling becomes medcoupling in tests.
[tools/medcoupling.git] / src / MEDPartitioner / MEDPARTITIONER_Graph.hxx
index a00d09131ac66fdc949d0dc4c3343f60747dc346..605718bd988095cbf7057f6763ff0cf3e77dc6b3 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2019  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
 #define __MEDPARTITIONER_GRAPH_HXX__
 
 #include "MEDPARTITIONER.hxx"
-#include "MEDPARTITIONER_SkyLineArray.hxx"
+#include "MCAuto.hxx"
 
 #include <string>
 
+namespace MEDCoupling
+{
+  class MEDCouplingSkyLineArray;
+}
+
+using namespace MEDCoupling;
+
 namespace MEDPARTITIONER 
 {
   class ParaDomainSelector;
   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
-    Graph(MEDPARTITIONER::SkyLineArray* graph, int* edgeweight=0);
+    Graph();
+    //creates a graph from a SKYLINEARRAY- WARNING!! Graph takes ownership of the array.
+    Graph(MEDCouplingSkyLineArray* graph, int* edgeweight=0);
     virtual ~Graph();
 
     void setEdgesWeights(int *edgeweight) { _edge_weight=edgeweight; }
     void setVerticesWeights(int *cellweight) { _cell_weight=cellweight; }
     
     //computes partitioning of the graph
-    virtual void partGraph(int ndomain, const std::string&, ParaDomainSelector *sel=0) = 0;
+    virtual void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0) = 0;
     
     //returns the partitioning
-    const int *getPart() const { return _partition->getValue(); }
+    const int *getPart() const;
     
     //returns the number of graph vertices (which can correspond to the cells in the mesh!)
-    int nbVertices() const { return _graph->getNumberOf(); }
+    int nbVertices() const;
+
+    // returns nb of domains in _partition
+    int nbDomains() const;
     
-    const SkyLineArray *getGraph() const { return _graph; }
+    const MEDCouplingSkyLineArray *getGraph() const { return (const MEDCouplingSkyLineArray*)_graph; }
+    const MEDCouplingSkyLineArray *getPartition() const { return (const MEDCouplingSkyLineArray*)_partition; }
 
   protected:
-    SkyLineArray* _graph;
-    SkyLineArray* _partition;
+    MCAuto<MEDCouplingSkyLineArray> _graph;
+    MCAuto<MEDCouplingSkyLineArray> _partition;
     int* _edge_weight;  
     int* _cell_weight;
   };