Debian Codegraph @

packages/seacas/applications/blot/pickn3.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 PICKN3 (PROMPT, NUMNPF, XN, YN, ZN, HIDENP,
9 & MIDDEF, NODRES , *)
10 C=======================================================================
11
12 C --*** PICKND *** (MESH) Pick a node and return node id
13 C -- Written by Ray J. Meyers - 20 June, 1990
14 C --
15 C --PICK3D picks a user-selected node. PICKND
16 C --puts a cursor on the screen, waits until the user positions the cursor,
17 C --then translates finds the nearest
18 C --node and returns its node id.
19 C --
20 C --Parameters:
21 C -- PROMPT - IN - the point requested
22 C -- NUMNPF - IN - the number of nodes desired
23 C -- XN, YN, ZN - IN - the displayed mesh nodal coordinates
24 C -- HIDENP - IN - node i is defined iff HIDENP(i) is true
25 C -- MIDDEF - IN - true if the middle of the displayed mesh is to be the
26 C -- starting position, else use the last selected position
27 C -- NODRES - the returned node number
28 C -- * - return statement if error picking point
29 C --
30 C --Common Variables:
31 C -- Sets DXLAST, DYLAST of /PICK/
32 C -- Uses /PICK/
33
34 PARAMETER (KLFT=1, KRGT=2, KBOT=3, KTOP=4, KNEA=5, KFAR=6)
35
36 include 'pick.blk'
37
38 CHARACTER*(*) PROMPT
39 REAL XN(*), YN(*), ZN(*)
40 LOGICAL HIDENP(*)
41 LOGICAL MIDDEF
42
43 CHARACTER*80 XPRMPT
44 CHARACTER CH
45
46 IF (.NOT. INITP) THEN
47 CALL PRTERR ('CMDERR', 'No mesh is displayed')
48 GOTO 110
49 END IF
50
51 C --Put up the cursor at the default location and wait for the user
52 C --to select a point
53
54 IF (PROMPT .NE. ' ') THEN
55 XPRMPT = 'Pick node nearest ' // PROMPT // '...'
56 ELSE
57 XPRMPT = ' '
58 END IF
59
60 IF (MIDDEF) THEN
61 DXRES = DXMID
62 DYRES = DYMID
63 ELSE
64 DXRES = DXLAST
65 DYRES = DYLAST
66 END IF
67 CALL GRIKEY (XPRMPT, DXRES, DYRES, CH, *110)
68
69 C --Save the selected position
70
71 DXLAST = DXRES
72 DYLAST = DYRES
73
74 C --Translate the point from device coordinates into object coordinates
75
76 XRES = PKMESH(KLFT) + (DXRES - DMESH(KLFT)) * DVRAT
77 YRES = PKMESH(KBOT) + (DYRES - DMESH(KBOT)) * DVRAT
78
79 C --Get the coordinates of the node nearest the point
80
81 DISMIN = 10E+30
82 DO 100 INP = 1, NUMNPF
83 IF (HIDENP(INP)) GOTO 100
84 X = XRES - XN(INP)
85 Y = YRES - YN(INP)
86 DIS = X*X + Y*Y
87 IF (DIS .LT. DISMIN) THEN
88 DISMIN = DIS
89 NODRES = INP
90 END IF
91 100 CONTINUE
92
93 RETURN
94
95 110 CONTINUE
96 RETURN 1
97 END