X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FRENUMBER%2FRenumberingFactory.cxx;h=2da7cde909324327eeecc7c95a356728094397ef;hb=c4551c56aa89896595842e5b41b048044681b4e8;hp=50cb5d14698b7c276860f65692c8528a2fa917e3;hpb=56fddf07c0b7170f79791d38e2b909a8a5b0b872;p=tools%2Fmedcoupling.git diff --git a/src/RENUMBER/RenumberingFactory.cxx b/src/RENUMBER/RenumberingFactory.cxx index 50cb5d146..2da7cde90 100644 --- a/src/RENUMBER/RenumberingFactory.cxx +++ b/src/RENUMBER/RenumberingFactory.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 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 @@ -27,20 +27,27 @@ #endif #include - -using namespace std; +#include namespace MED_RENUMBER { - Renumbering* RenumberingFactory(const string &s) + bool CompareRenumMeth(const std::string& s1, const char *s2) + { + std::string ss1(s1),ss2(s2); + std::transform(ss1.begin(), ss1.end(), ss1.begin(), ::tolower); + std::transform(ss2.begin(), ss2.end(), ss2.begin(), ::tolower); + return ss1==ss2; + } + + Renumbering* RenumberingFactory(const std::string &s) { #ifdef MED_ENABLE_METIS #ifdef ENABLE_BOOST - if (s=="METIS") + if ( CompareRenumMeth(s,METIS_ALG) ) { return new METISRenumbering; } - else if(s=="BOOST") + else if( CompareRenumMeth(s,BOOST_ALG) ) { return new BOOSTRenumbering; } @@ -51,7 +58,7 @@ namespace MED_RENUMBER } #endif #ifndef ENABLE_BOOST - if (s=="METIS") + if ( CompareRenumMeth(s,METIS_ALG) ) { return new METISRenumbering; } @@ -64,7 +71,7 @@ namespace MED_RENUMBER #endif #ifndef MED_ENABLE_METIS #ifdef ENABLE_BOOST - if (s=="BOOST") + if ( CompareRenumMeth(s,BOOST_ALG) ) { return new BOOSTRenumbering; } @@ -80,4 +87,24 @@ namespace MED_RENUMBER #endif #endif } + + std::vector AllRenumberMethods() + { + std::vector ret; + ret.push_back(std::string(BOOST_ALG)); + ret.push_back(std::string(METIS_ALG)); + return ret; + } + + 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; + } }