| 1 |
C Copyright(C) 1999-2020 National Technology & Engineering Solutions |
| 2 |
C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 3 |
C NTESS, the U.S. Government retains certain rights in this software. |
| 4 |
C |
| 5 |
C See packages/seacas/LICENSE for details |
| 6 |
|
| 7 |
C======================================================================= |
| 8 |
SUBROUTINE wrtray (LENF, NLNKF, LINKF, NXFAC, IXFAC, |
| 9 |
& XN, YN, ZN, IELBST, BLKCOL, IDELB, *) |
| 10 |
C======================================================================= |
| 11 |
|
| 12 |
C --*** WRTRAY *** (DETOUR) Write polygons to rayshade input file |
| 13 |
C -- |
| 14 |
C --WRTRAY writes the polygons to a rayshade input file format. |
| 15 |
C -- |
| 16 |
C --Parameters: |
| 17 |
C -- LENF - IN - the cumulative face counts by element block |
| 18 |
C -- NLNKF - IN - the number of nodes per face |
| 19 |
C -- LINKF - IN - the connectivity for all faces |
| 20 |
C -- NXFAC - IN - the number of ordered faces (if DOIXF) |
| 21 |
C -- IXFAC - IN - the indices of the ordered faces (if DOIXF) |
| 22 |
C -- XN, YN, ZN - IN - the nodal coordinates |
| 23 |
C -- IELBST - IN - the element block status (>0 if selected) |
| 24 |
C -- BLKCOL - IN/OUT - the user selected colors of the element blocks. |
| 25 |
C -- BLKCOL(0) = 1 if the user defined material |
| 26 |
C -- colors should be used in mesh plots. |
| 27 |
C -- = -1 if program selected colors should |
| 28 |
C -- be used. |
| 29 |
C -- BLKCOL(i) = the user selected color of element |
| 30 |
C -- block i: |
| 31 |
C -- -2 - no color selected by user. |
| 32 |
C -- -1 - black |
| 33 |
C -- 0 - white |
| 34 |
C -- 1 - red |
| 35 |
C -- 2 - green |
| 36 |
C -- 3 - yellow |
| 37 |
C -- 4 - blue |
| 38 |
C -- 5 - cyan |
| 39 |
C -- 6 - magenta |
| 40 |
C -- * - return statement if the cancel function is active |
| 41 |
C -- |
| 42 |
C --Common Variables: |
| 43 |
C -- Uses NUMEL, NELBLK of /DBNUMS/ |
| 44 |
C -- Uses IS3DIM of /D3NUMS/ |
| 45 |
|
| 46 |
include 'dbname.blk' |
| 47 |
include 'dbnums.blk' |
| 48 |
include 'd3nums.blk' |
| 49 |
|
| 50 |
INTEGER LENF(0:NELBLK) |
| 51 |
INTEGER NLNKF(NELBLK) |
| 52 |
INTEGER LINKF(*) |
| 53 |
INTEGER IXFAC(*) |
| 54 |
REAL XN(*), YN(*), ZN(*) |
| 55 |
INTEGER IELBST(NELBLK) |
| 56 |
INTEGER BLKCOL(0:NELBLK) |
| 57 |
INTEGER IDELB(*) |
| 58 |
|
| 59 |
REAL XPTS(0:20), YPTS(0:20), ZPTS(0:20) |
| 60 |
CHARACTER*20 STRING |
| 61 |
CHARACTER*2048 FILNAM |
| 62 |
SAVE NFIL |
| 63 |
DATA NFIL /0/ |
| 64 |
|
| 65 |
C ... Open the output file. |
| 66 |
filnam = basenam(:lenstr(basenam)) // '.ray' |
| 67 |
lnam = lenstr(filnam) |
| 68 |
NFIL = NFIL + 1 |
| 69 |
IF (NFIL .GT. 1) then |
| 70 |
call intstr (1, -1, NFIL, STRING, LSTR) |
| 71 |
FILNAM(LNAM+1:LNAM+LSTR) = STRING(:LSTR) |
| 72 |
LNAM = LNAM + LSTR |
| 73 |
END IF |
| 74 |
open (unit=95, file=filnam(:lnam), form='formatted', |
| 75 |
* status='unknown') |
| 76 |
|
| 77 |
PI = ATAN2(0.0, -1.0) |
| 78 |
|
| 79 |
xmin = 1.0e38 |
| 80 |
ymin = 1.0e38 |
| 81 |
zmin = 1.0e38 |
| 82 |
xmax =-1.0e38 |
| 83 |
ymax =-1.0e38 |
| 84 |
zmax =-1.0e38 |
| 85 |
|
| 86 |
LSTBLK = -999 |
| 87 |
DO 100 IX = 1, NXFAC |
| 88 |
IFAC = IXFAC(IX) |
| 89 |
IELB = 0 |
| 90 |
IXL = IDBLNK (IELB, IFAC, LENF, NLNKF) |
| 91 |
|
| 92 |
if (lstblk .ne. ielb) then |
| 93 |
write (string, 900) idelb(ielb) |
| 94 |
call pckstr (1, string) |
| 95 |
lstr = lenstr(string) |
| 96 |
lstblk = ielb |
| 97 |
end if |
| 98 |
|
| 99 |
NNPF = NLNKF(IELB) |
| 100 |
do 90 ilink = 0, nnpf-1 |
| 101 |
XPTS(ILINK) = XN(LINKF(IXL+ILINK)) |
| 102 |
YPTS(ILINK) = YN(LINKF(IXL+ILINK)) |
| 103 |
ZPTS(ILINK) = ZN(LINKF(IXL+ILINK)) |
| 104 |
|
| 105 |
xmin = min(xmin, xpts(ilink)) |
| 106 |
ymin = min(ymin, ypts(ilink)) |
| 107 |
zmin = min(zmin, zpts(ilink)) |
| 108 |
|
| 109 |
xmax = max(xmax, xpts(ilink)) |
| 110 |
ymax = max(ymax, ypts(ilink)) |
| 111 |
zmax = max(zmax, zpts(ilink)) |
| 112 |
90 continue |
| 113 |
|
| 114 |
write (95, 910) string(:lstr), |
| 115 |
* (xpts(i), ypts(i), zpts(i),i=0, nnpf-1) |
| 116 |
|
| 117 |
100 CONTINUE |
| 118 |
|
| 119 |
write (*,*) 'RAYSHADE polygon file written to ',filnam(:lnam) |
| 120 |
write (*,*) |
| 121 |
write (*,920) 'X', xmin, xmax, xmax-xmin, (xmin+xmax)/2 |
| 122 |
write (*,920) 'Y', ymin, ymax, ymax-ymin, (ymin+ymax)/2 |
| 123 |
write (*,920) 'Z', zmin, zmax, zmax-zmin, (zmin+zmax)/2 |
| 124 |
write (*,*) |
| 125 |
|
| 126 |
dmax = max(xmax-xmin, ymax-ymin) / 2.0 |
| 127 |
do 110 i=1, 9 |
| 128 |
fov = i * 5.0 |
| 129 |
angle = FOV/2.0 * PI/180. |
| 130 |
zdist = dmax / tan(angle) |
| 131 |
eyep = zmax + zdist |
| 132 |
write (*,930) eyep, FOV |
| 133 |
110 continue |
| 134 |
write (*,*) |
| 135 |
close (95) |
| 136 |
|
| 137 |
RETURN |
| 138 |
|
| 139 |
900 FORMAT ('id',i10) |
| 140 |
910 format ('poly ',A, 20(1pe13.5)) |
| 141 |
920 format (A1,': Min =',1pe11.3,' Max =',1pe11.3,' Range =', |
| 142 |
* 1pe11.3,' Center =',1pe11.3) |
| 143 |
930 FORMAT ('Z-coordinate of eye point =',1pe11.3,' for a ', |
| 144 |
* 0pf4.1,' degree field of view') |
| 145 |
END |