| 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 |
C======================================================================= |
| 7 |
SUBROUTINE NXMMAX (ISTEP, MMNUM, IVAR, NVAR, NUM, VAR, |
| 8 |
& OLDMIN, OLDMAX, XMIN, XMAX, |
| 9 |
& MINSTE, MAXSTE, MINNE, MAXNE, NMIN, NMAX) |
| 10 |
C======================================================================= |
| 11 |
|
| 12 |
C --*** NXMMAX *** (EXPLORE) Find the min/max for this time step |
| 13 |
C -- |
| 14 |
C --NXMMAX finds an incremental minimum and maximum of a variable |
| 15 |
C --for this time step. It does not reset the min/max if not on the |
| 16 |
C --first step. It may find the min/max that are greater/less than |
| 17 |
C --the previous values. |
| 18 |
C -- |
| 19 |
C --Parameters: |
| 20 |
C -- ISTEP - IN - the current step number, previous XMIN and XMAX |
| 21 |
C -- are overwritten if <=1 |
| 22 |
C -- MMNUM - IN - number of sequential min/max requests for this |
| 23 |
C -- variable, if >1 then find next min/max |
| 24 |
C -- IVAR - IN - min/max variable number |
| 25 |
C -- NUM - IN - the number of nodes or elements or 1 for global |
| 26 |
C -- VAR - IN - the variables for current time step |
| 27 |
C -- OLDMIN, OLDMAX - IN/OUT - the last minimum and maximum values, |
| 28 |
C -- only if MMNUM > 1 |
| 29 |
C -- XMIN, XMAX - IN/OUT - the minimum and maximum values |
| 30 |
C -- MINSTE, MAXSTE - IN/OUT - the step number where the minimum and |
| 31 |
C -- maximum were found |
| 32 |
C -- MINNE, MAXNE - IN/OUT - the node or element number where the |
| 33 |
C -- minimum and maximum were found |
| 34 |
C -- NMIN, NMAX - IN/OUT - the number of values equal to the minimum |
| 35 |
C -- and maximum were found |
| 36 |
|
| 37 |
REAL VAR(NUM, NVAR) |
| 38 |
|
| 39 |
IF (ISTEP .LE. 1) THEN |
| 40 |
XMIN = 1.0E36 |
| 41 |
XMAX = - 1.0E36 |
| 42 |
IF (MMNUM .LE. 1) THEN |
| 43 |
OLDMIN = - 1.0E36 |
| 44 |
OLDMAX = 1.0E36 |
| 45 |
ELSE |
| 46 |
OLDMIN = XMAX |
| 47 |
OLDMAX = XMIN |
| 48 |
END IF |
| 49 |
END IF |
| 50 |
|
| 51 |
DO 100 I = 1, NUM |
| 52 |
IF ((XMIN .GT. VAR(I,IVAR)) |
| 53 |
& .AND. (VAR(I,IVAR) .GT. OLDMIN)) THEN |
| 54 |
XMIN = VAR(I,IVAR) |
| 55 |
MINSTE = ISTEP |
| 56 |
MINNE = I |
| 57 |
NMIN = 1 |
| 58 |
ELSE IF (XMIN .EQ. VAR(I,IVAR)) THEN |
| 59 |
NMIN = NMIN + 1 |
| 60 |
END IF |
| 61 |
|
| 62 |
IF ((XMAX .LT. VAR(I,IVAR)) |
| 63 |
& .AND. (VAR(I,IVAR) .LT. OLDMAX)) THEN |
| 64 |
XMAX = VAR(I,IVAR) |
| 65 |
MAXSTE = ISTEP |
| 66 |
MAXNE = I |
| 67 |
NMAX = 1 |
| 68 |
ELSE IF (XMAX .EQ. VAR(I,IVAR)) THEN |
| 69 |
NMAX = NMAX + 1 |
| 70 |
END IF |
| 71 |
100 CONTINUE |
| 72 |
|
| 73 |
RETURN |
| 74 |
END |