Debian Codegraph @

packages/seacas/applications/algebra/ag_dofncg.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 DOFNCG (FUNC, PARTYP, LENARY, NELBLK, IXELB, ISEVOK,
9 & NUMIX, IXNODE, IXELEM, PARM, RESULT)
10 C=======================================================================
11
12 C --*** DOFNCG *** (ALGEBRA) Perform array-to-single-value function
13 C -- Written by Amy Gilkey - revised 05/17/88
14 C --
15 C --DOFNCG performs an intrinsic or external function with one parameter
16 C --that transforms the array into a single value (such as minimum of
17 C --all array values). Certain array values may be selected,
18 C --meaning the function is only applied to those values.
19 C --
20 C --Parameters:
21 C -- FUNC - IN - the intrinsic or external function
22 C -- PARTYP - IN - the parameter type (element must be handled differently)
23 C -- LENARY - IN - the length of the parameter array
24 C -- NELBLK - IN - the number of element blocks
25 C -- IXELB - IN - the cumulative element counts for each element block
26 C -- ISEVOK - IN - the element variable truth table for each element block
27 C -- NUMIX - IN - the number of selected values; <0 if all
28 C -- IXNODE - IN - the indices of the selected nodes (only if NUMIX>=0)
29 C -- IXELEM - IN - the indices of the selected elements (only if NUMIX>=0)
30 C -- PARM - IN - the parameter array
31 C -- RESULT - OUT - the returned result value
32
33 CHARACTER PARTYP
34 INTEGER IXELB(0:NELBLK)
35 LOGICAL ISEVOK(*)
36 INTEGER IXNODE(*)
37 INTEGER IXELEM(*)
38 REAL PARM(*)
39 REAL RESULT
40
41 LOGICAL INIT
42
43 INIT = .TRUE.
44
45 R = 0.0
46 IF (NUMIX .GE. 0) THEN
47 IF (PARTYP .NE. 'E') THEN
48 DO 100 I = 1, NUMIX
49 J = IXNODE(I)
50 IF (INIT) THEN
51 R = PARM(J)
52 INIT = .FALSE.
53 ELSE
54 R = FUNC (R, PARM(J))
55 END IF
56 100 CONTINUE
57 ELSE
58 DO 120 IELB = 1, NELBLK
59 IF (ISEVOK(IELB)) THEN
60 DO 110 I = IXELB(IELB-1)+1, IXELB(IELB)
61 J = IXELEM(I)
62 IF (INIT) THEN
63 R = PARM(J)
64 INIT = .FALSE.
65 ELSE
66 R = FUNC (R, PARM(J))
67 END IF
68 110 CONTINUE
69 END IF
70 120 CONTINUE
71 END IF
72
73 ELSE
74 C NUMIX < 0; ALL VALUES SELECTED
75 C NUMEL=NUMELO; NUMNP=NUMNPO; IXELB(J)=IXELBO(J), J=1,NELBLK
76 IF (PARTYP .NE. 'E') THEN
77 R = PARM(1)
78 DO 130 J = 2, LENARY
79 R = FUNC (R, PARM(J))
80 130 CONTINUE
81 ELSE
82 DO 150 IELB = 1, NELBLK
83 IF (ISEVOK(IELB)) THEN
84 DO 140 J = IXELB(IELB-1)+1, IXELB(IELB)
85 IF (INIT) THEN
86 R = PARM(J)
87 INIT = .FALSE.
88 ELSE
89 R = FUNC (R, PARM(J))
90 END IF
91 140 CONTINUE
92 END IF
93 150 CONTINUE
94 END IF
95 END IF
96
97 RESULT = R
98
99 RETURN
100 END