subroutine aptvdil (au, bu, np, tol, du, nerr) ccbeg. cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c SUBROUTINE APTVDIL c c call aptvdil (au, bu, np, tol, du, nerr) c c Version: aptvdis Updated 1990 November 26 10:00. c aptvdis Originated 1990 January 17 14:10. c c Author: Arthur L. Edwards, LLNL, L-298, Telephone (925) 422-4123. c c c Purpose: To find, for each of the np sets of input data, the distance c d = (du) from point a = (au) to point b = (bu), in the u c direction. Directions u, v and w are orthogonal. c If the magnitude of du is less than its estimated error, based c on tol, it will be truncated to zero. c Flag nerr indicates any input error. c c With no truncation, du = bu - au. c c Input: au, bu, np, tol. c c Output: du, nerr. c c Glossary: c c au Input The u coordinate of point "a". Size np. c The v and w coordinates are zero. c Directions u, v and w are orthogonal. c c bu Input The u coordinate of point "b". Size np. c The v and w coordinates are zero. c c du Output Distance between points "a" and "b", in the u c direction. May be truncated to zero, if less than c the estimated error in its calculation. See tol. c Size np. c c nerr Output Indicates an input error, if not 0. c 1 if np is not positive. c c np Input The size of arrays au, bu, du. c c tol Input Numerical tolerance limit. c On Cray computers, recommend 1.e-5 to 1.e-11. c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc ccend. c.... Dimensioned arguments. c---- Coordinate u of point "a". dimension au (1) c---- Coordinate u of point "b". dimension bu (1) c---- Component u of vector "d". dimension du (1) c.... Local variables. c---- Estimated error in du. common /laptvdil/ duerr c---- Index in au, bu, du. common /laptvdil/ n cbugc***DEBUG begins. cbug 9901 format (/ 'aptvdil finding distance between points:' / cbug & (i3,' au=',1pe22.14,' bu=',1pe22.14)) cbug write ( 3, 9901) (n, au(n), bu(n), n = 1, np) cbugc***DEBUG ends. c.... Initialize. nerr = 0 c.... Test for input errors. if (np .le. 0) then nerr = 1 go to 210 endif c.... Find the components of the distance vectors. c---- Loop over points or vectors. do 110 n = 1, np du(n) = bu(n) - au(n) c---- End of loop over points or vectors. 110 continue c.... See if the truncation error option is to be used. c---- Test and adjust du. if (tol .gt. 0.0) then c---- Loop over points or vectors. do 120 n = 1, np duerr = tol * (abs (au(n)) + abs (bu(n))) if (abs (du(n)) .lt. duerr) then du(n) = 0.0 endif c---- End of loop over points or vectors. 120 continue c---- Tested tol. endif cbugc***DEBUG begins. cbug 9902 format (/ 'aptvdil results:' / cbug & (i3,' du=',1pe22.14)) cbug write ( 3, 9902) (n, du(n), n = 1, np) cbugc***DEBUG ends. 210 return c.... End of subroutine aptvdil. (+1 line.) end UCRL-WEB-209832