-// Copyright (C) 2007-2014 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
#endif
#include <iostream>
-
-using namespace std;
+#include <algorithm>
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;
}
}
#endif
#ifndef ENABLE_BOOST
- if (s=="METIS")
+ if ( CompareRenumMeth(s,METIS_ALG) )
{
return new METISRenumbering;
}
#endif
#ifndef MED_ENABLE_METIS
#ifdef ENABLE_BOOST
- if (s=="BOOST")
+ if ( CompareRenumMeth(s,BOOST_ALG) )
{
return new BOOSTRenumbering;
}
#endif
#endif
}
+
+ std::vector<std::string> AllRenumberMethods()
+ {
+ std::vector<std::string> ret;
+ ret.push_back(std::string(BOOST_ALG));
+ ret.push_back(std::string(METIS_ALG));
+ return ret;
+ }
+
+ std::vector<std::string> RenumberAvailableMethods()
+ {
+ std::vector<std::string> 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;
+ }
}