From 320dd8cfe4e8cbb7a85b086dda0ad16566214d72 Mon Sep 17 00:00:00 2001 From: ageay Date: Tue, 13 Mar 2012 15:18:56 +0000 Subject: [PATCH] CLEAN-UP 2 --- src/MEDPartitioner/MEDPARTITIONER_Graph.cxx | 25 +++---------------- src/MEDPartitioner/MEDPARTITIONER_Graph.hxx | 24 ++++++++---------- .../MEDPARTITIONER_MetisGraph.cxx | 6 ++--- .../MEDPARTITIONER_ScotchGraph.cxx | 4 +-- 4 files changed, 20 insertions(+), 39 deletions(-) diff --git a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx index b94e531b2..c6d67b057 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Graph.cxx @@ -19,29 +19,12 @@ #include "MEDPARTITIONER_Graph.hxx" -using namespace MEDPARTITIONER; - -Graph::Graph(MEDPARTITIONER::SkyLineArray* array, int* edgeweight):_graph(array),_partition(0),_edgeweight(edgeweight),_cellweight(0) +MEDPARTITIONER::Graph::Graph(MEDPARTITIONER::SkyLineArray *array, int *edgeweight):_graph(array),_partition(0),_edge_weight(edgeweight),_cell_weight(0) { } -//================================================================================ -/*! - * \brief Destructor - */ -//================================================================================ - -Graph::~Graph() +MEDPARTITIONER::Graph::~Graph() { - if (_partition) - { - delete _partition; - _partition=0; - } - if (_graph) - { - delete _graph; - _graph=0; - } + delete _partition; + delete _graph; } - diff --git a/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx b/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx index 2aa4f81fd..d36fb0c64 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_Graph.hxx @@ -33,32 +33,30 @@ namespace MEDPARTITIONER public: typedef enum {METIS,SCOTCH} splitter_type; - Graph() - { - } + Graph() { } //creates a graph from a SKYLINEARRAY Graph(MEDPARTITIONER::SkyLineArray* graph, int* edgeweight=0); virtual ~Graph(); - void setEdgesWeights(int* edgeweight){_edgeweight=edgeweight;} - void setVerticesWeights(int* cellweight){_cellweight=cellweight;} + 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&, ParaDomainSelector *sel=0) = 0; //returns the partitioning - const int* getPart() const {return _partition->getValue();} + const int *getPart() const { return _partition->getValue(); } //returns the number of graph vertices (which can correspond to the cells in the mesh!) - int nbVertices() const {return _graph->getNumberOf();} + int nbVertices() const { return _graph->getNumberOf(); } - const MEDPARTITIONER::SkyLineArray* getGraph() const {return _graph;} + const SkyLineArray *getGraph() const { return _graph; } protected: - MEDPARTITIONER::SkyLineArray* _graph; - MEDPARTITIONER::SkyLineArray* _partition; - int* _edgeweight; - int* _cellweight; + SkyLineArray* _graph; + SkyLineArray* _partition; + int* _edge_weight; + int* _cell_weight; }; } #endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx index 96b8464a3..fe07e8ad4 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx @@ -69,9 +69,9 @@ void METISGraph::partGraph(int ndomain, int * xadj=const_cast(_graph->getIndex()); int * adjncy=const_cast(_graph->getValue()); //constraints - int * vwgt=_cellweight; - int * adjwgt=_edgeweight; - int wgtflag=(_edgeweight!=0)?1:0+(_cellweight!=0)?2:0; + int * vwgt=_cell_weight; + int * adjwgt=_edge_weight; + int wgtflag=(_edge_weight!=0)?1:0+(_cell_weight!=0)?2:0; //base 0 or 1 int base=0; //ndomain diff --git a/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx index b8f0a443c..bdeef3275 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx @@ -70,11 +70,11 @@ void SCOTCHGraph::partGraph(int ndomain, const std::string& options_string, Para n, // nb of graph nodes xadj, 0, - _cellweight, //graph vertices loads + _cell_weight, //graph vertices loads 0, xadj[n], // number of edges adjncy, - _edgeweight); + _edge_weight); SCOTCH_Strat scotch_strategy; SCOTCH_stratInit(&scotch_strategy); -- 2.39.2