1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "RenumberingFactory.hxx"
21 #include "RENUMBER_Renumbering.hxx"
22 #ifdef MED_ENABLE_METIS
23 #include "RENUMBER_METISRenumbering.hxx"
26 #include "RENUMBER_BOOSTRenumbering.hxx"
32 namespace MED_RENUMBER
34 bool CompareRenumMeth(const std::string& s1, const char *s2)
36 std::string ss1(s1),ss2(s2);
37 std::transform(ss1.begin(), ss1.end(), ss1.begin(), ::tolower);
38 std::transform(ss2.begin(), ss2.end(), ss2.begin(), ::tolower);
42 Renumbering* RenumberingFactory(const std::string &s)
44 #ifdef MED_ENABLE_METIS
46 if ( CompareRenumMeth(s,METIS_ALG) )
48 return new METISRenumbering;
50 else if( CompareRenumMeth(s,BOOST_ALG) )
52 return new BOOSTRenumbering;
56 std::cerr << "The method has to be METIS or BOOST" << std::endl;
61 if ( CompareRenumMeth(s,METIS_ALG) )
63 return new METISRenumbering;
67 std::cerr << "The method has to be METIS!" << std::endl;
72 #ifndef MED_ENABLE_METIS
74 if ( CompareRenumMeth(s,BOOST_ALG) )
76 return new BOOSTRenumbering;
80 std::cerr << "The method has to be BOOST!" << std::endl;
85 std::cerr << "Error, no method compiled" << std::endl;
91 std::vector<std::string> AllRenumberMethods()
93 std::vector<std::string> ret;
94 ret.push_back(std::string(BOOST_ALG));
95 ret.push_back(std::string(METIS_ALG));
99 std::vector<std::string> RenumberAvailableMethods()
101 std::vector<std::string> ret;
103 ret.push_back(std::string(BOOST_ALG));
105 #ifdef MED_ENABLE_METIS
106 ret.push_back(std::string(METIS_ALG));