Fix typedef order for metis.h and parmetis.h headers when scotch.h is not included
Previously resulted in a compiler error because typedef SCOTCH_Num idx_t
was defined before typedef DUMMYINT SCOTCH_Num
.
Also adds DUMMYSIZEBITIDX
in order to define IDXTYPEWIDTH
in the METIS and ParMETIS headers for the original libraries, for packages which use these definitions.
diff --git a/src/libscotchmetis/library_metis.h b/src/libscotchmetis/library_metis.h
index a259950..9cd576c 100644
--- a/src/libscotchmetis/library_metis.h
+++ b/src/libscotchmetis/library_metis.h
@@ -63,6 +63,14 @@
/** **/
/************************************************************/
+/*
+** The type and structure definitions.
+*/
+
+#ifndef SCOTCH_H /* In case "scotch.h" not included before */
+typedef DUMMYINT SCOTCH_Num;
+#endif /* SCOTCH_H */
+
/*
** The defines.
*/
@@ -92,6 +100,7 @@
#define SCOTCH_METIS_DATATYPES
typedef SCOTCH_Num idx_t;
typedef double real_t;
+#define IDXTYPEWIDTH DUMMYSIZEBITNUM
#endif /* SCOTCH_METIS_DATATYPES */
#ifndef SCOTCH_METIS_OPTIONS
@@ -146,14 +155,6 @@ typedef enum {
} rstatus_et;
#endif /* SCOTCH_METIS_RETURN */
-/*
-** The type and structure definitions.
-*/
-
-#ifndef SCOTCH_H /* In case "scotch.h" not included before */
-typedef DUMMYINT SCOTCH_Num;
-#endif /* SCOTCH_H */
-
/*
** The function prototypes.
*/
diff --git a/src/libscotchmetis/library_parmetis.h b/src/libscotchmetis/library_parmetis.h
index 945819f..f5c4ce9 100644
--- a/src/libscotchmetis/library_parmetis.h
+++ b/src/libscotchmetis/library_parmetis.h
@@ -61,6 +61,14 @@
/** **/
/************************************************************/
+/*
+** The type and structure definitions.
+*/
+
+#ifndef SCOTCH_H /* In case "scotch.h" not included before */
+typedef DUMMYINT SCOTCH_Num;
+#endif /* SCOTCH_H */
+
/*
** The defines and includes.
*/
@@ -93,6 +101,13 @@
#define METISNAME4(p,s) p##s
#endif /* METISNAMEL */
+#ifndef SCOTCH_METIS_DATATYPES
+#define SCOTCH_METIS_DATATYPES
+typedef SCOTCH_Num idx_t;
+typedef double real_t;
+#define IDXTYPEWIDTH DUMMYSIZEBITNUM
+#endif /* SCOTCH_METIS_DATATYPES */
+
#ifndef SCOTCH_METIS_RETURN
#define SCOTCH_METIS_RETURN
typedef enum {
@@ -103,14 +118,6 @@ typedef enum {
} rstatus_et;
#endif /* SCOTCH_METIS_RETURN */
-/*
-** The type and structure definitions.
-*/
-
-#ifndef SCOTCH_H /* In case "scotch.h" not included before */
-typedef DUMMYINT SCOTCH_Num;
-#endif /* SCOTCH_H */
-
/*
** The function prototypes.
*/
diff --git a/src/libscotch/dummysizes.c b/src/libscotch/dummysizes.c
index fbd7b52..7455672 100644
--- a/src/libscotch/dummysizes.c
+++ b/src/libscotch/dummysizes.c
@@ -253,6 +253,8 @@ char * argv[])
subsFill ("DUMMYPATCHLEVEL", EXPAND (SCOTCH_PATCHLEVEL_NUM));
subsFill ("DUMMYSIZEBYTEIDX", subsSizeByte (sizeof (IDX)));
subsFill ("DUMMYSIZEBYTENUM", subsSizeByte (sizeof (INT)));
+ subsFill ("DUMMYSIZEBITIDX", subsSizeByte (sizeof (IDX) * 8));
+ subsFill ("DUMMYSIZEBITNUM", subsSizeByte (sizeof (INT) * 8));
subsFill ("DUMMYSIZEARCHDOM", subsSize (sizeof (ArchDom)));
subsFill ("DUMMYSIZEARCH", subsSize (sizeof (Arch)));
subsFill ("DUMMYSIZEGEOM", subsSize (sizeof (Geom)));