From: Anthony Geay Date: Tue, 19 Dec 2017 07:20:29 +0000 (+0100) Subject: Start to put some order in all options X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c2c8c27c50d7a5c009451b8bfdad40a968a4e73f;p=tools%2Fmedcoupling.git Start to put some order in all options --- diff --git a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx index 86f8312e0..c1782c85d 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.cxx @@ -41,6 +41,10 @@ #include #include +const char MEDPARTITIONER::MEDPartitioner::METIS_PART_ALG[]="Metis"; +const char MEDPARTITIONER::MEDPartitioner::SCOTCH_PART_ALG[]="Scotch"; +const char MEDPARTITIONER::MEDPartitioner::PTSCOTCH_PART_ALG[]="PTScotch"; + MEDPARTITIONER::MEDPartitioner::MEDPartitioner(const std::string& filename, int ndomains, const std::string& library,bool create_boundary_faces, bool create_joints, bool mesure_memory): _input_collection( 0 ), _output_collection( 0 ), _new_topology( 0 ) { @@ -171,3 +175,18 @@ MEDPARTITIONER::Graph* MEDPARTITIONER::MEDPartitioner::Graph(MEDCoupling::MEDCou } return cellGraph; } + +std::vector MEDPARTITIONER::MEDPartitioner::AvailableAlgorithms() +{ + std::vector ret; +#ifdef MED_ENABLE_METIS + ret.push_back(std::string(METIS_PART_ALG)); +#endif +#ifdef MED_ENABLE_SCOTCH + ret.push_back(std::string(SCOTCH_PART_ALG)); +#endif +#ifdef MED_ENABLE_PTSCOTCH + ret.push_back(std::string(PTSCOTCH_PART_ALG)); +#endif + return ret; +} diff --git a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.hxx b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.hxx index 0ea20435d..93a90cbab 100644 --- a/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.hxx +++ b/src/MEDPartitioner/MEDPARTITIONER_MEDPartitioner.hxx @@ -45,6 +45,7 @@ namespace MEDPARTITIONER MEDPartitioner(const MEDCoupling::MEDFileData* fileData, int ndomains=1, const std::string& library="metis",bool create_boundary_faces=false, bool create_joints=false, bool mesure_memory=false); MEDPartitioner(const MEDCoupling::MEDFileData* fileData, Graph* graph, bool create_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, DataArrayInt* vlbloctab=0); + static std::vector AvailableAlgorithms(); void write(const std::string& filename); MEDCoupling::MEDFileData* getMEDFileData(); ~MEDPartitioner(); @@ -56,6 +57,10 @@ namespace MEDPARTITIONER MeshCollection* _input_collection; MeshCollection* _output_collection; Topology* _new_topology; + public: + static const char METIS_PART_ALG[]; + static const char SCOTCH_PART_ALG[]; + static const char PTSCOTCH_PART_ALG[]; }; } #endif diff --git a/src/MEDPartitioner_Swig/MEDPartitionerCommon.i b/src/MEDPartitioner_Swig/MEDPartitionerCommon.i index e67c75f89..7363c4dfb 100644 --- a/src/MEDPartitioner_Swig/MEDPartitionerCommon.i +++ b/src/MEDPartitioner_Swig/MEDPartitionerCommon.i @@ -25,6 +25,8 @@ using namespace MEDPARTITIONER; %} + + %newobject MEDPARTITIONER::MEDPartitioner::New; %newobject MEDPARTITIONER::MEDPartitioner::Graph; %newobject MEDPARTITIONER::MEDPartitioner::Graph::getGraph; @@ -63,6 +65,7 @@ namespace MEDPARTITIONER MEDPartitioner(const MEDCoupling::MEDFileData* fileData, int ndomains=1, const std::string& library="metis",bool create_boundary_faces=false, bool create_joints=false, bool mesure_memory=false) throw(INTERP_KERNEL::Exception); MEDPartitioner(const MEDCoupling::MEDFileData* fileData, Graph* graph, bool create_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, MEDCoupling::DataArrayInt* vlbloctab=0) throw(INTERP_KERNEL::Exception); + static std::vector AvailableAlgorithms(); MEDCoupling::MEDFileData* getMEDFileData() throw(INTERP_KERNEL::Exception); void write(const std::string& filename) throw(INTERP_KERNEL::Exception); }; diff --git a/src/PyWrapping/CMakeLists.txt b/src/PyWrapping/CMakeLists.txt index 3f041c0b7..059edbbcb 100644 --- a/src/PyWrapping/CMakeLists.txt +++ b/src/PyWrapping/CMakeLists.txt @@ -65,15 +65,6 @@ ENDIF(NOT MEDCOUPLING_MICROMED) IF(MEDCOUPLING_ENABLE_RENUMBER) LIST(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS -DWITH_RENUMBER) LIST(APPEND medcoupling_LIB_dependancies renumbercpp) - - IF(Boost_FOUND) - LIST(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS -DHAS_BOOST) - ENDIF(Boost_FOUND) - - IF(METIS_FOUND) - LIST(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS -DHAS_METIS) - ENDIF(METIS_FOUND) - ENDIF(MEDCOUPLING_ENABLE_RENUMBER) IF(MEDCOUPLING_ENABLE_PARTITIONER) diff --git a/src/PyWrapping/medcoupling.i b/src/PyWrapping/medcoupling.i index bce7790ca..79395956f 100644 --- a/src/PyWrapping/medcoupling.i +++ b/src/PyWrapping/medcoupling.i @@ -40,6 +40,37 @@ %include "MEDPartitionerCommon.i" #endif + +%{ + static const char SEQ_INTERPOL_EXT[]="Sequential interpolator"; + static const char MEDFILEIO_EXT[]="MED file I/O"; + static const char RENUM_EXT[]="Renumbering"; + static const char PART_EXT[]="Partitioner"; + static const char PAR_INTERPOL_EXT[]="Parallel interpolator"; + + static const char *EXTENSIONS[]={SEQ_INTERPOL_EXT,MEDFILEIO_EXT,RENUM_EXT,PART_EXT,PAR_INTERPOL_EXT}; + static const int NB_OF_EXTENSIONS=sizeof(EXTENSIONS)/sizeof(const char *); +%} + +%inline +{ + std::vector Extensions() + { + std::vector ret; + ret.push_back(std::string(SEQ_INTERPOL_EXT)); +#ifdef WITH_MED_FILE + ret.push_back(std::string(MEDFILEIO_EXT)); +#endif +#ifdef WITH_RENUMBER + ret.push_back(std::string(RENUM_EXT)); +#endif +#ifdef WITH_PARTITIONER + ret.push_back(std::string(PART_EXT)); +#endif + return ret; + } +} + %pythoncode %{ def MEDCouplingDataArrayDoubleIadd(self,*args): import _medcoupling diff --git a/src/RENUMBER/RenumberingFactory.cxx b/src/RENUMBER/RenumberingFactory.cxx index 93b5ad3e6..9bef7b9ba 100644 --- a/src/RENUMBER/RenumberingFactory.cxx +++ b/src/RENUMBER/RenumberingFactory.cxx @@ -31,16 +31,16 @@ using namespace std; namespace MED_RENUMBER -{ +{ Renumbering* RenumberingFactory(const string &s) { #ifdef MED_ENABLE_METIS #ifdef ENABLE_BOOST - if (s=="METIS") + if (s==METIS_ALG) { return new METISRenumbering; } - else if(s=="BOOST") + else if(s==BOOST_ALG) { return new BOOSTRenumbering; } @@ -51,7 +51,7 @@ namespace MED_RENUMBER } #endif #ifndef ENABLE_BOOST - if (s=="METIS") + if (s==METIS_ALG) { return new METISRenumbering; } @@ -64,7 +64,7 @@ namespace MED_RENUMBER #endif #ifndef MED_ENABLE_METIS #ifdef ENABLE_BOOST - if (s=="BOOST") + if (s==BOOST_ALG) { return new BOOSTRenumbering; } @@ -80,4 +80,16 @@ namespace MED_RENUMBER #endif #endif } + + std::vector RenumberAvailableMethods() + { + std::vector ret; +#ifdef ENABLE_BOOST + ret.push_back(std::string(BOOST_ALG)); +#endif +#ifdef MED_ENABLE_METIS + ret.push_back(std::string(METIS_ALG)); +#endif + return ret; + } } diff --git a/src/RENUMBER/RenumberingFactory.hxx b/src/RENUMBER/RenumberingFactory.hxx index 90cfe9ee0..a54d52068 100644 --- a/src/RENUMBER/RenumberingFactory.hxx +++ b/src/RENUMBER/RenumberingFactory.hxx @@ -28,6 +28,9 @@ namespace MED_RENUMBER { RENUMBER_EXPORT Renumbering* RenumberingFactory(const std::string& s); + RENUMBER_EXPORT std::vector RenumberAvailableMethods(); + const char METIS_ALG[]="METIS"; + const char BOOST_ALG[]="BOOST"; } #endif /*RENUMBERINGFACTORY_HXX_*/ diff --git a/src/RENUMBER_Swig/CMakeLists.txt b/src/RENUMBER_Swig/CMakeLists.txt index b1b9a0ebe..0ec67e031 100644 --- a/src/RENUMBER_Swig/CMakeLists.txt +++ b/src/RENUMBER_Swig/CMakeLists.txt @@ -29,14 +29,6 @@ ELSE() ENDIF() SET(SWIG_MODULE_MEDRenumber_EXTRA_FLAGS "${NUMPY_DEFINITIONS};${SCIPY_DEFINITIONS};-DWITHOUT_AUTOFIELD") -IF(Boost_FOUND) - SET(SWIG_MODULE_MEDRenumber_EXTRA_FLAGS -DHAS_BOOST ${SWIG_MODULE_MEDRenumber_EXTRA_FLAGS}) -ENDIF(Boost_FOUND) - -IF(METIS_FOUND) - SET(SWIG_MODULE_MEDRenumber_EXTRA_FLAGS -DHAS_METIS ${SWIG_MODULE_MEDRenumber_EXTRA_FLAGS}) -ENDIF(METIS_FOUND) - SET (MEDRenumber_SWIG_DPYS_FILES MEDRenumberCommon.i MEDRenumberImpl.i) diff --git a/src/RENUMBER_Swig/MEDRenumberImpl.i b/src/RENUMBER_Swig/MEDRenumberImpl.i index 270891760..4aabc832b 100644 --- a/src/RENUMBER_Swig/MEDRenumberImpl.i +++ b/src/RENUMBER_Swig/MEDRenumberImpl.i @@ -52,19 +52,5 @@ public: namespace MED_RENUMBER { Renumbering *RenumberingFactory(const std::string& s) throw(INTERP_KERNEL::Exception); -} - -%inline -{ - std::vector RenumberAvailableMethods()throw(INTERP_KERNEL::Exception) - { - std::vector ret; -#ifdef HAS_BOOST - ret.push_back(std::string("BOOST")); -#endif -#ifdef HAS_METIS - ret.push_back(std::string("METIS")); -#endif - return ret; - } + std::vector RenumberAvailableMethods(); }