Debian Codegraph @

packages/seacas/applications/blot/caldis.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 CALDIS (NNENUM, NENUM, XNE, YNE, ZNE, SDISTS)
9 C=======================================================================
10
11 C --*** CALDIS *** (SPLOT) Calculate node/element distances
12 C -- Written by Amy Gilkey - revised 02/14/86
13 C --
14 C --CALDIS calculates the distances between selected nodes or elements.
15 C --
16 C --Parameters:
17 C -- NNENUM - IN - the number of selected node/element numbers
18 C -- NENUM - IN - the selected node/element numbers
19 C -- XNE,
20 C -- YNE,
21 C -- ZNE - IN - the coordinates of the nodes (if nodes)
22 C -- or element centroids (if elements)
23 C -- SDISTS - OUT - the calculated distances
24 C --
25 C --Common Variables:
26 C -- Uses NDIM of /DBNUMS/
27
28 include 'dbnums.blk'
29
30 INTEGER NENUM(NNENUM)
31 REAL XNE(*), YNE(*), ZNE(*)
32 REAL SDISTS(NNENUM)
33
34 SDISTS(1) = 0.0
35 INE = NENUM(1)
36 XTHIS = XNE(INE)
37 YTHIS = YNE(INE)
38 IF (NDIM .EQ. 3) ZTHIS = ZNE(INE)
39
40 DO 100 NUM = 2, NNENUM
41 INE = NENUM(NUM)
42 XLAST = XTHIS
43 XTHIS = XNE(INE)
44 YLAST = YTHIS
45 YTHIS = YNE(INE)
46 IF (NDIM .EQ. 2) THEN
47 SDISTS(NUM) = SDISTS(NUM-1) +
48 & SQRT ((XTHIS-XLAST)**2 + (YTHIS-YLAST)**2)
49 ELSE IF (NDIM .EQ. 3) THEN
50 ZLAST = ZTHIS
51 ZTHIS = ZNE(INE)
52 SDISTS(NUM) = SDISTS(NUM-1) +
53 & SQRT ((XTHIS-XLAST)**2 + (YTHIS-YLAST)**2
54 & + (ZTHIS-ZLAST)**2)
55 END IF
56 100 CONTINUE
57
58 RETURN
59 END