From: ageay Date: Tue, 13 Mar 2012 11:31:11 +0000 (+0000) Subject: Preparation to compilation. X-Git-Tag: V6_main_FINAL~800 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7c1686252c2794554a2d3f4352255fd1c97b8c1d;p=tools%2Fmedcoupling.git Preparation to compilation. --- diff --git a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx index 5a09f7997..7516941a5 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MeshCollection.cxx @@ -40,10 +40,10 @@ #include #endif -#ifdef ENABLE_METIS +#ifdef MED_ENABLE_PARMETIS #include "MEDPARTITIONER_MetisGraph.hxx" #endif -#ifdef ENABLE_SCOTCH +#ifdef MED_ENABLE_SCOTCH #include "MEDPARTITIONER_ScotchGraph.hxx" #endif @@ -1443,7 +1443,7 @@ Topology* MeshCollection::createPartition(int nbdomain, //cvwat06 switch (split) { case Graph::METIS: -#ifdef ENABLE_METIS +#ifdef MED_ENABLE_PARMETIS if (MyGlobals::_Verbose>10) cout<<"METISGraph"<10) cout<<"SCOTCHGraph"< -#ifdef ENABLE_PARMETIS -#include +#ifdef MED_ENABLE_PARMETIS +#include +#include "parmetis.h" #endif -extern "C" { -#include + +#ifdef MED_ENABLE_METIS +extern "C" +{ +#include "metis.h" } +#endif -using namespace std; using namespace ParaMEDMEM; using namespace MEDPARTITIONER; @@ -51,12 +55,13 @@ METISGraph::~METISGraph() void METISGraph::partGraph(int ndomain, const std::string& options_string, - ParaDomainSelector* parallelizer) + ParaDomainSelector *parallelizer) { using std::vector; vector ran,vx,va; //for randomize - if (MyGlobals::_Verbose>10) cout<<"proc "<10) + std::cout << "proc " << MyGlobals::_Rank << " : METISGraph::partGraph" << std::endl; // number of graph vertices int n=_graph->getNumberOf(); @@ -85,57 +90,46 @@ void METISGraph::partGraph(int ndomain, int edgecut; int* partition=new int[n]; - //if (MyGlobals::_Verbose>10) cout<<"proc "<getProcVtxdist(); MPI_Comm comm=MPI_COMM_WORLD; try { if (MyGlobals::_Verbose>200) { - cout<<"proc "<0) { - cout<<"\nproc "<1000) - { - cout<<"\n -cell "<imaxx) imaxx=ilg; + if(ilg>imaxx) + imaxx=ilg; } - cout<<"\nproc "<10) - cout<<"proc "< index(n+1); @@ -210,7 +207,8 @@ void METISGraph::partGraph(int ndomain, index[0]=0; if (ran.size()>0 && MyGlobals::_Atomize==0) //there is randomize { - if (MyGlobals::_Is0verbose>100) cout<<"randomize"<100) + std::cout << "randomize" << std::endl; for (int i=0; i -namespace MEDPARTITIONER { - class SkyLineArray; +namespace MEDPARTITIONER +{ class MEDPARTITIONER_EXPORT METISGraph : public Graph { public: METISGraph(); - METISGraph(MEDPARTITIONER::SkyLineArray*, int* edgeweight=0); + METISGraph(MEDPARTITIONER::SkyLineArray*, int *edgeweight=0); virtual ~METISGraph(); - void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector* sel=0); + void partGraph(int ndomain, const std::string& options_string="", ParaDomainSelector *sel=0); }; } + #endif diff --git a/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx b/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx index be737cee7..b8f0a443c 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_ScotchGraph.cxx @@ -22,10 +22,13 @@ #include -extern "C" { +#ifdef MED_ENABLE_SCOTCH +extern "C" +{ #define restrict #include "scotch.h" } +#endif using namespace MEDPARTITIONER; @@ -43,6 +46,7 @@ SCOTCHGraph::~SCOTCHGraph() void SCOTCHGraph::partGraph(int ndomain, const std::string& options_string, ParaDomainSelector* sel) { +#ifdef MED_ENABLE_SCOTCH // number of graph vertices int n = _graph->getNumberOf(); @@ -104,5 +108,7 @@ void SCOTCHGraph::partGraph(int ndomain, const std::string& options_string, Para //to the object _partition = new MEDPARTITIONER::SkyLineArray(index,value); - +#else + throw INTERP_KERNEL::Exception(LOCALIZED("SCOTCH is not available. Check your products, please.")); +#endif } diff --git a/src/MEDPartitioner/Makefile.am b/src/MEDPartitioner/Makefile.am index 34256d2a8..7818a908f 100644 --- a/src/MEDPartitioner/Makefile.am +++ b/src/MEDPartitioner/Makefile.am @@ -42,74 +42,67 @@ MEDPARTITIONER_ParaDomainSelector.hxx \ MEDPARTITIONER_ConnectZone.hxx \ MEDPARTITIONER_SkyLineArray.hxx +if MED_ENABLE_PARMETIS + salomeinclude_HEADERS += MEDPARTITIONER_MetisGraph.hxx +endif if MED_ENABLE_METIS - salomeinclude_HEADERS+= MEDPARTITIONER_MetisGraph.hxx + salomeinclude_HEADERS += MEDPARTITIONER_MetisGraph.hxx endif if MED_ENABLE_SCOTCH - salomeinclude_HEADERS+= MEDPARTITIONER_ScotchGraph.hxx + salomeinclude_HEADERS += MEDPARTITIONER_ScotchGraph.hxx endif -dist_libmedpartitioner_la_SOURCES= \ -MEDPARTITIONER_Utils.cxx \ +dist_libmedpartitioner_la_SOURCES = \ MEDPARTITIONER_MeshCollection.cxx \ MEDPARTITIONER_MeshCollectionDriver.cxx \ MEDPARTITIONER_MeshCollectionMedXmlDriver.cxx \ MEDPARTITIONER_MeshCollectionMedAsciiDriver.cxx \ -MEDPARTITIONER_ParallelTopology.cxx \ MEDPARTITIONER_Graph.cxx\ MEDPARTITIONER_UserGraph.cxx\ -MEDPARTITIONER_ParaDomainSelector.cxx \ MEDPARTITIONER_JointFinder.cxx \ MEDPARTITIONER_SkyLineArray.cxx \ MEDPARTITIONER_ConnectZone.cxx -if MED_ENABLE_METIS - dist_libmedpartitioner_la_SOURCES+= MEDPARTITIONER_MetisGraph.cxx -endif -if MED_ENABLE_SCOTCH - dist_libmedpartitioner_la_SOURCES+= MEDPARTITIONER_ScotchGraph.cxx -endif - -libmedpartitioner_la_CPPFLAGS= $(MPI_INCLUDES) $(MED3_INCLUDES) $(HDF5_INCLUDES) @CXXTMPDPTHFLAGS@ \ - $(BOOST_CPPFLAGS) $(LIBXML_INCLUDES) \ - -I$(srcdir)/../INTERP_KERNEL/Bases -I$(srcdir)/../MEDCoupling \ - -I$(srcdir)/../MEDLoader -I$(srcdir)/../INTERP_KERNEL +libmedpartitioner_la_CPPFLAGS = $(MPI_INCLUDES) $(MED3_INCLUDES) $(HDF5_INCLUDES) \ + $(LIBXML_INCLUDES) -I$(srcdir)/../INTERP_KERNEL/Bases -I$(srcdir)/../MEDCoupling \ + -I$(srcdir)/../MEDLoader -I$(srcdir)/../INTERP_KERNEL -libmedpartitioner_la_LDFLAGS= +libmedpartitioner_la_LDFLAGS = -if MED_ENABLE_PARMETIS - libmedpartitioner_la_CPPFLAGS+= $(PARMETIS_CPPFLAGS) - libmedpartitioner_la_LDFLAGS+= $(PARMETIS_LIBS) -endif -if MED_ENABLE_METIS - libmedpartitioner_la_CPPFLAGS+= $(METIS_CPPFLAGS) - libmedpartitioner_la_LDFLAGS+= $(METIS_LIBS) +if MPI_IS_OK + dist_libmedpartitioner_la_SOURCES += MEDPARTITIONER_ParaDomainSelector.cxx \ + MEDPARTITIONER_Utils.cxx \ + MEDPARTITIONER_ParallelTopology.cxx \ + MEDPARTITIONER_ParaDomainSelector.cxx + + if MED_ENABLE_PARMETIS + dist_libmedpartitioner_la_SOURCES += MEDPARTITIONER_MetisGraph.cxx + libmedpartitioner_la_CPPFLAGS += $(PARMETIS_CPPFLAGS) + libmedpartitioner_la_LDFLAGS += $(PARMETIS_LIBS) + endif +else !MPI_IS_OK + if MED_ENABLE_METIS + dist_libmedpartitioner_la_SOURCES += MEDPARTITIONER_MetisGraph.cxx + libmedpartitioner_la_CPPFLAGS += $(METIS_CPPFLAGS) + libmedpartitioner_la_LDFLAGS += $(METIS_LIBS) + endif endif + if MED_ENABLE_SCOTCH - libmedpartitioner_la_CPPFLAGS+= $(SCOTCH_CPPFLAGS) - libmedpartitioner_la_LDFLAGS+= $(SCOTCH_LIBS) + dist_libmedpartitioner_la_SOURCES += MEDPARTITIONER_ScotchGraph.cxx + libmedpartitioner_la_CPPFLAGS += $(SCOTCH_CPPFLAGS) + libmedpartitioner_la_LDFLAGS += $(SCOTCH_LIBS) endif -if MED_ENABLE_KERNEL - libmedpartitioner_la_CPPFLAGS+= ${KERNEL_CXXFLAGS} - libmedpartitioner_la_LDFLAGS+= ${KERNEL_LDFLAGS} -lSALOMELocalTrace -endif - -libmedpartitioner_la_LDFLAGS+= $(MED2_LIBS) $(HDF5_LIBS) $(STDLIB) $(LIBXML_LIBS) $(MPI_LIBS) \ - ../INTERP_KERNEL/libinterpkernel.la ../MEDCoupling/libmedcoupling.la ../MEDLoader/libmedloader.la -medpartitioner_CPPFLAGS= $(libmedpartitioner_la_CPPFLAGS) -medpartitioner_LDADD= $(libmedpartitioner_la_LDFLAGS) -lm $(BOOST_LIBS) libmedpartitioner.la - -if MED_ENABLE_KERNEL - medpartitioner_LDADD+= -lSALOMEBasics -endif +libmedpartitioner_la_LDFLAGS += $(MED3_LIBS_C_ONLY) $(HDF5_LIBS) $(STDLIB) $(LIBXML_LIBS) $(MPI_LIBS) \ + ../INTERP_KERNEL/libinterpkernel.la ../MEDCoupling/libmedcoupling.la ../MEDLoader/libmedloader.la # Executables targets if MPI_IS_OK - bin_PROGRAMS= medpartitioner_para - dist_medpartitioner_para_SOURCES= medpartitioner_para.cxx - medpartitioner_para_CPPFLAGS= $(medpartitioner_CPPFLAGS) - medpartitioner_para_LDADD= $(medpartitioner_LDADD) + bin_PROGRAMS = medpartitioner_para + dist_medpartitioner_para_SOURCES = medpartitioner_para.cxx + medpartitioner_para_CPPFLAGS = $(MPI_INCLUDES) $(PARMETIS_CPPFLAGS) $(SCOTCH_CPPFLAGS) + medpartitioner_para_LDADD = libmedpartitioner.la endif OBSOLETE_FILES = diff --git a/src/MEDPartitioner/medpartitioner_para.cxx b/src/MEDPartitioner/medpartitioner_para.cxx index beacdca9a..6e3124560 100644 --- a/src/MEDPartitioner/medpartitioner_para.cxx +++ b/src/MEDPartitioner/medpartitioner_para.cxx @@ -61,8 +61,8 @@ using namespace MEDPARTITIONER; int main(int argc, char** argv) { -#ifndef ENABLE_PARMETIS -#ifndef ENABLE_PTSCOTCH +#ifndef MED_ENABLE_PARMETIS +#ifndef MED_ENABLE_SCOTCH cout << "Sorry, no one split method is available. Please, compile with ParMETIS or PT-SCOTCH."< : name of the input .med file or .xml master file\n" "\t--output-file= : name of the resulting file (without exension)\n" "\t--ndomains= : number of subdomains in the output file, default is 1\n" -#ifdef ENABLE_PARMETIS -#ifdef ENABLE_PTSCOTCH +#ifdef MED_MED_ENABLE_PARMETIS +#ifdef MED_MED_ENABLE_SCOTCH "\t--split-method= : name of the splitting library (metis/scotch), default is metis\n" #endif #endif @@ -148,8 +148,8 @@ int main(int argc, char** argv) MyGlobals::_Randomize=0; } -#ifdef ENABLE_PARMETIS -#ifndef ENABLE_PTSCOTCH +#ifdef MED_ENABLE_PARMETIS +#ifndef MED_ENABLE_SCOTCH library = "metis"; #endif #else