Actual source code: petschypre.h
1: #ifndef _PETSCHYPRE_H
2: #define _PETSCHYPRE_H
4: #include <petscsys.h>
5: #include <petscpkg_version.h>
6: #include <HYPRE_config.h>
7: #include <HYPRE_utilities.h>
9: /* from version 2.16 on, HYPRE_BigInt is 64 bit for 64bit installations
10: and 32 bit for 32bit installations -> not the best name for a variable */
11: #if PETSC_PKG_HYPRE_VERSION_LT(2, 16, 0)
12: typedef PetscInt HYPRE_BigInt;
13: #endif
15: #if defined(HYPRE_BIGINT) || defined(HYPRE_MIXEDINT)
16: #define PetscHYPRE_BigInt_FMT "lld"
17: #ifdef __cplusplus /* make sure our format specifiers line up */
18: #include <type_traits>
19: static_assert(std::is_same<HYPRE_BigInt, long long int>::value, "");
20: #endif
21: #else
22: #define PetscHYPRE_BigInt_FMT "d"
23: #ifdef __cplusplus /* make sure our format specifiers line up */
24: #include <type_traits>
25: static_assert(std::is_same<HYPRE_BigInt, int>::value, "");
26: #endif
27: #endif
29: /*
30: With scalar type == real, HYPRE_Complex == PetscScalar;
31: With scalar type == complex, HYPRE_Complex is double __complex__ while PetscScalar may be std::complex<double>
32: */
33: static inline PetscErrorCode PetscHYPREScalarCast(PetscScalar a, HYPRE_Complex *b)
34: {
35: #if defined(HYPRE_COMPLEX)
36: ((PetscReal *)b)[0] = PetscRealPart(a);
37: ((PetscReal *)b)[1] = PetscImaginaryPart(a);
38: #else
39: *b = a;
40: #endif
41: return 0;
42: }
43: #endif
45: #if PETSC_PKG_HYPRE_VERSION_LT(2, 19, 0)
46: typedef int HYPRE_MemoryLocation;
47: #define hypre_IJVectorMemoryLocation(a) 0
48: #define hypre_IJMatrixMemoryLocation(a) 0
49: #endif