[petsc-users] Bug Report : Continue line fails when wrapped wtih PetscCall(A)
Satish Balay
balay.anl at fastmail.org
Fri Mar 28 09:55:26 CDT 2025
Yeah - likely the reason why we default to using 'gfortran -ffree-line-length-none -ffree-line-length-0'
> include/petsc/finclude/petscsysbase.h:#define PetscCallA(func) call func; CHKERRA(ierr)
so if you are using regular "call" with line continuation, use:
call DMDACreate3D(PETSC_COMM_WORLD,&
DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,&
DMDA_STENCIL_STAR,three,three,three,&
PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,&
one,& ! number of degrees of freedom per node
one,& ! stencil width
PETSC_NULL_INTEGER_ARRAY,PETSC_NULL_INTEGER_ARRAY,PETSC_NULL_INTEGER_ARRAY,&
dm, & ! Output -- the resulting distributed array object
ierr)
CHKERRA(ierr)
Satish
On Fri, 28 Mar 2025, Zhao-Yi Yan wrote:
> Dear Developers,
>
>
> I am a Fortran programmer, and find the continue line symbol "&" in fortran fails to work when I call the routine with PetscCallA, for example
>
>
> The code like this
>
>
> " PetscCallA DMDACreate3D(PETSC_COMM_WORLD,&
> DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,&
> DMDA_STENCIL_STAR,three,three,three,&
> PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,&
> one,& ! number of degrees of freedom per node
> one,& ! stencil width
> PETSC_NULL_INTEGER_ARRAY,PETSC_NULL_INTEGER_ARRAY,PETSC_NULL_INTEGER_ARRAY,&
> dm, & ! Output -- the resulting distributed array object
> ierr)
> "
>
>
> could NOT pass the compiler, which would report error that
>
>
> call DMDACreate3D(PETSC_COMM_WORLD, & DM_BOUNDARY_NONE,DM_BOUNDARY_NON
> 1
> Error: Syntax error in argument list at (1)
>
>
> A simple work-around method is to replace PetscCallA with a regular call, which means maybe there are something wrong within PetscCallA.
>
>
>
>
>
> Related information:
> Petsc Release Version 3.22.4
> Linux mgt1 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
>
>
> Best regards,
> | |
> Zhao-Yi Yan
> |
> |
> 13971216897 at 163.com
> |
More information about the petsc-users
mailing list