[petsc-users] Why PETSc needs PetscScalar datatype?

Youjun Hu youjunhu at gmail.com
Sat Aug 4 13:19:12 CDT 2018


Thank Thibaut for the information.
There is often no clear boundary between library codes and application
codes.
For library codes, we do need the flexibility provided by the abstraction.
Cheers,
Youjun

On Sat, Aug 4, 2018 at 11:33 AM Appel, Thibaut <t.appel17 at imperial.ac.uk>
wrote:

> Hi,
>
> I can’t speak from a design point of view since I didn’t write PETSc
> myself but I assume it was to have more compact source files and to avoid
> copying routines twice (with one version for real and one version for
> complex).
>
> I am also using Fortran and it is actually flexible, as it allows you to
> write a unique version of your application code that works for both
> arithmetic types. If you need to write different pieces of code at some
> point, you can include preprocessed directives through the use of the
> PETSC_USE_COMPLEX boolean that is known at compilation time.
>
> Thibaut
>
> > Hi all,
> >
> > I am just wondering why PETSc introduces PetscScalar datatype in addition
> > to the PetscReal and PetscComplex.
> > Could someone help clarify the rationale behind this design?
> > I am primarily a Fortran guy. The additional datatype PetscScalar seems
> to
> > only confuse me rather than provide me any flexibility.
> > Cheers,
> > Youjun Hu
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180804/a217ccc7/attachment.html>


More information about the petsc-users mailing list