X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDPartitioner%2FMEDPARTITIONER_Graph.cxx;h=b9ed088fab44b4d4d57b5fdf30e5d0633a89b1e8;hb=7cdd24293941a0a2fd7a93adf86ce293ece155b8;hp=15d0239234b2fa23fb7fa0e818c23be484ad37c4;hpb=8763c12d01e33d6845dd53be65b001514d00bd42;p=tools%2Fmedcoupling.git diff --git a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx index 15d023923..b9ed088fa 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D +// Copyright (C) 2007-2021 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 @@ -19,12 +19,48 @@ #include "MEDPARTITIONER_Graph.hxx" -MEDPARTITIONER::Graph::Graph(MEDPARTITIONER::SkyLineArray *array, int *edgeweight):_graph(array),_partition(0),_edge_weight(edgeweight),_cell_weight(0) -{ -} +#include "MEDCouplingSkyLineArray.hxx" + +#include -MEDPARTITIONER::Graph::~Graph() +namespace MEDPARTITIONER { - delete _partition; - delete _graph; -} + Graph::Graph(): + _graph(0),_partition(0), + _edge_weight(0),_cell_weight(0) + { + } + + Graph::Graph(MEDCoupling::MEDCouplingSkyLineArray *array, int *edgeweight): + _graph(array),_partition(0), + _edge_weight(edgeweight),_cell_weight(0) + { + } + + Graph::~Graph() + { + } + + int Graph::nbDomains() const + { + std::set 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(); + } + +};