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 64-bit pointer installations
10: and 32-bit for 32-bit 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: PetscFunctionBegin;
36: #if defined(HYPRE_COMPLEX)
37: ((PetscReal *)b)[0] = PetscRealPart(a);
38: ((PetscReal *)b)[1] = PetscImaginaryPart(a);
39: #else
40: *b = a;
41: #endif
42: PetscFunctionReturn(PETSC_SUCCESS);
43: }
44: #endif
46: #if PETSC_PKG_HYPRE_VERSION_LT(2, 19, 0)
47: typedef int HYPRE_MemoryLocation;
48: #define hypre_IJVectorMemoryLocation(a) 0
49: #define hypre_IJMatrixMemoryLocation(a) 0
50: #endif