cast PetscScalar to double

Satish Balay balay at mcs.anl.gov
Wed Aug 19 08:17:59 CDT 2009


you can replace (double)(var) with one of the following [approprate to
your code] thingy.

PetscAbsScalar(var)
PetscRealPart(var)

Satish

On Wed, 19 Aug 2009, Fredrik Bengzon wrote:

> Hi
> I'm using a Petsc 3 installation compiled with support for complex numbers.
> However, in the code I have made frequent use of the stl library and the
> standard type double. This now gives a compilation error since PetscScalar can
> not be casted into double. Do you know of a quick workaround or do I have to
> replace every instance of double with PetscScalar?
> Regards,
> Fredrik Bengzon
> 



More information about the petsc-users mailing list