Debian Codegraph @

packages/seacas/applications/gen3d/g3_exparc.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 EXPARC (XN, YN, XN3, YN3, ZN3, IXNP, NRNP, NPCEN,
9 & SINANG, COSANG)
10 C=======================================================================
11
12 C --*** EXPARC *** (GEN3D) Calculate 3D coordinates
13 C -- Written by Amy Gilkey - revised 05/09/88
14 C -- Modified by Greg Sjaardema - 02/06/89
15 C -- Added Warp Function
16 C -- Added Gradient to Rotations (not for center blocks)
17 C --
18 C --NEWXYZ calculates the coordinate array for the 3D database.
19 C --
20 C --Parameters:
21 C -- XN, YN - IN - the 2D coordinates, destroyed
22 C -- XN3, YN3, ZN3 - OUT - the 3D coordinates
23 C -- IXNP - IN - the new index for each node
24 C -- NRNP - IN - the number of new nodes generated for each node
25 C -- NPCEN - IN - the node numbers of the center nodes by column and row
26 C -- SINANG, COSANG - SCRATCH - size = NNREPL, holds sin and cos of
27 C -- angles for rotations
28 C --
29 C --Common Variables:
30 C -- Uses NDIM, NUMNP of /DBNUMS/
31 C -- Uses NDIM3, NUMNP3 of /DBNUM3/
32 C -- Uses DOTRAN, NNREPL, DIM3, NRTRAN, D3TRAN, ZGRAD,
33 C -- CENTER, NUMCOL, NUMROW of /PARAMS/
34
35 INCLUDE 'g3_dbnums.blk'
36 INCLUDE 'g3_dbnum3.blk'
37 INCLUDE 'g3_params.blk'
38
39 REAL XN(NUMNP), YN(NUMNP),
40 & XN3(NUMNP3), YN3(NUMNP3), ZN3(NUMNP3)
41 INTEGER IXNP(*), NRNP(*)
42 INTEGER NPCEN(NUMCDM,*)
43 REAL SINANG(NNREPL), COSANG(NNREPL)
44
45 PI = ATAN2(0.0, -1.0)
46 C --For rotations, change X and add Z so that they define pie-shaped
47 C --regions around the Y axis
48
49 C --Copy Y coordinate from original
50
51 DO 520 INP = 1, NUMNP
52 JNP0 = IXNP(INP) - 1
53 DO 510 NR = 1, NRNP(INP)
54 YN3(JNP0+NR) = YN(INP)
55 510 CONTINUE
56 520 CONTINUE
57
58 C ... Check minimum X coordinate to see if we will generate bad elements
59 XMIN = XN(1)
60 DO 5 INP = 2, NUMNP
61 XMIN = MIN(XMIN, XN(INP))
62 5 CONTINUE
63 XMIN = XMIN - CENTER
64 if (XMIN .LT. 0) THEN
65 call prterr('WARNING',
66 & 'Input mesh crosses over axis of rotation (Y). Negative '//
67 & 'elements may be generated. Adjust ROTCEN or input mesh.')
68 end if
69
70 C --Subtract center, so rotation is around zero
71
72 IF (CENTER .NE. 0.0) THEN
73 DO 20 INP = 1, NUMNP
74 XN(INP) = XN(INP) - CENTER
75 20 CONTINUE
76 END IF
77
78 C --Get the coordinates for the non-center nodes
79
80 IBLK = 0
81 NXTNR = 1
82
83 ZEND = 0.0
84 DEGR = 0.0
85 1 CONTINUE
86 IBLK = IBLK + 1
87 IF (NRTRAN(IBLK) .GT. 0) THEN
88 ZBEG = ZEND
89 ZEND = ZBEG + D3TRAN(IBLK) * PI / 180.
90 DEGR = DEGR + D3TRAN(IBLK)
91 if (DEGR .lt. 360.0) then
92 nrot = nrtran(iblk)+1
93 else
94 nrot = nrtran(iblk)
95 end if
96 CALL INIGRD (-ZBEG, -ZEND, ZGRAD(IBLK),
97 * NRTRAN(IBLK), nrot, COSANG(NXTNR) )
98 NXTNR = NXTNR + NRTRAN(IBLK)
99 IF (IBLK .LT. MAXINT) GO TO 1
100 END IF
101
102 DO 30 NR = 1, NNREPL
103 ANG = COSANG(NR)
104 SINANG(NR) = SIN (ANG)
105 COSANG(NR) = COS (ANG)
106 30 CONTINUE
107
108 DO 60 INP = 1, NUMNP
109 IF (NRNP(INP) .EQ. NNREPL) THEN
110 JNP = IXNP(INP)
111 X = XN(INP)
112 DO 50 NR = 1, NNREPL
113 XN3(JNP) = X * COSANG(NR)
114 ZN3(JNP) = X * SINANG(NR)
115 JNP = JNP + 1
116 50 CONTINUE
117 END IF
118 60 CONTINUE
119
120 C --Add center of rotation
121
122 IF (CENTER .NE. 0.0) THEN
123 DO 180 JNP = 1, NUMNP3
124 XN3(JNP) = XN3(JNP) + CENTER
125 180 CONTINUE
126 END IF
127 RETURN
128 END