Closed ocramz closed 8 years ago
IMPORTANT : The main problem is with the interpretation of the PetscScalar_
synonym. It should be CDouble
for real-valued PETSc builds (the default), but Complex CDouble
if PETSc is configured with --with-scalar-type=complex
Fixed with generated C2Hs file Numerical.PETSc.Internal.C2HsGen.TypesC2HsGen
Currently, the elementary types such as PetscInt, PetscBool, PetscScalar ... are hardcoded as type synonyms to CInt, CDouble, Bool respectively (see Raw/Internal.hs).
The problem/feature is that PETSc can be configured with different numerical precisions, or using complex numbers as scalars, etc.
There should be a c2hs macro file that takes care of automatically mapping these types; it should be run before the inline-c step, since these types will be needed to build the inline-c context (see petscContext in Internal).