#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;
}
-
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
int * xadj=const_cast<int*>(_graph->getIndex());
int * adjncy=const_cast<int*>(_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
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);