Actual source code: petscsys.h

petsc-3.4.5 2014-06-29
  1: !
  2: !
  3: !  Base include file for Fortran use of the PETSc package.
  4: !
  5: #include "petscconf.h"
 6:  #include petscversion.h
 7:  #include finclude/petscsysdef.h

  9: #if !defined(PETSC_AVOID_MPIF_H)
 10: #include "mpif.h"
 11: #endif

 13: ! ------------------------------------------------------------------------
 14: !     Non Common block Stuff declared first
 15: !
 16: !     Flags
 17: !
 18:       PetscBool  PETSC_TRUE
 19:       PetscBool  PETSC_FALSE
 20: #if defined(PETSC_FORTRAN_PETSCTRUTH_INT)
 21:       parameter (PETSC_TRUE = 1,PETSC_FALSE = 0)
 22: #else
 23:       parameter (PETSC_TRUE = .true.,PETSC_FALSE = .false.)
 24: #endif
 25:       PetscInt   PETSC_DECIDE,PETSC_DETERMINE
 26:       parameter (PETSC_DECIDE=-1,PETSC_DETERMINE=-1)

 28:       PetscInt  PETSC_DEFAULT_INTEGER
 29:       parameter (PETSC_DEFAULT_INTEGER = -2)

 31:       PetscFortranDouble PETSC_DEFAULT_DOUBLE_PRECISION
 32:       parameter (PETSC_DEFAULT_DOUBLE_PRECISION=-2.0d0)

 34:       PetscEnum PETSC_FP_TRAP_OFF
 35:       PetscEnum PETSC_FP_TRAP_ON
 36:       parameter (PETSC_FP_TRAP_OFF = 0,PETSC_FP_TRAP_ON = 1)



 40: !
 41: !     Default PetscViewers.
 42: !
 43:       PetscFortranAddr PETSC_VIEWER_DRAW_WORLD
 44:       PetscFortranAddr PETSC_VIEWER_DRAW_SELF
 45:       PetscFortranAddr PETSC_VIEWER_SOCKET_WORLD
 46:       PetscFortranAddr PETSC_VIEWER_SOCKET_SELF
 47:       PetscFortranAddr PETSC_VIEWER_STDOUT_WORLD
 48:       PetscFortranAddr PETSC_VIEWER_STDOUT_SELF
 49:       PetscFortranAddr PETSC_VIEWER_STDERR_WORLD
 50:       PetscFortranAddr PETSC_VIEWER_STDERR_SELF
 51:       PetscFortranAddr PETSC_VIEWER_BINARY_WORLD
 52:       PetscFortranAddr PETSC_VIEWER_BINARY_SELF
 53:       PetscFortranAddr PETSC_VIEWER_MATLAB_WORLD
 54:       PetscFortranAddr PETSC_VIEWER_MATLAB_SELF

 56: !
 57: !     The numbers used below should match those in
 58: !     petsc-private/fortranimpl.h
 59: !
 60:       parameter (PETSC_VIEWER_DRAW_WORLD   = 4)
 61:       parameter (PETSC_VIEWER_DRAW_SELF    = 5)
 62:       parameter (PETSC_VIEWER_SOCKET_WORLD = 6)
 63:       parameter (PETSC_VIEWER_SOCKET_SELF  = 7)
 64:       parameter (PETSC_VIEWER_STDOUT_WORLD = 8)
 65:       parameter (PETSC_VIEWER_STDOUT_SELF  = 9)
 66:       parameter (PETSC_VIEWER_STDERR_WORLD = 10)
 67:       parameter (PETSC_VIEWER_STDERR_SELF  = 11)
 68:       parameter (PETSC_VIEWER_BINARY_WORLD = 12)
 69:       parameter (PETSC_VIEWER_BINARY_SELF  = 13)
 70:       parameter (PETSC_VIEWER_MATLAB_WORLD = 14)
 71:       parameter (PETSC_VIEWER_MATLAB_SELF  = 15)
 72: !
 73: !     PETSc DataTypes
 74: !
 75:       PetscEnum PETSC_INT
 76:       PetscEnum PETSC_DOUBLE
 77:       PetscEnum PETSC_COMPLEX
 78:       PetscEnum PETSC_LONG
 79:       PetscEnum PETSC_SHORT
 80:       PetscEnum PETSC_FLOAT
 81:       PetscEnum PETSC_CHAR
 82:       PetscEnum PETSC_BIT_LOGICAL
 83:       PetscEnum PETSC_ENUM
 84:       PetscEnum PETSC_BOOL
 85:       PetscEnum PETSC___FLOAT128

 87: #if defined(PETSC_USE_REAL_SINGLE)
 88: #define PETSC_REAL PETSC_FLOAT
 89: #elif defined(PETSC_USE_REAL___FLOAT128)
 90: #define PETSC_REAL PETSC___FLOAT128
 91: #else
 92: #define PETSC_REAL PETSC_DOUBLE
 93: #endif
 94: #define PETSC_FORTRANADDR PETSC_LONG

 96:       parameter (PETSC_INT=0,PETSC_DOUBLE=1,PETSC_COMPLEX=2)
 97:       parameter (PETSC_LONG=3,PETSC_SHORT=4,PETSC_FLOAT=5)
 98:       parameter (PETSC_CHAR=6,PETSC_BIT_LOGICAL=7,PETSC_ENUM=8)
 99:       parameter (PETSC_BOOL=9,PETSC___FLOAT128=10)
100: !
101: !
102: !
103:       PetscEnum PETSC_COPY_VALUES
104:       PetscEnum PETSC_OWN_POINTER
105:       PetscEnum PETSC_USE_POINTER

107:       parameter (PETSC_COPY_VALUES = 0)
108:       parameter (PETSC_OWN_POINTER = 1)
109:       parameter (PETSC_USE_POINTER = 2)
110: !
111: ! ------------------------------------------------------------------------
112: !     PETSc mathematics include file. Defines certain basic mathematical
113: !    constants and functions for working with single and double precision
114: !    floating point numbers as well as complex and integers.
115: !
116: !     Representation of complex i
117: !
118:       PetscFortranComplex PETSC_i
119: #if defined(PETSC_USE_REAL_SINGLE)
120:       parameter (PETSC_i = (0.0e0,1.0e0))
121: #else
122:       parameter (PETSC_i = (0.0d0,1.0d0))
123: #endif

125: !
126: !     Basic constants
127: !
128:       PetscFortranDouble PETSC_PI
129:       PetscFortranDouble PETSC_MAX_REAL
130:       PetscFortranDouble PETSC_MIN_REAL

132:       parameter (PETSC_PI = 3.14159265358979323846264d0)
133:       parameter (PETSC_MAX_REAL = 1.d300,PETSC_MIN_REAL = -1.d300)

135:       PetscFortranDouble PETSC_MACHINE_EPSILON
136:       PetscFortranDouble PETSC_SQRT_MACHINE_EPSILON
137:       PetscFortranDouble PETSC_SMALL

139: #if defined(PETSC_USE_REAL_SINGLE)
140:       parameter (PETSC_MACHINE_EPSILON = 1.e-7)
141:       parameter (PETSC_SQRT_MACHINE_EPSILON = 3.e-4)
142:       parameter (PETSC_SMALL = 1.e-5)
143: #else
144:       parameter (PETSC_MACHINE_EPSILON = 1.d-14)
145:       parameter (PETSC_SQRT_MACHINE_EPSILON = 1.d-7)
146:       parameter (PETSC_SMALL = 1.d-10)
147: #endif
148: !
149: ! ----------------------------------------------------------------------------
150: !    BEGIN PETSc aliases for MPI_ constants
151: !
152:       integer MPIU_SCALAR
153: #if defined(PETSC_USE_COMPLEX)
154: #if defined (PETSC_USE_REAL_SINGLE)
155:       parameter(MPIU_SCALAR = MPI_COMPLEX)
156: #else
157:       parameter(MPIU_SCALAR = MPI_DOUBLE_COMPLEX)
158: #endif
159: #else
160: #if defined (PETSC_USE_REAL_SINGLE)
161:       parameter (MPIU_SCALAR = MPI_REAL)
162: #else
163:       parameter(MPIU_SCALAR = MPI_DOUBLE_PRECISION)
164: #endif
165: #endif

167:       integer MPIU_INTEGER
168: #if defined(PETSC_USE_64BIT_INDICES)
169:       parameter(MPIU_INTEGER = MPI_INTEGER8)
170: #else
171:       parameter(MPIU_INTEGER = MPI_INTEGER)
172: #endif

174: !
175: ! ----------------------------------------------------------------------------
176: !    BEGIN COMMON-BLOCK VARIABLES
177: !
178: !
179: !     PETSc world communicator
180: !
181:       MPI_Comm PETSC_COMM_WORLD
182:       MPI_Comm PETSC_COMM_SELF
183: !
184: !     Fortran Null
185: !
186:       PetscChar(80)       PETSC_NULL_CHARACTER
187:       PetscInt            PETSC_NULL_INTEGER
188:       PetscFortranDouble  PETSC_NULL_DOUBLE
189:       PetscObject         PETSC_NULL_OBJECT
190: !
191: !      A PETSC_NULL_FUNCTION pointer
192: !
193:       external PETSC_NULL_FUNCTION
194:       PetscScalar   PETSC_NULL_SCALAR
195:       PetscReal     PETSC_NULL_REAL
196:       PetscBool     PETSC_NULL_BOOL
197: !
198: !     Common Block to store some of the PETSc constants.
199: !     which can be set - only at runtime.
200: !
201: !
202: !     A string should be in a different common block
203: !
204:       common /petscfortran1/ PETSC_NULL_CHARACTER
205:       common /petscfortran2/ PETSC_NULL_INTEGER
206:       common /petscfortran4/ PETSC_NULL_SCALAR
207:       common /petscfortran5/ PETSC_NULL_DOUBLE
208:       common /petscfortran6/ PETSC_NULL_REAL
209:       common /petscfortran7/ PETSC_NULL_BOOL
210:       common /petscfortran8/ PETSC_NULL_OBJECT
211:       common /petscfortran9/ PETSC_COMM_WORLD
212:       common /petscfortran10/ PETSC_COMM_SELF
213: !
214: !     Possible arguments to PetscPushErrorHandler()
215: !
216:       external PETSCTRACEBACKERRORHANDLER
217:       external PETSCABORTERRORHANDLER
218:       external PETSCEMACSCLIENTERRORHANDLER
219:       external PETSCATTACHDEBUGGERERRORHANDLER
220:       external PETSCIGNOREERRORHANDLER
221: !
222:       external PetscIsInfOrNanScalar
223:       external PetscIsInfOrNanReal
224:       PetscBool  PetscIsInfOrNanScalar
225:       PetscBool  PetscIsInfOrNanReal


228: !    END COMMON-BLOCK VARIABLES
229: ! ----------------------------------------------------------------------------
230: !
231: !
232: !     Random numbers
233: !
234: #define PETSCRAND 'rand'
235: #define PETSCRAND48 'rand48'
236: #define PETSCSPRNG 'sprng'
237: !
238: !
239: !
240:       PetscEnum PETSC_BINARY_INT_SIZE
241:       PetscEnum PETSC_BINARY_FLOAT_SIZE
242:       PetscEnum PETSC_BINARY_CHAR_SIZE
243:       PetscEnum PETSC_BINARY_SHORT_SIZE
244:       PetscEnum PETSC_BINARY_DOUBLE_SIZE
245:       PetscEnum PETSC_BINARY_SCALAR_SIZE

247:       parameter (PETSC_BINARY_INT_SIZE = 4)
248:       parameter (PETSC_BINARY_FLOAT_SIZE = 4)
249:       parameter (PETSC_BINARY_CHAR_SIZE = 1)
250:       parameter (PETSC_BINARY_SHORT_SIZE = 2)
251:       parameter (PETSC_BINARY_DOUBLE_SIZE = 8)
252: #if defined(PETSC_USE_COMPLEX)
253:       parameter (PETSC_BINARY_SCALAR_SIZE = 16)
254: #else
255:       parameter (PETSC_BINARY_SCALAR_SIZE = 8)
256: #endif

258:       PetscEnum PETSC_BINARY_SEEK_SET
259:       PetscEnum PETSC_BINARY_SEEK_CUR
260:       PetscEnum PETSC_BINARY_SEEK_END

262:       parameter (PETSC_BINARY_SEEK_SET = 0,PETSC_BINARY_SEEK_CUR = 1)
263:       parameter (PETSC_BINARY_SEEK_END = 2)

265:       PetscEnum PETSC_BUILDTWOSIDED_ALLREDUCE
266:       PetscEnum PETSC_BUILDTWOSIDED_IBARRIER
267:       parameter (PETSC_BUILDTWOSIDED_ALLREDUCE = 0)
268:       parameter (PETSC_BUILDTWOSIDED_IBARRIER = 1)
269: !