Debian Codegraph @

packages/seacas/applications/grepos/gp_centroid.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 subroutine centroid(x, y , z, xcent, ycent, zcent,
7 * nelblk, numelb, numlnk, link, ndim)
8 real x(*), y(*), z(*)
9 real xcent(*), ycent(*), zcent(*)
10 integer numelb(*), numlnk(*), link(*)
11
12 IELNK = 0
13 IE = 0
14 DO 100 IELB = 1, nelblk
15 IS = IE + 1
16 IE = IE + NUMELB(IELB)
17 ISLNK = IELNK + 1
18 IELNK = IELNK + NUMLNK(IELB) * NUMELB(IELB)
19
20 CALL cent1(x, y, z, xcent(is), ycent(is), zcent(is),
21 * NUMELB(IELB), NUMLNK(IELB), LINK(ISLNK), NDIM)
22 100 CONTINUE
23
24 RETURN
25 END
26
27 subroutine cent1(x, y, z, xcent, ycent, zcent,
28 * numelb, numlnk, link, ndim)
29
30 real x(*), y(*), z(*)
31 real xcent(*), ycent(*), zcent(*)
32 integer numelb, numlnk
33 integer link(numlnk,*)
34 integer ndim
35
36 do 20 ne=1, numelb
37 xc = 0.0
38 yc = 0.0
39 zc = 0.0
40 do 10 j=1, numlnk
41 xc = xc + x(link(j,ne))
42 yc = yc + y(link(j,ne))
43 if (ndim .eq. 3) then
44 zc = zc + z(link(j,ne))
45 end if
46 10 continue
47
48 rnodes = numlnk
49 xcent(ne) = xc / rnodes
50 ycent(ne) = yc / rnodes
51 if (ndim .eq. 3) then
52 zcent(ne) = zc / rnodes
53 end if
54
55 20 continue
56 return
57 end