[petsc-dev] fortran literals

Munson, Todd tmunson at mcs.anl.gov
Thu Sep 1 16:37:45 CDT 2016


Cool!

For what its worth, that only works when PETSC_USE_FORTRANKIND is true.
I'm not sure how many of the Petsc builds have this flag set.

Any idea how to do the same thing in C?

Todd.

> On Sep 1, 2016, at 4:13 PM, Lisandro Dalcin <dalcinl at gmail.com> wrote:
> 
> 
> On 1 September 2016 at 23:05, Barry Smith <bsmith at mcs.anl.gov> wrote:
>    I didn't have a solution to this
> 
> ! These lines should be added to $PETSC_DIR/include/petsc/finclude/petscsysdef.h
> #if defined(PETSC_USE_REAL_SINGLE)
> integer, parameter :: PETSC_REAL_KIND = selected_real_kind(5)
> #elif defined(PETSC_USE_REAL_DOUBLE)
> integer, parameter :: PETSC_REAL_KIND = selected_real_kind(10)
> #elif defined(PETSC_USE_REAL___FLOAT128)
> integer, parameter :: PETSC_REAL_KIND = selected_real_kind(20)
> #endif
> 
> ! User code should write literals this way
> PetscReal x
> x = 0.123456789123456789123456789_PETSC_REAL_KIND
> 
> 
> 
> -- 
> Lisandro Dalcin
> ============
> Research Scientist
> Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
> Extreme Computing Research Center (ECRC)
> King Abdullah University of Science and Technology (KAUST)
> http://ecrc.kaust.edu.sa/
> 
> 4700 King Abdullah University of Science and Technology
> al-Khawarizmi Bldg (Bldg 1), Office # 0109
> Thuwal 23955-6900, Kingdom of Saudi Arabia
> http://www.kaust.edu.sa
> 
> Office Phone: +966 12 808-0459




More information about the petsc-dev mailing list