[petsc-dev] c++, float128 and complex patch

Satish Balay balay at mcs.anl.gov
Thu Sep 7 10:02:22 CDT 2017


This fix is now in 'balay/fix-quad-complex-from-cxx' - and merged to next.

https://bitbucket.org/petsc/petsc/commits/546cf89789929e13eb602224f891fdd5ffa3c4fc

Satish

On Wed, 6 Sep 2017, Satish Balay wrote:

> On Wed, 6 Sep 2017, Satish Balay wrote:
> 
> > > So, could you give me a hint on how I should configure petsc so that this
> > > works? Is there a way to enforce the c99 complex numbers even when calling
> > > petsc from c++?
> > 
> > Perhaps this is the change you need?
> 
> Looks like I need one more change..
> 
> Satish
> 
> ---------
> balay at asterix /home/balay/petsc (master *=)
> $ git diff
> diff --git a/include/petscmath.h b/include/petscmath.h
> index a63f1f4977..a201c3093e 100644
> --- a/include/petscmath.h
> +++ b/include/petscmath.h
> @@ -214,7 +214,7 @@ PETSC_EXTERN MPI_Datatype MPIU___COMPLEX128;
>  #endif  /* PETSC_USE_REAL_ */
>  #endif  /* ! PETSC_SKIP_COMPLEX */
>  
> -#elif !defined(__cplusplus) && defined(PETSC_HAVE_C99_COMPLEX) && !defined(PETSC_USE_REAL___FP16)
> +#elif defined(PETSC_HAVE_C99_COMPLEX) && !defined(PETSC_USE_REAL___FP16)
>  #if !defined(PETSC_SKIP_COMPLEX)
>  #define PETSC_HAVE_COMPLEX 1
>  #include <complex.h>
> @@ -414,7 +414,7 @@ PETSC_EXTERN PetscComplex PETSC_i;
>  */
>  PETSC_STATIC_INLINE PetscComplex PetscCMPLX(PetscReal x, PetscReal y)
>  {
> -#if   defined(__cplusplus)
> +#if   defined(__cplusplus) && !defined(PETSC_USE_REAL___FLOAT128)
>    return PetscComplex(x,y);
>  #elif defined(_Imaginary_I)
>    return x + y * _Imaginary_I;
> 



More information about the petsc-dev mailing list