Debian Codegraph @

packages/seacas/applications/blot/rotzm.f

raw
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 ROTZM (RDMESH, NNPSUR, NPSURF, XN, YN, ZN,
9 & ROTMSH, ROTMAT, ROTCEN, ZMMESH, ZMCEN, *)
10 C=======================================================================
11
12 C --*** ROTZM *** (MESH) Find the object center within zoom limits
13 C -- Written by Amy Gilkey - revised 09/09/87
14 C --
15 C --ROTZM averages the coordinates of all surface nodes within the zoom
16 C --limits to find the center of the object visible within the zoom
17 C --window.
18 C --
19 C --Parameters:
20 C -- RDMESH - IN - the zoom mesh limits (may not be square)
21 C -- NNPSUR - IN - the number of surface nodes
22 C -- NPSURF - IN - the node numbers of the surface nodes
23 C -- XN, YN, ZN - IN - the nodal coordinates (unrotated)
24 C -- ROTMSH - IN - true iff the coordinates need to be rotated
25 C -- ROTMAT - IN - the rotation matrix
26 C -- ROTCEN - IN - the rotation center
27 C -- ZMMESH - OUT - the zoom mesh limits (may not be square)
28 C -- ZMCEN - OUT - the mesh center for the rotation
29 C -- * - return statement if no nodes within window; message is printed
30
31 PARAMETER (KLFT=1, KRGT=2, KBOT=3, KTOP=4, KNEA=5, KFAR=6)
32
33 REAL RDMESH(KTOP)
34 INTEGER NPSURF(*)
35 REAL XN(*), YN(*), ZN(*)
36 LOGICAL ROTMSH
37 REAL ROTMAT(3,3), ROTCEN(3)
38 REAL ZMMESH(KTOP)
39 REAL ZMCEN(3)
40
41 NIN = 0
42 XTOT = 0.0
43 YTOT = 0.0
44 ZTOT = 0.0
45
46 DO 100 IX = 1, NNPSUR
47 INP = NPSURF(IX)
48 IF (ROTMSH) THEN
49 CALL BL_ROTATE (1, 1, ROTMAT, ROTCEN,
50 & XN(INP), YN(INP), ZN(INP), X, Y, Z)
51 ELSE
52 X = XN(INP)
53 Y = YN(INP)
54 Z = ZN(INP)
55 END IF
56 IF ((X .GE. RDMESH(KLFT)) .AND. (X .LE. RDMESH(KRGT)) .AND.
57 & (Y .GE. RDMESH(KBOT)) .AND. (Y .LE. RDMESH(KTOP))) THEN
58 NIN = NIN + 1
59 XTOT = XTOT + X
60 YTOT = YTOT + Y
61 ZTOT = ZTOT + Z
62 END IF
63 100 CONTINUE
64
65 IF (NIN .LE. 0) THEN
66 CALL PRTERR ('CMDERR',
67 & 'No nodes within specified zoom window')
68 GOTO 110
69 END IF
70
71 XTOT = XTOT / NIN
72 YTOT = YTOT / NIN
73 ZTOT = ZTOT / NIN
74
75 CALL UNROT (1, 1, ROTMAT, ROTCEN,
76 & XTOT, YTOT, ZTOT, XCEN, YCEN, ZCEN)
77
78 XDIF = ROTCEN(1) - XCEN
79 YDIF = ROTCEN(2) - YCEN
80 ZMMESH(KLFT) = RDMESH(KLFT) + XDIF
81 ZMMESH(KRGT) = RDMESH(KRGT) + XDIF
82 ZMMESH(KBOT) = RDMESH(KBOT) + YDIF
83 ZMMESH(KTOP) = RDMESH(KTOP) + YDIF
84
85 ZMCEN(1) = XCEN
86 ZMCEN(2) = YCEN
87 ZMCEN(3) = ZCEN
88
89 RETURN
90
91 110 CONTINUE
92 RETURN 1
93 END