diff --git a/src/parallel/decompose/metisDecomp/metisDecomp.C b/src/parallel/decompose/metisDecomp/metisDecomp.C index 8889b48fb2b221c46839a06ce58ec256c0524a6c..9fa36b14890730589c2b0a895420d7657cf53a66 100644 --- a/src/parallel/decompose/metisDecomp/metisDecomp.C +++ b/src/parallel/decompose/metisDecomp/metisDecomp.C @@ -27,12 +27,23 @@ License #include "addToRunTimeSelectionTable.H" #include "Time.H" -extern "C" -{ - #define OMPI_SKIP_MPICXX - #include "metis.h" -} - +// Probably not needed... +#define MPICH_SKIP_MPICXX +#define OMPI_SKIP_MPICXX + +#include "metis.h" + +// Provide a clear error message if we have a size mismatch +// +// Metis has an 'idx_t' type, but the IDXTYPEWIDTH define is perhaps +// more future-proof? +#ifdef IDXTYPEWIDTH +static_assert +( + sizeof(Foam::label) == (IDXTYPEWIDTH/8), + "sizeof(Foam::label) == (IDXTYPEWIDTH/8), check your metis headers" +); +#endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/parallel/decompose/ptscotchDecomp/Make/options b/src/parallel/decompose/ptscotchDecomp/Make/options index 4d8690985afd93ff5e234354d28e59e23f225f2f..e50518232443d115e28bbe11d4221711e732f8f1 100644 --- a/src/parallel/decompose/ptscotchDecomp/Make/options +++ b/src/parallel/decompose/ptscotchDecomp/Make/options @@ -1,10 +1,15 @@ +/* + * NB: mplib PINC must appear after the SCOTCH_ARCH_PATH/include/FOAM_MPI + * to ensure we do not accidentally get a ptscotch header from the + * mpi distribution. + */ sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB) sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB) EXE_INC = \ - $(PFLAGS) $(PINC) \ - -I$(SCOTCH_INC_DIR) \ -I$(SCOTCH_ARCH_PATH)/include/$(FOAM_MPI) \ + -I$(SCOTCH_INC_DIR) \ + $(PFLAGS) $(PINC) \ -I../decompositionMethods/lnInclude /* @@ -13,8 +18,8 @@ EXE_INC = \ */ LIB_LIBS = \ -L$(SCOTCH_LIB_DIR) \ - -L$(FOAM_EXT_LIBBIN) \ -L$(FOAM_EXT_LIBBIN)/$(FOAM_MPI) \ + -L$(FOAM_EXT_LIBBIN) \ -lptscotch -lptscotcherrexit \ -lscotch diff --git a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C index f5c12994c7fc2843269928fa023fcb31f25b99f1..56d7a022c58234189d3c3f64065291d7b97055b6 100644 --- a/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C +++ b/src/parallel/decompose/ptscotchDecomp/ptscotchDecomp.C @@ -207,6 +207,7 @@ License #include "globalIndex.H" #include "SubField.H" +// Avoid too many warnings from mpi.h #pragma GCC diagnostic ignored "-Wold-style-cast" #include <cstdio> @@ -222,6 +223,13 @@ License #include <fenv.h> #endif +// Provide a clear error message if we have a size mismatch +static_assert +( + sizeof(Foam::label) == sizeof(SCOTCH_Num), + "sizeof(Foam::label) == sizeof(SCOTCH_Num), check your scotch headers" +); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/parallel/decompose/scotchDecomp/Make/options b/src/parallel/decompose/scotchDecomp/Make/options index 6846910c047d5b99af377adbe16d1cd9289a3994..d4e3013991ce088f291f5347c8e0d8a55d9b3140 100644 --- a/src/parallel/decompose/scotchDecomp/Make/options +++ b/src/parallel/decompose/scotchDecomp/Make/options @@ -1,12 +1,4 @@ -/* - * Note including of mplib compilation rules. - * This is purely to avoid scotch.h including mpicxx.h, which causes problems. - */ -sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB) -sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB) - EXE_INC = \ - $(PFLAGS) $(PINC) \ -I$(SCOTCH_INC_DIR) \ -I../decompositionMethods/lnInclude diff --git a/src/parallel/decompose/scotchDecomp/scotchDecomp.C b/src/parallel/decompose/scotchDecomp/scotchDecomp.C index 77067cdce157b81bbaf78487e262254c253739e9..a5afaa5a8160c0a39a0e47efcdeb2b4cd8419036 100644 --- a/src/parallel/decompose/scotchDecomp/scotchDecomp.C +++ b/src/parallel/decompose/scotchDecomp/scotchDecomp.C @@ -127,13 +127,13 @@ License #include "Time.H" #include "OFstream.H" -extern "C" -{ -#include "scotch.h" -} +// Probably not needed, but in case we pickup a ptscotch.h ... +#define MPICH_SKIP_MPICXX +#define OMPI_SKIP_MPICXX +#include "scotch.h" -// Hack: scotch generates floating point errors so need to switch of error +// Hack: scotch generates floating point errors so need to switch off error // trapping! #ifdef __GLIBC__ #ifndef _GNU_SOURCE @@ -142,6 +142,13 @@ extern "C" #include <fenv.h> #endif +// Provide a clear error message if we have a size mismatch +static_assert +( + sizeof(Foam::label) == sizeof(SCOTCH_Num), + "sizeof(Foam::label) == sizeof(SCOTCH_Num), check your scotch headers" +); + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/renumber/zoltanRenumber/Make/options b/src/renumber/zoltanRenumber/Make/options index 2d1fd2e105f4e02cc2b11f81d11a74aa131f783c..f16794e34de74e358954d585ce3ed07f862fa5d5 100644 --- a/src/renumber/zoltanRenumber/Make/options +++ b/src/renumber/zoltanRenumber/Make/options @@ -2,11 +2,11 @@ sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB) sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB) EXE_INC = \ + -I$(ZOLTAN_INC_DIR) \ $(PFLAGS) $(PINC) \ ${c++LESSWARN} \ -I$(LIB_SRC)/renumber/renumberMethods/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(ZOLTAN_INC_DIR) + -I$(LIB_SRC)/meshTools/lnInclude LIB_LIBS = \ -L$(ZOLTAN_LIB_DIR) -lzoltan \