From 856903a98bf0c7a3361f94b1c9fe20593241f8e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ne=C4=8Dada?= Date: Wed, 30 Mar 2022 10:52:11 +0300 Subject: [PATCH] Restructure headers to ensure ewald.h C++ compatibility --- qpms/ewald.c | 1 + qpms/ewald.h | 7 ++++--- qpms/lattices.h | 20 +++----------------- qpms/scatsystem.c | 1 + qpms/translations.c | 4 ++++ qpms/translations_dbg.c | 1 + 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/qpms/ewald.c b/qpms/ewald.c index 8c727a1..cebf428 100644 --- a/qpms/ewald.c +++ b/qpms/ewald.c @@ -7,6 +7,7 @@ #include #include "tiny_inlines.h" #include "qpms_error.h" +#include "lattices.h" #include #include #include diff --git a/qpms/ewald.h b/qpms/ewald.h index 4d0ac98..3d4ab7d 100644 --- a/qpms/ewald.h +++ b/qpms/ewald.h @@ -36,7 +36,8 @@ extern "C" { #include #include // for inlined lilgamma #include "qpms_types.h" -#include "lattices.h" +#include "lattices_types.h" +#include /// Use this handler to ignore underflows of incomplete gamma. @@ -288,7 +289,7 @@ int ewald3_sigma_short( * In such case, it is the responsibility of the caller to deallocate * the generator. */ - PGen *pgen_R, + struct PGen *pgen_R, /// Indicates whether pgen_R already generates shifted points. /** If false, the behaviour corresponds to the old ewald32_sigma_short_points_and_shift(), * so the function assumes that the generated points correspond to the unshifted Bravais lattice, @@ -320,7 +321,7 @@ int ewald3_sigma_long( // calls ewald3_21_sigma_long or ewald3_3_sigma_long, dep * In such case, it is the responsibility of the caller to deallocate * the generator. */ - PGen *pgen_K, + struct PGen *pgen_K, /// Indicates whether pgen_K already generates shifted points. /** If false, the behaviour corresponds to the old ewald32_sigma_long_points_and_shift(), * so the function assumes that the generated points correspond to the unshifted reciprocal Bravais lattice, diff --git a/qpms/lattices.h b/qpms/lattices.h index c41e479..d7bdac0 100644 --- a/qpms/lattices.h +++ b/qpms/lattices.h @@ -4,10 +4,12 @@ */ #ifndef LATTICES_H #define LATTICES_H -#ifdef __cplusplus +#ifdef __cplusplus // FIXME Not C++ compatible. Include "lattices_types.h" for minimal necessary enum decls. extern "C" { #endif +#include "lattices_types.h" + #include #include #include @@ -33,22 +35,6 @@ extern "C" { * */ -typedef enum LatticeDimensionality { - LAT1D = 1, - LAT2D = 2, - LAT3D = 4, - SPACE1D = 8, - SPACE2D = 16, - SPACE3D = 32, - LAT_1D_IN_3D = 33, - LAT_2D_IN_3D = 34, - LAT_3D_IN_3D = 40, - // special coordinate arrangements (indicating possible optimisations) - LAT_ZONLY = 64, - LAT_XYONLY = 128, - LAT_1D_IN_3D_ZONLY = 97, // LAT1D | SPACE3D | 64 - LAT_2D_IN_3D_XYONLY = 162 // LAT2D | SPACE3D | 128 -} LatticeDimensionality; inline static bool LatticeDimensionality_checkflags( LatticeDimensionality a, LatticeDimensionality flags_a_has_to_contain) { diff --git a/qpms/scatsystem.c b/qpms/scatsystem.c index 6cc0e88..c3affc2 100644 --- a/qpms/scatsystem.c +++ b/qpms/scatsystem.c @@ -24,6 +24,7 @@ #include "tolerances.h" #include "beyn.h" #include "tiny_inlines.h" +#include "lattices.h" #ifdef QPMS_SCATSYSTEM_USE_OWN_BLAS #include "qpmsblas.h" diff --git a/qpms/translations.c b/qpms/translations.c index dc15c97..e502f77 100644 --- a/qpms/translations.c +++ b/qpms/translations.c @@ -16,6 +16,10 @@ #include "normalisation.h" #include "translations_inlines.h" +#if defined LATTICESUMS31 || defined LATTICESUMS32 +#include "lattices.h" +#endif + /* * Define macros with additional factors that "should not be there" according * to the "original" formulae but are needed to work with my vswfs. diff --git a/qpms/translations_dbg.c b/qpms/translations_dbg.c index a2f998c..4334008 100644 --- a/qpms/translations_dbg.c +++ b/qpms/translations_dbg.c @@ -5,6 +5,7 @@ #include "tiny_inlines.h" #include "qpms_error.h" #include "normalisation.h" +#include "lattices.h" int qpms_trans_calculator_test_sswf(const qpms_trans_calculator *c,