From: eap Date: Fri, 8 Feb 2013 12:50:03 +0000 (+0000) Subject: 0021756: [CEA 602] MEDPartitioner improvements / X-Git-Tag: V6_main_FINAL~371 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=863084c8945325d424c839b03ae1a9dc3410704d;p=tools%2Fmedcoupling.git 0021756: [CEA 602] MEDPartitioner improvements / Create the class ParMETISGraph to enable co-existence of Metis and Parmetis --- diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.cxx index 5e85a6f94..f042c44bf 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.cxx @@ -17,7 +17,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "MEDPARTITIONER_MetisGraph.hxx" +#include "MEDPARTITIONER_ParMetisGraph.hxx" #include "MEDPARTITIONER_ParaDomainSelector.hxx" #include "MEDPARTITIONER_Utils.hxx" @@ -26,26 +26,28 @@ #include #ifdef MED_ENABLE_PARMETIS -#include -#include "parmetis.h" +#include +// #if PARMETIS_MAJOR_VERSION == 4 +// #define ParMETIS_PartKway ParMETIS_V3_PartKway +// #endif #endif using namespace MEDPARTITIONER; -METISGraph::METISGraph():Graph() +ParMETISGraph::ParMETISGraph():Graph() { } -METISGraph::METISGraph(MEDPARTITIONER::SkyLineArray* graph, int* edgeweight) +ParMETISGraph::ParMETISGraph(MEDPARTITIONER::SkyLineArray* graph, int* edgeweight) :Graph(graph,edgeweight) { } -METISGraph::~METISGraph() +ParMETISGraph::~ParMETISGraph() { } -void METISGraph::partGraph(int ndomain, +void ParMETISGraph::partGraph(int ndomain, const std::string& options_string, ParaDomainSelector *parallelizer) { @@ -53,7 +55,7 @@ void METISGraph::partGraph(int ndomain, vector ran,vx,va; //for randomize if (MyGlobals::_Verbose>10) - std::cout << "proc " << MyGlobals::_Rank << " : METISGraph::partGraph" << std::endl; + std::cout << "proc " << MyGlobals::_Rank << " : ParMETISGraph::partGraph" << std::endl; // number of graph vertices int n=_graph->getNumberOf(); @@ -81,12 +83,12 @@ void METISGraph::partGraph(int ndomain, // output parameters int edgecut; #if !defined(MED_ENABLE_PARMETIS) - throw INTERP_KERNEL::Exception("METISGraph::partGraph : PARMETIS is not available. Check your products, please."); + throw INTERP_KERNEL::Exception("ParMETISGraph::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; + std::cout << "proc " << MyGlobals::_Rank << " : ParMETISGraph::partGraph ParMETIS_PartKway new" << std::endl; int * vtxdist=parallelizer->getProcVtxdist(); MPI_Comm comm=MPI_COMM_WORLD; ParMETIS_PartKway(vtxdist, xadj, adjncy, vwgt, diff --git a/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.hxx b/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.hxx new file mode 100644 index 000000000..ffc689d11 --- /dev/null +++ b/src/MEDPartitioner/MEDPARTITIONER_ParMetisGraph.hxx @@ -0,0 +1,39 @@ +// Copyright (C) 2007-2012 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. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef __MEDPARTITIONER_ParMETISGraph_HXX__ +#define __MEDPARTITIONER_ParMETISGraph_HXX__ + +#include "MEDPARTITIONER_Graph.hxx" + +#include + +namespace MEDPARTITIONER +{ + class MEDPARTITIONER_EXPORT ParMETISGraph : public Graph + { + public: + ParMETISGraph(); + ParMETISGraph(MEDPARTITIONER::SkyLineArray*, int *edgeweight=0); + virtual ~ParMETISGraph(); + void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0); + }; +} + +#endif