|
I use the following I all my fortran codes (inspired by a post from Michael Metcalf on comp.lang.fortran many many moons ago):
PetscReal,Parameter :: PReal =
1.0
Integer,Parameter,Public :: Kr = Selected_Real_Kind(Precision(PReal))
PetscInt,Parameter :: PInt =
1
Integer,Parameter,Public :: Ki = kind(PInt)
You will need to pass constant with their kind (i.e. 1_Ki instead of 1)
The advantage of this approach over explicitly trying to figure out the proper type of integer ois that the same code will automatically work with 32 and 64 bit indices.
I’ve been wondering if petsc should include these definitions (perhaps under another name).
Blaise
—
Canada Research Chair in Mathematical and Computational Aspects of Solid Mechanics (Tier 1) Professor, Department of Mathematics & Statistics
Hamilton Hall room 409A, McMaster University 1280 Main Street West, Hamilton, Ontario L8S 4K1, Canada https://www.math.mcmaster.ca/bourdin | +1 (905) 525 9140 ext. 27243 |
- [petsc-users] PETSc Fortran 64-bit Mike Michell
- Re: [petsc-users] PETSc Fortran 64-bit Satish Balay via petsc-users
- Re: [petsc-users] PETSc Fortran 64-bit Blaise Bourdin
- Re: [petsc-users] PETSc Fortran 64-b... Mike Michell
- Re: [petsc-users] PETSc Fortran ... Satish Balay via petsc-users
- Re: [petsc-users] PETSc Fort... Satish Balay via petsc-users
- Re: [petsc-users] PETSc... Blaise Bourdin
- Re: [petsc-users] PETSc... Mike Michell
