[petsc-users] [petsc-dev] For Fortran users of PETSc development version

Gautam Bisht gbisht at lbl.gov
Thu May 11 11:24:39 CDT 2017


Hi Barry,

I'm wondering if these changes will be a part of future 3.8.0 release or
4.0.0 release. And, do you have a tentative timeline when such a release
tag would be made?

-Gautam.

On Sun, Dec 4, 2016 at 11:13 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
>   Jed noticed a small mistake in my description. It is type(tXXX) not
> type(iXXX) if you chose to declare your variables that way. Note that
> declaring them via type(tXXX) or XXX is identical (XXX is just a macro for
> type(tXXX)).
>
>    Barry
>
>
> > On Dec 4, 2016, at 11:57 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> >
> >
> >    For Fortran users of the PETSc development (git master branch) version
> >
> >
> >    I have updated and simplified the Fortran usage of PETSc in the past
> few weeks. I will put the branch barry/fortran-update into the master
> branch on Monday. The usage changes are
> >
> > A)  for each Fortran function (and main) use the following
> >
> >       subroutine mysubroutine(.....)
> > #include <petsc/finclude/petscxxx.h>
> >       use petscxxx
> >       implicit none
> >
> >     For example if you are using SNES in your code you would have
> >
> > #include <petsc/finclude/petscsnes.h>
> >       use petscsnes
> >       implicit none
> >
> > B) Instead of PETSC_NULL_OBJECT you must pass PETSC_NULL_XXX (for
> example PETSC_NULL_VEC) using the specific object type XXX that the
> function call is expecting.
> >
> > C) Objects can be declared either as XXX  a  or  type(iXXX) a, for
> example Mat a or type(iMat) a.  (Note that previously for those who used
> types it was type(Mat) but that can no longer be used.
> >
> > Notes:
> >
> > 1)   There are no longer any .h90 files that may be included
> >
> > 2)    Like C the include files are now nested so you no longer need to
> include for example
> >
> > #include <petsc/finclude/petscsys.h>
> > #include <petsc/finclude/petscvec.h>
> > #include <petsc/finclude/petscmat.h>
> > #include <petsc/finclude/petscpc.h>
> > #include <petsc/finclude/petscksp.h>
> >
> > you can just include
> >
> > #include <petsc/finclude/petscksp.h>
> >
> > 3) there is now type checking of most function calls. This will help
> eliminate bugs due to incorrect calling sequences. Note that Fortran
> distinguishes between a argument that is a scalar (zero dimensional array),
> a one dimensional array and a two dimensional array (etc). So you may get
> compile warnings because you are passing in an array when PETSc expects a
> scalar or vis-versa. If you get these simply fix your declaration of the
> variable to match what is expected. In some routines like MatSetValues()
> and friends you can pass either scalars, one dimensional arrays or two
> dimensional arrays, if you get errors here please send mail to
> petsc-maint at mcs.anl.gov and include enough of your code so we can see the
> dimensions of all your variables so we can fix the problems.
> >
> > 4) You can continue to use either fixed (.F extension) or free format
> (.F90 extension) for your source
> >
> > 5) All the examples in PETSc have been updated so consult them for
> clarifications.
> >
> >
> >  Please report any problems to petsc-maint at mcs.anl.gov
> >
> >   Thanks
> >
> >   Barry
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170511/0b1dd4b9/attachment.html>


More information about the petsc-users mailing list