CalculiX  2.13
A Free Software Three-Dimensional Structural Finite Element Program
ddeabm.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine ddeabm (DF, NEQ, T, Y, TOUT, INFO, RTOL, ATOL, IDID, RWORK, LRW, IWORK, LIW, RPAR, IPAR)
 
subroutine ddes (DF, NEQ, T, Y, TOUT, INFO, RTOL, ATOL, IDID, YPOUT, YP, YY, WT, P, PHI, ALPHA, BETA, PSI, V, W, SIG, G, GI, H, EPS, X, XOLD, HOLD, TOLD, DELSGN, TSTOP, TWOU, FOURU, START, PHASE1, NORND, STIFF, INTOUT, NS, KORD, KOLD, INIT, KSTEPS, KLE4, IQUIT, KPREV, IVC, IV, KGI, RPAR, IPAR)
 
subroutine dintp (X, Y, XOUT, YOUT, YPOUT, NEQN, KOLD, PHI, IVC, IV, KGI, GI, ALPHA, OG, OW, OX, OY)
 
subroutine xermsg (LIBRAR, SUBROU, MESSG, NERR, LEVEL)
 
subroutine xerprn (PREFIX, NPREF, MESSG, NWRAP)
 
subroutine xersve (LIBRAR, SUBROU, MESSG, KFLAG, NERR, LEVEL, ICOUNT)
 
double precision function d1mach (I)
 
subroutine xgetua (IUNITA, N)
 
subroutine dsteps (DF, NEQN, Y, X, H, EPS, WT, START, HOLD, K, KOLD, CRASH, PHI, P, YP, PSI, ALPHA, BETA, SIG, V, W, G, PHASE1, NS, NORND, KSTEPS, TWOU, FOURU, XOLD, KPREV, IVC, IV, KGI, GI, RPAR, IPAR)
 
subroutine fdump
 
integer function i1mach (I)
 
subroutine dhstrt (DF, NEQ, A, B, Y, YPRIME, ETOL, MORDER, SMALL, BIG, SPY, PV, YP, SF, RPAR, IPAR, H)
 
double precision function dhvnrm (V, NCOMP)
 
function j4save (IWHICH, IVALUE, ISET)
 
subroutine xercnt (LIBRAR, SUBROU, MESSG, NERR, LEVEL, KONTRL)
 
subroutine xerhlt (MESSG)
 

Function/Subroutine Documentation

◆ d1mach()

double precision function d1mach (   I)
2012 C***BEGIN PROLOGUE D1MACH
2013 C***PURPOSE Return floating point machine dependent constants.
2014 C***LIBRARY SLATEC
2015 C***CATEGORY R1
2016 C***TYPE DOUBLE PRECISION (R1MACH-S, D1MACH-D)
2017 C***KEYWORDS MACHINE CONSTANTS
2018 C***AUTHOR Fox, P. A., (Bell Labs)
2019 C Hall, A. D., (Bell Labs)
2020 C Schryer, N. L., (Bell Labs)
2021 C***DESCRIPTION
2022 C
2023 C D1MACH can be used to obtain machine-dependent parameters for the
2024 C local machine environment. It is a function subprogram with one
2025 C (input) argument, and can be referenced as follows:
2026 C
2027 C D = D1MACH(I)
2028 C
2029 C where I=1,...,5. The (output) value of D above is determined by
2030 C the (input) value of I. The results for various values of I are
2031 C discussed below.
2032 C
2033 C D1MACH( 1) = B**(EMIN-1), the smallest positive magnitude.
2034 C D1MACH( 2) = B**EMAX*(1 - B**(-T)), the largest magnitude.
2035 C D1MACH( 3) = B**(-T), the smallest relative spacing.
2036 C D1MACH( 4) = B**(1-T), the largest relative spacing.
2037 C D1MACH( 5) = LOG10(B)
2038 C
2039 C Assume double precision numbers are represented in the T-digit,
2040 C base-B form
2041 C
2042 C sign (B**E)*( (X(1)/B) + ... + (X(T)/B**T) )
2043 C
2044 C where 0 .LE. X(I) .LT. B for I=1,...,T, 0 .LT. X(1), and
2045 C EMIN .LE. E .LE. EMAX.
2046 C
2047 C The values of B, T, EMIN and EMAX are provided in I1MACH as
2048 C follows:
2049 C I1MACH(10) = B, the base.
2050 C I1MACH(14) = T, the number of base-B digits.
2051 C I1MACH(15) = EMIN, the smallest exponent E.
2052 C I1MACH(16) = EMAX, the largest exponent E.
2053 C
2054 C To alter this function for a particular environment, the desired
2055 C set of DATA statements should be activated by removing the C from
2056 C column 1. Also, the values of D1MACH(1) - D1MACH(4) should be
2057 C checked for consistency with the local operating system.
2058 C
2059 C***REFERENCES P. A. Fox, A. D. Hall and N. L. Schryer, Framework for
2060 C a portable library, ACM Transactions on Mathematical
2061 C Software 4, 2 (June 1978), pp. 177-188.
2062 C***ROUTINES CALLED XERMSG
2063 C***REVISION HISTORY (YYMMDD)
2064 C 750101 DATE WRITTEN
2065 C 890213 REVISION DATE from Version 3.2
2066 C 891214 Prologue converted to Version 4.0 format. (BAB)
2067 C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
2068 C 900618 Added DEC RISC constants. (WRB)
2069 C 900723 Added IBM RS 6000 constants. (WRB)
2070 C 900911 Added SUN 386i constants. (WRB)
2071 C 910710 Added HP 730 constants. (SMR)
2072 C 911114 Added Convex IEEE constants. (WRB)
2073 C 920121 Added SUN -r8 compiler option constants. (WRB)
2074 C 920229 Added Touchstone Delta i860 constants. (WRB)
2075 C 920501 Reformatted the REFERENCES section. (WRB)
2076 C 920625 Added CONVEX -p8 and -pd8 compiler option constants.
2077 C (BKS, WRB)
2078 C 930201 Added DEC Alpha and SGI constants. (RWC and WRB)
2079 C 010817 Elevated IEEE to highest importance; see next set of
2080 C comments below. (DWL)
2081 C***END PROLOGUE D1MACH
2082 C
2083  INTEGER small(4)
2084  INTEGER large(4)
2085  INTEGER right(4)
2086  INTEGER diver(4)
2087  INTEGER log10(4)
2088 C
2089 C Initial data here correspond to the IEEE standard. The values for
2090 C DMACH(1), DMACH(3) and DMACH(4) are slight upper bounds. The value
2091 C for DMACH(2) is a slight lower bound. The value for DMACH(5) is
2092 C a 20-digit approximation. If one of the sets of initial data below
2093 C is preferred, do the necessary commenting and uncommenting. (DWL)
2094  DOUBLE PRECISION dmach(5)
2095  DATA dmach / 2.23d-308, 1.79d+308, 1.111d-16, 2.222d-16,
2096  1 0.30102999566398119521d0 /
2097  SAVE dmach
2098 C
2099 cc EQUIVALENCE (DMACH(1),SMALL(1))
2100 cc EQUIVALENCE (DMACH(2),LARGE(1))
2101 cc EQUIVALENCE (DMACH(3),RIGHT(1))
2102 cc EQUIVALENCE (DMACH(4),DIVER(1))
2103 cc EQUIVALENCE (DMACH(5),LOG10(1))
2104 C
2105 C MACHINE CONSTANTS FOR THE AMIGA
2106 C ABSOFT FORTRAN COMPILER USING THE 68020/68881 COMPILER OPTION
2107 C
2108 C DATA SMALL(1), SMALL(2) / Z'00100000', Z'00000000' /
2109 C DATA LARGE(1), LARGE(2) / Z'7FEFFFFF', Z'FFFFFFFF' /
2110 C DATA RIGHT(1), RIGHT(2) / Z'3CA00000', Z'00000000' /
2111 C DATA DIVER(1), DIVER(2) / Z'3CB00000', Z'00000000' /
2112 C DATA LOG10(1), LOG10(2) / Z'3FD34413', Z'509F79FF' /
2113 C
2114 C MACHINE CONSTANTS FOR THE AMIGA
2115 C ABSOFT FORTRAN COMPILER USING SOFTWARE FLOATING POINT
2116 C
2117 C DATA SMALL(1), SMALL(2) / Z'00100000', Z'00000000' /
2118 C DATA LARGE(1), LARGE(2) / Z'7FDFFFFF', Z'FFFFFFFF' /
2119 C DATA RIGHT(1), RIGHT(2) / Z'3CA00000', Z'00000000' /
2120 C DATA DIVER(1), DIVER(2) / Z'3CB00000', Z'00000000' /
2121 C DATA LOG10(1), LOG10(2) / Z'3FD34413', Z'509F79FF' /
2122 C
2123 C MACHINE CONSTANTS FOR THE APOLLO
2124 C
2125 C DATA SMALL(1), SMALL(2) / 16#00100000, 16#00000000 /
2126 C DATA LARGE(1), LARGE(2) / 16#7FFFFFFF, 16#FFFFFFFF /
2127 C DATA RIGHT(1), RIGHT(2) / 16#3CA00000, 16#00000000 /
2128 C DATA DIVER(1), DIVER(2) / 16#3CB00000, 16#00000000 /
2129 C DATA LOG10(1), LOG10(2) / 16#3FD34413, 16#509F79FF /
2130 C
2131 C MACHINE CONSTANTS FOR THE BURROUGHS 1700 SYSTEM
2132 C
2133 C DATA SMALL(1) / ZC00800000 /
2134 C DATA SMALL(2) / Z000000000 /
2135 C DATA LARGE(1) / ZDFFFFFFFF /
2136 C DATA LARGE(2) / ZFFFFFFFFF /
2137 C DATA RIGHT(1) / ZCC5800000 /
2138 C DATA RIGHT(2) / Z000000000 /
2139 C DATA DIVER(1) / ZCC6800000 /
2140 C DATA DIVER(2) / Z000000000 /
2141 C DATA LOG10(1) / ZD00E730E7 /
2142 C DATA LOG10(2) / ZC77800DC0 /
2143 C
2144 C MACHINE CONSTANTS FOR THE BURROUGHS 5700 SYSTEM
2145 C
2146 C DATA SMALL(1) / O1771000000000000 /
2147 C DATA SMALL(2) / O0000000000000000 /
2148 C DATA LARGE(1) / O0777777777777777 /
2149 C DATA LARGE(2) / O0007777777777777 /
2150 C DATA RIGHT(1) / O1461000000000000 /
2151 C DATA RIGHT(2) / O0000000000000000 /
2152 C DATA DIVER(1) / O1451000000000000 /
2153 C DATA DIVER(2) / O0000000000000000 /
2154 C DATA LOG10(1) / O1157163034761674 /
2155 C DATA LOG10(2) / O0006677466732724 /
2156 C
2157 C MACHINE CONSTANTS FOR THE BURROUGHS 6700/7700 SYSTEMS
2158 C
2159 C DATA SMALL(1) / O1771000000000000 /
2160 C DATA SMALL(2) / O7770000000000000 /
2161 C DATA LARGE(1) / O0777777777777777 /
2162 C DATA LARGE(2) / O7777777777777777 /
2163 C DATA RIGHT(1) / O1461000000000000 /
2164 C DATA RIGHT(2) / O0000000000000000 /
2165 C DATA DIVER(1) / O1451000000000000 /
2166 C DATA DIVER(2) / O0000000000000000 /
2167 C DATA LOG10(1) / O1157163034761674 /
2168 C DATA LOG10(2) / O0006677466732724 /
2169 C
2170 C MACHINE CONSTANTS FOR THE CDC 170/180 SERIES USING NOS/VE
2171 C
2172 C DATA SMALL(1) / Z"3001800000000000" /
2173 C DATA SMALL(2) / Z"3001000000000000" /
2174 C DATA LARGE(1) / Z"4FFEFFFFFFFFFFFE" /
2175 C DATA LARGE(2) / Z"4FFE000000000000" /
2176 C DATA RIGHT(1) / Z"3FD2800000000000" /
2177 C DATA RIGHT(2) / Z"3FD2000000000000" /
2178 C DATA DIVER(1) / Z"3FD3800000000000" /
2179 C DATA DIVER(2) / Z"3FD3000000000000" /
2180 C DATA LOG10(1) / Z"3FFF9A209A84FBCF" /
2181 C DATA LOG10(2) / Z"3FFFF7988F8959AC" /
2182 C
2183 C MACHINE CONSTANTS FOR THE CDC 6000/7000 SERIES
2184 C
2185 C DATA SMALL(1) / 00564000000000000000B /
2186 C DATA SMALL(2) / 00000000000000000000B /
2187 C DATA LARGE(1) / 37757777777777777777B /
2188 C DATA LARGE(2) / 37157777777777777777B /
2189 C DATA RIGHT(1) / 15624000000000000000B /
2190 C DATA RIGHT(2) / 00000000000000000000B /
2191 C DATA DIVER(1) / 15634000000000000000B /
2192 C DATA DIVER(2) / 00000000000000000000B /
2193 C DATA LOG10(1) / 17164642023241175717B /
2194 C DATA LOG10(2) / 16367571421742254654B /
2195 C
2196 C MACHINE CONSTANTS FOR THE CELERITY C1260
2197 C
2198 C DATA SMALL(1), SMALL(2) / Z'00100000', Z'00000000' /
2199 C DATA LARGE(1), LARGE(2) / Z'7FEFFFFF', Z'FFFFFFFF' /
2200 C DATA RIGHT(1), RIGHT(2) / Z'3CA00000', Z'00000000' /
2201 C DATA DIVER(1), DIVER(2) / Z'3CB00000', Z'00000000' /
2202 C DATA LOG10(1), LOG10(2) / Z'3FD34413', Z'509F79FF' /
2203 C
2204 C MACHINE CONSTANTS FOR THE CONVEX
2205 C USING THE -fn OR -pd8 COMPILER OPTION
2206 C
2207 C DATA DMACH(1) / Z'0010000000000000' /
2208 C DATA DMACH(2) / Z'7FFFFFFFFFFFFFFF' /
2209 C DATA DMACH(3) / Z'3CC0000000000000' /
2210 C DATA DMACH(4) / Z'3CD0000000000000' /
2211 C DATA DMACH(5) / Z'3FF34413509F79FF' /
2212 C
2213 C MACHINE CONSTANTS FOR THE CONVEX
2214 C USING THE -fi COMPILER OPTION
2215 C
2216 C DATA DMACH(1) / Z'0010000000000000' /
2217 C DATA DMACH(2) / Z'7FEFFFFFFFFFFFFF' /
2218 C DATA DMACH(3) / Z'3CA0000000000000' /
2219 C DATA DMACH(4) / Z'3CB0000000000000' /
2220 C DATA DMACH(5) / Z'3FD34413509F79FF' /
2221 C
2222 C MACHINE CONSTANTS FOR THE CONVEX
2223 C USING THE -p8 COMPILER OPTION
2224 C
2225 C DATA DMACH(1) / Z'00010000000000000000000000000000' /
2226 C DATA DMACH(2) / Z'7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF' /
2227 C DATA DMACH(3) / Z'3F900000000000000000000000000000' /
2228 C DATA DMACH(4) / Z'3F910000000000000000000000000000' /
2229 C DATA DMACH(5) / Z'3FFF34413509F79FEF311F12B35816F9' /
2230 C
2231 C MACHINE CONSTANTS FOR THE CRAY
2232 C
2233 C DATA SMALL(1) / 201354000000000000000B /
2234 C DATA SMALL(2) / 000000000000000000000B /
2235 C DATA LARGE(1) / 577767777777777777777B /
2236 C DATA LARGE(2) / 000007777777777777774B /
2237 C DATA RIGHT(1) / 376434000000000000000B /
2238 C DATA RIGHT(2) / 000000000000000000000B /
2239 C DATA DIVER(1) / 376444000000000000000B /
2240 C DATA DIVER(2) / 000000000000000000000B /
2241 C DATA LOG10(1) / 377774642023241175717B /
2242 C DATA LOG10(2) / 000007571421742254654B /
2243 C
2244 C MACHINE CONSTANTS FOR THE DATA GENERAL ECLIPSE S/200
2245 C NOTE - IT MAY BE APPROPRIATE TO INCLUDE THE FOLLOWING CARD -
2246 C STATIC DMACH(5)
2247 C
2248 C DATA SMALL / 20K, 3*0 /
2249 C DATA LARGE / 77777K, 3*177777K /
2250 C DATA RIGHT / 31420K, 3*0 /
2251 C DATA DIVER / 32020K, 3*0 /
2252 C DATA LOG10 / 40423K, 42023K, 50237K, 74776K /
2253 C
2254 C MACHINE CONSTANTS FOR THE DEC ALPHA
2255 C USING G_FLOAT
2256 C
2257 C DATA DMACH(1) / '0000000000000010'X /
2258 C DATA DMACH(2) / 'FFFFFFFFFFFF7FFF'X /
2259 C DATA DMACH(3) / '0000000000003CC0'X /
2260 C DATA DMACH(4) / '0000000000003CD0'X /
2261 C DATA DMACH(5) / '79FF509F44133FF3'X /
2262 C
2263 C MACHINE CONSTANTS FOR THE DEC ALPHA
2264 C USING IEEE_FORMAT
2265 C
2266 C DATA DMACH(1) / '0010000000000000'X /
2267 C DATA DMACH(2) / '7FEFFFFFFFFFFFFF'X /
2268 C DATA DMACH(3) / '3CA0000000000000'X /
2269 C DATA DMACH(4) / '3CB0000000000000'X /
2270 C DATA DMACH(5) / '3FD34413509F79FF'X /
2271 C
2272 C MACHINE CONSTANTS FOR THE DEC RISC
2273 C
2274 C DATA SMALL(1), SMALL(2) / Z'00000000', Z'00100000'/
2275 C DATA LARGE(1), LARGE(2) / Z'FFFFFFFF', Z'7FEFFFFF'/
2276 C DATA RIGHT(1), RIGHT(2) / Z'00000000', Z'3CA00000'/
2277 C DATA DIVER(1), DIVER(2) / Z'00000000', Z'3CB00000'/
2278 C DATA LOG10(1), LOG10(2) / Z'509F79FF', Z'3FD34413'/
2279 C
2280 C MACHINE CONSTANTS FOR THE DEC VAX
2281 C USING D_FLOATING
2282 C (EXPRESSED IN INTEGER AND HEXADECIMAL)
2283 C THE HEX FORMAT BELOW MAY NOT BE SUITABLE FOR UNIX SYSTEMS
2284 C THE INTEGER FORMAT SHOULD BE OK FOR UNIX SYSTEMS
2285 C
2286 C DATA SMALL(1), SMALL(2) / 128, 0 /
2287 C DATA LARGE(1), LARGE(2) / -32769, -1 /
2288 C DATA RIGHT(1), RIGHT(2) / 9344, 0 /
2289 C DATA DIVER(1), DIVER(2) / 9472, 0 /
2290 C DATA LOG10(1), LOG10(2) / 546979738, -805796613 /
2291 C
2292 C DATA SMALL(1), SMALL(2) / Z00000080, Z00000000 /
2293 C DATA LARGE(1), LARGE(2) / ZFFFF7FFF, ZFFFFFFFF /
2294 C DATA RIGHT(1), RIGHT(2) / Z00002480, Z00000000 /
2295 C DATA DIVER(1), DIVER(2) / Z00002500, Z00000000 /
2296 C DATA LOG10(1), LOG10(2) / Z209A3F9A, ZCFF884FB /
2297 C
2298 C MACHINE CONSTANTS FOR THE DEC VAX
2299 C USING G_FLOATING
2300 C (EXPRESSED IN INTEGER AND HEXADECIMAL)
2301 C THE HEX FORMAT BELOW MAY NOT BE SUITABLE FOR UNIX SYSTEMS
2302 C THE INTEGER FORMAT SHOULD BE OK FOR UNIX SYSTEMS
2303 C
2304 C DATA SMALL(1), SMALL(2) / 16, 0 /
2305 C DATA LARGE(1), LARGE(2) / -32769, -1 /
2306 C DATA RIGHT(1), RIGHT(2) / 15552, 0 /
2307 C DATA DIVER(1), DIVER(2) / 15568, 0 /
2308 C DATA LOG10(1), LOG10(2) / 1142112243, 2046775455 /
2309 C
2310 C DATA SMALL(1), SMALL(2) / Z00000010, Z00000000 /
2311 C DATA LARGE(1), LARGE(2) / ZFFFF7FFF, ZFFFFFFFF /
2312 C DATA RIGHT(1), RIGHT(2) / Z00003CC0, Z00000000 /
2313 C DATA DIVER(1), DIVER(2) / Z00003CD0, Z00000000 /
2314 C DATA LOG10(1), LOG10(2) / Z44133FF3, Z79FF509F /
2315 C
2316 C MACHINE CONSTANTS FOR THE ELXSI 6400
2317 C (ASSUMING REAL*8 IS THE DEFAULT DOUBLE PRECISION)
2318 C
2319 C DATA SMALL(1), SMALL(2) / '00100000'X,'00000000'X /
2320 C DATA LARGE(1), LARGE(2) / '7FEFFFFF'X,'FFFFFFFF'X /
2321 C DATA RIGHT(1), RIGHT(2) / '3CB00000'X,'00000000'X /
2322 C DATA DIVER(1), DIVER(2) / '3CC00000'X,'00000000'X /
2323 C DATA LOG10(1), LOG10(2) / '3FD34413'X,'509F79FF'X /
2324 C
2325 C MACHINE CONSTANTS FOR THE HARRIS 220
2326 C
2327 C DATA SMALL(1), SMALL(2) / '20000000, '00000201 /
2328 C DATA LARGE(1), LARGE(2) / '37777777, '37777577 /
2329 C DATA RIGHT(1), RIGHT(2) / '20000000, '00000333 /
2330 C DATA DIVER(1), DIVER(2) / '20000000, '00000334 /
2331 C DATA LOG10(1), LOG10(2) / '23210115, '10237777 /
2332 C
2333 C MACHINE CONSTANTS FOR THE HONEYWELL 600/6000 SERIES
2334 C
2335 C DATA SMALL(1), SMALL(2) / O402400000000, O000000000000 /
2336 C DATA LARGE(1), LARGE(2) / O376777777777, O777777777777 /
2337 C DATA RIGHT(1), RIGHT(2) / O604400000000, O000000000000 /
2338 C DATA DIVER(1), DIVER(2) / O606400000000, O000000000000 /
2339 C DATA LOG10(1), LOG10(2) / O776464202324, O117571775714 /
2340 C
2341 C MACHINE CONSTANTS FOR THE HP 730
2342 C
2343 C DATA DMACH(1) / Z'0010000000000000' /
2344 C DATA DMACH(2) / Z'7FEFFFFFFFFFFFFF' /
2345 C DATA DMACH(3) / Z'3CA0000000000000' /
2346 C DATA DMACH(4) / Z'3CB0000000000000' /
2347 C DATA DMACH(5) / Z'3FD34413509F79FF' /
2348 C
2349 C MACHINE CONSTANTS FOR THE HP 2100
2350 C THREE WORD DOUBLE PRECISION OPTION WITH FTN4
2351 C
2352 C DATA SMALL(1), SMALL(2), SMALL(3) / 40000B, 0, 1 /
2353 C DATA LARGE(1), LARGE(2), LARGE(3) / 77777B, 177777B, 177776B /
2354 C DATA RIGHT(1), RIGHT(2), RIGHT(3) / 40000B, 0, 265B /
2355 C DATA DIVER(1), DIVER(2), DIVER(3) / 40000B, 0, 276B /
2356 C DATA LOG10(1), LOG10(2), LOG10(3) / 46420B, 46502B, 77777B /
2357 C
2358 C MACHINE CONSTANTS FOR THE HP 2100
2359 C FOUR WORD DOUBLE PRECISION OPTION WITH FTN4
2360 C
2361 C DATA SMALL(1), SMALL(2) / 40000B, 0 /
2362 C DATA SMALL(3), SMALL(4) / 0, 1 /
2363 C DATA LARGE(1), LARGE(2) / 77777B, 177777B /
2364 C DATA LARGE(3), LARGE(4) / 177777B, 177776B /
2365 C DATA RIGHT(1), RIGHT(2) / 40000B, 0 /
2366 C DATA RIGHT(3), RIGHT(4) / 0, 225B /
2367 C DATA DIVER(1), DIVER(2) / 40000B, 0 /
2368 C DATA DIVER(3), DIVER(4) / 0, 227B /
2369 C DATA LOG10(1), LOG10(2) / 46420B, 46502B /
2370 C DATA LOG10(3), LOG10(4) / 76747B, 176377B /
2371 C
2372 C MACHINE CONSTANTS FOR THE HP 9000
2373 C
2374 C DATA SMALL(1), SMALL(2) / 00040000000B, 00000000000B /
2375 C DATA LARGE(1), LARGE(2) / 17737777777B, 37777777777B /
2376 C DATA RIGHT(1), RIGHT(2) / 07454000000B, 00000000000B /
2377 C DATA DIVER(1), DIVER(2) / 07460000000B, 00000000000B /
2378 C DATA LOG10(1), LOG10(2) / 07764642023B, 12047674777B /
2379 C
2380 C MACHINE CONSTANTS FOR THE IBM 360/370 SERIES,
2381 C THE XEROX SIGMA 5/7/9, THE SEL SYSTEMS 85/86, AND
2382 C THE PERKIN ELMER (INTERDATA) 7/32.
2383 C
2384 C DATA SMALL(1), SMALL(2) / Z00100000, Z00000000 /
2385 C DATA LARGE(1), LARGE(2) / Z7FFFFFFF, ZFFFFFFFF /
2386 C DATA RIGHT(1), RIGHT(2) / Z33100000, Z00000000 /
2387 C DATA DIVER(1), DIVER(2) / Z34100000, Z00000000 /
2388 C DATA LOG10(1), LOG10(2) / Z41134413, Z509F79FF /
2389 C
2390 C MACHINE CONSTANTS FOR THE IBM PC
2391 C ASSUMES THAT ALL ARITHMETIC IS DONE IN DOUBLE PRECISION
2392 C ON 8088, I.E., NOT IN 80 BIT FORM FOR THE 8087.
2393 C
2394 C DATA SMALL(1) / 2.23D-308 /
2395 C DATA LARGE(1) / 1.79D+308 /
2396 C DATA RIGHT(1) / 1.11D-16 /
2397 C DATA DIVER(1) / 2.22D-16 /
2398 C DATA LOG10(1) / 0.301029995663981195D0 /
2399 C
2400 C MACHINE CONSTANTS FOR THE IBM RS 6000
2401 C
2402 C DATA DMACH(1) / Z'0010000000000000' /
2403 C DATA DMACH(2) / Z'7FEFFFFFFFFFFFFF' /
2404 C DATA DMACH(3) / Z'3CA0000000000000' /
2405 C DATA DMACH(4) / Z'3CB0000000000000' /
2406 C DATA DMACH(5) / Z'3FD34413509F79FF' /
2407 C
2408 C MACHINE CONSTANTS FOR THE INTEL i860
2409 C
2410 C DATA DMACH(1) / Z'0010000000000000' /
2411 C DATA DMACH(2) / Z'7FEFFFFFFFFFFFFF' /
2412 C DATA DMACH(3) / Z'3CA0000000000000' /
2413 C DATA DMACH(4) / Z'3CB0000000000000' /
2414 C DATA DMACH(5) / Z'3FD34413509F79FF' /
2415 C
2416 C MACHINE CONSTANTS FOR THE PDP-10 (KA PROCESSOR)
2417 C
2418 C DATA SMALL(1), SMALL(2) / "033400000000, "000000000000 /
2419 C DATA LARGE(1), LARGE(2) / "377777777777, "344777777777 /
2420 C DATA RIGHT(1), RIGHT(2) / "113400000000, "000000000000 /
2421 C DATA DIVER(1), DIVER(2) / "114400000000, "000000000000 /
2422 C DATA LOG10(1), LOG10(2) / "177464202324, "144117571776 /
2423 C
2424 C MACHINE CONSTANTS FOR THE PDP-10 (KI PROCESSOR)
2425 C
2426 C DATA SMALL(1), SMALL(2) / "000400000000, "000000000000 /
2427 C DATA LARGE(1), LARGE(2) / "377777777777, "377777777777 /
2428 C DATA RIGHT(1), RIGHT(2) / "103400000000, "000000000000 /
2429 C DATA DIVER(1), DIVER(2) / "104400000000, "000000000000 /
2430 C DATA LOG10(1), LOG10(2) / "177464202324, "476747767461 /
2431 C
2432 C MACHINE CONSTANTS FOR PDP-11 FORTRAN SUPPORTING
2433 C 32-BIT INTEGERS (EXPRESSED IN INTEGER AND OCTAL).
2434 C
2435 C DATA SMALL(1), SMALL(2) / 8388608, 0 /
2436 C DATA LARGE(1), LARGE(2) / 2147483647, -1 /
2437 C DATA RIGHT(1), RIGHT(2) / 612368384, 0 /
2438 C DATA DIVER(1), DIVER(2) / 620756992, 0 /
2439 C DATA LOG10(1), LOG10(2) / 1067065498, -2063872008 /
2440 C
2441 C DATA SMALL(1), SMALL(2) / O00040000000, O00000000000 /
2442 C DATA LARGE(1), LARGE(2) / O17777777777, O37777777777 /
2443 C DATA RIGHT(1), RIGHT(2) / O04440000000, O00000000000 /
2444 C DATA DIVER(1), DIVER(2) / O04500000000, O00000000000 /
2445 C DATA LOG10(1), LOG10(2) / O07746420232, O20476747770 /
2446 C
2447 C MACHINE CONSTANTS FOR PDP-11 FORTRAN SUPPORTING
2448 C 16-BIT INTEGERS (EXPRESSED IN INTEGER AND OCTAL).
2449 C
2450 C DATA SMALL(1), SMALL(2) / 128, 0 /
2451 C DATA SMALL(3), SMALL(4) / 0, 0 /
2452 C DATA LARGE(1), LARGE(2) / 32767, -1 /
2453 C DATA LARGE(3), LARGE(4) / -1, -1 /
2454 C DATA RIGHT(1), RIGHT(2) / 9344, 0 /
2455 C DATA RIGHT(3), RIGHT(4) / 0, 0 /
2456 C DATA DIVER(1), DIVER(2) / 9472, 0 /
2457 C DATA DIVER(3), DIVER(4) / 0, 0 /
2458 C DATA LOG10(1), LOG10(2) / 16282, 8346 /
2459 C DATA LOG10(3), LOG10(4) / -31493, -12296 /
2460 C
2461 C DATA SMALL(1), SMALL(2) / O000200, O000000 /
2462 C DATA SMALL(3), SMALL(4) / O000000, O000000 /
2463 C DATA LARGE(1), LARGE(2) / O077777, O177777 /
2464 C DATA LARGE(3), LARGE(4) / O177777, O177777 /
2465 C DATA RIGHT(1), RIGHT(2) / O022200, O000000 /
2466 C DATA RIGHT(3), RIGHT(4) / O000000, O000000 /
2467 C DATA DIVER(1), DIVER(2) / O022400, O000000 /
2468 C DATA DIVER(3), DIVER(4) / O000000, O000000 /
2469 C DATA LOG10(1), LOG10(2) / O037632, O020232 /
2470 C DATA LOG10(3), LOG10(4) / O102373, O147770 /
2471 C
2472 C MACHINE CONSTANTS FOR THE SILICON GRAPHICS
2473 C
2474 C DATA SMALL(1), SMALL(2) / Z'00100000', Z'00000000' /
2475 C DATA LARGE(1), LARGE(2) / Z'7FEFFFFF', Z'FFFFFFFF' /
2476 C DATA RIGHT(1), RIGHT(2) / Z'3CA00000', Z'00000000' /
2477 C DATA DIVER(1), DIVER(2) / Z'3CB00000', Z'00000000' /
2478 C DATA LOG10(1), LOG10(2) / Z'3FD34413', Z'509F79FF' /
2479 C
2480 C MACHINE CONSTANTS FOR THE SUN
2481 C
2482 C DATA DMACH(1) / Z'0010000000000000' /
2483 C DATA DMACH(2) / Z'7FEFFFFFFFFFFFFF' /
2484 C DATA DMACH(3) / Z'3CA0000000000000' /
2485 C DATA DMACH(4) / Z'3CB0000000000000' /
2486 C DATA DMACH(5) / Z'3FD34413509F79FF' /
2487 C
2488 C MACHINE CONSTANTS FOR THE SUN
2489 C USING THE -r8 COMPILER OPTION
2490 C
2491 C DATA DMACH(1) / Z'00010000000000000000000000000000' /
2492 C DATA DMACH(2) / Z'7FFEFFFFFFFFFFFFFFFFFFFFFFFFFFFF' /
2493 C DATA DMACH(3) / Z'3F8E0000000000000000000000000000' /
2494 C DATA DMACH(4) / Z'3F8F0000000000000000000000000000' /
2495 C DATA DMACH(5) / Z'3FFD34413509F79FEF311F12B35816F9' /
2496 C
2497 C MACHINE CONSTANTS FOR THE SUN 386i
2498 C
2499 C DATA SMALL(1), SMALL(2) / Z'FFFFFFFD', Z'000FFFFF' /
2500 C DATA LARGE(1), LARGE(2) / Z'FFFFFFB0', Z'7FEFFFFF' /
2501 C DATA RIGHT(1), RIGHT(2) / Z'000000B0', Z'3CA00000' /
2502 C DATA DIVER(1), DIVER(2) / Z'FFFFFFCB', Z'3CAFFFFF'
2503 C DATA LOG10(1), LOG10(2) / Z'509F79E9', Z'3FD34413' /
2504 C
2505 C MACHINE CONSTANTS FOR THE UNIVAC 1100 SERIES FTN COMPILER
2506 C
2507 C DATA SMALL(1), SMALL(2) / O000040000000, O000000000000 /
2508 C DATA LARGE(1), LARGE(2) / O377777777777, O777777777777 /
2509 C DATA RIGHT(1), RIGHT(2) / O170540000000, O000000000000 /
2510 C DATA DIVER(1), DIVER(2) / O170640000000, O000000000000 /
2511 C DATA LOG10(1), LOG10(2) / O177746420232, O411757177572 /
2512 C
2513 C***FIRST EXECUTABLE STATEMENT D1MACH
2514  IF (i .LT. 1 .OR. i .GT. 5) CALL xermsg ('SLATEC', 'D1MACH',
2515  + 'I OUT OF BOUNDS', 1, 2)
2516 C
2517  d1mach = dmach(i)
2518  RETURN
2519 C
double precision function d1mach(I)
Definition: ddeabm.f:2012
subroutine xermsg(LIBRAR, SUBROU, MESSG, NERR, LEVEL)
Definition: ddeabm.f:1265

◆ ddeabm()

subroutine ddeabm ( external  DF,
integer  NEQ,
double precision  T,
double precision, dimension(*)  Y,
double precision  TOUT,
integer, dimension(15)  INFO,
double precision, dimension(*)  RTOL,
double precision, dimension(*)  ATOL,
integer  IDID,
double precision, dimension(*)  RWORK,
integer  LRW,
integer, dimension(*)  IWORK,
integer  LIW,
double precision, dimension(*)  RPAR,
integer, dimension(*)  IPAR 
)
7 C***BEGIN PROLOGUE DDEABM
8 C***PURPOSE Solve an initial value problem in ordinary differential
9 C equations using an Adams-Bashforth method.
10 C***LIBRARY SLATEC (DEPAC)
11 C***CATEGORY I1A1B
12 C***TYPE DOUBLE PRECISION (DEABM-S, DDEABM-D)
13 C***KEYWORDS ADAMS-BASHFORTH METHOD, DEPAC, INITIAL VALUE PROBLEMS,
14 C ODE, ORDINARY DIFFERENTIAL EQUATIONS, PREDICTOR-CORRECTOR
15 C***AUTHOR Shampine, L. F., (SNLA)
16 C Watts, H. A., (SNLA)
17 C***DESCRIPTION
18 C
19 C This is the Adams code in the package of differential equation
20 C solvers DEPAC, consisting of the codes DDERKF, DDEABM, and DDEBDF.
21 C Design of the package was by L. F. Shampine and H. A. Watts.
22 C It is documented in
23 C SAND79-2374 , DEPAC - Design of a User Oriented Package of ODE
24 C Solvers.
25 C DDEABM is a driver for a modification of the code ODE written by
26 C L. F. Shampine and M. K. Gordon
27 C Sandia Laboratories
28 C Albuquerque, New Mexico 87185
29 C
30 C **********************************************************************
31 C * ABSTRACT *
32 C ************
33 C
34 C Subroutine DDEABM uses the Adams-Bashforth-Moulton
35 C Predictor-Corrector formulas of orders one through twelve to
36 C integrate a system of NEQ first order ordinary differential
37 C equations of the form
38 C DU/DX = DF(X,U)
39 C when the vector Y(*) of initial values for U(*) at X=T is given.
40 C The subroutine integrates from T to TOUT. It is easy to continue the
41 C integration to get results at additional TOUT. This is the interval
42 C mode of operation. It is also easy for the routine to return with
43 C the solution at each intermediate step on the way to TOUT. This is
44 C the intermediate-output mode of operation.
45 C
46 C DDEABM uses subprograms DDES, DSTEPS, DINTP, DHSTRT, DHVNRM,
47 C D1MACH, and the error handling routine XERMSG. The only machine
48 C dependent parameters to be assigned appear in D1MACH.
49 C
50 C **********************************************************************
51 C * Description of The Arguments To DDEABM (An Overview) *
52 C **********************************************************************
53 C
54 C The Parameters are
55 C
56 C DF -- This is the name of a subroutine which you provide to
57 C define the differential equations.
58 C
59 C NEQ -- This is the number of (first order) differential
60 C equations to be integrated.
61 C
62 C T -- This is a DOUBLE PRECISION value of the independent
63 C variable.
64 C
65 C Y(*) -- This DOUBLE PRECISION array contains the solution
66 C components at T.
67 C
68 C TOUT -- This is a DOUBLE PRECISION point at which a solution is
69 C desired.
70 C
71 C INFO(*) -- The basic task of the code is to integrate the
72 C differential equations from T to TOUT and return an
73 C answer at TOUT. INFO(*) is an INTEGER array which is used
74 C to communicate exactly how you want this task to be
75 C carried out.
76 C
77 C RTOL, ATOL -- These DOUBLE PRECISION quantities represent
78 C relative and absolute error tolerances which you
79 C provide to indicate how accurately you wish the
80 C solution to be computed. You may choose them to be
81 C both scalars or else both vectors.
82 C
83 C IDID -- This scalar quantity is an indicator reporting what
84 C the code did. You must monitor this INTEGER variable to
85 C decide what action to take next.
86 C
87 C RWORK(*), LRW -- RWORK(*) is a DOUBLE PRECISION work array of
88 C length LRW which provides the code with needed storage
89 C space.
90 C
91 C IWORK(*), LIW -- IWORK(*) is an INTEGER work array of length LIW
92 C which provides the code with needed storage space and an
93 C across call flag.
94 C
95 C RPAR, IPAR -- These are DOUBLE PRECISION and INTEGER parameter
96 C arrays which you can use for communication between your
97 C calling program and the DF subroutine.
98 C
99 C Quantities which are used as input items are
100 C NEQ, T, Y(*), TOUT, INFO(*),
101 C RTOL, ATOL, RWORK(1), LRW and LIW.
102 C
103 C Quantities which may be altered by the code are
104 C T, Y(*), INFO(1), RTOL, ATOL,
105 C IDID, RWORK(*) and IWORK(*).
106 C
107 C **********************************************************************
108 C * INPUT -- What To Do On The First Call To DDEABM *
109 C **********************************************************************
110 C
111 C The first call of the code is defined to be the start of each new
112 C problem. Read through the descriptions of all the following items,
113 C provide sufficient storage space for designated arrays, set
114 C appropriate variables for the initialization of the problem, and
115 C give information about how you want the problem to be solved.
116 C
117 C
118 C DF -- Provide a subroutine of the form
119 C DF(X,U,UPRIME,RPAR,IPAR)
120 C to define the system of first order differential equations
121 C which is to be solved. For the given values of X and the
122 C vector U(*)=(U(1),U(2),...,U(NEQ)) , the subroutine must
123 C evaluate the NEQ components of the system of differential
124 C equations DU/DX=DF(X,U) and store the derivatives in the
125 C array UPRIME(*), that is, UPRIME(I) = * DU(I)/DX * for
126 C equations I=1,...,NEQ.
127 C
128 C Subroutine DF must NOT alter X or U(*). You must declare
129 C the name df in an external statement in your program that
130 C calls DDEABM. You must dimension U and UPRIME in DF.
131 C
132 C RPAR and IPAR are DOUBLE PRECISION and INTEGER parameter
133 C arrays which you can use for communication between your
134 C calling program and subroutine DF. They are not used or
135 C altered by DDEABM. If you do not need RPAR or IPAR,
136 C ignore these parameters by treating them as dummy
137 C arguments. If you do choose to use them, dimension them in
138 C your calling program and in DF as arrays of appropriate
139 C length.
140 C
141 C NEQ -- Set it to the number of differential equations.
142 C (NEQ .GE. 1)
143 C
144 C T -- Set it to the initial point of the integration.
145 C You must use a program variable for T because the code
146 C changes its value.
147 C
148 C Y(*) -- Set this vector to the initial values of the NEQ solution
149 C components at the initial point. You must dimension Y at
150 C least NEQ in your calling program.
151 C
152 C TOUT -- Set it to the first point at which a solution
153 C is desired. You can take TOUT = T, in which case the code
154 C will evaluate the derivative of the solution at T and
155 C return. Integration either forward in T (TOUT .GT. T) or
156 C backward in T (TOUT .LT. T) is permitted.
157 C
158 C The code advances the solution from T to TOUT using
159 C step sizes which are automatically selected so as to
160 C achieve the desired accuracy. If you wish, the code will
161 C return with the solution and its derivative following
162 C each intermediate step (intermediate-output mode) so that
163 C you can monitor them, but you still must provide TOUT in
164 C accord with the basic aim of the code.
165 C
166 C The first step taken by the code is a critical one
167 C because it must reflect how fast the solution changes near
168 C the initial point. The code automatically selects an
169 C initial step size which is practically always suitable for
170 C the problem. By using the fact that the code will not step
171 C past TOUT in the first step, you could, if necessary,
172 C restrict the length of the initial step size.
173 C
174 C For some problems it may not be permissible to integrate
175 C past a point TSTOP because a discontinuity occurs there
176 C or the solution or its derivative is not defined beyond
177 C TSTOP. When you have declared a TSTOP point (see INFO(4)
178 C and RWORK(1)), you have told the code not to integrate
179 C past TSTOP. In this case any TOUT beyond TSTOP is invalid
180 C input.
181 C
182 C INFO(*) -- Use the INFO array to give the code more details about
183 C how you want your problem solved. This array should be
184 C dimensioned of length 15 to accommodate other members of
185 C DEPAC or possible future extensions, though DDEABM uses
186 C only the first four entries. You must respond to all of
187 C the following items which are arranged as questions. The
188 C simplest use of the code corresponds to answering all
189 C questions as YES ,i.e. setting ALL entries of INFO to 0.
190 C
191 C INFO(1) -- This parameter enables the code to initialize
192 C itself. You must set it to indicate the start of every
193 C new problem.
194 C
195 C **** Is this the first call for this problem ...
196 C YES -- set INFO(1) = 0
197 C NO -- not applicable here.
198 C See below for continuation calls. ****
199 C
200 C INFO(2) -- How much accuracy you want of your solution
201 C is specified by the error tolerances RTOL and ATOL.
202 C The simplest use is to take them both to be scalars.
203 C To obtain more flexibility, they can both be vectors.
204 C The code must be told your choice.
205 C
206 C **** Are both error tolerances RTOL, ATOL scalars ...
207 C YES -- set INFO(2) = 0
208 C and input scalars for both RTOL and ATOL
209 C NO -- set INFO(2) = 1
210 C and input arrays for both RTOL and ATOL ****
211 C
212 C INFO(3) -- The code integrates from T in the direction
213 C of TOUT by steps. If you wish, it will return the
214 C computed solution and derivative at the next
215 C intermediate step (the intermediate-output mode) or
216 C TOUT, whichever comes first. This is a good way to
217 C proceed if you want to see the behavior of the solution.
218 C If you must have solutions at a great many specific
219 C TOUT points, this code will compute them efficiently.
220 C
221 C **** Do you want the solution only at
222 C TOUT (and not at the next intermediate step) ...
223 C YES -- set INFO(3) = 0
224 C NO -- set INFO(3) = 1 ****
225 C
226 C INFO(4) -- To handle solutions at a great many specific
227 C values TOUT efficiently, this code may integrate past
228 C TOUT and interpolate to obtain the result at TOUT.
229 C Sometimes it is not possible to integrate beyond some
230 C point TSTOP because the equation changes there or it is
231 C not defined past TSTOP. Then you must tell the code
232 C not to go past.
233 C
234 C **** Can the integration be carried out without any
235 C Restrictions on the independent variable T ...
236 C YES -- set INFO(4)=0
237 C NO -- set INFO(4)=1
238 C and define the stopping point TSTOP by
239 C setting RWORK(1)=TSTOP ****
240 C
241 C RTOL, ATOL -- You must assign relative (RTOL) and absolute (ATOL)
242 C error tolerances to tell the code how accurately you want
243 C the solution to be computed. They must be defined as
244 C program variables because the code may change them. You
245 C have two choices --
246 C Both RTOL and ATOL are scalars. (INFO(2)=0)
247 C Both RTOL and ATOL are vectors. (INFO(2)=1)
248 C In either case all components must be non-negative.
249 C
250 C The tolerances are used by the code in a local error test
251 C at each step which requires roughly that
252 C ABS(LOCAL ERROR) .LE. RTOL*ABS(Y)+ATOL
253 C for each vector component.
254 C (More specifically, a Euclidean norm is used to measure
255 C the size of vectors, and the error test uses the magnitude
256 C of the solution at the beginning of the step.)
257 C
258 C The true (global) error is the difference between the true
259 C solution of the initial value problem and the computed
260 C approximation. Practically all present day codes,
261 C including this one, control the local error at each step
262 C and do not even attempt to control the global error
263 C directly. Roughly speaking, they produce a solution Y(T)
264 C which satisfies the differential equations with a
265 C residual R(T), DY(T)/DT = DF(T,Y(T)) + R(T) ,
266 C and, almost always, R(T) is bounded by the error
267 C tolerances. Usually, but not always, the true accuracy of
268 C the computed Y is comparable to the error tolerances. This
269 C code will usually, but not always, deliver a more accurate
270 C solution if you reduce the tolerances and integrate again.
271 C By comparing two such solutions you can get a fairly
272 C reliable idea of the true error in the solution at the
273 C bigger tolerances.
274 C
275 C Setting ATOL=0.D0 results in a pure relative error test on
276 C that component. Setting RTOL=0. results in a pure absolute
277 C error test on that component. A mixed test with non-zero
278 C RTOL and ATOL corresponds roughly to a relative error
279 C test when the solution component is much bigger than ATOL
280 C and to an absolute error test when the solution component
281 C is smaller than the threshold ATOL.
282 C
283 C Proper selection of the absolute error control parameters
284 C ATOL requires you to have some idea of the scale of the
285 C solution components. To acquire this information may mean
286 C that you will have to solve the problem more than once. In
287 C the absence of scale information, you should ask for some
288 C relative accuracy in all the components (by setting RTOL
289 C values non-zero) and perhaps impose extremely small
290 C absolute error tolerances to protect against the danger of
291 C a solution component becoming zero.
292 C
293 C The code will not attempt to compute a solution at an
294 C accuracy unreasonable for the machine being used. It will
295 C advise you if you ask for too much accuracy and inform
296 C you as to the maximum accuracy it believes possible.
297 C
298 C RWORK(*) -- Dimension this DOUBLE PRECISION work array of length
299 C LRW in your calling program.
300 C
301 C RWORK(1) -- If you have set INFO(4)=0, you can ignore this
302 C optional input parameter. Otherwise you must define a
303 C stopping point TSTOP by setting RWORK(1) = TSTOP.
304 C (for some problems it may not be permissible to integrate
305 C past a point TSTOP because a discontinuity occurs there
306 C or the solution or its derivative is not defined beyond
307 C TSTOP.)
308 C
309 C LRW -- Set it to the declared length of the RWORK array.
310 C You must have LRW .GE. 130+21*NEQ
311 C
312 C IWORK(*) -- Dimension this INTEGER work array of length LIW in
313 C your calling program.
314 C
315 C LIW -- Set it to the declared length of the IWORK array.
316 C You must have LIW .GE. 51
317 C
318 C RPAR, IPAR -- These are parameter arrays, of DOUBLE PRECISION and
319 C INTEGER type, respectively. You can use them for
320 C communication between your program that calls DDEABM and
321 C the DF subroutine. They are not used or altered by
322 C DDEABM. If you do not need RPAR or IPAR, ignore these
323 C parameters by treating them as dummy arguments. If you do
324 C choose to use them, dimension them in your calling program
325 C and in DF as arrays of appropriate length.
326 C
327 C **********************************************************************
328 C * OUTPUT -- After Any Return From DDEABM *
329 C **********************************************************************
330 C
331 C The principal aim of the code is to return a computed solution at
332 C TOUT, although it is also possible to obtain intermediate results
333 C along the way. To find out whether the code achieved its goal
334 C or if the integration process was interrupted before the task was
335 C completed, you must check the IDID parameter.
336 C
337 C
338 C T -- The solution was successfully advanced to the
339 C output value of T.
340 C
341 C Y(*) -- Contains the computed solution approximation at T.
342 C You may also be interested in the approximate derivative
343 C of the solution at T. It is contained in
344 C RWORK(21),...,RWORK(20+NEQ).
345 C
346 C IDID -- Reports what the code did
347 C
348 C *** Task Completed ***
349 C Reported by positive values of IDID
350 C
351 C IDID = 1 -- A step was successfully taken in the
352 C intermediate-output mode. The code has not
353 C yet reached TOUT.
354 C
355 C IDID = 2 -- The integration to TOUT was successfully
356 C completed (T=TOUT) by stepping exactly to TOUT.
357 C
358 C IDID = 3 -- The integration to TOUT was successfully
359 C completed (T=TOUT) by stepping past TOUT.
360 C Y(*) is obtained by interpolation.
361 C
362 C *** Task Interrupted ***
363 C Reported by negative values of IDID
364 C
365 C IDID = -1 -- A large amount of work has been expended.
366 C (500 steps attempted)
367 C
368 C IDID = -2 -- The error tolerances are too stringent.
369 C
370 C IDID = -3 -- The local error test cannot be satisfied
371 C because you specified a zero component in ATOL
372 C and the corresponding computed solution
373 C component is zero. Thus, a pure relative error
374 C test is impossible for this component.
375 C
376 C IDID = -4 -- The problem appears to be stiff.
377 C
378 C IDID = -5,-6,-7,..,-32 -- Not applicable for this code
379 C but used by other members of DEPAC or possible
380 C future extensions.
381 C
382 C *** Task Terminated ***
383 C Reported by the value of IDID=-33
384 C
385 C IDID = -33 -- The code has encountered trouble from which
386 C it cannot recover. A message is printed
387 C explaining the trouble and control is returned
388 C to the calling program. For example, this occurs
389 C when invalid input is detected.
390 C
391 C RTOL, ATOL -- These quantities remain unchanged except when
392 C IDID = -2. In this case, the error tolerances have been
393 C increased by the code to values which are estimated to be
394 C appropriate for continuing the integration. However, the
395 C reported solution at T was obtained using the input values
396 C of RTOL and ATOL.
397 C
398 C RWORK, IWORK -- Contain information which is usually of no
399 C interest to the user but necessary for subsequent calls.
400 C However, you may find use for
401 C
402 C RWORK(11)--which contains the step size H to be
403 C attempted on the next step.
404 C
405 C RWORK(12)--if the tolerances have been increased by the
406 C code (IDID = -2) , they were multiplied by the
407 C value in RWORK(12).
408 C
409 C RWORK(13)--Which contains the current value of the
410 C independent variable, i.e. the farthest point
411 C integration has reached. This will be different
412 C from T only when interpolation has been
413 C performed (IDID=3).
414 C
415 C RWORK(20+I)--Which contains the approximate derivative
416 C of the solution component Y(I). In DDEABM, it
417 C is obtained by calling subroutine DF to
418 C evaluate the differential equation using T and
419 C Y(*) when IDID=1 or 2, and by interpolation
420 C when IDID=3.
421 C
422 C **********************************************************************
423 C * INPUT -- What To Do To Continue The Integration *
424 C * (calls after the first) *
425 C **********************************************************************
426 C
427 C This code is organized so that subsequent calls to continue the
428 C integration involve little (if any) additional effort on your
429 C part. You must monitor the IDID parameter in order to determine
430 C what to do next.
431 C
432 C Recalling that the principal task of the code is to integrate
433 C from T to TOUT (the interval mode), usually all you will need
434 C to do is specify a new TOUT upon reaching the current TOUT.
435 C
436 C Do not alter any quantity not specifically permitted below,
437 C in particular do not alter NEQ, T, Y(*), RWORK(*), IWORK(*) or
438 C the differential equation in subroutine DF. Any such alteration
439 C constitutes a new problem and must be treated as such, i.e.
440 C you must start afresh.
441 C
442 C You cannot change from vector to scalar error control or vice
443 C versa (INFO(2)) but you can change the size of the entries of
444 C RTOL, ATOL. Increasing a tolerance makes the equation easier
445 C to integrate. Decreasing a tolerance will make the equation
446 C harder to integrate and should generally be avoided.
447 C
448 C You can switch from the intermediate-output mode to the
449 C interval mode (INFO(3)) or vice versa at any time.
450 C
451 C If it has been necessary to prevent the integration from going
452 C past a point TSTOP (INFO(4), RWORK(1)), keep in mind that the
453 C code will not integrate to any TOUT beyond the currently
454 C specified TSTOP. Once TSTOP has been reached you must change
455 C the value of TSTOP or set INFO(4)=0. You may change INFO(4)
456 C or TSTOP at any time but you must supply the value of TSTOP in
457 C RWORK(1) whenever you set INFO(4)=1.
458 C
459 C The parameter INFO(1) is used by the code to indicate the
460 C beginning of a new problem and to indicate whether integration
461 C is to be continued. You must input the value INFO(1) = 0
462 C when starting a new problem. You must input the value
463 C INFO(1) = 1 if you wish to continue after an interrupted task.
464 C Do not set INFO(1) = 0 on a continuation call unless you
465 C want the code to restart at the current T.
466 C
467 C *** Following A Completed Task ***
468 C If
469 C IDID = 1, call the code again to continue the integration
470 C another step in the direction of TOUT.
471 C
472 C IDID = 2 or 3, define a new TOUT and call the code again.
473 C TOUT must be different from T. You cannot change
474 C the direction of integration without restarting.
475 C
476 C *** Following An Interrupted Task ***
477 C To show the code that you realize the task was
478 C interrupted and that you want to continue, you
479 C must take appropriate action and reset INFO(1) = 1
480 C If
481 C IDID = -1, the code has attempted 500 steps.
482 C If you want to continue, set INFO(1) = 1 and
483 C call the code again. An additional 500 steps
484 C will be allowed.
485 C
486 C IDID = -2, the error tolerances RTOL, ATOL have been
487 C increased to values the code estimates appropriate
488 C for continuing. You may want to change them
489 C yourself. If you are sure you want to continue
490 C with relaxed error tolerances, set INFO(1)=1 and
491 C call the code again.
492 C
493 C IDID = -3, a solution component is zero and you set the
494 C corresponding component of ATOL to zero. If you
495 C are sure you want to continue, you must first
496 C alter the error criterion to use positive values
497 C for those components of ATOL corresponding to zero
498 C solution components, then set INFO(1)=1 and call
499 C the code again.
500 C
501 C IDID = -4, the problem appears to be stiff. It is very
502 C inefficient to solve such problems with DDEABM.
503 C The code DDEBDF in DEPAC handles this task
504 C efficiently. If you are absolutely sure you want
505 C to continue with DDEABM, set INFO(1)=1 and call
506 C the code again.
507 C
508 C IDID = -5,-6,-7,..,-32 --- cannot occur with this code
509 C but used by other members of DEPAC or possible
510 C future extensions.
511 C
512 C *** Following A Terminated Task ***
513 C If
514 C IDID = -33, you cannot continue the solution of this
515 C problem. An attempt to do so will result in your
516 C run being terminated.
517 C
518 C **********************************************************************
519 C *Long Description:
520 C
521 C **********************************************************************
522 C * DEPAC Package Overview *
523 C **********************************************************************
524 C
525 C .... You have a choice of three differential equation solvers from
526 C .... DEPAC. The following brief descriptions are meant to aid you in
527 C .... choosing the most appropriate code for your problem.
528 C
529 C .... DDERKF is a fifth order Runge-Kutta code. It is the simplest of
530 C .... the three choices, both algorithmically and in the use of the
531 C .... code. DDERKF is primarily designed to solve non-stiff and
532 C .... mildly stiff differential equations when derivative evaluations
533 C .... are not expensive. It should generally not be used to get high
534 C .... accuracy results nor answers at a great many specific points.
535 C .... Because DDERKF has very low overhead costs, it will usually
536 C .... result in the least expensive integration when solving
537 C .... problems requiring a modest amount of accuracy and having
538 C .... equations that are not costly to evaluate. DDERKF attempts to
539 C .... discover when it is not suitable for the task posed.
540 C
541 C .... DDEABM is a variable order (one through twelve) Adams code.
542 C .... Its complexity lies somewhere between that of DDERKF and
543 C .... DDEBDF. DDEABM is primarily designed to solve non-stiff and
544 C .... mildly stiff differential equations when derivative evaluations
545 C .... are expensive, high accuracy results are needed or answers at
546 C .... many specific points are required. DDEABM attempts to discover
547 C .... when it is not suitable for the task posed.
548 C
549 C .... DDEBDF is a variable order (one through five) backward
550 C .... differentiation formula code. it is the most complicated of
551 C .... the three choices. DDEBDF is primarily designed to solve stiff
552 C .... differential equations at crude to moderate tolerances.
553 C .... If the problem is very stiff at all, DDERKF and DDEABM will be
554 C .... quite inefficient compared to DDEBDF. However, DDEBDF will be
555 C .... inefficient compared to DDERKF and DDEABM on non-stiff problems
556 C .... because it uses much more storage, has a much larger overhead,
557 C .... and the low order formulas will not give high accuracies
558 C .... efficiently.
559 C
560 C .... The concept of stiffness cannot be described in a few words.
561 C .... If you do not know the problem to be stiff, try either DDERKF
562 C .... or DDEABM. Both of these codes will inform you of stiffness
563 C .... when the cost of solving such problems becomes important.
564 C
565 C *********************************************************************
566 C
567 C***REFERENCES L. F. Shampine and H. A. Watts, DEPAC - design of a user
568 C oriented package of ODE solvers, Report SAND79-2374,
569 C Sandia Laboratories, 1979.
570 C***ROUTINES CALLED DDES, XERMSG
571 C***REVISION HISTORY (YYMMDD)
572 C 820301 DATE WRITTEN
573 C 890531 Changed all specific intrinsics to generic. (WRB)
574 C 890831 Modified array declarations. (WRB)
575 C 891006 Cosmetic changes to prologue. (WRB)
576 C 891024 Changed references from DVNORM to DHVNRM. (WRB)
577 C 891024 REVISION DATE from Version 3.2
578 C 891214 Prologue converted to Version 4.0 format. (BAB)
579 C 900510 Convert XERRWV calls to XERMSG calls. (RWC)
580 C 920501 Reformatted the REFERENCES section. (WRB)
581 C***END PROLOGUE DDEABM
582 C
583  INTEGER ialpha, ibeta, idelsn, idid, ifouru, ig, ihold,
584  1 info, ip, ipar, iphi, ipsi, isig, itold, itstar, itwou,
585  2 iv, iw, iwork, iwt, iyp, iypout, iyy, liw, lrw, neq
586  DOUBLE PRECISION atol, rpar, rtol, rwork, t, tout, y
587  LOGICAL start,phase1,nornd,stiff,intout
588 C
589  dimension y(*),info(15),rtol(*),atol(*),rwork(*),iwork(*),
590  1 rpar(*),ipar(*)
591 C
592  CHARACTER*8 xern1
593  CHARACTER*16 xern3
594 C
595  EXTERNAL df
596 C
597 C CHECK FOR AN APPARENT INFINITE LOOP
598 C
599 C***FIRST EXECUTABLE STATEMENT DDEABM
600  IF ( info(1) .EQ. 0 ) iwork(liw) = 0
601  IF (iwork(liw) .GE. 5) THEN
602  IF (t .EQ. rwork(21 + neq)) THEN
603  WRITE (xern3, '(1PE15.6)') t
604  CALL xermsg ('SLATEC', 'DDEABM',
605  * 'AN APPARENT INFINITE LOOP HAS BEEN DETECTED.$$' //
606  * 'YOU HAVE MADE REPEATED CALLS AT T = ' // xern3 //
607  * ' AND THE INTEGRATION HAS NOT ADVANCED. CHECK THE ' //
608  * 'WAY YOU HAVE SET PARAMETERS FOR THE CALL TO THE ' //
609  * 'CODE, PARTICULARLY INFO(1).', 13, 2)
610  RETURN
611  ENDIF
612  ENDIF
613 C
614 C CHECK LRW AND LIW FOR SUFFICIENT STORAGE ALLOCATION
615 C
616  idid=0
617  IF (lrw .LT. 130+21*neq) THEN
618  WRITE (xern1, '(I8)') lrw
619  CALL xermsg ('SLATEC', 'DDEABM', 'THE LENGTH OF THE RWORK ' //
620  * 'ARRAY MUST BE AT LEAST 130 + 21*NEQ.$$' //
621  * 'YOU HAVE CALLED THE CODE WITH LRW = ' // xern1, 1, 1)
622  idid=-33
623  ENDIF
624 C
625  IF (liw .LT. 51) THEN
626  WRITE (xern1, '(I8)') liw
627  CALL xermsg ('SLATEC', 'DDEABM', 'THE LENGTH OF THE IWORK ' //
628  * 'ARRAY MUST BE AT LEAST 51.$$YOU HAVE CALLED THE CODE ' //
629  * 'WITH LIW = ' // xern1, 2, 1)
630  idid=-33
631  ENDIF
632 C
633 C COMPUTE THE INDICES FOR THE ARRAYS TO BE STORED IN THE WORK ARRAY
634 C
635  iypout = 21
636  itstar = neq + 21
637  iyp = 1 + itstar
638  iyy = neq + iyp
639  iwt = neq + iyy
640  ip = neq + iwt
641  iphi = neq + ip
642  ialpha = (neq*16) + iphi
643  ibeta = 12 + ialpha
644  ipsi = 12 + ibeta
645  iv = 12 + ipsi
646  iw = 12 + iv
647  isig = 12 + iw
648  ig = 13 + isig
649  igi = 13 + ig
650  ixold = 11 + igi
651  ihold = 1 + ixold
652  itold = 1 + ihold
653  idelsn = 1 + itold
654  itwou = 1 + idelsn
655  ifouru = 1 + itwou
656 C
657  rwork(itstar) = t
658  IF (info(1) .EQ. 0) GO TO 50
659  start = iwork(21) .NE. (-1)
660  phase1 = iwork(22) .NE. (-1)
661  nornd = iwork(23) .NE. (-1)
662  stiff = iwork(24) .NE. (-1)
663  intout = iwork(25) .NE. (-1)
664 C
665  50 CALL ddes(df,neq,t,y,tout,info,rtol,atol,idid,rwork(iypout),
666  1 rwork(iyp),rwork(iyy),rwork(iwt),rwork(ip),rwork(iphi),
667  2 rwork(ialpha),rwork(ibeta),rwork(ipsi),rwork(iv),
668  3 rwork(iw),rwork(isig),rwork(ig),rwork(igi),rwork(11),
669  4 rwork(12),rwork(13),rwork(ixold),rwork(ihold),
670  5 rwork(itold),rwork(idelsn),rwork(1),rwork(itwou),
671  5 rwork(ifouru),start,phase1,nornd,stiff,intout,iwork(26),
672  6 iwork(27),iwork(28),iwork(29),iwork(30),iwork(31),
673  7 iwork(32),iwork(33),iwork(34),iwork(35),iwork(45),
674  8 rpar,ipar)
675 C
676  iwork(21) = -1
677  IF (start) iwork(21) = 1
678  iwork(22) = -1
679  IF (phase1) iwork(22) = 1
680  iwork(23) = -1
681  IF (nornd) iwork(23) = 1
682  iwork(24) = -1
683  IF (stiff) iwork(24) = 1
684  iwork(25) = -1
685  IF (intout) iwork(25) = 1
686 C
687  IF (idid .NE. (-2)) iwork(liw) = iwork(liw) + 1
688  IF (t .NE. rwork(itstar)) iwork(liw) = 0
689 C
690  RETURN
subroutine df(x, u, uprime, rpar, nev)
Definition: subspace.f:133
subroutine xermsg(LIBRAR, SUBROU, MESSG, NERR, LEVEL)
Definition: ddeabm.f:1265
subroutine ddes(DF, NEQ, T, Y, TOUT, INFO, RTOL, ATOL, IDID, YPOUT, YP, YY, WT, P, PHI, ALPHA, BETA, PSI, V, W, SIG, G, GI, H, EPS, X, XOLD, HOLD, TOLD, DELSGN, TSTOP, TWOU, FOURU, START, PHASE1, NORND, STIFF, INTOUT, NS, KORD, KOLD, INIT, KSTEPS, KLE4, IQUIT, KPREV, IVC, IV, KGI, RPAR, IPAR)
Definition: ddeabm.f:698

◆ ddes()

subroutine ddes ( external  DF,
integer  NEQ,
double precision  T,
double precision, dimension(*)  Y,
double precision  TOUT,
integer, dimension(15)  INFO,
double precision, dimension(*)  RTOL,
double precision, dimension(*)  ATOL,
integer  IDID,
double precision, dimension(*)  YPOUT,
double precision, dimension(*)  YP,
double precision, dimension(*)  YY,
double precision, dimension(*)  WT,
double precision, dimension(*)  P,
double precision, dimension(neq,16)  PHI,
double precision, dimension(12)  ALPHA,
double precision, dimension(12)  BETA,
double precision, dimension(12)  PSI,
double precision, dimension(12)  V,
double precision, dimension(12)  W,
double precision, dimension(13)  SIG,
double precision, dimension(13)  G,
double precision, dimension(11)  GI,
double precision  H,
double precision  EPS,
double precision  X,
double precision  XOLD,
double precision  HOLD,
double precision  TOLD,
double precision  DELSGN,
double precision  TSTOP,
double precision  TWOU,
double precision  FOURU,
logical  START,
logical  PHASE1,
logical  NORND,
logical  STIFF,
logical  INTOUT,
integer  NS,
integer  KORD,
integer  KOLD,
integer  INIT,
integer  KSTEPS,
integer  KLE4,
integer  IQUIT,
integer  KPREV,
integer  IVC,
integer, dimension(10)  IV,
integer  KGI,
double precision, dimension(*)  RPAR,
integer, dimension(*)  IPAR 
)
698 C***BEGIN PROLOGUE DDES
699 C***SUBSIDIARY
700 C***PURPOSE Subsidiary to DDEABM
701 C***LIBRARY SLATEC
702 C***TYPE DOUBLE PRECISION (DES-S, DDES-D)
703 C***AUTHOR Watts, H. A., (SNLA)
704 C***DESCRIPTION
705 C
706 C DDEABM merely allocates storage for DDES to relieve the user of the
707 C inconvenience of a long call list. Consequently DDES is used as
708 C described in the comments for DDEABM .
709 C
710 C***SEE ALSO DDEABM
711 C***ROUTINES CALLED D1MACH, DINTP, DSTEPS, XERMSG
712 C***REVISION HISTORY (YYMMDD)
713 C 820301 DATE WRITTEN
714 C 890531 Changed all specific intrinsics to generic. (WRB)
715 C 890831 Modified array declarations. (WRB)
716 C 891214 Prologue converted to Version 4.0 format. (BAB)
717 C 900328 Added TYPE section. (WRB)
718 C 900510 Convert XERRWV calls to XERMSG calls, cvt GOTOs to
719 C IF-THEN-ELSE. (RWC)
720 C 910722 Updated AUTHOR section. (ALS)
721 C***END PROLOGUE DDES
722 C
723  INTEGER idid, info, init, ipar, iquit, iv, ivc, k, kgi, kle4,
724  1 kold, kord, kprev, ksteps, l, ltol, maxnum, natolp, neq,
725  2 nrtolp, ns
726  DOUBLE PRECISION a, absdel, alpha, atol, beta, d1mach,
727  1 del, delsgn, dt, eps, fouru, g, gi, h,
728  2 ha, hold, p, phi, psi, rpar, rtol, sig, t, told, tout,
729  3 tstop, twou, u, v, w, wt, x, xold, y, yp, ypout, yy
730  LOGICAL stiff,crash,start,phase1,nornd,intout
731 C
732  dimension y(*),yy(*),wt(*),phi(neq,16),p(*),yp(*),
733  1 ypout(*),psi(12),alpha(12),beta(12),sig(13),v(12),w(12),g(13),
734  2 gi(11),iv(10),info(15),rtol(*),atol(*),rpar(*),ipar(*)
735  CHARACTER*8 xern1
736  CHARACTER*16 xern3, xern4
737 C
738  EXTERNAL df
739 C
740 C.......................................................................
741 C
742 C THE EXPENSE OF SOLVING THE PROBLEM IS MONITORED BY COUNTING THE
743 C NUMBER OF STEPS ATTEMPTED. WHEN THIS EXCEEDS MAXNUM, THE COUNTER
744 C IS RESET TO ZERO AND THE USER IS INFORMED ABOUT POSSIBLE EXCESSIVE
745 C WORK.
746 C
747  SAVE maxnum
748  DATA maxnum/500/
749 C
750 C.......................................................................
751 C
752 C***FIRST EXECUTABLE STATEMENT DDES
753  IF (info(1) .EQ. 0) THEN
754 C
755 C ON THE FIRST CALL , PERFORM INITIALIZATION --
756 C DEFINE THE MACHINE UNIT ROUNDOFF QUANTITY U BY CALLING THE
757 C FUNCTION ROUTINE D1MACH. THE USER MUST MAKE SURE THAT THE
758 C VALUES SET IN D1MACH ARE RELEVANT TO THE COMPUTER BEING USED.
759 C
760  u=d1mach(4)
761 C -- SET ASSOCIATED MACHINE DEPENDENT PARAMETERS
762  twou=2.d0*u
763  fouru=4.d0*u
764 C -- SET TERMINATION FLAG
765  iquit=0
766 C -- SET INITIALIZATION INDICATOR
767  init=0
768 C -- SET COUNTER FOR ATTEMPTED STEPS
769  ksteps=0
770 C -- SET INDICATOR FOR INTERMEDIATE-OUTPUT
771  intout= .false.
772 C -- SET INDICATOR FOR STIFFNESS DETECTION
773  stiff= .false.
774 C -- SET STEP COUNTER FOR STIFFNESS DETECTION
775  kle4=0
776 C -- SET INDICATORS FOR STEPS CODE
777  start= .true.
778  phase1= .true.
779  nornd= .true.
780 C -- RESET INFO(1) FOR SUBSEQUENT CALLS
781  info(1)=1
782  ENDIF
783 C
784 C.......................................................................
785 C
786 C CHECK VALIDITY OF INPUT PARAMETERS ON EACH ENTRY
787 C
788  IF (info(1) .NE. 0 .AND. info(1) .NE. 1) THEN
789  WRITE (xern1, '(I8)') info(1)
790  CALL xermsg ('SLATEC', 'DDES', 'IN DDEABM, INFO(1) MUST BE ' //
791  * 'SET TO 0 FOR THE START OF A NEW PROBLEM, AND MUST BE ' //
792  * 'SET TO 1 FOLLOWING AN INTERRUPTED TASK. YOU ARE ' //
793  * 'ATTEMPTING TO CONTINUE THE INTEGRATION ILLEGALLY BY ' //
794  * 'CALLING THE CODE WITH INFO(1) = ' // xern1, 3, 1)
795  idid=-33
796  ENDIF
797 C
798  IF (info(2) .NE. 0 .AND. info(2) .NE. 1) THEN
799  WRITE (xern1, '(I8)') info(2)
800  CALL xermsg ('SLATEC', 'DDES', 'IN DDEABM, INFO(2) MUST BE ' //
801  * '0 OR 1 INDICATING SCALAR AND VECTOR ERROR TOLERANCES, ' //
802  * 'RESPECTIVELY. YOU HAVE CALLED THE CODE WITH INFO(2) = ' //
803  * xern1, 4, 1)
804  idid=-33
805  ENDIF
806 C
807  IF (info(3) .NE. 0 .AND. info(3) .NE. 1) THEN
808  WRITE (xern1, '(I8)') info(3)
809  CALL xermsg ('SLATEC', 'DDES', 'IN DDEABM, INFO(3) MUST BE ' //
810  * '0 OR 1 INDICATING THE INTERVAL OR INTERMEDIATE-OUTPUT ' //
811  * 'MODE OF INTEGRATION, RESPECTIVELY. YOU HAVE CALLED ' //
812  * 'THE CODE WITH INFO(3) = ' // xern1, 5, 1)
813  idid=-33
814  ENDIF
815 C
816  IF (info(4) .NE. 0 .AND. info(4) .NE. 1) THEN
817  WRITE (xern1, '(I8)') info(4)
818  CALL xermsg ('SLATEC', 'DDES', 'IN DDEABM, INFO(4) MUST BE ' //
819  * '0 OR 1 INDICATING WHETHER OR NOT THE INTEGRATION ' //
820  * 'INTERVAL IS TO BE RESTRICTED BY A POINT TSTOP. YOU ' //
821  * 'HAVE CALLED THE CODE WITH INFO(4) = ' // xern1, 14, 1)
822  idid=-33
823  ENDIF
824 C
825  IF (neq .LT. 1) THEN
826  WRITE (xern1, '(I8)') neq
827  CALL xermsg ('SLATEC', 'DDES', 'IN DDEABM, THE NUMBER OF ' //
828  * 'EQUATIONS NEQ MUST BE A POSITIVE INTEGER. YOU HAVE ' //
829  * 'CALLED THE CODE WITH NEQ = ' // xern1, 6, 1)
830  idid=-33
831  ENDIF
832 C
833  nrtolp = 0
834  natolp = 0
835  DO 90 k=1,neq
836  IF (nrtolp .EQ. 0 .AND. rtol(k) .LT. 0.d0) THEN
837  WRITE (xern1, '(I8)') k
838  WRITE (xern3, '(1PE15.6)') rtol(k)
839  CALL xermsg ('SLATEC', 'DDES', 'IN DDEABM, THE RELATIVE ' //
840  * 'ERROR TOLERANCES RTOL MUST BE NON-NEGATIVE. YOU ' //
841  * 'HAVE CALLED THE CODE WITH RTOL(' // xern1 // ') = ' //
842  * xern3 // '. IN THE CASE OF VECTOR ERROR TOLERANCES, ' //
843  * 'NO FURTHER CHECKING OF RTOL COMPONENTS IS DONE.', 7, 1)
844  idid = -33
845  nrtolp = 1
846  ENDIF
847 C
848  IF (natolp .EQ. 0 .AND. atol(k) .LT. 0.d0) THEN
849  WRITE (xern1, '(I8)') k
850  WRITE (xern3, '(1PE15.6)') atol(k)
851  CALL xermsg ('SLATEC', 'DDES', 'IN DDEABM, THE ABSOLUTE ' //
852  * 'ERROR TOLERANCES ATOL MUST BE NON-NEGATIVE. YOU ' //
853  * 'HAVE CALLED THE CODE WITH ATOL(' // xern1 // ') = ' //
854  * xern3 // '. IN THE CASE OF VECTOR ERROR TOLERANCES, ' //
855  * 'NO FURTHER CHECKING OF ATOL COMPONENTS IS DONE.', 8, 1)
856  idid = -33
857  natolp = 1
858  ENDIF
859 C
860  IF (info(2) .EQ. 0) GO TO 100
861  IF (natolp.GT.0 .AND. nrtolp.GT.0) GO TO 100
862  90 CONTINUE
863 C
864  100 IF (info(4) .EQ. 1) THEN
865  IF (sign(1.d0,tout-t) .NE. sign(1.d0,tstop-t)
866  1 .OR. abs(tout-t) .GT. abs(tstop-t)) THEN
867  WRITE (xern3, '(1PE15.6)') tout
868  WRITE (xern4, '(1PE15.6)') tstop
869  CALL xermsg ('SLATEC', 'DDES', 'IN DDEABM, YOU HAVE ' //
870  * 'CALLED THE CODE WITH TOUT = ' // xern3 // ' BUT ' //
871  * 'YOU HAVE ALSO TOLD THE CODE (INFO(4) = 1) NOT TO ' //
872  * 'INTEGRATE PAST THE POINT TSTOP = ' // xern4 //
873  * ' THESE INSTRUCTIONS CONFLICT.', 14, 1)
874  idid=-33
875  ENDIF
876  ENDIF
877 C
878 C CHECK SOME CONTINUATION POSSIBILITIES
879 C
880  IF (init .NE. 0) THEN
881  IF (t .EQ. tout) THEN
882  WRITE (xern3, '(1PE15.6)') t
883  CALL xermsg ('SLATEC', 'DDES', 'IN DDEABM, YOU HAVE ' //
884  * 'CALLED THE CODE WITH T = TOUT = ' // xern3 //
885  * '$$THIS IS NOT ALLOWED ON CONTINUATION CALLS.', 9, 1)
886  idid=-33
887  ENDIF
888 C
889  IF (t .NE. told) THEN
890  WRITE (xern3, '(1PE15.6)') told
891  WRITE (xern4, '(1PE15.6)') t
892  CALL xermsg ('SLATEC', 'DDES', 'IN DDEABM, YOU HAVE ' //
893  * 'CHANGED THE VALUE OF T FROM ' // xern3 // ' TO ' //
894  * xern4 //' THIS IS NOT ALLOWED ON CONTINUATION CALLS.',
895  * 10, 1)
896  idid=-33
897  ENDIF
898 C
899  IF (init .NE. 1) THEN
900  IF (delsgn*(tout-t) .LT. 0.d0) THEN
901  WRITE (xern3, '(1PE15.6)') tout
902  CALL xermsg ('SLATEC', 'DDES', 'IN DDEABM, BY ' //
903  * 'CALLING THE CODE WITH TOUT = ' // xern3 //
904  * ' YOU ARE ATTEMPTING TO CHANGE THE DIRECTION OF ' //
905  * 'INTEGRATION.$$THIS IS NOT ALLOWED WITHOUT ' //
906  * 'RESTARTING.', 11, 1)
907  idid=-33
908  ENDIF
909  ENDIF
910  ENDIF
911 C
912 C INVALID INPUT DETECTED
913 C
914  IF (idid .EQ. (-33)) THEN
915  IF (iquit .NE. (-33)) THEN
916  iquit = -33
917  info(1) = -1
918  ELSE
919  CALL xermsg ('SLATEC', 'DDES', 'IN DDEABM, INVALID ' //
920  * 'INPUT WAS DETECTED ON SUCCESSIVE ENTRIES. IT IS ' //
921  * 'IMPOSSIBLE TO PROCEED BECAUSE YOU HAVE NOT ' //
922  * 'CORRECTED THE PROBLEM, SO EXECUTION IS BEING ' //
923  * 'TERMINATED.', 12, 2)
924  ENDIF
925  RETURN
926  ENDIF
927 C
928 C.......................................................................
929 C
930 C RTOL = ATOL = 0. IS ALLOWED AS VALID INPUT AND INTERPRETED AS
931 C ASKING FOR THE MOST ACCURATE SOLUTION POSSIBLE. IN THIS CASE,
932 C THE RELATIVE ERROR TOLERANCE RTOL IS RESET TO THE SMALLEST VALUE
933 C FOURU WHICH IS LIKELY TO BE REASONABLE FOR THIS METHOD AND MACHINE
934 C
935  DO 180 k=1,neq
936  IF (rtol(k)+atol(k) .GT. 0.d0) GO TO 170
937  rtol(k)=fouru
938  idid=-2
939  170 IF (info(2) .EQ. 0) GO TO 190
940  180 CONTINUE
941 C
942  190 IF (idid .NE. (-2)) GO TO 200
943 C RTOL=ATOL=0 ON INPUT, SO RTOL IS CHANGED TO A
944 C SMALL POSITIVE VALUE
945  info(1)=-1
946  RETURN
947 C
948 C BRANCH ON STATUS OF INITIALIZATION INDICATOR
949 C INIT=0 MEANS INITIAL DERIVATIVES AND NOMINAL STEP SIZE
950 C AND DIRECTION NOT YET SET
951 C INIT=1 MEANS NOMINAL STEP SIZE AND DIRECTION NOT YET SET
952 C INIT=2 MEANS NO FURTHER INITIALIZATION REQUIRED
953 C
954  200 IF (init .EQ. 0) GO TO 210
955  IF (init .EQ. 1) GO TO 220
956  GO TO 240
957 C
958 C.......................................................................
959 C
960 C MORE INITIALIZATION --
961 C -- EVALUATE INITIAL DERIVATIVES
962 C
963  210 init=1
964  a=t
965  CALL df(a,y,yp,rpar,ipar)
966  IF (t .NE. tout) GO TO 220
967  idid=2
968  DO 215 l = 1,neq
969  215 ypout(l) = yp(l)
970  told=t
971  RETURN
972 C
973 C -- SET INDEPENDENT AND DEPENDENT VARIABLES
974 C X AND YY(*) FOR STEPS
975 C -- SET SIGN OF INTEGRATION DIRECTION
976 C -- INITIALIZE THE STEP SIZE
977 C
978  220 init = 2
979  x = t
980  DO 230 l = 1,neq
981  230 yy(l) = y(l)
982  delsgn = sign(1.0d0,tout-t)
983  h = sign(max(fouru*abs(x),abs(tout-x)),tout-x)
984 C
985 C.......................................................................
986 C
987 C ON EACH CALL SET INFORMATION WHICH DETERMINES THE ALLOWED INTERVAL
988 C OF INTEGRATION BEFORE RETURNING WITH AN ANSWER AT TOUT
989 C
990  240 del = tout - t
991  absdel = abs(del)
992 C
993 C.......................................................................
994 C
995 C IF ALREADY PAST OUTPUT POINT, INTERPOLATE AND RETURN
996 C
997  250 IF(abs(x-t) .LT. absdel) GO TO 260
998  CALL dintp(x,yy,tout,y,ypout,neq,kold,phi,ivc,iv,kgi,gi,
999  1 alpha,g,w,xold,p)
1000  idid = 3
1001  IF (x .NE. tout) GO TO 255
1002  idid = 2
1003  intout = .false.
1004  255 t = tout
1005  told = t
1006  RETURN
1007 C
1008 C IF CANNOT GO PAST TSTOP AND SUFFICIENTLY CLOSE,
1009 C EXTRAPOLATE AND RETURN
1010 C
1011  260 IF (info(4) .NE. 1) GO TO 280
1012  IF (abs(tstop-x) .GE. fouru*abs(x)) GO TO 280
1013  dt = tout - x
1014  DO 270 l = 1,neq
1015  270 y(l) = yy(l) + dt*yp(l)
1016  CALL df(tout,y,ypout,rpar,ipar)
1017  idid = 3
1018  t = tout
1019  told = t
1020  RETURN
1021 C
1022  280 IF (info(3) .EQ. 0 .OR. .NOT.intout) GO TO 300
1023 C
1024 C INTERMEDIATE-OUTPUT MODE
1025 C
1026  idid = 1
1027  DO 290 l = 1,neq
1028  y(l)=yy(l)
1029  290 ypout(l) = yp(l)
1030  t = x
1031  told = t
1032  intout = .false.
1033  RETURN
1034 C
1035 C.......................................................................
1036 C
1037 C MONITOR NUMBER OF STEPS ATTEMPTED
1038 C
1039  300 IF (ksteps .LE. maxnum) GO TO 330
1040 C
1041 C A SIGNIFICANT AMOUNT OF WORK HAS BEEN EXPENDED
1042  idid=-1
1043  ksteps=0
1044  IF (.NOT. stiff) GO TO 310
1045 C
1046 C PROBLEM APPEARS TO BE STIFF
1047  idid=-4
1048  stiff= .false.
1049  kle4=0
1050 C
1051  310 DO 320 l = 1,neq
1052  y(l) = yy(l)
1053  320 ypout(l) = yp(l)
1054  t = x
1055  told = t
1056  info(1) = -1
1057  intout = .false.
1058  RETURN
1059 C
1060 C.......................................................................
1061 C
1062 C LIMIT STEP SIZE, SET WEIGHT VECTOR AND TAKE A STEP
1063 C
1064  330 ha = abs(h)
1065  IF (info(4) .NE. 1) GO TO 340
1066  ha = min(ha,abs(tstop-x))
1067  340 h = sign(ha,h)
1068  eps = 1.0d0
1069  ltol = 1
1070  DO 350 l = 1,neq
1071  IF (info(2) .EQ. 1) ltol = l
1072  wt(l) = rtol(ltol)*abs(yy(l)) + atol(ltol)
1073  IF (wt(l) .LE. 0.0d0) GO TO 360
1074  350 CONTINUE
1075  GO TO 380
1076 C
1077 C RELATIVE ERROR CRITERION INAPPROPRIATE
1078  360 idid = -3
1079  DO 370 l = 1,neq
1080  y(l) = yy(l)
1081  370 ypout(l) = yp(l)
1082  t = x
1083  told = t
1084  info(1) = -1
1085  intout = .false.
1086  RETURN
1087 C
1088  380 CALL dsteps(df,neq,yy,x,h,eps,wt,start,hold,kord,kold,crash,phi,p,
1089  1 yp,psi,alpha,beta,sig,v,w,g,phase1,ns,nornd,ksteps,
1090  2 twou,fouru,xold,kprev,ivc,iv,kgi,gi,rpar,ipar)
1091 C
1092 C.......................................................................
1093 C
1094  IF(.NOT.crash) GO TO 420
1095 C
1096 C TOLERANCES TOO SMALL
1097  idid = -2
1098  rtol(1) = eps*rtol(1)
1099  atol(1) = eps*atol(1)
1100  IF (info(2) .EQ. 0) GO TO 400
1101  DO 390 l = 2,neq
1102  rtol(l) = eps*rtol(l)
1103  390 atol(l) = eps*atol(l)
1104  400 DO 410 l = 1,neq
1105  y(l) = yy(l)
1106  410 ypout(l) = yp(l)
1107  t = x
1108  told = t
1109  info(1) = -1
1110  intout = .false.
1111  RETURN
1112 C
1113 C (STIFFNESS TEST) COUNT NUMBER OF CONSECUTIVE STEPS TAKEN WITH THE
1114 C ORDER OF THE METHOD BEING LESS OR EQUAL TO FOUR
1115 C
1116  420 kle4 = kle4 + 1
1117  IF(kold .GT. 4) kle4 = 0
1118  IF(kle4 .GE. 50) stiff = .true.
1119  intout = .true.
1120  GO TO 250
subroutine init(nktet, inodfa, ipofa, netet_)
Definition: init.f:20
#define max(a, b)
Definition: cascade.c:32
double precision function d1mach(I)
Definition: ddeabm.f:2012
subroutine df(x, u, uprime, rpar, nev)
Definition: subspace.f:133
subroutine xermsg(LIBRAR, SUBROU, MESSG, NERR, LEVEL)
Definition: ddeabm.f:1265
#define min(a, b)
Definition: cascade.c:31
subroutine dsteps(DF, NEQN, Y, X, H, EPS, WT, START, HOLD, K, KOLD, CRASH, PHI, P, YP, PSI, ALPHA, BETA, SIG, V, W, G, PHASE1, NS, NORND, KSTEPS, TWOU, FOURU, XOLD, KPREV, IVC, IV, KGI, GI, RPAR, IPAR)
Definition: ddeabm.f:2577
subroutine dintp(X, Y, XOUT, YOUT, YPOUT, NEQN, KOLD, PHI, IVC, IV, KGI, GI, ALPHA, OG, OW, OX, OY)
Definition: ddeabm.f:1125

◆ dhstrt()

subroutine dhstrt ( external  DF,
integer  NEQ,
double precision  A,
double precision  B,
double precision, dimension(*)  Y,
double precision, dimension(*)  YPRIME,
double precision, dimension(*)  ETOL,
integer  MORDER,
double precision  SMALL,
double precision  BIG,
double precision, dimension(*)  SPY,
double precision, dimension(*)  PV,
double precision, dimension(*)  YP,
double precision, dimension(*)  SF,
double precision, dimension(*)  RPAR,
integer, dimension(*)  IPAR,
double precision  H 
)
4092 C***BEGIN PROLOGUE DHSTRT
4093 C***SUBSIDIARY
4094 C***PURPOSE Subsidiary to DDEABM, DDEBDF and DDERKF
4095 C***LIBRARY SLATEC
4096 C***TYPE DOUBLE PRECISION (HSTART-S, DHSTRT-D)
4097 C***AUTHOR Watts, H. A., (SNLA)
4098 C***DESCRIPTION
4099 C
4100 C DHSTRT computes a starting step size to be used in solving initial
4101 C value problems in ordinary differential equations.
4102 C
4103 C **********************************************************************
4104 C ABSTRACT
4105 C
4106 C Subroutine DHSTRT computes a starting step size to be used by an
4107 C initial value method in solving ordinary differential equations.
4108 C It is based on an estimate of the local Lipschitz constant for the
4109 C differential equation (lower bound on a norm of the Jacobian) ,
4110 C a bound on the differential equation (first derivative) , and
4111 C a bound on the partial derivative of the equation with respect to
4112 C the independent variable.
4113 C (all approximated near the initial point A)
4114 C
4115 C Subroutine DHSTRT uses a function subprogram DHVNRM for computing
4116 C a vector norm. The maximum norm is presently utilized though it
4117 C can easily be replaced by any other vector norm. It is presumed
4118 C that any replacement norm routine would be carefully coded to
4119 C prevent unnecessary underflows or overflows from occurring, and
4120 C also, would not alter the vector or number of components.
4121 C
4122 C **********************************************************************
4123 C On input you must provide the following
4124 C
4125 C DF -- This is a subroutine of the form
4126 C DF(X,U,UPRIME,RPAR,IPAR)
4127 C which defines the system of first order differential
4128 C equations to be solved. For the given values of X and the
4129 C vector U(*)=(U(1),U(2),...,U(NEQ)) , the subroutine must
4130 C evaluate the NEQ components of the system of differential
4131 C equations DU/DX=DF(X,U) and store the derivatives in the
4132 C array UPRIME(*), that is, UPRIME(I) = * DU(I)/DX * for
4133 C equations I=1,...,NEQ.
4134 C
4135 C Subroutine DF must not alter X or U(*). You must declare
4136 C the name DF in an external statement in your program that
4137 C calls DHSTRT. You must dimension U and UPRIME in DF.
4138 C
4139 C RPAR and IPAR are DOUBLE PRECISION and INTEGER parameter
4140 C arrays which you can use for communication between your
4141 C program and subroutine DF. They are not used or altered by
4142 C DHSTRT. If you do not need RPAR or IPAR, ignore these
4143 C parameters by treating them as dummy arguments. If you do
4144 C choose to use them, dimension them in your program and in
4145 C DF as arrays of appropriate length.
4146 C
4147 C NEQ -- This is the number of (first order) differential equations
4148 C to be integrated.
4149 C
4150 C A -- This is the initial point of integration.
4151 C
4152 C B -- This is a value of the independent variable used to define
4153 C the direction of integration. A reasonable choice is to
4154 C set B to the first point at which a solution is desired.
4155 C You can also use B, if necessary, to restrict the length
4156 C of the first integration step because the algorithm will
4157 C not compute a starting step length which is bigger than
4158 C ABS(B-A), unless B has been chosen too close to A.
4159 C (it is presumed that DHSTRT has been called with B
4160 C different from A on the machine being used. Also see the
4161 C discussion about the parameter SMALL.)
4162 C
4163 C Y(*) -- This is the vector of initial values of the NEQ solution
4164 C components at the initial point A.
4165 C
4166 C YPRIME(*) -- This is the vector of derivatives of the NEQ
4167 C solution components at the initial point A.
4168 C (defined by the differential equations in subroutine DF)
4169 C
4170 C ETOL -- This is the vector of error tolerances corresponding to
4171 C the NEQ solution components. It is assumed that all
4172 C elements are positive. Following the first integration
4173 C step, the tolerances are expected to be used by the
4174 C integrator in an error test which roughly requires that
4175 C ABS(LOCAL ERROR) .LE. ETOL
4176 C for each vector component.
4177 C
4178 C MORDER -- This is the order of the formula which will be used by
4179 C the initial value method for taking the first integration
4180 C step.
4181 C
4182 C SMALL -- This is a small positive machine dependent constant
4183 C which is used for protecting against computations with
4184 C numbers which are too small relative to the precision of
4185 C floating point arithmetic. SMALL should be set to
4186 C (approximately) the smallest positive DOUBLE PRECISION
4187 C number such that (1.+SMALL) .GT. 1. on the machine being
4188 C used. The quantity SMALL**(3/8) is used in computing
4189 C increments of variables for approximating derivatives by
4190 C differences. Also the algorithm will not compute a
4191 C starting step length which is smaller than
4192 C 100*SMALL*ABS(A).
4193 C
4194 C BIG -- This is a large positive machine dependent constant which
4195 C is used for preventing machine overflows. A reasonable
4196 C choice is to set big to (approximately) the square root of
4197 C the largest DOUBLE PRECISION number which can be held in
4198 C the machine.
4199 C
4200 C SPY(*),PV(*),YP(*),SF(*) -- These are DOUBLE PRECISION work
4201 C arrays of length NEQ which provide the routine with needed
4202 C storage space.
4203 C
4204 C RPAR,IPAR -- These are parameter arrays, of DOUBLE PRECISION and
4205 C INTEGER type, respectively, which can be used for
4206 C communication between your program and the DF subroutine.
4207 C They are not used or altered by DHSTRT.
4208 C
4209 C **********************************************************************
4210 C On Output (after the return from DHSTRT),
4211 C
4212 C H -- is an appropriate starting step size to be attempted by the
4213 C differential equation method.
4214 C
4215 C All parameters in the call list remain unchanged except for
4216 C the working arrays SPY(*),PV(*),YP(*), and SF(*).
4217 C
4218 C **********************************************************************
4219 C
4220 C***SEE ALSO DDEABM, DDEBDF, DDERKF
4221 C***ROUTINES CALLED DHVNRM
4222 C***REVISION HISTORY (YYMMDD)
4223 C 820301 DATE WRITTEN
4224 C 890531 Changed all specific intrinsics to generic. (WRB)
4225 C 890831 Modified array declarations. (WRB)
4226 C 890911 Removed unnecessary intrinsics. (WRB)
4227 C 891024 Changed references from DVNORM to DHVNRM. (WRB)
4228 C 891214 Prologue converted to Version 4.0 format. (BAB)
4229 C 900328 Added TYPE section. (WRB)
4230 C 910722 Updated AUTHOR section. (ALS)
4231 C***END PROLOGUE DHSTRT
4232 C
4233  INTEGER ipar, j, k, lk, morder, neq
4234  DOUBLE PRECISION a, absdx, b, big, da, delf, dely,
4235  1 dfdub, dfdxb, dhvnrm,
4236  2 dx, dy, etol, fbnd, h, pv, relper, rpar, sf, small, spy,
4237  3 srydpb, tolexp, tolmin, tolp, tolsum, y, ydpb, yp, yprime
4238  dimension y(*),yprime(*),etol(*),spy(*),pv(*),yp(*),
4239  1 sf(*),rpar(*),ipar(*)
4240  EXTERNAL df
4241 C
4242 C ..................................................................
4243 C
4244 C BEGIN BLOCK PERMITTING ...EXITS TO 160
4245 C***FIRST EXECUTABLE STATEMENT DHSTRT
4246  dx = b - a
4247  absdx = abs(dx)
4248  relper = small**0.375d0
4249 C
4250 C ...............................................................
4251 C
4252 C COMPUTE AN APPROXIMATE BOUND (DFDXB) ON THE PARTIAL
4253 C DERIVATIVE OF THE EQUATION WITH RESPECT TO THE
4254 C INDEPENDENT VARIABLE. PROTECT AGAINST AN OVERFLOW.
4255 C ALSO COMPUTE A BOUND (FBND) ON THE FIRST DERIVATIVE
4256 C LOCALLY.
4257 C
4258  da = sign(max(min(relper*abs(a),absdx),
4259  1 100.0d0*small*abs(a)),dx)
4260  IF (da .EQ. 0.0d0) da = relper*dx
4261  CALL df(a+da,y,sf,rpar,ipar)
4262  DO 10 j = 1, neq
4263  yp(j) = sf(j) - yprime(j)
4264  10 CONTINUE
4265  delf = dhvnrm(yp,neq)
4266  dfdxb = big
4267  IF (delf .LT. big*abs(da)) dfdxb = delf/abs(da)
4268  fbnd = dhvnrm(sf,neq)
4269 C
4270 C ...............................................................
4271 C
4272 C COMPUTE AN ESTIMATE (DFDUB) OF THE LOCAL LIPSCHITZ
4273 C CONSTANT FOR THE SYSTEM OF DIFFERENTIAL EQUATIONS. THIS
4274 C ALSO REPRESENTS AN ESTIMATE OF THE NORM OF THE JACOBIAN
4275 C LOCALLY. THREE ITERATIONS (TWO WHEN NEQ=1) ARE USED TO
4276 C ESTIMATE THE LIPSCHITZ CONSTANT BY NUMERICAL DIFFERENCES.
4277 C THE FIRST PERTURBATION VECTOR IS BASED ON THE INITIAL
4278 C DERIVATIVES AND DIRECTION OF INTEGRATION. THE SECOND
4279 C PERTURBATION VECTOR IS FORMED USING ANOTHER EVALUATION OF
4280 C THE DIFFERENTIAL EQUATION. THE THIRD PERTURBATION VECTOR
4281 C IS FORMED USING PERTURBATIONS BASED ONLY ON THE INITIAL
4282 C VALUES. COMPONENTS THAT ARE ZERO ARE ALWAYS CHANGED TO
4283 C NON-ZERO VALUES (EXCEPT ON THE FIRST ITERATION). WHEN
4284 C INFORMATION IS AVAILABLE, CARE IS TAKEN TO ENSURE THAT
4285 C COMPONENTS OF THE PERTURBATION VECTOR HAVE SIGNS WHICH ARE
4286 C CONSISTENT WITH THE SLOPES OF LOCAL SOLUTION CURVES.
4287 C ALSO CHOOSE THE LARGEST BOUND (FBND) FOR THE FIRST
4288 C DERIVATIVE.
4289 C
4290 C PERTURBATION VECTOR SIZE IS HELD
4291 C CONSTANT FOR ALL ITERATIONS. COMPUTE
4292 C THIS CHANGE FROM THE
4293 C SIZE OF THE VECTOR OF INITIAL
4294 C VALUES.
4295  dely = relper*dhvnrm(y,neq)
4296  IF (dely .EQ. 0.0d0) dely = relper
4297  dely = sign(dely,dx)
4298  delf = dhvnrm(yprime,neq)
4299  fbnd = max(fbnd,delf)
4300  IF (delf .EQ. 0.0d0) GO TO 30
4301 C USE INITIAL DERIVATIVES FOR FIRST PERTURBATION
4302  DO 20 j = 1, neq
4303  spy(j) = yprime(j)
4304  yp(j) = yprime(j)
4305  20 CONTINUE
4306  GO TO 50
4307  30 CONTINUE
4308 C CANNOT HAVE A NULL PERTURBATION VECTOR
4309  DO 40 j = 1, neq
4310  spy(j) = 0.0d0
4311  yp(j) = 1.0d0
4312  40 CONTINUE
4313  delf = dhvnrm(yp,neq)
4314  50 CONTINUE
4315 C
4316  dfdub = 0.0d0
4317  lk = min(neq+1,3)
4318  DO 140 k = 1, lk
4319 C DEFINE PERTURBED VECTOR OF INITIAL VALUES
4320  DO 60 j = 1, neq
4321  pv(j) = y(j) + dely*(yp(j)/delf)
4322  60 CONTINUE
4323  IF (k .EQ. 2) GO TO 80
4324 C EVALUATE DERIVATIVES ASSOCIATED WITH PERTURBED
4325 C VECTOR AND COMPUTE CORRESPONDING DIFFERENCES
4326  CALL df(a,pv,yp,rpar,ipar)
4327  DO 70 j = 1, neq
4328  pv(j) = yp(j) - yprime(j)
4329  70 CONTINUE
4330  GO TO 100
4331  80 CONTINUE
4332 C USE A SHIFTED VALUE OF THE INDEPENDENT VARIABLE
4333 C IN COMPUTING ONE ESTIMATE
4334  CALL df(a+da,pv,yp,rpar,ipar)
4335  DO 90 j = 1, neq
4336  pv(j) = yp(j) - sf(j)
4337  90 CONTINUE
4338  100 CONTINUE
4339 C CHOOSE LARGEST BOUNDS ON THE FIRST DERIVATIVE
4340 C AND A LOCAL LIPSCHITZ CONSTANT
4341  fbnd = max(fbnd,dhvnrm(yp,neq))
4342  delf = dhvnrm(pv,neq)
4343 C ...EXIT
4344  IF (delf .GE. big*abs(dely)) GO TO 150
4345  dfdub = max(dfdub,delf/abs(dely))
4346 C ......EXIT
4347  IF (k .EQ. lk) GO TO 160
4348 C CHOOSE NEXT PERTURBATION VECTOR
4349  IF (delf .EQ. 0.0d0) delf = 1.0d0
4350  DO 130 j = 1, neq
4351  IF (k .EQ. 2) GO TO 110
4352  dy = abs(pv(j))
4353  IF (dy .EQ. 0.0d0) dy = delf
4354  GO TO 120
4355  110 CONTINUE
4356  dy = y(j)
4357  IF (dy .EQ. 0.0d0) dy = dely/relper
4358  120 CONTINUE
4359  IF (spy(j) .EQ. 0.0d0) spy(j) = yp(j)
4360  IF (spy(j) .NE. 0.0d0) dy = sign(dy,spy(j))
4361  yp(j) = dy
4362  130 CONTINUE
4363  delf = dhvnrm(yp,neq)
4364  140 CONTINUE
4365  150 CONTINUE
4366 C
4367 C PROTECT AGAINST AN OVERFLOW
4368  dfdub = big
4369  160 CONTINUE
4370 C
4371 C ..................................................................
4372 C
4373 C COMPUTE A BOUND (YDPB) ON THE NORM OF THE SECOND DERIVATIVE
4374 C
4375  ydpb = dfdxb + dfdub*fbnd
4376 C
4377 C ..................................................................
4378 C
4379 C DEFINE THE TOLERANCE PARAMETER UPON WHICH THE STARTING STEP
4380 C SIZE IS TO BE BASED. A VALUE IN THE MIDDLE OF THE ERROR
4381 C TOLERANCE RANGE IS SELECTED.
4382 C
4383  tolmin = big
4384  tolsum = 0.0d0
4385  DO 170 k = 1, neq
4386  tolexp = log10(etol(k))
4387  tolmin = min(tolmin,tolexp)
4388  tolsum = tolsum + tolexp
4389  170 CONTINUE
4390  tolp = 10.0d0**(0.5d0*(tolsum/neq + tolmin)/(morder+1))
4391 C
4392 C ..................................................................
4393 C
4394 C COMPUTE A STARTING STEP SIZE BASED ON THE ABOVE FIRST AND
4395 C SECOND DERIVATIVE INFORMATION
4396 C
4397 C RESTRICT THE STEP LENGTH TO BE NOT BIGGER
4398 C THAN ABS(B-A). (UNLESS B IS TOO CLOSE
4399 C TO A)
4400  h = absdx
4401 C
4402  IF (ydpb .NE. 0.0d0 .OR. fbnd .NE. 0.0d0) GO TO 180
4403 C
4404 C BOTH FIRST DERIVATIVE TERM (FBND) AND SECOND
4405 C DERIVATIVE TERM (YDPB) ARE ZERO
4406  IF (tolp .LT. 1.0d0) h = absdx*tolp
4407  GO TO 200
4408  180 CONTINUE
4409 C
4410  IF (ydpb .NE. 0.0d0) GO TO 190
4411 C
4412 C ONLY SECOND DERIVATIVE TERM (YDPB) IS ZERO
4413  IF (tolp .LT. fbnd*absdx) h = tolp/fbnd
4414  GO TO 200
4415  190 CONTINUE
4416 C
4417 C SECOND DERIVATIVE TERM (YDPB) IS NON-ZERO
4418  srydpb = sqrt(0.5d0*ydpb)
4419  IF (tolp .LT. srydpb*absdx) h = tolp/srydpb
4420  200 CONTINUE
4421 C
4422 C FURTHER RESTRICT THE STEP LENGTH TO BE NOT
4423 C BIGGER THAN 1/DFDUB
4424  IF (h*dfdub .GT. 1.0d0) h = 1.0d0/dfdub
4425 C
4426 C FINALLY, RESTRICT THE STEP LENGTH TO BE NOT
4427 C SMALLER THAN 100*SMALL*ABS(A). HOWEVER, IF
4428 C A=0. AND THE COMPUTED H UNDERFLOWED TO ZERO,
4429 C THE ALGORITHM RETURNS SMALL*ABS(B) FOR THE
4430 C STEP LENGTH.
4431  h = max(h,100.0d0*small*abs(a))
4432  IF (h .EQ. 0.0d0) h = small*abs(b)
4433 C
4434 C NOW SET DIRECTION OF INTEGRATION
4435  h = sign(h,dx)
4436 C
4437  RETURN
#define max(a, b)
Definition: cascade.c:32
subroutine df(x, u, uprime, rpar, nev)
Definition: subspace.f:133
#define min(a, b)
Definition: cascade.c:31
double precision function dhvnrm(V, NCOMP)
Definition: ddeabm.f:4441

◆ dhvnrm()

double precision function dhvnrm ( double precision, dimension(*)  V,
integer  NCOMP 
)
4441 C***BEGIN PROLOGUE DHVNRM
4442 C***SUBSIDIARY
4443 C***PURPOSE Subsidiary to DDEABM, DDEBDF and DDERKF
4444 C***LIBRARY SLATEC
4445 C***TYPE DOUBLE PRECISION (HVNRM-S, DHVNRM-D)
4446 C***AUTHOR Watts, H. A., (SNLA)
4447 C***DESCRIPTION
4448 C
4449 C Compute the maximum norm of the vector V(*) of length NCOMP and
4450 C return the result as DHVNRM
4451 C
4452 C***SEE ALSO DDEABM, DDEBDF, DDERKF
4453 C***ROUTINES CALLED (NONE)
4454 C***REVISION HISTORY (YYMMDD)
4455 C 820301 DATE WRITTEN
4456 C 890531 Changed all specific intrinsics to generic. (WRB)
4457 C 890831 Modified array declarations. (WRB)
4458 C 891024 Changed references from DVNORM to DHVNRM. (WRB)
4459 C 891024 Changed routine name from DVNORM to DHVNRM. (WRB)
4460 C 891214 Prologue converted to Version 4.0 format. (BAB)
4461 C 900328 Added TYPE section. (WRB)
4462 C 910722 Updated AUTHOR section. (ALS)
4463 C***END PROLOGUE DHVNRM
4464 C
4465  INTEGER k, ncomp
4466  DOUBLE PRECISION v
4467  dimension v(*)
4468 C***FIRST EXECUTABLE STATEMENT DHVNRM
4469  dhvnrm = 0.0d0
4470  DO 10 k = 1, ncomp
4471  dhvnrm = max(dhvnrm,abs(v(k)))
4472  10 CONTINUE
4473  RETURN
#define max(a, b)
Definition: cascade.c:32
double precision function dhvnrm(V, NCOMP)
Definition: ddeabm.f:4441

◆ dintp()

subroutine dintp ( double precision  X,
double precision, dimension(*)  Y,
double precision  XOUT,
double precision, dimension(*)  YOUT,
double precision, dimension(*)  YPOUT,
integer  NEQN,
integer  KOLD,
double precision, dimension(neqn,16)  PHI,
integer  IVC,
integer, dimension(10)  IV,
integer  KGI,
double precision, dimension(11)  GI,
double precision, dimension(12)  ALPHA,
double precision, dimension(13)  OG,
double precision, dimension(12)  OW,
double precision  OX,
double precision, dimension(*)  OY 
)
1125 C***BEGIN PROLOGUE DINTP
1126 C***PURPOSE Approximate the solution at XOUT by evaluating the
1127 C polynomial computed in DSTEPS at XOUT. Must be used in
1128 C conjunction with DSTEPS.
1129 C***LIBRARY SLATEC (DEPAC)
1130 C***CATEGORY I1A1B
1131 C***TYPE DOUBLE PRECISION (SINTRP-S, DINTP-D)
1132 C***KEYWORDS ADAMS METHOD, DEPAC, INITIAL VALUE PROBLEMS, ODE,
1133 C ORDINARY DIFFERENTIAL EQUATIONS, PREDICTOR-CORRECTOR,
1134 C SMOOTH INTERPOLANT
1135 C***AUTHOR Watts, H. A., (SNLA)
1136 C***DESCRIPTION
1137 C
1138 C The methods in subroutine DSTEPS approximate the solution near X
1139 C by a polynomial. Subroutine DINTP approximates the solution at
1140 C XOUT by evaluating the polynomial there. Information defining this
1141 C polynomial is passed from DSTEPS so DINTP cannot be used alone.
1142 C
1143 C Subroutine DSTEPS is completely explained and documented in the text
1144 C "Computer Solution of Ordinary Differential Equations, the Initial
1145 C Value Problem" by L. F. Shampine and M. K. Gordon.
1146 C
1147 C Input to DINTP --
1148 C
1149 C The user provides storage in the calling program for the arrays in
1150 C the call list
1151 C DIMENSION Y(NEQN),YOUT(NEQN),YPOUT(NEQN),PHI(NEQN,16),OY(NEQN)
1152 C AND ALPHA(12),OG(13),OW(12),GI(11),IV(10)
1153 C and defines
1154 C XOUT -- point at which solution is desired.
1155 C The remaining parameters are defined in DSTEPS and passed to
1156 C DINTP from that subroutine
1157 C
1158 C Output from DINTP --
1159 C
1160 C YOUT(*) -- solution at XOUT
1161 C YPOUT(*) -- derivative of solution at XOUT
1162 C The remaining parameters are returned unaltered from their input
1163 C values. Integration with DSTEPS may be continued.
1164 C
1165 C***REFERENCES H. A. Watts, A smoother interpolant for DE/STEP, INTRP
1166 C II, Report SAND84-0293, Sandia Laboratories, 1984.
1167 C***ROUTINES CALLED (NONE)
1168 C***REVISION HISTORY (YYMMDD)
1169 C 840201 DATE WRITTEN
1170 C 890831 Modified array declarations. (WRB)
1171 C 890831 REVISION DATE from Version 3.2
1172 C 891214 Prologue converted to Version 4.0 format. (BAB)
1173 C 920501 Reformatted the REFERENCES section. (WRB)
1174 C***END PROLOGUE DINTP
1175 C
1176  INTEGER i, iq, iv, ivc, iw, j, jq, kgi, kold, kp1, kp2,
1177  1 l, m, neqn
1178  DOUBLE PRECISION alp, alpha, c, g, gdi, gdif, gi, gamma, h, hi,
1179  1 hmu, og, ow, ox, oy, phi, rmu, sigma, temp1, temp2, temp3,
1180  2 w, x, xi, xim1, xiq, xout, y, yout, ypout
1181 C
1182  dimension y(*),yout(*),ypout(*),phi(neqn,16),oy(*)
1183  dimension g(13),c(13),w(13),og(13),ow(12),alpha(12),gi(11),iv(10)
1184 C
1185 C***FIRST EXECUTABLE STATEMENT DINTP
1186  kp1 = kold + 1
1187  kp2 = kold + 2
1188 C
1189  hi = xout - ox
1190  h = x - ox
1191  xi = hi/h
1192  xim1 = xi - 1.d0
1193 C
1194 C INITIALIZE W(*) FOR COMPUTING G(*)
1195 C
1196  xiq = xi
1197  DO 10 iq = 1,kp1
1198  xiq = xi*xiq
1199  temp1 = iq*(iq+1)
1200  10 w(iq) = xiq/temp1
1201 C
1202 C COMPUTE THE DOUBLE INTEGRAL TERM GDI
1203 C
1204  IF (kold .LE. kgi) GO TO 50
1205  IF (ivc .GT. 0) GO TO 20
1206  gdi = 1.0d0/temp1
1207  m = 2
1208  GO TO 30
1209  20 iw = iv(ivc)
1210  gdi = ow(iw)
1211  m = kold - iw + 3
1212  30 IF (m .GT. kold) GO TO 60
1213  DO 40 i = m,kold
1214  40 gdi = ow(kp2-i) - alpha(i)*gdi
1215  GO TO 60
1216  50 gdi = gi(kold)
1217 C
1218 C COMPUTE G(*) AND C(*)
1219 C
1220  60 g(1) = xi
1221  g(2) = 0.5d0*xi*xi
1222  c(1) = 1.0d0
1223  c(2) = xi
1224  IF (kold .LT. 2) GO TO 90
1225  DO 80 i = 2,kold
1226  alp = alpha(i)
1227  gamma = 1.0d0 + xim1*alp
1228  l = kp2 - i
1229  DO 70 jq = 1,l
1230  70 w(jq) = gamma*w(jq) - alp*w(jq+1)
1231  g(i+1) = w(1)
1232  80 c(i+1) = gamma*c(i)
1233 C
1234 C DEFINE INTERPOLATION PARAMETERS
1235 C
1236  90 sigma = (w(2) - xim1*w(1))/gdi
1237  rmu = xim1*c(kp1)/gdi
1238  hmu = rmu/h
1239 C
1240 C INTERPOLATE FOR THE SOLUTION -- YOUT
1241 C AND FOR THE DERIVATIVE OF THE SOLUTION -- YPOUT
1242 C
1243  DO 100 l = 1,neqn
1244  yout(l) = 0.0d0
1245  100 ypout(l) = 0.0d0
1246  DO 120 j = 1,kold
1247  i = kp2 - j
1248  gdif = og(i) - og(i-1)
1249  temp2 = (g(i) - g(i-1)) - sigma*gdif
1250  temp3 = (c(i) - c(i-1)) + rmu*gdif
1251  DO 110 l = 1,neqn
1252  yout(l) = yout(l) + temp2*phi(l,i)
1253  110 ypout(l) = ypout(l) + temp3*phi(l,i)
1254  120 CONTINUE
1255  DO 130 l = 1,neqn
1256  yout(l) = ((1.0d0 - sigma)*oy(l) + sigma*y(l)) +
1257  1 h*(yout(l) + (g(1) - sigma*og(1))*phi(l,1))
1258  130 ypout(l) = hmu*(oy(l) - y(l)) +
1259  1 (ypout(l) + (c(1) + rmu*og(1))*phi(l,1))
1260 C
1261  RETURN

◆ dsteps()

subroutine dsteps ( external  DF,
integer  NEQN,
double precision, dimension(*)  Y,
double precision  X,
double precision  H,
double precision  EPS,
double precision, dimension(*)  WT,
logical  START,
double precision  HOLD,
integer  K,
integer  KOLD,
logical  CRASH,
double precision, dimension(neqn,16)  PHI,
double precision, dimension(*)  P,
double precision, dimension(*)  YP,
double precision, dimension(12)  PSI,
double precision, dimension(12)  ALPHA,
double precision, dimension(12)  BETA,
double precision, dimension(13)  SIG,
double precision, dimension(12)  V,
double precision, dimension(12)  W,
double precision, dimension(13)  G,
logical  PHASE1,
integer  NS,
logical  NORND,
integer  KSTEPS,
double precision  TWOU,
double precision  FOURU,
double precision  XOLD,
  KPREV,
  IVC,
dimension(10)  IV,
  KGI,
double precision, dimension(11)  GI,
double precision, dimension(*)  RPAR,
integer, dimension(*)  IPAR 
)
2577 C***BEGIN PROLOGUE DSTEPS
2578 C***PURPOSE Integrate a system of first order ordinary differential
2579 C equations one step.
2580 C***LIBRARY SLATEC (DEPAC)
2581 C***CATEGORY I1A1B
2582 C***TYPE DOUBLE PRECISION (STEPS-S, DSTEPS-D)
2583 C***KEYWORDS ADAMS METHOD, DEPAC, INITIAL VALUE PROBLEMS, ODE,
2584 C ORDINARY DIFFERENTIAL EQUATIONS, PREDICTOR-CORRECTOR
2585 C***AUTHOR Shampine, L. F., (SNLA)
2586 C Gordon, M. K., (SNLA)
2587 C MODIFIED BY H.A. WATTS
2588 C***DESCRIPTION
2589 C
2590 C Written by L. F. Shampine and M. K. Gordon
2591 C
2592 C Abstract
2593 C
2594 C Subroutine DSTEPS is normally used indirectly through subroutine
2595 C DDEABM . Because DDEABM suffices for most problems and is much
2596 C easier to use, using it should be considered before using DSTEPS
2597 C alone.
2598 C
2599 C Subroutine DSTEPS integrates a system of NEQN first order ordinary
2600 C differential equations one step, normally from X to X+H, using a
2601 C modified divided difference form of the Adams Pece formulas. Local
2602 C extrapolation is used to improve absolute stability and accuracy.
2603 C The code adjusts its order and step size to control the local error
2604 C per unit step in a generalized sense. Special devices are included
2605 C to control roundoff error and to detect when the user is requesting
2606 C too much accuracy.
2607 C
2608 C This code is completely explained and documented in the text,
2609 C Computer Solution of Ordinary Differential Equations, The Initial
2610 C Value Problem by L. F. Shampine and M. K. Gordon.
2611 C Further details on use of this code are available in "Solving
2612 C Ordinary Differential Equations with ODE, STEP, and INTRP",
2613 C by L. F. Shampine and M. K. Gordon, SLA-73-1060.
2614 C
2615 C
2616 C The parameters represent --
2617 C DF -- subroutine to evaluate derivatives
2618 C NEQN -- number of equations to be integrated
2619 C Y(*) -- solution vector at X
2620 C X -- independent variable
2621 C H -- appropriate step size for next step. Normally determined by
2622 C code
2623 C EPS -- local error tolerance
2624 C WT(*) -- vector of weights for error criterion
2625 C START -- logical variable set .TRUE. for first step, .FALSE.
2626 C otherwise
2627 C HOLD -- step size used for last successful step
2628 C K -- appropriate order for next step (determined by code)
2629 C KOLD -- order used for last successful step
2630 C CRASH -- logical variable set .TRUE. when no step can be taken,
2631 C .FALSE. otherwise.
2632 C YP(*) -- derivative of solution vector at X after successful
2633 C step
2634 C KSTEPS -- counter on attempted steps
2635 C TWOU -- 2.*U where U is machine unit roundoff quantity
2636 C FOURU -- 4.*U where U is machine unit roundoff quantity
2637 C RPAR,IPAR -- parameter arrays which you may choose to use
2638 C for communication between your program and subroutine F.
2639 C They are not altered or used by DSTEPS.
2640 C The variables X,XOLD,KOLD,KGI and IVC and the arrays Y,PHI,ALPHA,G,
2641 C W,P,IV and GI are required for the interpolation subroutine SINTRP.
2642 C The remaining variables and arrays are included in the call list
2643 C only to eliminate local retention of variables between calls.
2644 C
2645 C Input to DSTEPS
2646 C
2647 C First call --
2648 C
2649 C The user must provide storage in his calling program for all arrays
2650 C in the call list, namely
2651 C
2652 C DIMENSION Y(NEQN),WT(NEQN),PHI(NEQN,16),P(NEQN),YP(NEQN),PSI(12),
2653 C 1 ALPHA(12),BETA(12),SIG(13),V(12),W(12),G(13),GI(11),IV(10),
2654 C 2 RPAR(*),IPAR(*)
2655 C
2656 C **Note**
2657 C
2658 C The user must also declare START , CRASH , PHASE1 and NORND
2659 C logical variables and DF an EXTERNAL subroutine, supply the
2660 C subroutine DF(X,Y,YP) to evaluate
2661 C DY(I)/DX = YP(I) = DF(X,Y(1),Y(2),...,Y(NEQN))
2662 C and initialize only the following parameters.
2663 C NEQN -- number of equations to be integrated
2664 C Y(*) -- vector of initial values of dependent variables
2665 C X -- initial value of the independent variable
2666 C H -- nominal step size indicating direction of integration
2667 C and maximum size of step. Must be variable
2668 C EPS -- local error tolerance per step. Must be variable
2669 C WT(*) -- vector of non-zero weights for error criterion
2670 C START -- .TRUE.
2671 C YP(*) -- vector of initial derivative values
2672 C KSTEPS -- set KSTEPS to zero
2673 C TWOU -- 2.*U where U is machine unit roundoff quantity
2674 C FOURU -- 4.*U where U is machine unit roundoff quantity
2675 C Define U to be the machine unit roundoff quantity by calling
2676 C the function routine D1MACH, U = D1MACH(4), or by
2677 C computing U so that U is the smallest positive number such
2678 C that 1.0+U .GT. 1.0.
2679 C
2680 C DSTEPS requires that the L2 norm of the vector with components
2681 C LOCAL ERROR(L)/WT(L) be less than EPS for a successful step. The
2682 C array WT allows the user to specify an error test appropriate
2683 C for his problem. For example,
2684 C WT(L) = 1.0 specifies absolute error,
2685 C = ABS(Y(L)) error relative to the most recent value of the
2686 C L-th component of the solution,
2687 C = ABS(YP(L)) error relative to the most recent value of
2688 C the L-th component of the derivative,
2689 C = MAX(WT(L),ABS(Y(L))) error relative to the largest
2690 C magnitude of L-th component obtained so far,
2691 C = ABS(Y(L))*RELERR/EPS + ABSERR/EPS specifies a mixed
2692 C relative-absolute test where RELERR is relative
2693 C error, ABSERR is absolute error and EPS =
2694 C MAX(RELERR,ABSERR) .
2695 C
2696 C Subsequent calls --
2697 C
2698 C Subroutine DSTEPS is designed so that all information needed to
2699 C continue the integration, including the step size H and the order
2700 C K , is returned with each step. With the exception of the step
2701 C size, the error tolerance, and the weights, none of the parameters
2702 C should be altered. The array WT must be updated after each step
2703 C to maintain relative error tests like those above. Normally the
2704 C integration is continued just beyond the desired endpoint and the
2705 C solution interpolated there with subroutine SINTRP . If it is
2706 C impossible to integrate beyond the endpoint, the step size may be
2707 C reduced to hit the endpoint since the code will not take a step
2708 C larger than the H input. Changing the direction of integration,
2709 C i.e., the sign of H , requires the user set START = .TRUE. before
2710 C calling DSTEPS again. This is the only situation in which START
2711 C should be altered.
2712 C
2713 C Output from DSTEPS
2714 C
2715 C Successful Step --
2716 C
2717 C The subroutine returns after each successful step with START and
2718 C CRASH set .FALSE. . X represents the independent variable
2719 C advanced one step of length HOLD from its value on input and Y
2720 C the solution vector at the new value of X . All other parameters
2721 C represent information corresponding to the new X needed to
2722 C continue the integration.
2723 C
2724 C Unsuccessful Step --
2725 C
2726 C When the error tolerance is too small for the machine precision,
2727 C the subroutine returns without taking a step and CRASH = .TRUE. .
2728 C An appropriate step size and error tolerance for continuing are
2729 C estimated and all other information is restored as upon input
2730 C before returning. To continue with the larger tolerance, the user
2731 C just calls the code again. A restart is neither required nor
2732 C desirable.
2733 C
2734 C***REFERENCES L. F. Shampine and M. K. Gordon, Solving ordinary
2735 C differential equations with ODE, STEP, and INTRP,
2736 C Report SLA-73-1060, Sandia Laboratories, 1973.
2737 C***ROUTINES CALLED D1MACH, DHSTRT
2738 C***REVISION HISTORY (YYMMDD)
2739 C 740101 DATE WRITTEN
2740 C 890531 Changed all specific intrinsics to generic. (WRB)
2741 C 890831 Modified array declarations. (WRB)
2742 C 890831 REVISION DATE from Version 3.2
2743 C 891214 Prologue converted to Version 4.0 format. (BAB)
2744 C 920501 Reformatted the REFERENCES section. (WRB)
2745 C***END PROLOGUE DSTEPS
2746 C
2747  INTEGER i, ifail, im1, ip1, ipar, iq, j, k, km1, km2, knew,
2748  1 kold, kp1, kp2, ksteps, l, limit1, limit2, neqn, ns, nsm2,
2749  2 nsp1, nsp2
2750  DOUBLE PRECISION absh, alpha, beta, big, d1mach,
2751  1 eps, erk, erkm1, erkm2, erkp1, err,
2752  2 fouru, g, gi, gstr, h, hnew, hold, p, p5eps, phi, psi, r,
2753  3 reali, realns, rho, round, rpar, sig, tau, temp1,
2754  4 temp2, temp3, temp4, temp5, temp6, two, twou, u, v, w, wt,
2755  5 x, xold, y, yp
2756  LOGICAL start,crash,phase1,nornd
2757  dimension y(*),wt(*),phi(neqn,16),p(*),yp(*),psi(12),
2758  1 alpha(12),beta(12),sig(13),v(12),w(12),g(13),gi(11),iv(10),
2759  2 rpar(*),ipar(*)
2760  dimension two(13),gstr(13)
2761  EXTERNAL df
2762  SAVE two, gstr
2763 C
2764  DATA two(1),two(2),two(3),two(4),two(5),two(6),two(7),two(8),
2765  1 two(9),two(10),two(11),two(12),two(13)
2766  2 /2.0d0,4.0d0,8.0d0,16.0d0,32.0d0,64.0d0,128.0d0,256.0d0,
2767  3 512.0d0,1024.0d0,2048.0d0,4096.0d0,8192.0d0/
2768  DATA gstr(1),gstr(2),gstr(3),gstr(4),gstr(5),gstr(6),gstr(7),
2769  1 gstr(8),gstr(9),gstr(10),gstr(11),gstr(12),gstr(13)
2770  2 /0.5d0,0.0833d0,0.0417d0,0.0264d0,0.0188d0,0.0143d0,0.0114d0,
2771  3 0.00936d0,0.00789d0,0.00679d0,0.00592d0,0.00524d0,0.00468d0/
2772 C
2773 C *** BEGIN BLOCK 0 ***
2774 C CHECK IF STEP SIZE OR ERROR TOLERANCE IS TOO SMALL FOR MACHINE
2775 C PRECISION. IF FIRST STEP, INITIALIZE PHI ARRAY AND ESTIMATE A
2776 C STARTING STEP SIZE.
2777 C ***
2778 C
2779 C IF STEP SIZE IS TOO SMALL, DETERMINE AN ACCEPTABLE ONE
2780 C
2781 C***FIRST EXECUTABLE STATEMENT DSTEPS
2782  crash = .true.
2783  IF(abs(h) .GE. fouru*abs(x)) GO TO 5
2784  h = sign(fouru*abs(x),h)
2785  RETURN
2786  5 p5eps = 0.5d0*eps
2787 C
2788 C IF ERROR TOLERANCE IS TOO SMALL, INCREASE IT TO AN ACCEPTABLE VALUE
2789 C
2790  round = 0.0d0
2791  DO 10 l = 1,neqn
2792  10 round = round + (y(l)/wt(l))**2
2793  round = twou*sqrt(round)
2794  IF(p5eps .GE. round) GO TO 15
2795  eps = 2.0d0*round*(1.0d0 + fouru)
2796  RETURN
2797  15 crash = .false.
2798  g(1) = 1.0d0
2799  g(2) = 0.5d0
2800  sig(1) = 1.0d0
2801  IF(.NOT.start) GO TO 99
2802 C
2803 C INITIALIZE. COMPUTE APPROPRIATE STEP SIZE FOR FIRST STEP
2804 C
2805 C CALL DF(X,Y,YP,RPAR,IPAR)
2806 C SUM = 0.0
2807  DO 20 l = 1,neqn
2808  phi(l,1) = yp(l)
2809  20 phi(l,2) = 0.0d0
2810 C20 SUM = SUM + (YP(L)/WT(L))**2
2811 C SUM = SQRT(SUM)
2812 C ABSH = ABS(H)
2813 C IF(EPS .LT. 16.0*SUM*H*H) ABSH = 0.25*SQRT(EPS/SUM)
2814 C H = SIGN(MAX(ABSH,FOURU*ABS(X)),H)
2815 C
2816  u = d1mach(4)
2817  big = sqrt(d1mach(2))
2818  CALL dhstrt(df,neqn,x,x+h,y,yp,wt,1,u,big,
2819  1 phi(1,3),phi(1,4),phi(1,5),phi(1,6),rpar,ipar,h)
2820 C
2821  hold = 0.0d0
2822  k = 1
2823  kold = 0
2824  kprev = 0
2825  start = .false.
2826  phase1 = .true.
2827  nornd = .true.
2828  IF(p5eps .GT. 100.0d0*round) GO TO 99
2829  nornd = .false.
2830  DO 25 l = 1,neqn
2831  25 phi(l,15) = 0.0d0
2832  99 ifail = 0
2833 C *** END BLOCK 0 ***
2834 C
2835 C *** BEGIN BLOCK 1 ***
2836 C COMPUTE COEFFICIENTS OF FORMULAS FOR THIS STEP. AVOID COMPUTING
2837 C THOSE QUANTITIES NOT CHANGED WHEN STEP SIZE IS NOT CHANGED.
2838 C ***
2839 C
2840  100 kp1 = k+1
2841  kp2 = k+2
2842  km1 = k-1
2843  km2 = k-2
2844 C
2845 C NS IS THE NUMBER OF DSTEPS TAKEN WITH SIZE H, INCLUDING THE CURRENT
2846 C ONE. WHEN K.LT.NS, NO COEFFICIENTS CHANGE
2847 C
2848  IF(h .NE. hold) ns = 0
2849  IF (ns.LE.kold) ns = ns+1
2850  nsp1 = ns+1
2851  IF (k .LT. ns) GO TO 199
2852 C
2853 C COMPUTE THOSE COMPONENTS OF ALPHA(*),BETA(*),PSI(*),SIG(*) WHICH
2854 C ARE CHANGED
2855 C
2856  beta(ns) = 1.0d0
2857  realns = ns
2858  alpha(ns) = 1.0d0/realns
2859  temp1 = h*realns
2860  sig(nsp1) = 1.0d0
2861  IF(k .LT. nsp1) GO TO 110
2862  DO 105 i = nsp1,k
2863  im1 = i-1
2864  temp2 = psi(im1)
2865  psi(im1) = temp1
2866  beta(i) = beta(im1)*psi(im1)/temp2
2867  temp1 = temp2 + h
2868  alpha(i) = h/temp1
2869  reali = i
2870  105 sig(i+1) = reali*alpha(i)*sig(i)
2871  110 psi(k) = temp1
2872 C
2873 C COMPUTE COEFFICIENTS G(*)
2874 C
2875 C INITIALIZE V(*) AND SET W(*).
2876 C
2877  IF(ns .GT. 1) GO TO 120
2878  DO 115 iq = 1,k
2879  temp3 = iq*(iq+1)
2880  v(iq) = 1.0d0/temp3
2881  115 w(iq) = v(iq)
2882  ivc = 0
2883  kgi = 0
2884  IF (k .EQ. 1) GO TO 140
2885  kgi = 1
2886  gi(1) = w(2)
2887  GO TO 140
2888 C
2889 C IF ORDER WAS RAISED, UPDATE DIAGONAL PART OF V(*)
2890 C
2891  120 IF(k .LE. kprev) GO TO 130
2892  IF (ivc .EQ. 0) GO TO 122
2893  jv = kp1 - iv(ivc)
2894  ivc = ivc - 1
2895  GO TO 123
2896  122 jv = 1
2897  temp4 = k*kp1
2898  v(k) = 1.0d0/temp4
2899  w(k) = v(k)
2900  IF (k .NE. 2) GO TO 123
2901  kgi = 1
2902  gi(1) = w(2)
2903  123 nsm2 = ns-2
2904  IF(nsm2 .LT. jv) GO TO 130
2905  DO 125 j = jv,nsm2
2906  i = k-j
2907  v(i) = v(i) - alpha(j+1)*v(i+1)
2908  125 w(i) = v(i)
2909  IF (i .NE. 2) GO TO 130
2910  kgi = ns - 1
2911  gi(kgi) = w(2)
2912 C
2913 C UPDATE V(*) AND SET W(*)
2914 C
2915  130 limit1 = kp1 - ns
2916  temp5 = alpha(ns)
2917  DO 135 iq = 1,limit1
2918  v(iq) = v(iq) - temp5*v(iq+1)
2919  135 w(iq) = v(iq)
2920  g(nsp1) = w(1)
2921  IF (limit1 .EQ. 1) GO TO 137
2922  kgi = ns
2923  gi(kgi) = w(2)
2924  137 w(limit1+1) = v(limit1+1)
2925  IF (k .GE. kold) GO TO 140
2926  ivc = ivc + 1
2927  iv(ivc) = limit1 + 2
2928 C
2929 C COMPUTE THE G(*) IN THE WORK VECTOR W(*)
2930 C
2931  140 nsp2 = ns + 2
2932  kprev = k
2933  IF(kp1 .LT. nsp2) GO TO 199
2934  DO 150 i = nsp2,kp1
2935  limit2 = kp2 - i
2936  temp6 = alpha(i-1)
2937  DO 145 iq = 1,limit2
2938  145 w(iq) = w(iq) - temp6*w(iq+1)
2939  150 g(i) = w(1)
2940  199 CONTINUE
2941 C *** END BLOCK 1 ***
2942 C
2943 C *** BEGIN BLOCK 2 ***
2944 C PREDICT A SOLUTION P(*), EVALUATE DERIVATIVES USING PREDICTED
2945 C SOLUTION, ESTIMATE LOCAL ERROR AT ORDER K AND ERRORS AT ORDERS K,
2946 C K-1, K-2 AS IF CONSTANT STEP SIZE WERE USED.
2947 C ***
2948 C
2949 C INCREMENT COUNTER ON ATTEMPTED DSTEPS
2950 C
2951  ksteps = ksteps + 1
2952 C
2953 C CHANGE PHI TO PHI STAR
2954 C
2955  IF(k .LT. nsp1) GO TO 215
2956  DO 210 i = nsp1,k
2957  temp1 = beta(i)
2958  DO 205 l = 1,neqn
2959  205 phi(l,i) = temp1*phi(l,i)
2960  210 CONTINUE
2961 C
2962 C PREDICT SOLUTION AND DIFFERENCES
2963 C
2964  215 DO 220 l = 1,neqn
2965  phi(l,kp2) = phi(l,kp1)
2966  phi(l,kp1) = 0.0d0
2967  220 p(l) = 0.0d0
2968  DO 230 j = 1,k
2969  i = kp1 - j
2970  ip1 = i+1
2971  temp2 = g(i)
2972  DO 225 l = 1,neqn
2973  p(l) = p(l) + temp2*phi(l,i)
2974  225 phi(l,i) = phi(l,i) + phi(l,ip1)
2975  230 CONTINUE
2976  IF(nornd) GO TO 240
2977  DO 235 l = 1,neqn
2978  tau = h*p(l) - phi(l,15)
2979  p(l) = y(l) + tau
2980  235 phi(l,16) = (p(l) - y(l)) - tau
2981  GO TO 250
2982  240 DO 245 l = 1,neqn
2983  245 p(l) = y(l) + h*p(l)
2984  250 xold = x
2985  x = x + h
2986  absh = abs(h)
2987  CALL df(x,p,yp,rpar,ipar)
2988 C
2989 C ESTIMATE ERRORS AT ORDERS K,K-1,K-2
2990 C
2991  erkm2 = 0.0d0
2992  erkm1 = 0.0d0
2993  erk = 0.0d0
2994  DO 265 l = 1,neqn
2995  temp3 = 1.0d0/wt(l)
2996  temp4 = yp(l) - phi(l,1)
2997  IF(km2)265,260,255
2998  255 erkm2 = erkm2 + ((phi(l,km1)+temp4)*temp3)**2
2999  260 erkm1 = erkm1 + ((phi(l,k)+temp4)*temp3)**2
3000  265 erk = erk + (temp4*temp3)**2
3001  IF(km2)280,275,270
3002  270 erkm2 = absh*sig(km1)*gstr(km2)*sqrt(erkm2)
3003  275 erkm1 = absh*sig(k)*gstr(km1)*sqrt(erkm1)
3004  280 temp5 = absh*sqrt(erk)
3005  err = temp5*(g(k)-g(kp1))
3006  erk = temp5*sig(kp1)*gstr(k)
3007  knew = k
3008 C
3009 C TEST IF ORDER SHOULD BE LOWERED
3010 C
3011  IF(km2)299,290,285
3012  285 IF(max(erkm1,erkm2) .LE. erk) knew = km1
3013  GO TO 299
3014  290 IF(erkm1 .LE. 0.5d0*erk) knew = km1
3015 C
3016 C TEST IF STEP SUCCESSFUL
3017 C
3018  299 IF(err .LE. eps) GO TO 400
3019 C *** END BLOCK 2 ***
3020 C
3021 C *** BEGIN BLOCK 3 ***
3022 C THE STEP IS UNSUCCESSFUL. RESTORE X, PHI(*,*), PSI(*) .
3023 C IF THIRD CONSECUTIVE FAILURE, SET ORDER TO ONE. IF STEP FAILS MORE
3024 C THAN THREE TIMES, CONSIDER AN OPTIMAL STEP SIZE. DOUBLE ERROR
3025 C TOLERANCE AND RETURN IF ESTIMATED STEP SIZE IS TOO SMALL FOR MACHINE
3026 C PRECISION.
3027 C ***
3028 C
3029 C RESTORE X, PHI(*,*) AND PSI(*)
3030 C
3031  phase1 = .false.
3032  x = xold
3033  DO 310 i = 1,k
3034  temp1 = 1.0d0/beta(i)
3035  ip1 = i+1
3036  DO 305 l = 1,neqn
3037  305 phi(l,i) = temp1*(phi(l,i) - phi(l,ip1))
3038  310 CONTINUE
3039  IF(k .LT. 2) GO TO 320
3040  DO 315 i = 2,k
3041  315 psi(i-1) = psi(i) - h
3042 C
3043 C ON THIRD FAILURE, SET ORDER TO ONE. THEREAFTER, USE OPTIMAL STEP
3044 C SIZE
3045 C
3046  320 ifail = ifail + 1
3047  temp2 = 0.5d0
3048  IF(ifail - 3) 335,330,325
3049  325 IF(p5eps .LT. 0.25d0*erk) temp2 = sqrt(p5eps/erk)
3050  330 knew = 1
3051  335 h = temp2*h
3052  k = knew
3053  ns = 0
3054  IF(abs(h) .GE. fouru*abs(x)) GO TO 340
3055  crash = .true.
3056  h = sign(fouru*abs(x),h)
3057  eps = eps + eps
3058  RETURN
3059  340 GO TO 100
3060 C *** END BLOCK 3 ***
3061 C
3062 C *** BEGIN BLOCK 4 ***
3063 C THE STEP IS SUCCESSFUL. CORRECT THE PREDICTED SOLUTION, EVALUATE
3064 C THE DERIVATIVES USING THE CORRECTED SOLUTION AND UPDATE THE
3065 C DIFFERENCES. DETERMINE BEST ORDER AND STEP SIZE FOR NEXT STEP.
3066 C ***
3067  400 kold = k
3068  hold = h
3069 C
3070 C CORRECT AND EVALUATE
3071 C
3072  temp1 = h*g(kp1)
3073  IF(nornd) GO TO 410
3074  DO 405 l = 1,neqn
3075  temp3 = y(l)
3076  rho = temp1*(yp(l) - phi(l,1)) - phi(l,16)
3077  y(l) = p(l) + rho
3078  phi(l,15) = (y(l) - p(l)) - rho
3079  405 p(l) = temp3
3080  GO TO 420
3081  410 DO 415 l = 1,neqn
3082  temp3 = y(l)
3083  y(l) = p(l) + temp1*(yp(l) - phi(l,1))
3084  415 p(l) = temp3
3085  420 CALL df(x,y,yp,rpar,ipar)
3086 C
3087 C UPDATE DIFFERENCES FOR NEXT STEP
3088 C
3089  DO 425 l = 1,neqn
3090  phi(l,kp1) = yp(l) - phi(l,1)
3091  425 phi(l,kp2) = phi(l,kp1) - phi(l,kp2)
3092  DO 435 i = 1,k
3093  DO 430 l = 1,neqn
3094  430 phi(l,i) = phi(l,i) + phi(l,kp1)
3095  435 CONTINUE
3096 C
3097 C ESTIMATE ERROR AT ORDER K+1 UNLESS:
3098 C IN FIRST PHASE WHEN ALWAYS RAISE ORDER,
3099 C ALREADY DECIDED TO LOWER ORDER,
3100 C STEP SIZE NOT CONSTANT SO ESTIMATE UNRELIABLE
3101 C
3102  erkp1 = 0.0d0
3103  IF(knew .EQ. km1 .OR. k .EQ. 12) phase1 = .false.
3104  IF(phase1) GO TO 450
3105  IF(knew .EQ. km1) GO TO 455
3106  IF(kp1 .GT. ns) GO TO 460
3107  DO 440 l = 1,neqn
3108  440 erkp1 = erkp1 + (phi(l,kp2)/wt(l))**2
3109  erkp1 = absh*gstr(kp1)*sqrt(erkp1)
3110 C
3111 C USING ESTIMATED ERROR AT ORDER K+1, DETERMINE APPROPRIATE ORDER
3112 C FOR NEXT STEP
3113 C
3114  IF(k .GT. 1) GO TO 445
3115  IF(erkp1 .GE. 0.5d0*erk) GO TO 460
3116  GO TO 450
3117  445 IF(erkm1 .LE. min(erk,erkp1)) GO TO 455
3118  IF(erkp1 .GE. erk .OR. k .EQ. 12) GO TO 460
3119 C
3120 C HERE ERKP1 .LT. ERK .LT. MAX(ERKM1,ERKM2) ELSE ORDER WOULD HAVE
3121 C BEEN LOWERED IN BLOCK 2. THUS ORDER IS TO BE RAISED
3122 C
3123 C RAISE ORDER
3124 C
3125  450 k = kp1
3126  erk = erkp1
3127  GO TO 460
3128 C
3129 C LOWER ORDER
3130 C
3131  455 k = km1
3132  erk = erkm1
3133 C
3134 C WITH NEW ORDER DETERMINE APPROPRIATE STEP SIZE FOR NEXT STEP
3135 C
3136  460 hnew = h + h
3137  IF(phase1) GO TO 465
3138  IF(p5eps .GE. erk*two(k+1)) GO TO 465
3139  hnew = h
3140  IF(p5eps .GE. erk) GO TO 465
3141  temp2 = k+1
3142  r = (p5eps/erk)**(1.0d0/temp2)
3143  hnew = absh*max(0.5d0,min(0.9d0,r))
3144  hnew = sign(max(hnew,fouru*abs(x)),h)
3145  465 h = hnew
3146  RETURN
3147 C *** END BLOCK 4 ***
#define max(a, b)
Definition: cascade.c:32
double precision function d1mach(I)
Definition: ddeabm.f:2012
subroutine df(x, u, uprime, rpar, nev)
Definition: subspace.f:133
#define min(a, b)
Definition: cascade.c:31
void tau(double *ad, double **aup, double *adb, double *aubp, double *sigma, double *b, ITG *icol, ITG **irowp, ITG *neq, ITG *nzs)
subroutine dhstrt(DF, NEQ, A, B, Y, YPRIME, ETOL, MORDER, SMALL, BIG, SPY, PV, YP, SF, RPAR, IPAR, H)
Definition: ddeabm.f:4092

◆ fdump()

subroutine fdump ( )
3151 C***BEGIN PROLOGUE FDUMP
3152 C***PURPOSE Symbolic dump (should be locally written).
3153 C***LIBRARY SLATEC (XERROR)
3154 C***CATEGORY R3
3155 C***TYPE ALL (FDUMP-A)
3156 C***KEYWORDS ERROR, XERMSG
3157 C***AUTHOR Jones, R. E., (SNLA)
3158 C***DESCRIPTION
3159 C
3160 C ***Note*** Machine Dependent Routine
3161 C FDUMP is intended to be replaced by a locally written
3162 C version which produces a symbolic dump. Failing this,
3163 C it should be replaced by a version which prints the
3164 C subprogram nesting list. Note that this dump must be
3165 C printed on each of up to five files, as indicated by the
3166 C XGETUA routine. See XSETUA and XGETUA for details.
3167 C
3168 C Written by Ron Jones, with SLATEC Common Math Library Subcommittee
3169 C
3170 C***REFERENCES (NONE)
3171 C***ROUTINES CALLED (NONE)
3172 C***REVISION HISTORY (YYMMDD)
3173 C 790801 DATE WRITTEN
3174 C 861211 REVISION DATE from Version 3.2
3175 C 891214 Prologue converted to Version 4.0 format. (BAB)
3176 C***END PROLOGUE FDUMP
3177 C***FIRST EXECUTABLE STATEMENT FDUMP
3178  RETURN

◆ i1mach()

integer function i1mach (   I)
3182 C***BEGIN PROLOGUE I1MACH
3183 C***PURPOSE Return integer machine dependent constants.
3184 C***LIBRARY SLATEC
3185 C***CATEGORY R1
3186 C***TYPE INTEGER (I1MACH-I)
3187 C***KEYWORDS MACHINE CONSTANTS
3188 C***AUTHOR Fox, P. A., (Bell Labs)
3189 C Hall, A. D., (Bell Labs)
3190 C Schryer, N. L., (Bell Labs)
3191 C***DESCRIPTION
3192 C
3193 C I1MACH can be used to obtain machine-dependent parameters for the
3194 C local machine environment. It is a function subprogram with one
3195 C (input) argument and can be referenced as follows:
3196 C
3197 C K = I1MACH(I)
3198 C
3199 C where I=1,...,16. The (output) value of K above is determined by
3200 C the (input) value of I. The results for various values of I are
3201 C discussed below.
3202 C
3203 C I/O unit numbers:
3204 C I1MACH( 1) = the standard input unit.
3205 C I1MACH( 2) = the standard output unit.
3206 C I1MACH( 3) = the standard punch unit.
3207 C I1MACH( 4) = the standard error message unit.
3208 C
3209 C Words:
3210 C I1MACH( 5) = the number of bits per integer storage unit.
3211 C I1MACH( 6) = the number of characters per integer storage unit.
3212 C
3213 C Integers:
3214 C assume integers are represented in the S-digit, base-A form
3215 C
3216 C sign ( X(S-1)*A**(S-1) + ... + X(1)*A + X(0) )
3217 C
3218 C where 0 .LE. X(I) .LT. A for I=0,...,S-1.
3219 C I1MACH( 7) = A, the base.
3220 C I1MACH( 8) = S, the number of base-A digits.
3221 C I1MACH( 9) = A**S - 1, the largest magnitude.
3222 C
3223 C Floating-Point Numbers:
3224 C Assume floating-point numbers are represented in the T-digit,
3225 C base-B form
3226 C sign (B**E)*( (X(1)/B) + ... + (X(T)/B**T) )
3227 C
3228 C where 0 .LE. X(I) .LT. B for I=1,...,T,
3229 C 0 .LT. X(1), and EMIN .LE. E .LE. EMAX.
3230 C I1MACH(10) = B, the base.
3231 C
3232 C Single-Precision:
3233 C I1MACH(11) = T, the number of base-B digits.
3234 C I1MACH(12) = EMIN, the smallest exponent E.
3235 C I1MACH(13) = EMAX, the largest exponent E.
3236 C
3237 C Double-Precision:
3238 C I1MACH(14) = T, the number of base-B digits.
3239 C I1MACH(15) = EMIN, the smallest exponent E.
3240 C I1MACH(16) = EMAX, the largest exponent E.
3241 C
3242 C To alter this function for a particular environment, the desired
3243 C set of DATA statements should be activated by removing the C from
3244 C column 1. Also, the values of I1MACH(1) - I1MACH(4) should be
3245 C checked for consistency with the local operating system.
3246 C
3247 C***REFERENCES P. A. Fox, A. D. Hall and N. L. Schryer, Framework for
3248 C a portable library, ACM Transactions on Mathematical
3249 C Software 4, 2 (June 1978), pp. 177-188.
3250 C***ROUTINES CALLED (NONE)
3251 C***REVISION HISTORY (YYMMDD)
3252 C 750101 DATE WRITTEN
3253 C 891012 Added VAX G-floating constants. (WRB)
3254 C 891012 REVISION DATE from Version 3.2
3255 C 891214 Prologue converted to Version 4.0 format. (BAB)
3256 C 900618 Added DEC RISC constants. (WRB)
3257 C 900723 Added IBM RS 6000 constants. (WRB)
3258 C 901009 Correct I1MACH(7) for IBM Mainframes. Should be 2 not 16.
3259 C (RWC)
3260 C 910710 Added HP 730 constants. (SMR)
3261 C 911114 Added Convex IEEE constants. (WRB)
3262 C 920121 Added SUN -r8 compiler option constants. (WRB)
3263 C 920229 Added Touchstone Delta i860 constants. (WRB)
3264 C 920501 Reformatted the REFERENCES section. (WRB)
3265 C 920625 Added Convex -p8 and -pd8 compiler option constants.
3266 C (BKS, WRB)
3267 C 930201 Added DEC Alpha and SGI constants. (RWC and WRB)
3268 C 930618 Corrected I1MACH(5) for Convex -p8 and -pd8 compiler
3269 C options. (DWL, RWC and WRB).
3270 C 010817 Elevated IEEE to highest importance; see next set of
3271 C comments below. (DWL)
3272 C***END PROLOGUE I1MACH
3273 C
3274 C Initial data here correspond to the IEEE standard. If one of the
3275 C sets of initial data below is preferred, do the necessary commenting
3276 C and uncommenting. (DWL)
3277  INTEGER imach(16),output
3278  DATA imach( 1) / 5 /
3279  DATA imach( 2) / 6 /
3280  DATA imach( 3) / 6 /
3281  DATA imach( 4) / 6 /
3282  DATA imach( 5) / 32 /
3283  DATA imach( 6) / 4 /
3284  DATA imach( 7) / 2 /
3285  DATA imach( 8) / 31 /
3286  DATA imach( 9) / 2147483647 /
3287  DATA imach(10) / 2 /
3288  DATA imach(11) / 24 /
3289  DATA imach(12) / -126 /
3290  DATA imach(13) / 127 /
3291  DATA imach(14) / 53 /
3292  DATA imach(15) / -1022 /
3293  DATA imach(16) / 1023 /
3294  SAVE imach
3295 cc EQUIVALENCE (IMACH(4),OUTPUT)
3296 C
3297 C MACHINE CONSTANTS FOR THE AMIGA
3298 C ABSOFT COMPILER
3299 C
3300 C DATA IMACH( 1) / 5 /
3301 C DATA IMACH( 2) / 6 /
3302 C DATA IMACH( 3) / 5 /
3303 C DATA IMACH( 4) / 6 /
3304 C DATA IMACH( 5) / 32 /
3305 C DATA IMACH( 6) / 4 /
3306 C DATA IMACH( 7) / 2 /
3307 C DATA IMACH( 8) / 31 /
3308 C DATA IMACH( 9) / 2147483647 /
3309 C DATA IMACH(10) / 2 /
3310 C DATA IMACH(11) / 24 /
3311 C DATA IMACH(12) / -126 /
3312 C DATA IMACH(13) / 127 /
3313 C DATA IMACH(14) / 53 /
3314 C DATA IMACH(15) / -1022 /
3315 C DATA IMACH(16) / 1023 /
3316 C
3317 C MACHINE CONSTANTS FOR THE APOLLO
3318 C
3319 C DATA IMACH( 1) / 5 /
3320 C DATA IMACH( 2) / 6 /
3321 C DATA IMACH( 3) / 6 /
3322 C DATA IMACH( 4) / 6 /
3323 C DATA IMACH( 5) / 32 /
3324 C DATA IMACH( 6) / 4 /
3325 C DATA IMACH( 7) / 2 /
3326 C DATA IMACH( 8) / 31 /
3327 C DATA IMACH( 9) / 2147483647 /
3328 C DATA IMACH(10) / 2 /
3329 C DATA IMACH(11) / 24 /
3330 C DATA IMACH(12) / -125 /
3331 C DATA IMACH(13) / 129 /
3332 C DATA IMACH(14) / 53 /
3333 C DATA IMACH(15) / -1021 /
3334 C DATA IMACH(16) / 1025 /
3335 C
3336 C MACHINE CONSTANTS FOR THE BURROUGHS 1700 SYSTEM
3337 C
3338 C DATA IMACH( 1) / 7 /
3339 C DATA IMACH( 2) / 2 /
3340 C DATA IMACH( 3) / 2 /
3341 C DATA IMACH( 4) / 2 /
3342 C DATA IMACH( 5) / 36 /
3343 C DATA IMACH( 6) / 4 /
3344 C DATA IMACH( 7) / 2 /
3345 C DATA IMACH( 8) / 33 /
3346 C DATA IMACH( 9) / Z1FFFFFFFF /
3347 C DATA IMACH(10) / 2 /
3348 C DATA IMACH(11) / 24 /
3349 C DATA IMACH(12) / -256 /
3350 C DATA IMACH(13) / 255 /
3351 C DATA IMACH(14) / 60 /
3352 C DATA IMACH(15) / -256 /
3353 C DATA IMACH(16) / 255 /
3354 C
3355 C MACHINE CONSTANTS FOR THE BURROUGHS 5700 SYSTEM
3356 C
3357 C DATA IMACH( 1) / 5 /
3358 C DATA IMACH( 2) / 6 /
3359 C DATA IMACH( 3) / 7 /
3360 C DATA IMACH( 4) / 6 /
3361 C DATA IMACH( 5) / 48 /
3362 C DATA IMACH( 6) / 6 /
3363 C DATA IMACH( 7) / 2 /
3364 C DATA IMACH( 8) / 39 /
3365 C DATA IMACH( 9) / O0007777777777777 /
3366 C DATA IMACH(10) / 8 /
3367 C DATA IMACH(11) / 13 /
3368 C DATA IMACH(12) / -50 /
3369 C DATA IMACH(13) / 76 /
3370 C DATA IMACH(14) / 26 /
3371 C DATA IMACH(15) / -50 /
3372 C DATA IMACH(16) / 76 /
3373 C
3374 C MACHINE CONSTANTS FOR THE BURROUGHS 6700/7700 SYSTEMS
3375 C
3376 C DATA IMACH( 1) / 5 /
3377 C DATA IMACH( 2) / 6 /
3378 C DATA IMACH( 3) / 7 /
3379 C DATA IMACH( 4) / 6 /
3380 C DATA IMACH( 5) / 48 /
3381 C DATA IMACH( 6) / 6 /
3382 C DATA IMACH( 7) / 2 /
3383 C DATA IMACH( 8) / 39 /
3384 C DATA IMACH( 9) / O0007777777777777 /
3385 C DATA IMACH(10) / 8 /
3386 C DATA IMACH(11) / 13 /
3387 C DATA IMACH(12) / -50 /
3388 C DATA IMACH(13) / 76 /
3389 C DATA IMACH(14) / 26 /
3390 C DATA IMACH(15) / -32754 /
3391 C DATA IMACH(16) / 32780 /
3392 C
3393 C MACHINE CONSTANTS FOR THE CDC 170/180 SERIES USING NOS/VE
3394 C
3395 C DATA IMACH( 1) / 5 /
3396 C DATA IMACH( 2) / 6 /
3397 C DATA IMACH( 3) / 7 /
3398 C DATA IMACH( 4) / 6 /
3399 C DATA IMACH( 5) / 64 /
3400 C DATA IMACH( 6) / 8 /
3401 C DATA IMACH( 7) / 2 /
3402 C DATA IMACH( 8) / 63 /
3403 C DATA IMACH( 9) / 9223372036854775807 /
3404 C DATA IMACH(10) / 2 /
3405 C DATA IMACH(11) / 47 /
3406 C DATA IMACH(12) / -4095 /
3407 C DATA IMACH(13) / 4094 /
3408 C DATA IMACH(14) / 94 /
3409 C DATA IMACH(15) / -4095 /
3410 C DATA IMACH(16) / 4094 /
3411 C
3412 C MACHINE CONSTANTS FOR THE CDC 6000/7000 SERIES
3413 C
3414 C DATA IMACH( 1) / 5 /
3415 C DATA IMACH( 2) / 6 /
3416 C DATA IMACH( 3) / 7 /
3417 C DATA IMACH( 4) / 6LOUTPUT/
3418 C DATA IMACH( 5) / 60 /
3419 C DATA IMACH( 6) / 10 /
3420 C DATA IMACH( 7) / 2 /
3421 C DATA IMACH( 8) / 48 /
3422 C DATA IMACH( 9) / 00007777777777777777B /
3423 C DATA IMACH(10) / 2 /
3424 C DATA IMACH(11) / 47 /
3425 C DATA IMACH(12) / -929 /
3426 C DATA IMACH(13) / 1070 /
3427 C DATA IMACH(14) / 94 /
3428 C DATA IMACH(15) / -929 /
3429 C DATA IMACH(16) / 1069 /
3430 C
3431 C MACHINE CONSTANTS FOR THE CELERITY C1260
3432 C
3433 C DATA IMACH( 1) / 5 /
3434 C DATA IMACH( 2) / 6 /
3435 C DATA IMACH( 3) / 6 /
3436 C DATA IMACH( 4) / 0 /
3437 C DATA IMACH( 5) / 32 /
3438 C DATA IMACH( 6) / 4 /
3439 C DATA IMACH( 7) / 2 /
3440 C DATA IMACH( 8) / 31 /
3441 C DATA IMACH( 9) / Z'7FFFFFFF' /
3442 C DATA IMACH(10) / 2 /
3443 C DATA IMACH(11) / 24 /
3444 C DATA IMACH(12) / -126 /
3445 C DATA IMACH(13) / 127 /
3446 C DATA IMACH(14) / 53 /
3447 C DATA IMACH(15) / -1022 /
3448 C DATA IMACH(16) / 1023 /
3449 C
3450 C MACHINE CONSTANTS FOR THE CONVEX
3451 C USING THE -fn COMPILER OPTION
3452 C
3453 C DATA IMACH( 1) / 5 /
3454 C DATA IMACH( 2) / 6 /
3455 C DATA IMACH( 3) / 7 /
3456 C DATA IMACH( 4) / 6 /
3457 C DATA IMACH( 5) / 32 /
3458 C DATA IMACH( 6) / 4 /
3459 C DATA IMACH( 7) / 2 /
3460 C DATA IMACH( 8) / 31 /
3461 C DATA IMACH( 9) / 2147483647 /
3462 C DATA IMACH(10) / 2 /
3463 C DATA IMACH(11) / 24 /
3464 C DATA IMACH(12) / -127 /
3465 C DATA IMACH(13) / 127 /
3466 C DATA IMACH(14) / 53 /
3467 C DATA IMACH(15) / -1023 /
3468 C DATA IMACH(16) / 1023 /
3469 C
3470 C MACHINE CONSTANTS FOR THE CONVEX
3471 C USING THE -fi COMPILER OPTION
3472 C
3473 C DATA IMACH( 1) / 5 /
3474 C DATA IMACH( 2) / 6 /
3475 C DATA IMACH( 3) / 7 /
3476 C DATA IMACH( 4) / 6 /
3477 C DATA IMACH( 5) / 32 /
3478 C DATA IMACH( 6) / 4 /
3479 C DATA IMACH( 7) / 2 /
3480 C DATA IMACH( 8) / 31 /
3481 C DATA IMACH( 9) / 2147483647 /
3482 C DATA IMACH(10) / 2 /
3483 C DATA IMACH(11) / 24 /
3484 C DATA IMACH(12) / -125 /
3485 C DATA IMACH(13) / 128 /
3486 C DATA IMACH(14) / 53 /
3487 C DATA IMACH(15) / -1021 /
3488 C DATA IMACH(16) / 1024 /
3489 C
3490 C MACHINE CONSTANTS FOR THE CONVEX
3491 C USING THE -p8 COMPILER OPTION
3492 C
3493 C DATA IMACH( 1) / 5 /
3494 C DATA IMACH( 2) / 6 /
3495 C DATA IMACH( 3) / 7 /
3496 C DATA IMACH( 4) / 6 /
3497 C DATA IMACH( 5) / 64 /
3498 C DATA IMACH( 6) / 4 /
3499 C DATA IMACH( 7) / 2 /
3500 C DATA IMACH( 8) / 63 /
3501 C DATA IMACH( 9) / 9223372036854775807 /
3502 C DATA IMACH(10) / 2 /
3503 C DATA IMACH(11) / 53 /
3504 C DATA IMACH(12) / -1023 /
3505 C DATA IMACH(13) / 1023 /
3506 C DATA IMACH(14) / 113 /
3507 C DATA IMACH(15) / -16383 /
3508 C DATA IMACH(16) / 16383 /
3509 C
3510 C MACHINE CONSTANTS FOR THE CONVEX
3511 C USING THE -pd8 COMPILER OPTION
3512 C
3513 C DATA IMACH( 1) / 5 /
3514 C DATA IMACH( 2) / 6 /
3515 C DATA IMACH( 3) / 7 /
3516 C DATA IMACH( 4) / 6 /
3517 C DATA IMACH( 5) / 64 /
3518 C DATA IMACH( 6) / 4 /
3519 C DATA IMACH( 7) / 2 /
3520 C DATA IMACH( 8) / 63 /
3521 C DATA IMACH( 9) / 9223372036854775807 /
3522 C DATA IMACH(10) / 2 /
3523 C DATA IMACH(11) / 53 /
3524 C DATA IMACH(12) / -1023 /
3525 C DATA IMACH(13) / 1023 /
3526 C DATA IMACH(14) / 53 /
3527 C DATA IMACH(15) / -1023 /
3528 C DATA IMACH(16) / 1023 /
3529 C
3530 C MACHINE CONSTANTS FOR THE CRAY
3531 C USING THE 46 BIT INTEGER COMPILER OPTION
3532 C
3533 C DATA IMACH( 1) / 100 /
3534 C DATA IMACH( 2) / 101 /
3535 C DATA IMACH( 3) / 102 /
3536 C DATA IMACH( 4) / 101 /
3537 C DATA IMACH( 5) / 64 /
3538 C DATA IMACH( 6) / 8 /
3539 C DATA IMACH( 7) / 2 /
3540 C DATA IMACH( 8) / 46 /
3541 C DATA IMACH( 9) / 1777777777777777B /
3542 C DATA IMACH(10) / 2 /
3543 C DATA IMACH(11) / 47 /
3544 C DATA IMACH(12) / -8189 /
3545 C DATA IMACH(13) / 8190 /
3546 C DATA IMACH(14) / 94 /
3547 C DATA IMACH(15) / -8099 /
3548 C DATA IMACH(16) / 8190 /
3549 C
3550 C MACHINE CONSTANTS FOR THE CRAY
3551 C USING THE 64 BIT INTEGER COMPILER OPTION
3552 C
3553 C DATA IMACH( 1) / 100 /
3554 C DATA IMACH( 2) / 101 /
3555 C DATA IMACH( 3) / 102 /
3556 C DATA IMACH( 4) / 101 /
3557 C DATA IMACH( 5) / 64 /
3558 C DATA IMACH( 6) / 8 /
3559 C DATA IMACH( 7) / 2 /
3560 C DATA IMACH( 8) / 63 /
3561 C DATA IMACH( 9) / 777777777777777777777B /
3562 C DATA IMACH(10) / 2 /
3563 C DATA IMACH(11) / 47 /
3564 C DATA IMACH(12) / -8189 /
3565 C DATA IMACH(13) / 8190 /
3566 C DATA IMACH(14) / 94 /
3567 C DATA IMACH(15) / -8099 /
3568 C DATA IMACH(16) / 8190 /
3569 C
3570 C MACHINE CONSTANTS FOR THE DATA GENERAL ECLIPSE S/200
3571 C
3572 C DATA IMACH( 1) / 11 /
3573 C DATA IMACH( 2) / 12 /
3574 C DATA IMACH( 3) / 8 /
3575 C DATA IMACH( 4) / 10 /
3576 C DATA IMACH( 5) / 16 /
3577 C DATA IMACH( 6) / 2 /
3578 C DATA IMACH( 7) / 2 /
3579 C DATA IMACH( 8) / 15 /
3580 C DATA IMACH( 9) / 32767 /
3581 C DATA IMACH(10) / 16 /
3582 C DATA IMACH(11) / 6 /
3583 C DATA IMACH(12) / -64 /
3584 C DATA IMACH(13) / 63 /
3585 C DATA IMACH(14) / 14 /
3586 C DATA IMACH(15) / -64 /
3587 C DATA IMACH(16) / 63 /
3588 C
3589 C MACHINE CONSTANTS FOR THE DEC ALPHA
3590 C USING G_FLOAT
3591 C
3592 C DATA IMACH( 1) / 5 /
3593 C DATA IMACH( 2) / 6 /
3594 C DATA IMACH( 3) / 5 /
3595 C DATA IMACH( 4) / 6 /
3596 C DATA IMACH( 5) / 32 /
3597 C DATA IMACH( 6) / 4 /
3598 C DATA IMACH( 7) / 2 /
3599 C DATA IMACH( 8) / 31 /
3600 C DATA IMACH( 9) / 2147483647 /
3601 C DATA IMACH(10) / 2 /
3602 C DATA IMACH(11) / 24 /
3603 C DATA IMACH(12) / -127 /
3604 C DATA IMACH(13) / 127 /
3605 C DATA IMACH(14) / 53 /
3606 C DATA IMACH(15) / -1023 /
3607 C DATA IMACH(16) / 1023 /
3608 C
3609 C MACHINE CONSTANTS FOR THE DEC ALPHA
3610 C USING IEEE_FLOAT
3611 C
3612 C DATA IMACH( 1) / 5 /
3613 C DATA IMACH( 2) / 6 /
3614 C DATA IMACH( 3) / 6 /
3615 C DATA IMACH( 4) / 6 /
3616 C DATA IMACH( 5) / 32 /
3617 C DATA IMACH( 6) / 4 /
3618 C DATA IMACH( 7) / 2 /
3619 C DATA IMACH( 8) / 31 /
3620 C DATA IMACH( 9) / 2147483647 /
3621 C DATA IMACH(10) / 2 /
3622 C DATA IMACH(11) / 24 /
3623 C DATA IMACH(12) / -125 /
3624 C DATA IMACH(13) / 128 /
3625 C DATA IMACH(14) / 53 /
3626 C DATA IMACH(15) / -1021 /
3627 C DATA IMACH(16) / 1024 /
3628 C
3629 C MACHINE CONSTANTS FOR THE DEC RISC
3630 C
3631 C DATA IMACH( 1) / 5 /
3632 C DATA IMACH( 2) / 6 /
3633 C DATA IMACH( 3) / 6 /
3634 C DATA IMACH( 4) / 6 /
3635 C DATA IMACH( 5) / 32 /
3636 C DATA IMACH( 6) / 4 /
3637 C DATA IMACH( 7) / 2 /
3638 C DATA IMACH( 8) / 31 /
3639 C DATA IMACH( 9) / 2147483647 /
3640 C DATA IMACH(10) / 2 /
3641 C DATA IMACH(11) / 24 /
3642 C DATA IMACH(12) / -125 /
3643 C DATA IMACH(13) / 128 /
3644 C DATA IMACH(14) / 53 /
3645 C DATA IMACH(15) / -1021 /
3646 C DATA IMACH(16) / 1024 /
3647 C
3648 C MACHINE CONSTANTS FOR THE DEC VAX
3649 C USING D_FLOATING
3650 C
3651 C DATA IMACH( 1) / 5 /
3652 C DATA IMACH( 2) / 6 /
3653 C DATA IMACH( 3) / 5 /
3654 C DATA IMACH( 4) / 6 /
3655 C DATA IMACH( 5) / 32 /
3656 C DATA IMACH( 6) / 4 /
3657 C DATA IMACH( 7) / 2 /
3658 C DATA IMACH( 8) / 31 /
3659 C DATA IMACH( 9) / 2147483647 /
3660 C DATA IMACH(10) / 2 /
3661 C DATA IMACH(11) / 24 /
3662 C DATA IMACH(12) / -127 /
3663 C DATA IMACH(13) / 127 /
3664 C DATA IMACH(14) / 56 /
3665 C DATA IMACH(15) / -127 /
3666 C DATA IMACH(16) / 127 /
3667 C
3668 C MACHINE CONSTANTS FOR THE DEC VAX
3669 C USING G_FLOATING
3670 C
3671 C DATA IMACH( 1) / 5 /
3672 C DATA IMACH( 2) / 6 /
3673 C DATA IMACH( 3) / 5 /
3674 C DATA IMACH( 4) / 6 /
3675 C DATA IMACH( 5) / 32 /
3676 C DATA IMACH( 6) / 4 /
3677 C DATA IMACH( 7) / 2 /
3678 C DATA IMACH( 8) / 31 /
3679 C DATA IMACH( 9) / 2147483647 /
3680 C DATA IMACH(10) / 2 /
3681 C DATA IMACH(11) / 24 /
3682 C DATA IMACH(12) / -127 /
3683 C DATA IMACH(13) / 127 /
3684 C DATA IMACH(14) / 53 /
3685 C DATA IMACH(15) / -1023 /
3686 C DATA IMACH(16) / 1023 /
3687 C
3688 C MACHINE CONSTANTS FOR THE ELXSI 6400
3689 C
3690 C DATA IMACH( 1) / 5 /
3691 C DATA IMACH( 2) / 6 /
3692 C DATA IMACH( 3) / 6 /
3693 C DATA IMACH( 4) / 6 /
3694 C DATA IMACH( 5) / 32 /
3695 C DATA IMACH( 6) / 4 /
3696 C DATA IMACH( 7) / 2 /
3697 C DATA IMACH( 8) / 32 /
3698 C DATA IMACH( 9) / 2147483647 /
3699 C DATA IMACH(10) / 2 /
3700 C DATA IMACH(11) / 24 /
3701 C DATA IMACH(12) / -126 /
3702 C DATA IMACH(13) / 127 /
3703 C DATA IMACH(14) / 53 /
3704 C DATA IMACH(15) / -1022 /
3705 C DATA IMACH(16) / 1023 /
3706 C
3707 C MACHINE CONSTANTS FOR THE HARRIS 220
3708 C
3709 C DATA IMACH( 1) / 5 /
3710 C DATA IMACH( 2) / 6 /
3711 C DATA IMACH( 3) / 0 /
3712 C DATA IMACH( 4) / 6 /
3713 C DATA IMACH( 5) / 24 /
3714 C DATA IMACH( 6) / 3 /
3715 C DATA IMACH( 7) / 2 /
3716 C DATA IMACH( 8) / 23 /
3717 C DATA IMACH( 9) / 8388607 /
3718 C DATA IMACH(10) / 2 /
3719 C DATA IMACH(11) / 23 /
3720 C DATA IMACH(12) / -127 /
3721 C DATA IMACH(13) / 127 /
3722 C DATA IMACH(14) / 38 /
3723 C DATA IMACH(15) / -127 /
3724 C DATA IMACH(16) / 127 /
3725 C
3726 C MACHINE CONSTANTS FOR THE HONEYWELL 600/6000 SERIES
3727 C
3728 C DATA IMACH( 1) / 5 /
3729 C DATA IMACH( 2) / 6 /
3730 C DATA IMACH( 3) / 43 /
3731 C DATA IMACH( 4) / 6 /
3732 C DATA IMACH( 5) / 36 /
3733 C DATA IMACH( 6) / 6 /
3734 C DATA IMACH( 7) / 2 /
3735 C DATA IMACH( 8) / 35 /
3736 C DATA IMACH( 9) / O377777777777 /
3737 C DATA IMACH(10) / 2 /
3738 C DATA IMACH(11) / 27 /
3739 C DATA IMACH(12) / -127 /
3740 C DATA IMACH(13) / 127 /
3741 C DATA IMACH(14) / 63 /
3742 C DATA IMACH(15) / -127 /
3743 C DATA IMACH(16) / 127 /
3744 C
3745 C MACHINE CONSTANTS FOR THE HP 730
3746 C
3747 C DATA IMACH( 1) / 5 /
3748 C DATA IMACH( 2) / 6 /
3749 C DATA IMACH( 3) / 6 /
3750 C DATA IMACH( 4) / 6 /
3751 C DATA IMACH( 5) / 32 /
3752 C DATA IMACH( 6) / 4 /
3753 C DATA IMACH( 7) / 2 /
3754 C DATA IMACH( 8) / 31 /
3755 C DATA IMACH( 9) / 2147483647 /
3756 C DATA IMACH(10) / 2 /
3757 C DATA IMACH(11) / 24 /
3758 C DATA IMACH(12) / -125 /
3759 C DATA IMACH(13) / 128 /
3760 C DATA IMACH(14) / 53 /
3761 C DATA IMACH(15) / -1021 /
3762 C DATA IMACH(16) / 1024 /
3763 C
3764 C MACHINE CONSTANTS FOR THE HP 2100
3765 C 3 WORD DOUBLE PRECISION OPTION WITH FTN4
3766 C
3767 C DATA IMACH( 1) / 5 /
3768 C DATA IMACH( 2) / 6 /
3769 C DATA IMACH( 3) / 4 /
3770 C DATA IMACH( 4) / 1 /
3771 C DATA IMACH( 5) / 16 /
3772 C DATA IMACH( 6) / 2 /
3773 C DATA IMACH( 7) / 2 /
3774 C DATA IMACH( 8) / 15 /
3775 C DATA IMACH( 9) / 32767 /
3776 C DATA IMACH(10) / 2 /
3777 C DATA IMACH(11) / 23 /
3778 C DATA IMACH(12) / -128 /
3779 C DATA IMACH(13) / 127 /
3780 C DATA IMACH(14) / 39 /
3781 C DATA IMACH(15) / -128 /
3782 C DATA IMACH(16) / 127 /
3783 C
3784 C MACHINE CONSTANTS FOR THE HP 2100
3785 C 4 WORD DOUBLE PRECISION OPTION WITH FTN4
3786 C
3787 C DATA IMACH( 1) / 5 /
3788 C DATA IMACH( 2) / 6 /
3789 C DATA IMACH( 3) / 4 /
3790 C DATA IMACH( 4) / 1 /
3791 C DATA IMACH( 5) / 16 /
3792 C DATA IMACH( 6) / 2 /
3793 C DATA IMACH( 7) / 2 /
3794 C DATA IMACH( 8) / 15 /
3795 C DATA IMACH( 9) / 32767 /
3796 C DATA IMACH(10) / 2 /
3797 C DATA IMACH(11) / 23 /
3798 C DATA IMACH(12) / -128 /
3799 C DATA IMACH(13) / 127 /
3800 C DATA IMACH(14) / 55 /
3801 C DATA IMACH(15) / -128 /
3802 C DATA IMACH(16) / 127 /
3803 C
3804 C MACHINE CONSTANTS FOR THE HP 9000
3805 C
3806 C DATA IMACH( 1) / 5 /
3807 C DATA IMACH( 2) / 6 /
3808 C DATA IMACH( 3) / 6 /
3809 C DATA IMACH( 4) / 7 /
3810 C DATA IMACH( 5) / 32 /
3811 C DATA IMACH( 6) / 4 /
3812 C DATA IMACH( 7) / 2 /
3813 C DATA IMACH( 8) / 32 /
3814 C DATA IMACH( 9) / 2147483647 /
3815 C DATA IMACH(10) / 2 /
3816 C DATA IMACH(11) / 24 /
3817 C DATA IMACH(12) / -126 /
3818 C DATA IMACH(13) / 127 /
3819 C DATA IMACH(14) / 53 /
3820 C DATA IMACH(15) / -1015 /
3821 C DATA IMACH(16) / 1017 /
3822 C
3823 C MACHINE CONSTANTS FOR THE IBM 360/370 SERIES,
3824 C THE XEROX SIGMA 5/7/9, THE SEL SYSTEMS 85/86, AND
3825 C THE PERKIN ELMER (INTERDATA) 7/32.
3826 C
3827 C DATA IMACH( 1) / 5 /
3828 C DATA IMACH( 2) / 6 /
3829 C DATA IMACH( 3) / 7 /
3830 C DATA IMACH( 4) / 6 /
3831 C DATA IMACH( 5) / 32 /
3832 C DATA IMACH( 6) / 4 /
3833 C DATA IMACH( 7) / 2 /
3834 C DATA IMACH( 8) / 31 /
3835 C DATA IMACH( 9) / Z7FFFFFFF /
3836 C DATA IMACH(10) / 16 /
3837 C DATA IMACH(11) / 6 /
3838 C DATA IMACH(12) / -64 /
3839 C DATA IMACH(13) / 63 /
3840 C DATA IMACH(14) / 14 /
3841 C DATA IMACH(15) / -64 /
3842 C DATA IMACH(16) / 63 /
3843 C
3844 C MACHINE CONSTANTS FOR THE IBM PC
3845 C
3846 C DATA IMACH( 1) / 5 /
3847 C DATA IMACH( 2) / 6 /
3848 C DATA IMACH( 3) / 0 /
3849 C DATA IMACH( 4) / 0 /
3850 C DATA IMACH( 5) / 32 /
3851 C DATA IMACH( 6) / 4 /
3852 C DATA IMACH( 7) / 2 /
3853 C DATA IMACH( 8) / 31 /
3854 C DATA IMACH( 9) / 2147483647 /
3855 C DATA IMACH(10) / 2 /
3856 C DATA IMACH(11) / 24 /
3857 C DATA IMACH(12) / -125 /
3858 C DATA IMACH(13) / 127 /
3859 C DATA IMACH(14) / 53 /
3860 C DATA IMACH(15) / -1021 /
3861 C DATA IMACH(16) / 1023 /
3862 C
3863 C MACHINE CONSTANTS FOR THE IBM RS 6000
3864 C
3865 C DATA IMACH( 1) / 5 /
3866 C DATA IMACH( 2) / 6 /
3867 C DATA IMACH( 3) / 6 /
3868 C DATA IMACH( 4) / 0 /
3869 C DATA IMACH( 5) / 32 /
3870 C DATA IMACH( 6) / 4 /
3871 C DATA IMACH( 7) / 2 /
3872 C DATA IMACH( 8) / 31 /
3873 C DATA IMACH( 9) / 2147483647 /
3874 C DATA IMACH(10) / 2 /
3875 C DATA IMACH(11) / 24 /
3876 C DATA IMACH(12) / -125 /
3877 C DATA IMACH(13) / 128 /
3878 C DATA IMACH(14) / 53 /
3879 C DATA IMACH(15) / -1021 /
3880 C DATA IMACH(16) / 1024 /
3881 C
3882 C MACHINE CONSTANTS FOR THE INTEL i860
3883 C
3884 C DATA IMACH( 1) / 5 /
3885 C DATA IMACH( 2) / 6 /
3886 C DATA IMACH( 3) / 6 /
3887 C DATA IMACH( 4) / 6 /
3888 C DATA IMACH( 5) / 32 /
3889 C DATA IMACH( 6) / 4 /
3890 C DATA IMACH( 7) / 2 /
3891 C DATA IMACH( 8) / 31 /
3892 C DATA IMACH( 9) / 2147483647 /
3893 C DATA IMACH(10) / 2 /
3894 C DATA IMACH(11) / 24 /
3895 C DATA IMACH(12) / -125 /
3896 C DATA IMACH(13) / 128 /
3897 C DATA IMACH(14) / 53 /
3898 C DATA IMACH(15) / -1021 /
3899 C DATA IMACH(16) / 1024 /
3900 C
3901 C MACHINE CONSTANTS FOR THE PDP-10 (KA PROCESSOR)
3902 C
3903 C DATA IMACH( 1) / 5 /
3904 C DATA IMACH( 2) / 6 /
3905 C DATA IMACH( 3) / 5 /
3906 C DATA IMACH( 4) / 6 /
3907 C DATA IMACH( 5) / 36 /
3908 C DATA IMACH( 6) / 5 /
3909 C DATA IMACH( 7) / 2 /
3910 C DATA IMACH( 8) / 35 /
3911 C DATA IMACH( 9) / "377777777777 /
3912 C DATA IMACH(10) / 2 /
3913 C DATA IMACH(11) / 27 /
3914 C DATA IMACH(12) / -128 /
3915 C DATA IMACH(13) / 127 /
3916 C DATA IMACH(14) / 54 /
3917 C DATA IMACH(15) / -101 /
3918 C DATA IMACH(16) / 127 /
3919 C
3920 C MACHINE CONSTANTS FOR THE PDP-10 (KI PROCESSOR)
3921 C
3922 C DATA IMACH( 1) / 5 /
3923 C DATA IMACH( 2) / 6 /
3924 C DATA IMACH( 3) / 5 /
3925 C DATA IMACH( 4) / 6 /
3926 C DATA IMACH( 5) / 36 /
3927 C DATA IMACH( 6) / 5 /
3928 C DATA IMACH( 7) / 2 /
3929 C DATA IMACH( 8) / 35 /
3930 C DATA IMACH( 9) / "377777777777 /
3931 C DATA IMACH(10) / 2 /
3932 C DATA IMACH(11) / 27 /
3933 C DATA IMACH(12) / -128 /
3934 C DATA IMACH(13) / 127 /
3935 C DATA IMACH(14) / 62 /
3936 C DATA IMACH(15) / -128 /
3937 C DATA IMACH(16) / 127 /
3938 C
3939 C MACHINE CONSTANTS FOR PDP-11 FORTRAN SUPPORTING
3940 C 32-BIT INTEGER ARITHMETIC.
3941 C
3942 C DATA IMACH( 1) / 5 /
3943 C DATA IMACH( 2) / 6 /
3944 C DATA IMACH( 3) / 5 /
3945 C DATA IMACH( 4) / 6 /
3946 C DATA IMACH( 5) / 32 /
3947 C DATA IMACH( 6) / 4 /
3948 C DATA IMACH( 7) / 2 /
3949 C DATA IMACH( 8) / 31 /
3950 C DATA IMACH( 9) / 2147483647 /
3951 C DATA IMACH(10) / 2 /
3952 C DATA IMACH(11) / 24 /
3953 C DATA IMACH(12) / -127 /
3954 C DATA IMACH(13) / 127 /
3955 C DATA IMACH(14) / 56 /
3956 C DATA IMACH(15) / -127 /
3957 C DATA IMACH(16) / 127 /
3958 C
3959 C MACHINE CONSTANTS FOR PDP-11 FORTRAN SUPPORTING
3960 C 16-BIT INTEGER ARITHMETIC.
3961 C
3962 C DATA IMACH( 1) / 5 /
3963 C DATA IMACH( 2) / 6 /
3964 C DATA IMACH( 3) / 5 /
3965 C DATA IMACH( 4) / 6 /
3966 C DATA IMACH( 5) / 16 /
3967 C DATA IMACH( 6) / 2 /
3968 C DATA IMACH( 7) / 2 /
3969 C DATA IMACH( 8) / 15 /
3970 C DATA IMACH( 9) / 32767 /
3971 C DATA IMACH(10) / 2 /
3972 C DATA IMACH(11) / 24 /
3973 C DATA IMACH(12) / -127 /
3974 C DATA IMACH(13) / 127 /
3975 C DATA IMACH(14) / 56 /
3976 C DATA IMACH(15) / -127 /
3977 C DATA IMACH(16) / 127 /
3978 C
3979 C MACHINE CONSTANTS FOR THE SILICON GRAPHICS
3980 C
3981 C DATA IMACH( 1) / 5 /
3982 C DATA IMACH( 2) / 6 /
3983 C DATA IMACH( 3) / 6 /
3984 C DATA IMACH( 4) / 6 /
3985 C DATA IMACH( 5) / 32 /
3986 C DATA IMACH( 6) / 4 /
3987 C DATA IMACH( 7) / 2 /
3988 C DATA IMACH( 8) / 31 /
3989 C DATA IMACH( 9) / 2147483647 /
3990 C DATA IMACH(10) / 2 /
3991 C DATA IMACH(11) / 24 /
3992 C DATA IMACH(12) / -125 /
3993 C DATA IMACH(13) / 128 /
3994 C DATA IMACH(14) / 53 /
3995 C DATA IMACH(15) / -1021 /
3996 C DATA IMACH(16) / 1024 /
3997 C
3998 C MACHINE CONSTANTS FOR THE SUN
3999 C
4000 C DATA IMACH( 1) / 5 /
4001 C DATA IMACH( 2) / 6 /
4002 C DATA IMACH( 3) / 6 /
4003 C DATA IMACH( 4) / 6 /
4004 C DATA IMACH( 5) / 32 /
4005 C DATA IMACH( 6) / 4 /
4006 C DATA IMACH( 7) / 2 /
4007 C DATA IMACH( 8) / 31 /
4008 C DATA IMACH( 9) / 2147483647 /
4009 C DATA IMACH(10) / 2 /
4010 C DATA IMACH(11) / 24 /
4011 C DATA IMACH(12) / -125 /
4012 C DATA IMACH(13) / 128 /
4013 C DATA IMACH(14) / 53 /
4014 C DATA IMACH(15) / -1021 /
4015 C DATA IMACH(16) / 1024 /
4016 C
4017 C MACHINE CONSTANTS FOR THE SUN
4018 C USING THE -r8 COMPILER OPTION
4019 C
4020 C DATA IMACH( 1) / 5 /
4021 C DATA IMACH( 2) / 6 /
4022 C DATA IMACH( 3) / 6 /
4023 C DATA IMACH( 4) / 6 /
4024 C DATA IMACH( 5) / 32 /
4025 C DATA IMACH( 6) / 4 /
4026 C DATA IMACH( 7) / 2 /
4027 C DATA IMACH( 8) / 31 /
4028 C DATA IMACH( 9) / 2147483647 /
4029 C DATA IMACH(10) / 2 /
4030 C DATA IMACH(11) / 53 /
4031 C DATA IMACH(12) / -1021 /
4032 C DATA IMACH(13) / 1024 /
4033 C DATA IMACH(14) / 113 /
4034 C DATA IMACH(15) / -16381 /
4035 C DATA IMACH(16) / 16384 /
4036 C
4037 C MACHINE CONSTANTS FOR THE UNIVAC 1100 SERIES FTN COMPILER
4038 C
4039 C DATA IMACH( 1) / 5 /
4040 C DATA IMACH( 2) / 6 /
4041 C DATA IMACH( 3) / 1 /
4042 C DATA IMACH( 4) / 6 /
4043 C DATA IMACH( 5) / 36 /
4044 C DATA IMACH( 6) / 4 /
4045 C DATA IMACH( 7) / 2 /
4046 C DATA IMACH( 8) / 35 /
4047 C DATA IMACH( 9) / O377777777777 /
4048 C DATA IMACH(10) / 2 /
4049 C DATA IMACH(11) / 27 /
4050 C DATA IMACH(12) / -128 /
4051 C DATA IMACH(13) / 127 /
4052 C DATA IMACH(14) / 60 /
4053 C DATA IMACH(15) / -1024 /
4054 C DATA IMACH(16) / 1023 /
4055 C
4056 C MACHINE CONSTANTS FOR THE Z80 MICROPROCESSOR
4057 C
4058 C DATA IMACH( 1) / 1 /
4059 C DATA IMACH( 2) / 1 /
4060 C DATA IMACH( 3) / 0 /
4061 C DATA IMACH( 4) / 1 /
4062 C DATA IMACH( 5) / 16 /
4063 C DATA IMACH( 6) / 2 /
4064 C DATA IMACH( 7) / 2 /
4065 C DATA IMACH( 8) / 15 /
4066 C DATA IMACH( 9) / 32767 /
4067 C DATA IMACH(10) / 2 /
4068 C DATA IMACH(11) / 24 /
4069 C DATA IMACH(12) / -127 /
4070 C DATA IMACH(13) / 127 /
4071 C DATA IMACH(14) / 56 /
4072 C DATA IMACH(15) / -127 /
4073 C DATA IMACH(16) / 127 /
4074 C
4075 C***FIRST EXECUTABLE STATEMENT I1MACH
4076  IF (i .LT. 1 .OR. i .GT. 16) GO TO 10
4077 C
4078  i1mach = imach(i)
4079  RETURN
4080 C
4081  10 CONTINUE
4082  WRITE (unit = output, fmt = 9000)
4083  9000 FORMAT ('1ERROR 1 IN I1MACH - I OUT OF BOUNDS')
4084 C
4085 C CALL FDUMP
4086 C
4087  stop
subroutine stop()
Definition: stop.f:20
integer function i1mach(I)
Definition: ddeabm.f:3182

◆ j4save()

function j4save (   IWHICH,
  IVALUE,
logical  ISET 
)
4477 C***BEGIN PROLOGUE J4SAVE
4478 C***SUBSIDIARY
4479 C***PURPOSE Save or recall global variables needed by error
4480 C handling routines.
4481 C***LIBRARY SLATEC (XERROR)
4482 C***TYPE INTEGER (J4SAVE-I)
4483 C***KEYWORDS ERROR MESSAGES, ERROR NUMBER, RECALL, SAVE, XERROR
4484 C***AUTHOR Jones, R. E., (SNLA)
4485 C***DESCRIPTION
4486 C
4487 C Abstract
4488 C J4SAVE saves and recalls several global variables needed
4489 C by the library error handling routines.
4490 C
4491 C Description of Parameters
4492 C --Input--
4493 C IWHICH - Index of item desired.
4494 C = 1 Refers to current error number.
4495 C = 2 Refers to current error control flag.
4496 C = 3 Refers to current unit number to which error
4497 C messages are to be sent. (0 means use standard.)
4498 C = 4 Refers to the maximum number of times any
4499 C message is to be printed (as set by XERMAX).
4500 C = 5 Refers to the total number of units to which
4501 C each error message is to be written.
4502 C = 6 Refers to the 2nd unit for error messages
4503 C = 7 Refers to the 3rd unit for error messages
4504 C = 8 Refers to the 4th unit for error messages
4505 C = 9 Refers to the 5th unit for error messages
4506 C IVALUE - The value to be set for the IWHICH-th parameter,
4507 C if ISET is .TRUE. .
4508 C ISET - If ISET=.TRUE., the IWHICH-th parameter will BE
4509 C given the value, IVALUE. If ISET=.FALSE., the
4510 C IWHICH-th parameter will be unchanged, and IVALUE
4511 C is a dummy parameter.
4512 C --Output--
4513 C The (old) value of the IWHICH-th parameter will be returned
4514 C in the function value, J4SAVE.
4515 C
4516 C***SEE ALSO XERMSG
4517 C***REFERENCES R. E. Jones and D. K. Kahaner, XERROR, the SLATEC
4518 C Error-handling Package, SAND82-0800, Sandia
4519 C Laboratories, 1982.
4520 C***ROUTINES CALLED (NONE)
4521 C***REVISION HISTORY (YYMMDD)
4522 C 790801 DATE WRITTEN
4523 C 891214 Prologue converted to Version 4.0 format. (BAB)
4524 C 900205 Minor modifications to prologue. (WRB)
4525 C 900402 Added TYPE section. (WRB)
4526 C 910411 Added KEYWORDS section. (WRB)
4527 C 920501 Reformatted the REFERENCES section. (WRB)
4528 C***END PROLOGUE J4SAVE
4529  LOGICAL iset
4530  INTEGER iparam(9)
4531  SAVE iparam
4532  DATA iparam(1),iparam(2),iparam(3),iparam(4)/0,2,0,10/
4533  DATA iparam(5)/1/
4534  DATA iparam(6),iparam(7),iparam(8),iparam(9)/0,0,0,0/
4535 C***FIRST EXECUTABLE STATEMENT J4SAVE
4536  j4save = iparam(iwhich)
4537  IF (iset) iparam(iwhich) = ivalue
4538  RETURN
function j4save(IWHICH, IVALUE, ISET)
Definition: ddeabm.f:4477

◆ xercnt()

subroutine xercnt ( character*(*)  LIBRAR,
character*(*)  SUBROU,
character*(*)  MESSG,
  NERR,
  LEVEL,
  KONTRL 
)
4542 C***BEGIN PROLOGUE XERCNT
4543 C***SUBSIDIARY
4544 C***PURPOSE Allow user control over handling of errors.
4545 C***LIBRARY SLATEC (XERROR)
4546 C***CATEGORY R3C
4547 C***TYPE ALL (XERCNT-A)
4548 C***KEYWORDS ERROR, XERROR
4549 C***AUTHOR Jones, R. E., (SNLA)
4550 C***DESCRIPTION
4551 C
4552 C Abstract
4553 C Allows user control over handling of individual errors.
4554 C Just after each message is recorded, but before it is
4555 C processed any further (i.e., before it is printed or
4556 C a decision to abort is made), a call is made to XERCNT.
4557 C If the user has provided his own version of XERCNT, he
4558 C can then override the value of KONTROL used in processing
4559 C this message by redefining its value.
4560 C KONTRL may be set to any value from -2 to 2.
4561 C The meanings for KONTRL are the same as in XSETF, except
4562 C that the value of KONTRL changes only for this message.
4563 C If KONTRL is set to a value outside the range from -2 to 2,
4564 C it will be moved back into that range.
4565 C
4566 C Description of Parameters
4567 C
4568 C --Input--
4569 C LIBRAR - the library that the routine is in.
4570 C SUBROU - the subroutine that XERMSG is being called from
4571 C MESSG - the first 20 characters of the error message.
4572 C NERR - same as in the call to XERMSG.
4573 C LEVEL - same as in the call to XERMSG.
4574 C KONTRL - the current value of the control flag as set
4575 C by a call to XSETF.
4576 C
4577 C --Output--
4578 C KONTRL - the new value of KONTRL. If KONTRL is not
4579 C defined, it will remain at its original value.
4580 C This changed value of control affects only
4581 C the current occurrence of the current message.
4582 C
4583 C***REFERENCES R. E. Jones and D. K. Kahaner, XERROR, the SLATEC
4584 C Error-handling Package, SAND82-0800, Sandia
4585 C Laboratories, 1982.
4586 C***ROUTINES CALLED (NONE)
4587 C***REVISION HISTORY (YYMMDD)
4588 C 790801 DATE WRITTEN
4589 C 861211 REVISION DATE from Version 3.2
4590 C 891214 Prologue converted to Version 4.0 format. (BAB)
4591 C 900206 Routine changed from user-callable to subsidiary. (WRB)
4592 C 900510 Changed calling sequence to include LIBRARY and SUBROUTINE
4593 C names, changed routine name from XERCTL to XERCNT. (RWC)
4594 C 920501 Reformatted the REFERENCES section. (WRB)
4595 C***END PROLOGUE XERCNT
4596  CHARACTER*(*) librar, subrou, messg
4597 C***FIRST EXECUTABLE STATEMENT XERCNT
4598  RETURN

◆ xerhlt()

subroutine xerhlt ( character*(*)  MESSG)
4602 C***BEGIN PROLOGUE XERHLT
4603 C***SUBSIDIARY
4604 C***PURPOSE Abort program execution and print error message.
4605 C***LIBRARY SLATEC (XERROR)
4606 C***CATEGORY R3C
4607 C***TYPE ALL (XERHLT-A)
4608 C***KEYWORDS ABORT PROGRAM EXECUTION, ERROR, XERROR
4609 C***AUTHOR Jones, R. E., (SNLA)
4610 C***DESCRIPTION
4611 C
4612 C Abstract
4613 C ***Note*** machine dependent routine
4614 C XERHLT aborts the execution of the program.
4615 C The error message causing the abort is given in the calling
4616 C sequence, in case one needs it for printing on a dayfile,
4617 C for example.
4618 C
4619 C Description of Parameters
4620 C MESSG is as in XERMSG.
4621 C
4622 C***REFERENCES R. E. Jones and D. K. Kahaner, XERROR, the SLATEC
4623 C Error-handling Package, SAND82-0800, Sandia
4624 C Laboratories, 1982.
4625 C***ROUTINES CALLED (NONE)
4626 C***REVISION HISTORY (YYMMDD)
4627 C 790801 DATE WRITTEN
4628 C 861211 REVISION DATE from Version 3.2
4629 C 891214 Prologue converted to Version 4.0 format. (BAB)
4630 C 900206 Routine changed from user-callable to subsidiary. (WRB)
4631 C 900510 Changed calling sequence to delete length of character
4632 C and changed routine name from XERABT to XERHLT. (RWC)
4633 C 920501 Reformatted the REFERENCES section. (WRB)
4634 C***END PROLOGUE XERHLT
4635  CHARACTER*(*) messg
4636 C***FIRST EXECUTABLE STATEMENT XERHLT
4637  stop
subroutine stop()
Definition: stop.f:20

◆ xermsg()

subroutine xermsg ( character*(*)  LIBRAR,
character*(*)  SUBROU,
character*(*)  MESSG,
  NERR,
  LEVEL 
)
1265 C***BEGIN PROLOGUE XERMSG
1266 C***PURPOSE Process error messages for SLATEC and other libraries.
1267 C***LIBRARY SLATEC (XERROR)
1268 C***CATEGORY R3C
1269 C***TYPE ALL (XERMSG-A)
1270 C***KEYWORDS ERROR MESSAGE, XERROR
1271 C***AUTHOR Fong, Kirby, (NMFECC at LLNL)
1272 C***DESCRIPTION
1273 C
1274 C XERMSG processes a diagnostic message in a manner determined by the
1275 C value of LEVEL and the current value of the library error control
1276 C flag, KONTRL. See subroutine XSETF for details.
1277 C
1278 C LIBRAR A character constant (or character variable) with the name
1279 C of the library. This will be 'SLATEC' for the SLATEC
1280 C Common Math Library. The error handling package is
1281 C general enough to be used by many libraries
1282 C simultaneously, so it is desirable for the routine that
1283 C detects and reports an error to identify the library name
1284 C as well as the routine name.
1285 C
1286 C SUBROU A character constant (or character variable) with the name
1287 C of the routine that detected the error. Usually it is the
1288 C name of the routine that is calling XERMSG. There are
1289 C some instances where a user callable library routine calls
1290 C lower level subsidiary routines where the error is
1291 C detected. In such cases it may be more informative to
1292 C supply the name of the routine the user called rather than
1293 C the name of the subsidiary routine that detected the
1294 C error.
1295 C
1296 C MESSG A character constant (or character variable) with the text
1297 C of the error or warning message. In the example below,
1298 C the message is a character constant that contains a
1299 C generic message.
1300 C
1301 C CALL XERMSG ('SLATEC', 'MMPY',
1302 C *'THE ORDER OF THE MATRIX EXCEEDS THE ROW DIMENSION',
1303 C *3, 1)
1304 C
1305 C It is possible (and is sometimes desirable) to generate a
1306 C specific message--e.g., one that contains actual numeric
1307 C values. Specific numeric values can be converted into
1308 C character strings using formatted WRITE statements into
1309 C character variables. This is called standard Fortran
1310 C internal file I/O and is exemplified in the first three
1311 C lines of the following example. You can also catenate
1312 C substrings of characters to construct the error message.
1313 C Here is an example showing the use of both writing to
1314 C an internal file and catenating character strings.
1315 C
1316 C CHARACTER*5 CHARN, CHARL
1317 C WRITE (CHARN,10) N
1318 C WRITE (CHARL,10) LDA
1319 C 10 FORMAT(I5)
1320 C CALL XERMSG ('SLATEC', 'MMPY', 'THE ORDER'//CHARN//
1321 C * ' OF THE MATRIX EXCEEDS ITS ROW DIMENSION OF'//
1322 C * CHARL, 3, 1)
1323 C
1324 C There are two subtleties worth mentioning. One is that
1325 C the // for character catenation is used to construct the
1326 C error message so that no single character constant is
1327 C continued to the next line. This avoids confusion as to
1328 C whether there are trailing blanks at the end of the line.
1329 C The second is that by catenating the parts of the message
1330 C as an actual argument rather than encoding the entire
1331 C message into one large character variable, we avoid
1332 C having to know how long the message will be in order to
1333 C declare an adequate length for that large character
1334 C variable. XERMSG calls XERPRN to print the message using
1335 C multiple lines if necessary. If the message is very long,
1336 C XERPRN will break it into pieces of 72 characters (as
1337 C requested by XERMSG) for printing on multiple lines.
1338 C Also, XERMSG asks XERPRN to prefix each line with ' * '
1339 C so that the total line length could be 76 characters.
1340 C Note also that XERPRN scans the error message backwards
1341 C to ignore trailing blanks. Another feature is that
1342 C the substring '$$' is treated as a new line sentinel
1343 C by XERPRN. If you want to construct a multiline
1344 C message without having to count out multiples of 72
1345 C characters, just use '$$' as a separator. '$$'
1346 C obviously must occur within 72 characters of the
1347 C start of each line to have its intended effect since
1348 C XERPRN is asked to wrap around at 72 characters in
1349 C addition to looking for '$$'.
1350 C
1351 C NERR An integer value that is chosen by the library routine's
1352 C author. It must be in the range -99 to 999 (three
1353 C printable digits). Each distinct error should have its
1354 C own error number. These error numbers should be described
1355 C in the machine readable documentation for the routine.
1356 C The error numbers need be unique only within each routine,
1357 C so it is reasonable for each routine to start enumerating
1358 C errors from 1 and proceeding to the next integer.
1359 C
1360 C LEVEL An integer value in the range 0 to 2 that indicates the
1361 C level (severity) of the error. Their meanings are
1362 C
1363 C -1 A warning message. This is used if it is not clear
1364 C that there really is an error, but the user's attention
1365 C may be needed. An attempt is made to only print this
1366 C message once.
1367 C
1368 C 0 A warning message. This is used if it is not clear
1369 C that there really is an error, but the user's attention
1370 C may be needed.
1371 C
1372 C 1 A recoverable error. This is used even if the error is
1373 C so serious that the routine cannot return any useful
1374 C answer. If the user has told the error package to
1375 C return after recoverable errors, then XERMSG will
1376 C return to the Library routine which can then return to
1377 C the user's routine. The user may also permit the error
1378 C package to terminate the program upon encountering a
1379 C recoverable error.
1380 C
1381 C 2 A fatal error. XERMSG will not return to its caller
1382 C after it receives a fatal error. This level should
1383 C hardly ever be used; it is much better to allow the
1384 C user a chance to recover. An example of one of the few
1385 C cases in which it is permissible to declare a level 2
1386 C error is a reverse communication Library routine that
1387 C is likely to be called repeatedly until it integrates
1388 C across some interval. If there is a serious error in
1389 C the input such that another step cannot be taken and
1390 C the Library routine is called again without the input
1391 C error having been corrected by the caller, the Library
1392 C routine will probably be called forever with improper
1393 C input. In this case, it is reasonable to declare the
1394 C error to be fatal.
1395 C
1396 C Each of the arguments to XERMSG is input; none will be modified by
1397 C XERMSG. A routine may make multiple calls to XERMSG with warning
1398 C level messages; however, after a call to XERMSG with a recoverable
1399 C error, the routine should return to the user. Do not try to call
1400 C XERMSG with a second recoverable error after the first recoverable
1401 C error because the error package saves the error number. The user
1402 C can retrieve this error number by calling another entry point in
1403 C the error handling package and then clear the error number when
1404 C recovering from the error. Calling XERMSG in succession causes the
1405 C old error number to be overwritten by the latest error number.
1406 C This is considered harmless for error numbers associated with
1407 C warning messages but must not be done for error numbers of serious
1408 C errors. After a call to XERMSG with a recoverable error, the user
1409 C must be given a chance to call NUMXER or XERCLR to retrieve or
1410 C clear the error number.
1411 C***REFERENCES R. E. Jones and D. K. Kahaner, XERROR, the SLATEC
1412 C Error-handling Package, SAND82-0800, Sandia
1413 C Laboratories, 1982.
1414 C***ROUTINES CALLED FDUMP, J4SAVE, XERCNT, XERHLT, XERPRN, XERSVE
1415 C***REVISION HISTORY (YYMMDD)
1416 C 880101 DATE WRITTEN
1417 C 880621 REVISED AS DIRECTED AT SLATEC CML MEETING OF FEBRUARY 1988.
1418 C THERE ARE TWO BASIC CHANGES.
1419 C 1. A NEW ROUTINE, XERPRN, IS USED INSTEAD OF XERPRT TO
1420 C PRINT MESSAGES. THIS ROUTINE WILL BREAK LONG MESSAGES
1421 C INTO PIECES FOR PRINTING ON MULTIPLE LINES. '$$' IS
1422 C ACCEPTED AS A NEW LINE SENTINEL. A PREFIX CAN BE
1423 C ADDED TO EACH LINE TO BE PRINTED. XERMSG USES EITHER
1424 C ' ***' OR ' * ' AND LONG MESSAGES ARE BROKEN EVERY
1425 C 72 CHARACTERS (AT MOST) SO THAT THE MAXIMUM LINE
1426 C LENGTH OUTPUT CAN NOW BE AS GREAT AS 76.
1427 C 2. THE TEXT OF ALL MESSAGES IS NOW IN UPPER CASE SINCE THE
1428 C FORTRAN STANDARD DOCUMENT DOES NOT ADMIT THE EXISTENCE
1429 C OF LOWER CASE.
1430 C 880708 REVISED AFTER THE SLATEC CML MEETING OF JUNE 29 AND 30.
1431 C THE PRINCIPAL CHANGES ARE
1432 C 1. CLARIFY COMMENTS IN THE PROLOGUES
1433 C 2. RENAME XRPRNT TO XERPRN
1434 C 3. REWORK HANDLING OF '$$' IN XERPRN TO HANDLE BLANK LINES
1435 C SIMILAR TO THE WAY FORMAT STATEMENTS HANDLE THE /
1436 C CHARACTER FOR NEW RECORDS.
1437 C 890706 REVISED WITH THE HELP OF FRED FRITSCH AND REG CLEMENS TO
1438 C CLEAN UP THE CODING.
1439 C 890721 REVISED TO USE NEW FEATURE IN XERPRN TO COUNT CHARACTERS IN
1440 C PREFIX.
1441 C 891013 REVISED TO CORRECT COMMENTS.
1442 C 891214 Prologue converted to Version 4.0 format. (WRB)
1443 C 900510 Changed test on NERR to be -9999999 < NERR < 99999999, but
1444 C NERR .ne. 0, and on LEVEL to be -2 < LEVEL < 3. Added
1445 C LEVEL=-1 logic, changed calls to XERSAV to XERSVE, and
1446 C XERCTL to XERCNT. (RWC)
1447 C 920501 Reformatted the REFERENCES section. (WRB)
1448 C***END PROLOGUE XERMSG
1449  CHARACTER*(*) librar, subrou, messg
1450  CHARACTER*8 xlibr, xsubr
1451  CHARACTER*72 temp
1452  CHARACTER*20 lfirst
1453 C***FIRST EXECUTABLE STATEMENT XERMSG
1454  lkntrl = j4save(2, 0, .false.)
1455  maxmes = j4save(4, 0, .false.)
1456 C
1457 C LKNTRL IS A LOCAL COPY OF THE CONTROL FLAG KONTRL.
1458 C MAXMES IS THE MAXIMUM NUMBER OF TIMES ANY PARTICULAR MESSAGE
1459 C SHOULD BE PRINTED.
1460 C
1461 C WE PRINT A FATAL ERROR MESSAGE AND TERMINATE FOR AN ERROR IN
1462 C CALLING XERMSG. THE ERROR NUMBER SHOULD BE POSITIVE,
1463 C AND THE LEVEL SHOULD BE BETWEEN 0 AND 2.
1464 C
1465  IF (nerr.LT.-9999999 .OR. nerr.GT.99999999 .OR. nerr.EQ.0 .OR.
1466  * level.LT.-1 .OR. level.GT.2) THEN
1467  CALL xerprn (' ***', -1, 'FATAL ERROR IN...$$ ' //
1468  * 'XERMSG -- INVALID ERROR NUMBER OR LEVEL$$ '//
1469  * 'JOB ABORT DUE TO FATAL ERROR.', 72)
1470  CALL xersve (' ', ' ', ' ', 0, 0, 0, kdummy)
1471  CALL xerhlt (' ***XERMSG -- INVALID INPUT')
1472  RETURN
1473  ENDIF
1474 C
1475 C RECORD THE MESSAGE.
1476 C
1477  i = j4save(1, nerr, .true.)
1478  CALL xersve (librar, subrou, messg, 1, nerr, level, kount)
1479 C
1480 C HANDLE PRINT-ONCE WARNING MESSAGES.
1481 C
1482  IF (level.EQ.-1 .AND. kount.GT.1) RETURN
1483 C
1484 C ALLOW TEMPORARY USER OVERRIDE OF THE CONTROL FLAG.
1485 C
1486  xlibr = librar
1487  xsubr = subrou
1488  lfirst = messg
1489  lerr = nerr
1490  llevel = level
1491  CALL xercnt (xlibr, xsubr, lfirst, lerr, llevel, lkntrl)
1492 C
1493  lkntrl = max(-2, min(2,lkntrl))
1494  mkntrl = abs(lkntrl)
1495 C
1496 C SKIP PRINTING IF THE CONTROL FLAG VALUE AS RESET IN XERCNT IS
1497 C ZERO AND THE ERROR IS NOT FATAL.
1498 C
1499  IF (level.LT.2 .AND. lkntrl.EQ.0) GO TO 30
1500  IF (level.EQ.0 .AND. kount.GT.maxmes) GO TO 30
1501  IF (level.EQ.1 .AND. kount.GT.maxmes .AND. mkntrl.EQ.1) GO TO 30
1502  IF (level.EQ.2 .AND. kount.GT.max(1,maxmes)) GO TO 30
1503 C
1504 C ANNOUNCE THE NAMES OF THE LIBRARY AND SUBROUTINE BY BUILDING A
1505 C MESSAGE IN CHARACTER VARIABLE TEMP (NOT EXCEEDING 66 CHARACTERS)
1506 C AND SENDING IT OUT VIA XERPRN. PRINT ONLY IF CONTROL FLAG
1507 C IS NOT ZERO.
1508 C
1509  IF (lkntrl .NE. 0) THEN
1510  temp(1:21) = 'MESSAGE FROM ROUTINE '
1511  i = min(len(subrou), 16)
1512  temp(22:21+i) = subrou(1:i)
1513  temp(22+i:33+i) = ' IN LIBRARY '
1514  ltemp = 33 + i
1515  i = min(len(librar), 16)
1516  temp(ltemp+1:ltemp+i) = librar(1:i)
1517  temp(ltemp+i+1:ltemp+i+1) = '.'
1518  ltemp = ltemp + i + 1
1519  CALL xerprn (' ***', -1, temp(1:ltemp), 72)
1520  ENDIF
1521 C
1522 C IF LKNTRL IS POSITIVE, PRINT AN INTRODUCTORY LINE BEFORE
1523 C PRINTING THE MESSAGE. THE INTRODUCTORY LINE TELLS THE CHOICE
1524 C FROM EACH OF THE FOLLOWING THREE OPTIONS.
1525 C 1. LEVEL OF THE MESSAGE
1526 C 'INFORMATIVE MESSAGE'
1527 C 'POTENTIALLY RECOVERABLE ERROR'
1528 C 'FATAL ERROR'
1529 C 2. WHETHER CONTROL FLAG WILL ALLOW PROGRAM TO CONTINUE
1530 C 'PROG CONTINUES'
1531 C 'PROG ABORTED'
1532 C 3. WHETHER OR NOT A TRACEBACK WAS REQUESTED. (THE TRACEBACK
1533 C MAY NOT BE IMPLEMENTED AT SOME SITES, SO THIS ONLY TELLS
1534 C WHAT WAS REQUESTED, NOT WHAT WAS DELIVERED.)
1535 C 'TRACEBACK REQUESTED'
1536 C 'TRACEBACK NOT REQUESTED'
1537 C NOTICE THAT THE LINE INCLUDING FOUR PREFIX CHARACTERS WILL NOT
1538 C EXCEED 74 CHARACTERS.
1539 C WE SKIP THE NEXT BLOCK IF THE INTRODUCTORY LINE IS NOT NEEDED.
1540 C
1541  IF (lkntrl .GT. 0) THEN
1542 C
1543 C THE FIRST PART OF THE MESSAGE TELLS ABOUT THE LEVEL.
1544 C
1545  IF (level .LE. 0) THEN
1546  temp(1:20) = 'INFORMATIVE MESSAGE,'
1547  ltemp = 20
1548  ELSEIF (level .EQ. 1) THEN
1549  temp(1:30) = 'POTENTIALLY RECOVERABLE ERROR,'
1550  ltemp = 30
1551  ELSE
1552  temp(1:12) = 'FATAL ERROR,'
1553  ltemp = 12
1554  ENDIF
1555 C
1556 C THEN WHETHER THE PROGRAM WILL CONTINUE.
1557 C
1558  IF ((mkntrl.EQ.2 .AND. level.GE.1) .OR.
1559  * (mkntrl.EQ.1 .AND. level.EQ.2)) THEN
1560  temp(ltemp+1:ltemp+14) = ' PROG ABORTED,'
1561  ltemp = ltemp + 14
1562  ELSE
1563  temp(ltemp+1:ltemp+16) = ' PROG CONTINUES,'
1564  ltemp = ltemp + 16
1565  ENDIF
1566 C
1567 C FINALLY TELL WHETHER THERE SHOULD BE A TRACEBACK.
1568 C
1569  IF (lkntrl .GT. 0) THEN
1570  temp(ltemp+1:ltemp+20) = ' TRACEBACK REQUESTED'
1571  ltemp = ltemp + 20
1572  ELSE
1573  temp(ltemp+1:ltemp+24) = ' TRACEBACK NOT REQUESTED'
1574  ltemp = ltemp + 24
1575  ENDIF
1576  CALL xerprn (' ***', -1, temp(1:ltemp), 72)
1577  ENDIF
1578 C
1579 C NOW SEND OUT THE MESSAGE.
1580 C
1581  CALL xerprn (' * ', -1, messg, 72)
1582 C
1583 C IF LKNTRL IS POSITIVE, WRITE THE ERROR NUMBER AND REQUEST A
1584 C TRACEBACK.
1585 C
1586  IF (lkntrl .GT. 0) THEN
1587  WRITE (temp, '(''ERROR NUMBER = '', I8)') nerr
1588  DO 10 i=16,22
1589  IF (temp(i:i) .NE. ' ') GO TO 20
1590  10 CONTINUE
1591 C
1592  20 CALL xerprn (' * ', -1, temp(1:15) // temp(i:23), 72)
1593  CALL fdump
1594  ENDIF
1595 C
1596 C IF LKNTRL IS NOT ZERO, PRINT A BLANK LINE AND AN END OF MESSAGE.
1597 C
1598  IF (lkntrl .NE. 0) THEN
1599  CALL xerprn (' * ', -1, ' ', 72)
1600  CALL xerprn (' ***', -1, 'END OF MESSAGE', 72)
1601  CALL xerprn (' ', 0, ' ', 72)
1602  ENDIF
1603 C
1604 C IF THE ERROR IS NOT FATAL OR THE ERROR IS RECOVERABLE AND THE
1605 C CONTROL FLAG IS SET FOR RECOVERY, THEN RETURN.
1606 C
1607  30 IF (level.LE.0 .OR. (level.EQ.1 .AND. mkntrl.LE.1)) RETURN
1608 C
1609 C THE PROGRAM WILL BE STOPPED DUE TO AN UNRECOVERED ERROR OR A
1610 C FATAL ERROR. PRINT THE REASON FOR THE ABORT AND THE ERROR
1611 C SUMMARY IF THE CONTROL FLAG AND THE MAXIMUM ERROR COUNT PERMIT.
1612 C
1613  IF (lkntrl.GT.0 .AND. kount.LT.max(1,maxmes)) THEN
1614  IF (level .EQ. 1) THEN
1615  CALL xerprn
1616  * (' ***', -1, 'JOB ABORT DUE TO UNRECOVERED ERROR.', 72)
1617  ELSE
1618  CALL xerprn(' ***', -1, 'JOB ABORT DUE TO FATAL ERROR.', 72)
1619  ENDIF
1620  CALL xersve (' ', ' ', ' ', -1, 0, 0, kdummy)
1621  CALL xerhlt (' ')
1622  ELSE
1623  CALL xerhlt (messg)
1624  ENDIF
1625  RETURN
#define max(a, b)
Definition: cascade.c:32
#define min(a, b)
Definition: cascade.c:31
function j4save(IWHICH, IVALUE, ISET)
Definition: ddeabm.f:4477
subroutine fdump
Definition: ddeabm.f:3151
subroutine xerhlt(MESSG)
Definition: ddeabm.f:4602
subroutine xercnt(LIBRAR, SUBROU, MESSG, NERR, LEVEL, KONTRL)
Definition: ddeabm.f:4542
subroutine xersve(LIBRAR, SUBROU, MESSG, KFLAG, NERR, LEVEL, ICOUNT)
Definition: ddeabm.f:1858
subroutine xerprn(PREFIX, NPREF, MESSG, NWRAP)
Definition: ddeabm.f:1629

◆ xerprn()

subroutine xerprn ( character*(*)  PREFIX,
integer  NPREF,
character*(*)  MESSG,
integer  NWRAP 
)
1629 C***BEGIN PROLOGUE XERPRN
1630 C***SUBSIDIARY
1631 C***PURPOSE Print error messages processed by XERMSG.
1632 C***LIBRARY SLATEC (XERROR)
1633 C***CATEGORY R3C
1634 C***TYPE ALL (XERPRN-A)
1635 C***KEYWORDS ERROR MESSAGES, PRINTING, XERROR
1636 C***AUTHOR Fong, Kirby, (NMFECC at LLNL)
1637 C***DESCRIPTION
1638 C
1639 C This routine sends one or more lines to each of the (up to five)
1640 C logical units to which error messages are to be sent. This routine
1641 C is called several times by XERMSG, sometimes with a single line to
1642 C print and sometimes with a (potentially very long) message that may
1643 C wrap around into multiple lines.
1644 C
1645 C PREFIX Input argument of type CHARACTER. This argument contains
1646 C characters to be put at the beginning of each line before
1647 C the body of the message. No more than 16 characters of
1648 C PREFIX will be used.
1649 C
1650 C NPREF Input argument of type INTEGER. This argument is the number
1651 C of characters to use from PREFIX. If it is negative, the
1652 C intrinsic function LEN is used to determine its length. If
1653 C it is zero, PREFIX is not used. If it exceeds 16 or if
1654 C LEN(PREFIX) exceeds 16, only the first 16 characters will be
1655 C used. If NPREF is positive and the length of PREFIX is less
1656 C than NPREF, a copy of PREFIX extended with blanks to length
1657 C NPREF will be used.
1658 C
1659 C MESSG Input argument of type CHARACTER. This is the text of a
1660 C message to be printed. If it is a long message, it will be
1661 C broken into pieces for printing on multiple lines. Each line
1662 C will start with the appropriate prefix and be followed by a
1663 C piece of the message. NWRAP is the number of characters per
1664 C piece; that is, after each NWRAP characters, we break and
1665 C start a new line. In addition the characters '$$' embedded
1666 C in MESSG are a sentinel for a new line. The counting of
1667 C characters up to NWRAP starts over for each new line. The
1668 C value of NWRAP typically used by XERMSG is 72 since many
1669 C older error messages in the SLATEC Library are laid out to
1670 C rely on wrap-around every 72 characters.
1671 C
1672 C NWRAP Input argument of type INTEGER. This gives the maximum size
1673 C piece into which to break MESSG for printing on multiple
1674 C lines. An embedded '$$' ends a line, and the count restarts
1675 C at the following character. If a line break does not occur
1676 C on a blank (it would split a word) that word is moved to the
1677 C next line. Values of NWRAP less than 16 will be treated as
1678 C 16. Values of NWRAP greater than 132 will be treated as 132.
1679 C The actual line length will be NPREF + NWRAP after NPREF has
1680 C been adjusted to fall between 0 and 16 and NWRAP has been
1681 C adjusted to fall between 16 and 132.
1682 C
1683 C***REFERENCES R. E. Jones and D. K. Kahaner, XERROR, the SLATEC
1684 C Error-handling Package, SAND82-0800, Sandia
1685 C Laboratories, 1982.
1686 C***ROUTINES CALLED I1MACH, XGETUA
1687 C***REVISION HISTORY (YYMMDD)
1688 C 880621 DATE WRITTEN
1689 C 880708 REVISED AFTER THE SLATEC CML SUBCOMMITTEE MEETING OF
1690 C JUNE 29 AND 30 TO CHANGE THE NAME TO XERPRN AND TO REWORK
1691 C THE HANDLING OF THE NEW LINE SENTINEL TO BEHAVE LIKE THE
1692 C SLASH CHARACTER IN FORMAT STATEMENTS.
1693 C 890706 REVISED WITH THE HELP OF FRED FRITSCH AND REG CLEMENS TO
1694 C STREAMLINE THE CODING AND FIX A BUG THAT CAUSED EXTRA BLANK
1695 C LINES TO BE PRINTED.
1696 C 890721 REVISED TO ADD A NEW FEATURE. A NEGATIVE VALUE OF NPREF
1697 C CAUSES LEN(PREFIX) TO BE USED AS THE LENGTH.
1698 C 891013 REVISED TO CORRECT ERROR IN CALCULATING PREFIX LENGTH.
1699 C 891214 Prologue converted to Version 4.0 format. (WRB)
1700 C 900510 Added code to break messages between words. (RWC)
1701 C 920501 Reformatted the REFERENCES section. (WRB)
1702 C***END PROLOGUE XERPRN
1703  CHARACTER*(*) prefix, messg
1704  INTEGER npref, nwrap
1705  CHARACTER*148 cbuff
1706  INTEGER iu(5), nunit
1707  CHARACTER*2 newlin
1708  parameter(newlin = '$$')
1709 C***FIRST EXECUTABLE STATEMENT XERPRN
1710  CALL xgetua(iu,nunit)
1711 C
1712 C A ZERO VALUE FOR A LOGICAL UNIT NUMBER MEANS TO USE THE STANDARD
1713 C ERROR MESSAGE UNIT INSTEAD. I1MACH(4) RETRIEVES THE STANDARD
1714 C ERROR MESSAGE UNIT.
1715 C
1716  n = i1mach(4)
1717  DO 10 i=1,nunit
1718  IF (iu(i) .EQ. 0) iu(i) = n
1719  10 CONTINUE
1720 C
1721 C LPREF IS THE LENGTH OF THE PREFIX. THE PREFIX IS PLACED AT THE
1722 C BEGINNING OF CBUFF, THE CHARACTER BUFFER, AND KEPT THERE DURING
1723 C THE REST OF THIS ROUTINE.
1724 C
1725  IF ( npref .LT. 0 ) THEN
1726  lpref = len(prefix)
1727  ELSE
1728  lpref = npref
1729  ENDIF
1730  lpref = min(16, lpref)
1731  IF (lpref .NE. 0) cbuff(1:lpref) = prefix
1732 C
1733 C LWRAP IS THE MAXIMUM NUMBER OF CHARACTERS WE WANT TO TAKE AT ONE
1734 C TIME FROM MESSG TO PRINT ON ONE LINE.
1735 C
1736  lwrap = max(16, min(132, nwrap))
1737 C
1738 C SET LENMSG TO THE LENGTH OF MESSG, IGNORE ANY TRAILING BLANKS.
1739 C
1740  lenmsg = len(messg)
1741  n = lenmsg
1742  DO 20 i=1,n
1743  IF (messg(lenmsg:lenmsg) .NE. ' ') GO TO 30
1744  lenmsg = lenmsg - 1
1745  20 CONTINUE
1746  30 CONTINUE
1747 C
1748 C IF THE MESSAGE IS ALL BLANKS, THEN PRINT ONE BLANK LINE.
1749 C
1750  IF (lenmsg .EQ. 0) THEN
1751  cbuff(lpref+1:lpref+1) = ' '
1752  DO 40 i=1,nunit
1753  WRITE(iu(i), '(A)') cbuff(1:lpref+1)
1754  40 CONTINUE
1755  RETURN
1756  ENDIF
1757 C
1758 C SET NEXTC TO THE POSITION IN MESSG WHERE THE NEXT SUBSTRING
1759 C STARTS. FROM THIS POSITION WE SCAN FOR THE NEW LINE SENTINEL.
1760 C WHEN NEXTC EXCEEDS LENMSG, THERE IS NO MORE TO PRINT.
1761 C WE LOOP BACK TO LABEL 50 UNTIL ALL PIECES HAVE BEEN PRINTED.
1762 C
1763 C WE LOOK FOR THE NEXT OCCURRENCE OF THE NEW LINE SENTINEL. THE
1764 C INDEX INTRINSIC FUNCTION RETURNS ZERO IF THERE IS NO OCCURRENCE
1765 C OR IF THE LENGTH OF THE FIRST ARGUMENT IS LESS THAN THE LENGTH
1766 C OF THE SECOND ARGUMENT.
1767 C
1768 C THERE ARE SEVERAL CASES WHICH SHOULD BE CHECKED FOR IN THE
1769 C FOLLOWING ORDER. WE ARE ATTEMPTING TO SET LPIECE TO THE NUMBER
1770 C OF CHARACTERS THAT SHOULD BE TAKEN FROM MESSG STARTING AT
1771 C POSITION NEXTC.
1772 C
1773 C LPIECE .EQ. 0 THE NEW LINE SENTINEL DOES NOT OCCUR IN THE
1774 C REMAINDER OF THE CHARACTER STRING. LPIECE
1775 C SHOULD BE SET TO LWRAP OR LENMSG+1-NEXTC,
1776 C WHICHEVER IS LESS.
1777 C
1778 C LPIECE .EQ. 1 THE NEW LINE SENTINEL STARTS AT MESSG(NEXTC:
1779 C NEXTC). LPIECE IS EFFECTIVELY ZERO, AND WE
1780 C PRINT NOTHING TO AVOID PRODUCING UNNECESSARY
1781 C BLANK LINES. THIS TAKES CARE OF THE SITUATION
1782 C WHERE THE LIBRARY ROUTINE HAS A MESSAGE OF
1783 C EXACTLY 72 CHARACTERS FOLLOWED BY A NEW LINE
1784 C SENTINEL FOLLOWED BY MORE CHARACTERS. NEXTC
1785 C SHOULD BE INCREMENTED BY 2.
1786 C
1787 C LPIECE .GT. LWRAP+1 REDUCE LPIECE TO LWRAP.
1788 C
1789 C ELSE THIS LAST CASE MEANS 2 .LE. LPIECE .LE. LWRAP+1
1790 C RESET LPIECE = LPIECE-1. NOTE THAT THIS
1791 C PROPERLY HANDLES THE END CASE WHERE LPIECE .EQ.
1792 C LWRAP+1. THAT IS, THE SENTINEL FALLS EXACTLY
1793 C AT THE END OF A LINE.
1794 C
1795  nextc = 1
1796  50 lpiece = index(messg(nextc:lenmsg), newlin)
1797  IF (lpiece .EQ. 0) THEN
1798 C
1799 C THERE WAS NO NEW LINE SENTINEL FOUND.
1800 C
1801  idelta = 0
1802  lpiece = min(lwrap, lenmsg+1-nextc)
1803  IF (lpiece .LT. lenmsg+1-nextc) THEN
1804  DO 52 i=lpiece+1,2,-1
1805  IF (messg(nextc+i-1:nextc+i-1) .EQ. ' ') THEN
1806  lpiece = i-1
1807  idelta = 1
1808  GOTO 54
1809  ENDIF
1810  52 CONTINUE
1811  ENDIF
1812  54 cbuff(lpref+1:lpref+lpiece) = messg(nextc:nextc+lpiece-1)
1813  nextc = nextc + lpiece + idelta
1814  ELSEIF (lpiece .EQ. 1) THEN
1815 C
1816 C WE HAVE A NEW LINE SENTINEL AT MESSG(NEXTC:NEXTC+1).
1817 C DON'T PRINT A BLANK LINE.
1818 C
1819  nextc = nextc + 2
1820  GO TO 50
1821  ELSEIF (lpiece .GT. lwrap+1) THEN
1822 C
1823 C LPIECE SHOULD BE SET DOWN TO LWRAP.
1824 C
1825  idelta = 0
1826  lpiece = lwrap
1827  DO 56 i=lpiece+1,2,-1
1828  IF (messg(nextc+i-1:nextc+i-1) .EQ. ' ') THEN
1829  lpiece = i-1
1830  idelta = 1
1831  GOTO 58
1832  ENDIF
1833  56 CONTINUE
1834  58 cbuff(lpref+1:lpref+lpiece) = messg(nextc:nextc+lpiece-1)
1835  nextc = nextc + lpiece + idelta
1836  ELSE
1837 C
1838 C IF WE ARRIVE HERE, IT MEANS 2 .LE. LPIECE .LE. LWRAP+1.
1839 C WE SHOULD DECREMENT LPIECE BY ONE.
1840 C
1841  lpiece = lpiece - 1
1842  cbuff(lpref+1:lpref+lpiece) = messg(nextc:nextc+lpiece-1)
1843  nextc = nextc + lpiece + 2
1844  ENDIF
1845 C
1846 C PRINT
1847 C
1848  DO 60 i=1,nunit
1849  WRITE(iu(i), '(A)') cbuff(1:lpref+lpiece)
1850  60 CONTINUE
1851 C
1852  IF (nextc .LE. lenmsg) GO TO 50
1853  RETURN
#define max(a, b)
Definition: cascade.c:32
#define min(a, b)
Definition: cascade.c:31
integer function i1mach(I)
Definition: ddeabm.f:3182
subroutine xgetua(IUNITA, N)
Definition: ddeabm.f:2523

◆ xersve()

subroutine xersve ( character*(*)  LIBRAR,
character*(*)  SUBROU,
character*(*)  MESSG,
  KFLAG,
  NERR,
  LEVEL,
  ICOUNT 
)
1858 C***BEGIN PROLOGUE XERSVE
1859 C***SUBSIDIARY
1860 C***PURPOSE Record that an error has occurred.
1861 C***LIBRARY SLATEC (XERROR)
1862 C***CATEGORY R3
1863 C***TYPE ALL (XERSVE-A)
1864 C***KEYWORDS ERROR, XERROR
1865 C***AUTHOR Jones, R. E., (SNLA)
1866 C***DESCRIPTION
1867 C
1868 C *Usage:
1869 C
1870 C INTEGER KFLAG, NERR, LEVEL, ICOUNT
1871 C CHARACTER * (len) LIBRAR, SUBROU, MESSG
1872 C
1873 C CALL XERSVE (LIBRAR, SUBROU, MESSG, KFLAG, NERR, LEVEL, ICOUNT)
1874 C
1875 C *Arguments:
1876 C
1877 C LIBRAR :IN is the library that the message is from.
1878 C SUBROU :IN is the subroutine that the message is from.
1879 C MESSG :IN is the message to be saved.
1880 C KFLAG :IN indicates the action to be performed.
1881 C when KFLAG > 0, the message in MESSG is saved.
1882 C when KFLAG=0 the tables will be dumped and
1883 C cleared.
1884 C when KFLAG < 0, the tables will be dumped and
1885 C not cleared.
1886 C NERR :IN is the error number.
1887 C LEVEL :IN is the error severity.
1888 C ICOUNT :OUT the number of times this message has been seen,
1889 C or zero if the table has overflowed and does not
1890 C contain this message specifically. When KFLAG=0,
1891 C ICOUNT will not be altered.
1892 C
1893 C *Description:
1894 C
1895 C Record that this error occurred and possibly dump and clear the
1896 C tables.
1897 C
1898 C***REFERENCES R. E. Jones and D. K. Kahaner, XERROR, the SLATEC
1899 C Error-handling Package, SAND82-0800, Sandia
1900 C Laboratories, 1982.
1901 C***ROUTINES CALLED I1MACH, XGETUA
1902 C***REVISION HISTORY (YYMMDD)
1903 C 800319 DATE WRITTEN
1904 C 861211 REVISION DATE from Version 3.2
1905 C 891214 Prologue converted to Version 4.0 format. (BAB)
1906 C 900413 Routine modified to remove reference to KFLAG. (WRB)
1907 C 900510 Changed to add LIBRARY NAME and SUBROUTINE to calling
1908 C sequence, use IF-THEN-ELSE, make number of saved entries
1909 C easily changeable, changed routine name from XERSAV to
1910 C XERSVE. (RWC)
1911 C 910626 Added LIBTAB and SUBTAB to SAVE statement. (BKS)
1912 C 920501 Reformatted the REFERENCES section. (WRB)
1913 C***END PROLOGUE XERSVE
1914  parameter(lentab=10)
1915  INTEGER lun(5)
1916  CHARACTER*(*) librar, subrou, messg
1917  CHARACTER*8 libtab(lentab), subtab(lentab), lib, sub
1918  CHARACTER*20 mestab(lentab), mes
1919  dimension nertab(lentab), levtab(lentab), kount(lentab)
1920  SAVE libtab, subtab, mestab, nertab, levtab, kount, kountx, nmsg
1921  DATA kountx/0/, nmsg/0/
1922 C***FIRST EXECUTABLE STATEMENT XERSVE
1923 C
1924  IF (kflag.LE.0) THEN
1925 C
1926 C Dump the table.
1927 C
1928  IF (nmsg.EQ.0) RETURN
1929 C
1930 C Print to each unit.
1931 C
1932  CALL xgetua (lun, nunit)
1933  DO 20 kunit = 1,nunit
1934  iunit = lun(kunit)
1935  IF (iunit.EQ.0) iunit = i1mach(4)
1936 C
1937 C Print the table header.
1938 C
1939  WRITE (iunit,9000)
1940 C
1941 C Print body of table.
1942 C
1943  DO 10 i = 1,nmsg
1944  WRITE (iunit,9010) libtab(i), subtab(i), mestab(i),
1945  * nertab(i),levtab(i),kount(i)
1946  10 CONTINUE
1947 C
1948 C Print number of other errors.
1949 C
1950  IF (kountx.NE.0) WRITE (iunit,9020) kountx
1951  WRITE (iunit,9030)
1952  20 CONTINUE
1953 C
1954 C Clear the error tables.
1955 C
1956  IF (kflag.EQ.0) THEN
1957  nmsg = 0
1958  kountx = 0
1959  ENDIF
1960  ELSE
1961 C
1962 C PROCESS A MESSAGE...
1963 C SEARCH FOR THIS MESSG, OR ELSE AN EMPTY SLOT FOR THIS MESSG,
1964 C OR ELSE DETERMINE THAT THE ERROR TABLE IS FULL.
1965 C
1966  lib = librar
1967  sub = subrou
1968  mes = messg
1969  DO 30 i = 1,nmsg
1970  IF (lib.EQ.libtab(i) .AND. sub.EQ.subtab(i) .AND.
1971  * mes.EQ.mestab(i) .AND. nerr.EQ.nertab(i) .AND.
1972  * level.EQ.levtab(i)) THEN
1973  kount(i) = kount(i) + 1
1974  icount = kount(i)
1975  RETURN
1976  ENDIF
1977  30 CONTINUE
1978 C
1979  IF (nmsg.LT.lentab) THEN
1980 C
1981 C Empty slot found for new message.
1982 C
1983  nmsg = nmsg + 1
1984  libtab(i) = lib
1985  subtab(i) = sub
1986  mestab(i) = mes
1987  nertab(i) = nerr
1988  levtab(i) = level
1989  kount(i) = 1
1990  icount = 1
1991  ELSE
1992 C
1993 C Table is full.
1994 C
1995  kountx = kountx+1
1996  icount = 0
1997  ENDIF
1998  ENDIF
1999  RETURN
2000 C
2001 C Formats.
2002 C
2003  9000 FORMAT ('0 ERROR MESSAGE SUMMARY' /
2004  + ' LIBRARY SUBROUTINE MESSAGE START NERR',
2005  + ' LEVEL COUNT')
2006  9010 FORMAT (1x,a,3x,a,3x,a,3i10)
2007  9020 FORMAT ('0OTHER ERRORS NOT INDIVIDUALLY TABULATED = ', i10)
2008  9030 FORMAT (1x)
integer function i1mach(I)
Definition: ddeabm.f:3182
subroutine xgetua(IUNITA, N)
Definition: ddeabm.f:2523

◆ xgetua()

subroutine xgetua ( dimension(5)  IUNITA,
  N 
)
2523 C***BEGIN PROLOGUE XGETUA
2524 C***PURPOSE Return unit number(s) to which error messages are being
2525 C sent.
2526 C***LIBRARY SLATEC (XERROR)
2527 C***CATEGORY R3C
2528 C***TYPE ALL (XGETUA-A)
2529 C***KEYWORDS ERROR, XERROR
2530 C***AUTHOR Jones, R. E., (SNLA)
2531 C***DESCRIPTION
2532 C
2533 C Abstract
2534 C XGETUA may be called to determine the unit number or numbers
2535 C to which error messages are being sent.
2536 C These unit numbers may have been set by a call to XSETUN,
2537 C or a call to XSETUA, or may be a default value.
2538 C
2539 C Description of Parameters
2540 C --Output--
2541 C IUNIT - an array of one to five unit numbers, depending
2542 C on the value of N. A value of zero refers to the
2543 C default unit, as defined by the I1MACH machine
2544 C constant routine. Only IUNIT(1),...,IUNIT(N) are
2545 C defined by XGETUA. The values of IUNIT(N+1),...,
2546 C IUNIT(5) are not defined (for N .LT. 5) or altered
2547 C in any way by XGETUA.
2548 C N - the number of units to which copies of the
2549 C error messages are being sent. N will be in the
2550 C range from 1 to 5.
2551 C
2552 C***REFERENCES R. E. Jones and D. K. Kahaner, XERROR, the SLATEC
2553 C Error-handling Package, SAND82-0800, Sandia
2554 C Laboratories, 1982.
2555 C***ROUTINES CALLED J4SAVE
2556 C***REVISION HISTORY (YYMMDD)
2557 C 790801 DATE WRITTEN
2558 C 861211 REVISION DATE from Version 3.2
2559 C 891214 Prologue converted to Version 4.0 format. (BAB)
2560 C 920501 Reformatted the REFERENCES section. (WRB)
2561 C***END PROLOGUE XGETUA
2562  dimension iunita(5)
2563 C***FIRST EXECUTABLE STATEMENT XGETUA
2564  n = j4save(5,0,.false.)
2565  DO 30 i=1,n
2566  index = i+4
2567  IF (i.EQ.1) index = 3
2568  iunita(i) = j4save(index,0,.false.)
2569  30 CONTINUE
2570  RETURN
function j4save(IWHICH, IVALUE, ISET)
Definition: ddeabm.f:4477
Hosted by OpenAircraft.com, (Michigan UAV, LLC)