[petsc-users] missing types in petscsysdef.h

Lukas van de Wiel lukas.drinkt.thee at gmail.com
Tue Feb 7 06:09:10 CST 2017


Hi Matt,

thank you for your fast reply.

I have tried this with the dev version.
The structure of the include files is a lot more transparent, now! Thanks!

However, PetscReal is still not defined.


I can use my old method to change the third to last line from petscsys.h block

#if defined (PETSC_USE_REAL_SINGLE)
#define PetscReal PetscFortranFloat
#elif defined(PETSC_USE_REAL___FLOAT128)
#define PetscReal PetscFortranLongDouble
#elif defined(PETSC_USE_REAL_DOUBLE)
#define PetscReal PetscFortranDouble
#endif

to

#if defined (PETSC_USE_REAL_SINGLE)
#define PetscReal PetscFortranFloat
#elif defined(PETSC_USE_REAL___FLOAT128)
#define PetscReal PetscFortranLongDouble
#else
#define PetscReal PetscFortranDouble
#endif

To make sure it PetscReal is defined as double, even wthen there is no
PETSC_USE_REAL_[TYPE] defined, and similar for PetscScalar, but that
is ugly. :-\

Cheers
Lukas

On 2/7/17, Matthew Knepley <knepley at gmail.com> wrote:
> On Tue, Feb 7, 2017 at 5:12 AM, Lukas van de Wiel <
> lukas.drinkt.thee at gmail.com> wrote:
>
>> Dear fellow PETSc users,
>>
>> I have been using PETSc for several years now, but I notice that after
>> every upgrade I have to make changes to include/finclude/petscsysdef.h
>> to get my Fortran code to work with it (or, in 3.7.5
>> include/petsc/finclude/petscsysdef.h)
>>
>
> We will definitely fix this. However, the entire Fortran interface has been
> rewritten to make it simpler,
> and allow using all the features os F90. Please see the bottom of
> http://www.mcs.anl.gov/petsc/documentation/changes/dev.html
>
> Would you be able to try out the master branch of PETSc development
> (instructions here http://www.mcs.anl.gov/petsc/developers/index.html)?
> This would let us know if the bug is still there.
>
>   Thanks,
>
>      Matt
>
>
>> I have been running 3.4.2 for a few years, and PetscReal and
>> PetscScalar were never defined, apparently because no
>> PETSC_USE_REAL_[TYPE] was never defined.
>>
>> In 3.7.5 I have the same problem, and it also affects
>> PetscFortranComplex which also depends on PETSC_USE_REAL_[TYPE].
>>
>> However, my configure.log nicely shows:
>>
>> #ifndef PETSC_USE_REAL_DOUBLE
>> #define PETSC_USE_REAL_DOUBLE 1
>> #endif
>>
>> It seems that changing petscsysdef.h is not the proper solution. Is
>> there a more elegant way for me to fix this?
>>
>> Thanks for your expertise,
>> Lukas
>>
>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>


More information about the petsc-users mailing list