X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDPartitioner%2FMEDPARTITIONER_Graph.cxx;h=8037cf6940e9a030dcad662f0d9654ff5b031dd2;hb=e057263132f3cb4871fb280f8d9c963ba17567a1;hp=7ae83470dc513f1d7c53847febd93f9bd4642289;hpb=f1a947b32a36d8dc8e3079b25305bb50e8cb59a0;p=tools%2Fmedcoupling.git diff --git a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx index 7ae83470d..8037cf694 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 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 // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -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::DataArrayInt* array = _partition->getValuesArray() ) + { + for ( const int * dom = array->begin(); dom != array->end(); ++dom ) + domains.insert( *dom ); + } + return domains.size(); + } + + const int *Graph::getPart() const + { + return _partition->getValues(); + } + + int Graph::nbVertices() const + { + return _graph->getNumberOf(); + } + +};