Skip to content
Snippets Groups Projects
Commit ba0f24fa authored by Markus Blatt's avatar Markus Blatt
Browse files

[bugfix] Fixes usage of scotch (parmetis/metis)

There were problems with repartition.hh when using the original parmetis. The cause was
that for scotch we need to require both parmetis.h and metis.h, which broke backwards
compatibility for the original parmetis (which worked without metis, too). With the patch
we check whether parmetis.h is from scotch and if that is the case also require metis. If not,
metis suffices.
parent f5c31982
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,9 @@
#if HAVE_PARMETIS
#include <parmetis.h>
#endif
#if HAVE_METIS
#if defined(METISNAMEL) && HAVE_METIS
// METISNAMEL is defined when scotch is used and according to christian
// we have to include the metis header in this case.
#include <metis.h>
#endif
......@@ -755,7 +757,7 @@ namespace Dune
Dune::OwnerOverlapCopyCommunication<T1,T2>*& outcomm,
RedistributeInterface& redistInf,
bool verbose=false);
#if HAVE_PARMETIS && HAVE_METIS
#if HAVE_PARMETIS && (!defined(METISNAMEL) || HAVE_METIS)
extern "C" {
// backwards compatibility to parmetis < 4.0.0
#if PARMETIS_MAJOR_VERSION > 3
......@@ -833,7 +835,7 @@ namespace Dune
<<" to "<<nparts<<" parts"<<std::endl;
Timer time;
int rank = oocomm.communicator().rank();
#if !HAVE_PARMETIS
#if !HAVE_PARMETIS || (defined(METISNAMEL) && !HAVE_METIS)
int* part = new int[1];
part[0]=0;
#else
......@@ -1274,7 +1276,7 @@ namespace Dune
// Global communications are necessary
// The parmetis global identifiers for the owner vertices.
ParmetisDuneIndexMap indexMap(graph,oocomm);
#if HAVE_PARMETIS
#if HAVE_PARMETIS && (!defined(METISNAMEL) || HAVE_METIS)
idxtype *part = new idxtype[indexMap.numOfOwnVtx()];
#else
std::size_t *part = new std::size_t[indexMap.numOfOwnVtx()];
......@@ -1282,7 +1284,7 @@ namespace Dune
for(std::size_t i=0; i < indexMap.numOfOwnVtx(); ++i)
part[i]=mype;
#if !HAVE_PARMETIS
#if !HAVE_PARMETIS || (defined(METISNAMEL) && !HAVE_METIS)
if(oocomm.communicator().rank()==0 && nparts>1)
std::cerr<<"ParMETIS not activated. Will repartition to 1 domain instead of requested "
<<nparts<<" domains."<<std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment