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

[bugfix] Fix macros for the case that HAVE_METIS is not defined.

For HAVE_METIS we do not use the ENABLE trick. It is therefore either defined or
not. Therfore using "#if HAVE_METIS" is a bug. This patch fixes this.
parent 4c68085c
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@
#if HAVE_PARMETIS
#include <parmetis.h>
#endif
#if defined(METISNAMEL) && HAVE_METIS
#if defined(METISNAMEL) && defined(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>
......@@ -757,12 +757,18 @@ namespace Dune
Dune::OwnerOverlapCopyCommunication<T1,T2>*& outcomm,
RedistributeInterface& redistInf,
bool verbose=false);
#if HAVE_PARMETIS && (!defined(METISNAMEL) || HAVE_METIS)
extern "C" {
// backwards compatibility to parmetis < 4.0.0
#if HAVE_PARMETIS
#if PARMETIS_MAJOR_VERSION > 3
typedef idx_t idxtype;
#elif defined(METISNAMEL)
typedef int idxtype;
#else
typedef std::size_t idxtype;
#endif
#if !defined(METISNAMEL) || !defined(HAVE_METIS)
extern "C"
{
// backwards compatibility to parmetis < 4.0.0
void METIS_PartGraphKway(int *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt,
idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts,
int *options, int *edgecut, idxtype *part);
......@@ -771,8 +777,7 @@ namespace Dune
idxtype *adjwgt, int *wgtflag, int *numflag, int *nparts,
int *options, int *edgecut, idxtype *part);
}
#else
typedef std::size_t idxtype;
#endif
#endif
template<class S, class T>
......@@ -835,7 +840,7 @@ namespace Dune
<<" to "<<nparts<<" parts"<<std::endl;
Timer time;
int rank = oocomm.communicator().rank();
#if !HAVE_PARMETIS || (defined(METISNAMEL) && !HAVE_METIS)
#if !HAVE_PARMETIS || (defined(METISNAMEL) && !defined(HAVE_METIS))
int* part = new int[1];
part[0]=0;
#else
......@@ -1276,7 +1281,7 @@ namespace Dune
// Global communications are necessary
// The parmetis global identifiers for the owner vertices.
ParmetisDuneIndexMap indexMap(graph,oocomm);
#if HAVE_PARMETIS && (!defined(METISNAMEL) || HAVE_METIS)
#if HAVE_PARMETIS && (!defined(METISNAMEL) || defined(HAVE_METIS))
idxtype *part = new idxtype[indexMap.numOfOwnVtx()];
#else
std::size_t *part = new std::size_t[indexMap.numOfOwnVtx()];
......@@ -1284,7 +1289,7 @@ namespace Dune
for(std::size_t i=0; i < indexMap.numOfOwnVtx(); ++i)
part[i]=mype;
#if !HAVE_PARMETIS || (defined(METISNAMEL) && !HAVE_METIS)
#if !HAVE_PARMETIS || (defined(METISNAMEL) && !defined(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