PETSc requires fortran preprocessing [or one could say C preprocessing if preprocessing is not part of any fortran standard - but most compilers support it] - and preprocessing is case sensitive.
Satish On Sat, 4 Aug 2018, Youjun Hu wrote: > Thank Satish. > PetscFortranComplex works. > I just want to distinguish between real and complex variables in my Fotran > code, so I prefer to use PetscFortranComplex when a variables is complex. > I began to learn petsc just several weeks ago. > Another unusual thing I noticed is that petsc keywords are case-sensitive > in Fotran codes, which breaks the convention that Fortran is > case-insensitive. > Correct me if I am wrong. > > Youjun > > On Sat, Aug 4, 2018 at 3:24 PM Satish Balay <[email protected]> wrote: > > > For some reason it is PetscFortranComplex [on fortran side] > > > > I'm not sure I understand your logic for using PetscComplex and not > > PetscScalar. > > > > We recommend using PetscScalar. You can choose not to follow our > > recommendation. > > > > But we don't say 'PetscScalar' is the wrong thing for users [as you > > appear to infer] > > > > Satish > > > > On Sat, 4 Aug 2018, Youjun Hu wrote: > > > > > I just tried to change PetscScalar to the specific datatype PetscComplex > > in > > > my Fortran code, but the compiler raised the following error: > > > PetscComplex my_coeff > > > Error: Unclassifiable statement at (1) > > > > > > It seems that the compiler does not know this datatype. > > > > > > My Petsc was configured with ./configure --with-scalar-type=complex > > > --with-precision=double > > > > > > Before the modification, the code was complied successfully. > > > Could someone help? > > > > > > Thanks, > > > Youjun > > > > > > > > > > >
