SALOME_LOG_OPTIONAL_PACKAGE(CppUnit SALOME_BUILD_TESTS)
ENDIF(MEDCOUPLING_BUILD_TESTS)
+FIND_PACKAGE(SalomeMPI REQUIRED)
+ADD_DEFINITIONS("-DHAVE_MPI")
+
IF(MEDCOUPLING_USE_MPI)
FIND_PACKAGE(SalomeMPI REQUIRED)
ADD_DEFINITIONS("-DHAVE_MPI")
INCLUDE_DIRECTORIES(${PARMETIS_INCLUDE_DIRS})
ENDIF(MEDCOUPLING_PARTITIONER_PARMETIS)
+ADD_DEFINITIONS(${MPI_DEFINITIONS})
+INCLUDE_DIRECTORIES(${MPI_INCLUDE_DIRS})
+
IF(MEDCOUPLING_USE_MPI)
ADD_DEFINITIONS(${MPI_DEFINITIONS})
INCLUDE_DIRECTORIES(${MPI_INCLUDE_DIRS})
SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${SCOTCH_LIBRARIES})
ENDIF(MEDCOUPLING_PARTITIONER_SCOTCH)
+SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_UtilsPara.cxx MEDPARTITIONER_JointFinder.cxx)
+SET(medpartitionercpp_LDFLAGS ${medpartitionercpp_LDFLAGS} ${MPI_LIBRARIES})
+
+
IF(${MEDCOUPLING_USE_MPI})
SET(medpartitionercpp_SOURCES ${medpartitionercpp_SOURCES} MEDPARTITIONER_UtilsPara.cxx MEDPARTITIONER_JointFinder.cxx)
ADD_EXECUTABLE(medpartitioner_para medpartitioner_para.cxx)
#ifndef __MEDPARTITIONER_GRAPH_HXX__
#define __MEDPARTITIONER_GRAPH_HXX__
+#include "MEDCouplingMemArray.hxx"
#include "MEDPARTITIONER.hxx"
#include "MCAuto.hxx"
return _output_collection->retrieveDriver()->getMEDFileData();
}
-MEDPARTITIONER::Graph* MEDPARTITIONER::MEDPartitioner::Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split, int* edgeweight)
+MEDPARTITIONER::Graph* MEDPARTITIONER::MEDPartitioner::Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split, int* edgeweight, DataArrayInt* vlbloctab)
{
MEDPARTITIONER::Graph* cellGraph=0;
// will be destroyed by XXXGraph class:
break;
case Graph::SCOTCH:
#ifdef MED_ENABLE_SCOTCH
- cellGraph=new SCOTCHGraph(arr,edgeweight);
+ cellGraph=new SCOTCHGraph(arr,edgeweight,vlbloctab);
#else
throw INTERP_KERNEL::Exception("MEDPartitioner::Graph : SCOTCH is not available. Check your products, please.");
#endif
MEDPartitioner(const std::string& filename, int ndomains=1, const std::string& library="metis",bool creates_boundary_faces=false, bool create_joints=false, bool mesure_memory=false);
MEDPartitioner(const MEDCoupling::MEDFileData* fileData, int ndomains=1, const std::string& library="metis",bool creates_boundary_faces=false, bool create_joints=false, bool mesure_memory=false);
MEDPartitioner(const MEDCoupling::MEDFileData* fileData, Graph* graph, bool creates_boundary_faces=false, bool create_joints=false, bool mesure_memory=false);
- static MEDPARTITIONER::Graph* Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split=Graph::METIS, int* edgeweight=0);
+ static MEDPARTITIONER::Graph* Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split=Graph::METIS, int* edgeweight=0, DataArrayInt* vlbloctab=0);
void write(const std::string& filename);
MEDCoupling::MEDFileData* getMEDFileData();
~MEDPartitioner();
#include "MEDCouplingSkyLineArray.hxx"
#include <cstdio>
+#include <mpi.h>
#ifdef MED_ENABLE_SCOTCH
extern "C"
{
#define restrict
-#include "scotch.h"
+#include "ptscotch.h"
}
#endif
{
}
-SCOTCHGraph::SCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray* graph, int* edgeweight):Graph(graph,edgeweight)
+SCOTCHGraph::SCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray* graph, int* edgeweight, DataArrayInt* vlbloctab):Graph(graph,edgeweight), _vlbloctab(vlbloctab)
{
}
//output parameters
int* partition = new int[n+1];
- SCOTCH_Graph scotch_graph;
- SCOTCH_graphInit(&scotch_graph);
- SCOTCH_graphBuild(&scotch_graph,
- 0, //base first indice 0
- n, //nb of graph nodes
- xadj,
- 0,
- _cell_weight, //graph vertices loads
- 0,
- xadj[n], //number of edges
- adjncy,
- _edge_weight);
+ int* vlbloctab = _vlbloctab?const_cast<int*>(_vlbloctab->begin()):0;
+
+ SCOTCH_Dgraph scotch_graph;
+ SCOTCH_dgraphInit(&scotch_graph, MPI_COMM_WORLD);
+ SCOTCH_dgraphBuild(&scotch_graph,
+ 0, // baseval , base first indice 0
+ n, // vertlocnbr , nb of local graph nodes
+ n, // vertlocmax , should be set to vertlocnbr for graphs without holes
+ xadj, // vertloctab[vertnbr+1] , index vertex table
+ 0, // vendloctab , index end vertex table if disjoint, set to zero
+ _cell_weight, // veloloctab , graph vertices loads, set to zero
+ vlbloctab, // vlblocltab , vertex label array : global vertex index
+ xadj[n], // edgelocnbr , number of edges
+ xadj[n], // edgelocsiz , same as edgelocnbr if edgeloctab is compact
+ adjncy, // edgeloctab[edgelocnbr], global indexes of edges
+ 0, // edgegsttab , optionnal, should be computed internally, set to zero
+ _edge_weight); // edloloctab , graph edges loads, set to zero
+
SCOTCH_Strat scotch_strategy;
SCOTCH_stratInit(&scotch_strategy);
if (nparts>1)
{
if (MyGlobals::_Verbose>10) std::cout << "SCOTCHGraph::graphPart SCOTCH_graphPart" << std::endl;
- SCOTCH_graphPart(&scotch_graph,nparts,&scotch_strategy,partition);
+ SCOTCH_dgraphPart(&scotch_graph,nparts,&scotch_strategy,partition);
}
else //partition for 1 subdomain
{
}
SCOTCH_stratExit(&scotch_strategy);
- SCOTCH_graphExit(&scotch_graph);
+ SCOTCH_dgraphExit(&scotch_graph);
std::vector<int> index(n+1);
std::vector<int> value(n);
{
public:
SCOTCHGraph();
- SCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray*, int* edgeweight=0);
+ SCOTCHGraph(MEDCoupling::MEDCouplingSkyLineArray*, int* edgeweight=0, DataArrayInt* vlbloctab=0);
virtual ~SCOTCHGraph();
void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector* sel=0);
+ protected:
+ DataArrayInt* _vlbloctab;
};
}
MEDPartitioner(const std::string& filename, int ndomains=1, const std::string& library="metis",bool creates_boundary_faces=false, bool create_joints=false, bool mesure_memory=false) throw(INTERP_KERNEL::Exception);
MEDPartitioner(const MEDCoupling::MEDFileData* fileData, int ndomains=1, const std::string& library="metis",bool creates_boundary_faces=false, bool create_joints=false, bool mesure_memory=false) throw(INTERP_KERNEL::Exception);
MEDPartitioner(const MEDCoupling::MEDFileData* fileData, Graph* graph, bool creates_boundary_faces=false, bool create_joints=false, bool mesure_memory=false) throw(INTERP_KERNEL::Exception);
- static MEDPARTITIONER::Graph* Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split=Graph::METIS, int* edgeweight=0) throw(INTERP_KERNEL::Exception);
+ static MEDPARTITIONER::Graph* Graph(MEDCoupling::MEDCouplingSkyLineArray* graph, Graph::splitter_type split=Graph::METIS, int* edgeweight=0, MEDCoupling::DataArrayInt* vlbloctab=0) throw(INTERP_KERNEL::Exception);
MEDCoupling::MEDFileData* getMEDFileData() throw(INTERP_KERNEL::Exception);
void write(const std::string& filename) throw(INTERP_KERNEL::Exception);
};