From a32c04394493b8136a25419152cf70c015087fa0 Mon Sep 17 00:00:00 2001 From: mark <mark@opencfd> Date: Tue, 13 Sep 2016 08:51:03 +0200 Subject: [PATCH] BUG: metisDecomp compile failure for WM_DP (closes #232) - spurious use of floatScalar instead of scalar for processor weights. STYLE: partially updated dummy metis.h to reflect metis-5.1.0 API --- src/dummyThirdParty/metisDecomp/metis.h | 59 +++++++++++-------- .../decompose/metisDecomp/metisDecomp.C | 2 +- 2 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/dummyThirdParty/metisDecomp/metis.h b/src/dummyThirdParty/metisDecomp/metis.h index 7b6ca31fc62..b594fc09b1d 100644 --- a/src/dummyThirdParty/metisDecomp/metis.h +++ b/src/dummyThirdParty/metisDecomp/metis.h @@ -1,5 +1,5 @@ #ifndef METIS_H -#define METIS_H 1 +#define METIS_H /* *** DUMMY VERSION of metis.h - this file should not be included if you have metis * installed in the correct position in $WM_THIRD_PARTY_DIR - see @@ -8,39 +8,52 @@ #warning "Dummy metis.h - gets included since it cannot find metis installation." -#define IDXTYPEWIDTH 32 +// Integer type: OpenFOAM uses WM_LABEL_SIZE, metis.h uses IDXTYPEWIDTH +#if WM_LABEL_SIZE == 32 + typedef int32_t idx_t; -/*------------------------------------------------------------------------ -* Undefine the following #define in order to use short idxtype as the idxtype -*-------------------------------------------------------------------------*/ -#if IDXTYPEWIDTH == 32 + #define IDXTYPEWIDTH 32 #define SCNIDX SCNd32 #define PRIIDX PRId32 +#elif WM_LABEL_SIZE == 64 + typedef int64_t idx_t; - typedef int32_t idxtype; -#elif IDXTYPEWIDTH == 64 + #define IDXTYPEWIDTH 64 #define SCNIDX SCNd64 #define PRIIDX PRId64 - - typedef int64_t idxtype; #else - #error "Incorrect user-supplied value fo IDXTYPEWIDTH" + #error "Incorrect user-supplied value for WM_LABEL_SIZE (metis IDXTYPEWIDTH)" #endif -void METIS_WPartGraphRecursive(idxtype *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, - idxtype *adjwgt, idxtype *wgtflag, idxtype *numflag, idxtype *nparts, float *tpwgts, - idxtype *options, idxtype *edgecut, idxtype *part); -void METIS_PartGraphRecursive(idxtype *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, - idxtype *adjwgt, idxtype *wgtflag, idxtype *numflag, idxtype *nparts, idxtype *options, - idxtype *edgecut, idxtype *part); -void METIS_WPartGraphKway(idxtype *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, - idxtype *adjwgt, idxtype *wgtflag, idxtype *numflag, idxtype *nparts, float *tpwgts, - idxtype *options, idxtype *edgecut, idxtype *part); -void METIS_PartGraphKway(idxtype *nvtxs, idxtype *xadj, idxtype *adjncy, idxtype *vwgt, - idxtype *adjwgt, idxtype *wgtflag, idxtype *numflag, idxtype *nparts, idxtype *options, - idxtype *edgecut, idxtype *part); +// Float type: OpenFOAM uses WM_SP, WM_DP, metis.h uses REALTYPEWIDTH +#if defined(WM_SP) + typedef float real_t; + #define REALTYPEWIDTH 32 +#elif defined(WM_DP) + typedef double real_t; + #define REALTYPEWIDTH 64 +#else + #error "Incorrect user-supplied value for WM_SP / WM_DP (metis REALTYPEWIDTH)" +#endif + +#ifdef __cplusplus +extern "C" { +#endif +int METIS_PartGraphRecursive(idx_t *nvtxs, idx_t *ncon, idx_t *xadj, + idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt, + idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options, + idx_t *edgecut, idx_t *part); + +int METIS_PartGraphKway(idx_t *nvtxs, idx_t *ncon, idx_t *xadj, + idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt, + idx_t *nparts, real_t *tpwgts, real_t *ubvec, idx_t *options, + idx_t *edgecut, idx_t *part); + +#ifdef __cplusplus +} +#endif #endif diff --git a/src/parallel/decompose/metisDecomp/metisDecomp.C b/src/parallel/decompose/metisDecomp/metisDecomp.C index 11b75a0ea06..28449f42d0d 100644 --- a/src/parallel/decompose/metisDecomp/metisDecomp.C +++ b/src/parallel/decompose/metisDecomp/metisDecomp.C @@ -67,7 +67,7 @@ Foam::label Foam::metisDecomp::decompose // processor weights initialised with no size, only used if specified in // a file - Field<floatScalar> processorWeights; + Field<scalar> processorWeights; // cell weights (so on the vertices of the dual) List<label> cellWeights; -- GitLab