Debian Codegraph @

packages/seacas/applications/grepos/gp_munnps.f

raw
1 C Copyright(C) 1999-2020, 2022 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 MUNNPS (NUMNPS, ISTAT, LNPSNL, LNPSDF,
9 & IDNPS, NNNPS, IXNNPS, LTNNPS, FACNPS,
10 & LTNX, FACX, IXNPS, NNX, ISCR, NAMSCR, NAME)
11 C=======================================================================
12
13 C --*** MUNNPS *** (GJOIN) Compress and rearrange nodal point sets
14 C -- Written by Amy Gilkey - revised 02/25/88
15 C --
16 C --MUNNPS processes the nodal point sets according to the set status.
17 C --Sets may be combined or deleted.
18 C --
19 C --Parameters:
20 C -- NUMNPS - IN/OUT - the number of nodal point sets
21 C -- ISTAT - IN - the status of each set:
22 C -- 0 = same
23 C -- - = delete
24 C -- n = combine with set n
25 C -- LNPSNL - IN/OUT - the length of the nodal point sets node list
26 C -- LNPSDF - IN/OUT - the length of the nodal point dist.fact. list
27 C -- IDNPS - IN/OUT - the nodal point set ID for each set
28 C -- NNNPS - IN/OUT - the number of nodes for each set
29 C -- IXNNPS - IN/OUT - the index of the first node for each set
30 C -- LTNNPS - IN/OUT - the nodes for all sets
31 C -- FACNPS - IN/OUT - the distribution factors for all sets
32 C -- LTNX - SCRATCH - sized to hold the set nodes
33 C -- FACX - SCRATCH - sized to hold the set factors
34 C -- IXNPS - SCRATCH - size = NUMNPS
35 C -- NNX - SCRATCH - size = NUMNPS
36 C -- ISCR - SCRATCH - size = NUMNPS
37
38 include 'gp_params.blk'
39 include 'gp_namlen.blk'
40
41 INTEGER ISTAT(*)
42 INTEGER IDNPS(*)
43 INTEGER NNNPS(*)
44 INTEGER IXNNPS(*)
45 INTEGER LTNNPS(*), LTNX(*)
46 REAL FACNPS(*), FACX(*)
47 INTEGER IXNPS(*)
48 INTEGER NNX(*)
49 INTEGER ISCR(*)
50 CHARACTER*(maxnam) NAMSCR(*)
51 CHARACTER*(maxnam) NAME(*)
52
53 IF (NUMNPS .LE. 0) RETURN
54
55 IF (LNPSDF .NE. LNPSNL .AND. LNPSDF .NE. 0) then
56 call prterr('ERROR',
57 * 'Length of nodeset dist. fact. list must be zero or '//
58 * 'equal to length of nodeset node list. It is neither.')
59 end if
60
61 JNPS = 0
62 JNN0 = 0
63 DO 120 INPS = 1, NUMNPS
64
65 IF (ISTAT(INPS) .EQ. 0) THEN
66 NINSET = 1
67 ISCR(NINSET) = INPS
68 ELSE IF (ISTAT(INPS) .EQ. INPS) THEN
69 CALL GETALL (INPS, NUMNPS, ISTAT, NINSET, ISCR)
70 ELSE
71 NINSET = 0
72 END IF
73
74 IF (NINSET .GT. 0) THEN
75 JNPS = JNPS + 1
76 IXNPS(JNPS) = INPS
77 NNX(JNPS) = 0
78 JOLD = JNN0+1
79 END IF
80
81 DO 110 ISET = 1, NINSET
82 N = ISCR(ISET)
83 JLEN = JNN0+1 - JOLD
84 INN0 = IXNNPS(N) - 1
85 C ... Find max node number in the LTNX(JOLD:JOLD+JLEN) array.
86 maxnod = 0
87 do 90 i=jold, jold+jlen-1
88 if (ltnx(i) .gt. maxnod) maxnod = ltnx(i)
89 90 continue
90
91 NNEW = 0
92 C ... Goal is to minimize the number of calls to locint.
93 C More memory intensive solution may be to index all nodes
94 C contained in ltnx(jold,jold+jlen) in
95 C a large array and see if ltnnps(inno+i) is indexed....
96
97 DO 100 I = 1, NNNPS(N)
98 IF (JLEN .EQ. 0 .OR. maxnod .lt. LTNNPS(INN0+I) .or.
99 * LOCINT (LTNNPS(INN0+I), JLEN, LTNX(JOLD)) .EQ. 0)
100 & THEN
101 NNEW = NNEW + 1
102 LTNX(JNN0+NNEW) = LTNNPS(INN0+I)
103 if (lnpsdf .ne. 0) then
104 FACX(JNN0+NNEW) = FACNPS(INN0+I)
105 end if
106 END IF
107 100 CONTINUE
108 NNX(JNPS) = NNX(JNPS) + NNEW
109 JNN0 = JNN0 + NNEW
110 110 CONTINUE
111 120 CONTINUE
112
113 CALL ORDIX (JNPS, IXNPS, NUMNPS, IDNPS, ISCR, IDNPS)
114 CALL ORDSTR(JNPS, IXNPS, NUMNPS, NAME, NAMSCR)
115 CALL MOVINT (JNPS, NNX, NNNPS)
116 NUMNPS = JNPS
117 JNN = 1
118 DO 130 INPS = 1, NUMNPS
119 IXNNPS(INPS) = JNN
120 JNN = JNN + NNNPS(INPS)
121 130 CONTINUE
122 LNPSNL = JNN - 1
123
124 CALL MOVINT (LNPSNL, LTNX, LTNNPS)
125 if (lnpsdf .ne. 0) then
126 CALL MOVREA (LNPSNL, FACX, FACNPS)
127 lnpsdf = lnpsnl
128 end if
129
130 RETURN
131 END