Debian Codegraph @

packages/seacas/applications/explore/exp_ckmap.f

raw
1 C Copyright(C) 1999-2020, 2024 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 CKMAP (ICNT, MAP, INDX, TYPE)
8 C=======================================================================
9
10 C --*** CKMAP *** (EXPLORE) Check database node/element map
11 C --
12 C --CKMAP checks the node/element order map.
13 C --
14 C --Parameters:
15 C -- ICNT - IN - the number of nodes/elements
16 C -- MAP - IN - the node/element order map
17 C -- INDX - SCRATCH - size = ICNT
18
19 include 'exp_errcnt.blk'
20 INTEGER MAP(*)
21 INTEGER INDX(*)
22 CHARACTER*(*) TYPE
23
24 CHARACTER*1024 STRA
25 C --Check that each node/element appears once and only once in the map
26 C The 'map(i)' values may be larger than icnt, so we can't do a
27 C simple check. Instead, we do an indexed sort and check for no
28 C duplicate adjacent values.
29
30 nerr = 0
31 if (icnt .le. 1) return
32
33 CALL INDEXI (MAP, INDX, ICNT, .TRUE.)
34
35 C ... There has been a request to show min and max ids to help with
36 C debugging potential database corruption issues. Do it here.
37
38 if (indx(1) .eq. 1 .and. indx(icnt) .eq. icnt .and.
39 $ (map(icnt) - map(1) +1 .eq. icnt)) then
40 write (stra, 10001) type, map(indx(1)), map(indx(icnt)),
41 $ 'sequential'
42 else
43 write (stra, 10001) type, map(indx(1)), map(indx(icnt)),
44 $ 'NOT sequential'
45 endif
46 10001 FORMAT('INFO: ', A, ' global id range: ',I12, ' to ', I12,
47 $ '. Map is ', A)
48 call sqzstr(stra, lstra)
49 CALL PRTERR ('CMDSPEC', STRA(:lstra))
50
51 ILAST = MAP(INDX(1))
52 DO 100 IEL = 2, ICNT
53 if (map(indx(iel)) .eq. ilast) then
54 if (nerr .lt. maxerrs .or. maxerrs .le. 0) then
55 write (stra, 10000) type, ilast, type,
56 * indx(iel-1), indx(iel)
57 10000 FORMAT('MAP ERROR: ',A,' global id ',I12,
58 * ' assigned to ',A,'s', I12,' and ',I12,'.')
59 call sqzstr(stra, lstra)
60 CALL PRTERR ('CMDSPEC', STRA(:lstra))
61 else if (nerr .eq. maxerrs .and. maxerrs .gt. 0) then
62 call prterr('CMDSPEC',
63 $ '...skipping additional errors...')
64 end if
65 nerr = nerr + 1
66 end if
67 ilast = map(indx(iel))
68 100 CONTINUE
69 if (nerr .gt. 0) then
70 write (stra, 10010) nerr, type
71 10010 FORMAT('MAP ERROR: Found ',I12,' errors in ',A,' map check.')
72 call sqzstr(stra, lstra)
73 CALL PRTERR ('CMDSPEC', STRA(:lstra))
74 end if
75 RETURN
76 END