Salome HOME
[EDF21269] : Reproduce PTScotch graph split between independant runs
[tools/medcoupling.git] / src / MEDPartitioner / MEDPARTITIONER_Graph.cxx
index 8ae65517b7524ad748fdc40befd474f2cb1e0121..17df2fc01d8ef31d709b0f7cbfbd1d76dbf9e71c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  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
 
 #include <set>
 
-MEDPARTITIONER::Graph::Graph(MEDCoupling::MEDCouplingSkyLineArray *array, int *edgeweight):_graph(array),_partition(0),_edge_weight(edgeweight),_cell_weight(0)
+namespace MEDPARTITIONER
 {
-}
+  Graph::Graph():
+    _graph(0),_partition(0),
+    _edge_weight(0),_cell_weight(0)
+  {
+  }
 
-MEDPARTITIONER::Graph::~Graph()
-{
-  delete _partition;
-  delete _graph;
-}
+  Graph::Graph(MEDCoupling::MEDCouplingSkyLineArray *array, int *edgeweight):
+    _graph(array),_partition(0),
+    _edge_weight(edgeweight),_cell_weight(0)
+  {
+  }
 
-int MEDPARTITIONER::Graph::nbDomains() const
-{
-  std::set<int> domains;
-  if ( _partition )
-    if ( MEDCoupling::DataArrayInt* array = _partition->getValueArray() )
-    {
-      for ( const int * dom = array->begin(); dom != array->end(); ++dom )
-        domains.insert( *dom );
-    }
-  return domains.size();
-}
-
-const int *MEDPARTITIONER::Graph::getPart() const
-{
-  return _partition->getValue();
-}
+  Graph::~Graph()
+  {
+  }
 
-int MEDPARTITIONER::Graph::nbVertices() const
-{
-  return _graph->getNumberOf();
-}
+  int Graph::nbDomains() const
+  {
+    std::set<mcIdType> domains;
+    if ( _partition.isNotNull() )
+      if ( MEDCoupling::DataArrayIdType* array = _partition->getValuesArray() )
+      {
+        for ( const mcIdType * dom = array->begin(); dom != array->end(); ++dom )
+          domains.insert( *dom );
+      }
+    return (int)domains.size();
+  }
+
+  const mcIdType *Graph::getPart() const
+  {
+    return _partition->getValues();
+  }
+
+  mcIdType Graph::nbVertices() const
+  {
+    return _graph->getNumberOf();
+  }
+
+};