Debian Codegraph @

packages/seacas/applications/grepos/gp_mapev.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 mapev(nold, nnew, nvar, map, vars, scr)
9 C=======================================================================
10 C --*** MAPVAR *** (GREPOS) Map values from old array to new.
11 C --
12 C --MAPVAR reorders the data in VARS based on the map in MAP
13 C --
14 C --Parameters:
15 C -- NOLD - IN - number of old values,
16 C -- NNEW - IN - number of new values
17 C -- NVAR - IN - the number of variables
18 C -- NVARDM - IN - the row dimension of VARNP
19 C -- MAP - IN - map from new value to old MAP(NEW) = OLD
20 C size is 'nnew'
21 C -- VARS - IN/OUT - the values. On input in old order,
22 C on output in new order
23 C -- SCR - TMP - temporary storage area
24
25 integer map(*)
26 real vars(*)
27 c real vars(nold, nvar)
28 real scr(*)
29
30 C ... VARS is treated as a doubly-dimensioned array (NOLD, NVAR),
31 C on input and (NNEW, NVAR) on output.
32 C The dimensions need to be in this order so we can read them
33 C in using exgev and exgnv. Note that dbist2 ensures that there
34 C are values for all elements for each variable even if the
35 C variable does not exist for a particular block. This makes it
36 C easier to transfer variables from old to new. We don't need to
37 C worry about the truth table in this routine; just transfer
38 C all variables from old to new and the output takes care
39 C of truth table handling. This is a little extra work
40 C done in this routine, but permits modifying truth table or
41 C combining element blocks with different truth tables.
42
43 do 30 ivar = 1, nvar
44 do 10 i = 1, nnew
45 scr(i) = vars(map(i) + nold * (ivar-1))
46 10 continue
47
48 do 20 i = 1, nnew
49 vars(i + nnew * (ivar-1)) = scr(i)
50 20 continue
51 30 continue
52
53 return
54 end