From: cvw Date: Wed, 28 Mar 2012 08:01:12 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: V6_main_FINAL~710 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0a4eca32e71cf1c9f7b9d92832bef566295f4212;p=tools%2Fmedcoupling.git *** empty log message *** --- diff --git a/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx index 11e8841fc..dda41050b 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MetisGraph.cxx @@ -55,7 +55,7 @@ void METISGraph::partGraph(int ndomain, if (MyGlobals::_Verbose>10) std::cout << "proc " << MyGlobals::_Rank << " : METISGraph::partGraph" << std::endl; - // number of graph vertices + //number of graph vertices int n=_graph->getNumberOf(); //graph int * xadj=const_cast(_graph->getIndex()); @@ -78,17 +78,17 @@ void METISGraph::partGraph(int ndomain, seems no changes int options[4]={1,0,33,0}; //test for a random seed of 33 */ int options[4]={0,0,0,0}; - // output parameters - int edgecut; - int* partition=new int[n]; - #if !defined(MED_ENABLE_METIS) throw INTERP_KERNEL::Exception("METISGraph::partGraph : METIS is not available. Check your products, please."); #else + //output parameters + int edgecut; + int* partition=new int[n]; + if(nparts >1) { if (MyGlobals::_Verbose>10) - std::cout << "METISGraph::partGraph METIS_PartGraph METIS_PartGraph(RecursiveOrKway) newww" << std::endl; + std::cout << "METISGraph::partGraph METIS_PartGraph METIS_PartGraph(RecursiveOrKway)" << std::endl; if (options_string != "k") METIS_PartGraphRecursive(&n, xadj, adjncy, vwgt, adjwgt, &wgtflag, &base, &nparts, options, &edgecut, partition); diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.cxx index 719690af4..5046ac4ed 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.cxx @@ -80,12 +80,11 @@ void METISGraph::partGraph(int ndomain, int options[4]={0,0,0,0}; // output parameters int edgecut; - int* partition=new int[n]; - #if !defined(MED_ENABLE_PARMETIS) throw INTERP_KERNEL::Exception("METISGraph::partGraph : PARMETIS is not available. Check your products, please."); #else - + int* partition=new int[n]; + if (MyGlobals::_Verbose>10) std::cout << "proc " << MyGlobals::_Rank << " : METISGraph::partGraph ParMETIS_PartKway new" << std::endl; int * vtxdist=parallelizer->getProcVtxdist(); diff --git a/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx index 7daa64652..99b542707 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx @@ -19,6 +19,7 @@ #include "MEDPARTITIONER_Graph.hxx" #include "MEDPARTITIONER_ScotchGraph.hxx" +#include "MEDPARTITIONER_Utils.hxx" #include @@ -46,51 +47,53 @@ SCOTCHGraph::~SCOTCHGraph() void SCOTCHGraph::partGraph(int ndomain, const std::string& options_string, ParaDomainSelector* sel) { -#ifdef MED_ENABLE_SCOTCH - // number of graph vertices + if (MyGlobals::_Verbose>10) + std::cout << "proc " << MyGlobals::_Rank << " : SCOTCHGraph::partGraph" << std::endl; + + //number of graph vertices int n = _graph->getNumberOf(); - //graph int * xadj=const_cast(_graph->getIndex()); - int * adjncy = const_cast(_graph->getValue()); - + int * adjncy=const_cast(_graph->getValue()); //ndomain - int nparts = ndomain; + int nparts=ndomain; - // output parameters +#if !defined(MED_ENABLE_SCOTCH) + throw INTERP_KERNEL::Exception("SCOTCHGraph::partGraph : SCOTCH is not available. Check your products, please."); +#else + //output parameters int* partition = new int[n+1]; - + SCOTCH_Graph scotch_graph; - SCOTCH_graphInit(&scotch_graph); - - SCOTCH_graphBuild(&scotch_graph, - 1, //first indice 1 - n, // nb of graph nodes + 0, //base first indice 0 + n, //nb of graph nodes xadj, 0, _cell_weight, //graph vertices loads 0, - xadj[n], // number of edges + xadj[n], //number of edges adjncy, _edge_weight); - - SCOTCH_Strat scotch_strategy; + SCOTCH_Strat scotch_strategy; SCOTCH_stratInit(&scotch_strategy); - + //!user-defined options for the strategy if (options_string!="") SCOTCH_stratGraphMap(&scotch_strategy,options_string.c_str()); - - if (nparts>1) - SCOTCH_graphPart(&scotch_graph,nparts,&scotch_strategy,partition); - else - // partition for 1 subdomain + if (nparts>1) + { + if (MyGlobals::_Verbose>10) std::cout << "SCOTCHGraph::graphPart SCOTCH_graphPart" << std::endl; + SCOTCH_graphPart(&scotch_graph,nparts,&scotch_strategy,partition); + } + else //partition for 1 subdomain + { for (int i=0; i