summaryrefslogtreecommitdiff
path: root/Dragon/src/MCGDSP.f
blob: df65f5a98b52a2ee52f548d602231099b8aab755 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
*DECK MCGDSP
      SUBROUTINE MCGDSP(N,NFI,NLONG,LC,NZON,NOM,KM,MCU,IM,PREV,NEXT)
*
*-----------------------------------------------------------------------
*
*Purpose:
* Calculation of the position of the coefficients relative to a track
* in ACA matrices. Non-cylic tracking version.
*
*Copyright:
* Copyright (C) 2002 Ecole Polytechnique de Montreal
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version
*
*Author(s): I. Suslov and R. Le Tellier
*
*Parameters: input
* N       number of elements in the current track.
* NFI     total number of volumes and surfaces.
* NLONG   total number of cells with unknowns quantities.
* LC      dimension of vector MCU.
* NZON    index-number of the mixture type assigned to each volume.
* NOM     integer tracking elements.
* KM      used in CDD acceleration.
* MCU     used in CDD acceleration.
* IM      used in CDD acceleration.
*
*Parameters: output
* PREV    PREV(I) location of non diagonal element (NOM(I),NOM(I-1))
*         of preconditioning matrices in vector CF and CQ.
* NEXT    NEXT(I) location of non diagonal element (NOM(I),NOM(I+1))
*         of preconditioning matrices in vector CF and CQ.
*
*-----------------------------------------------------------------------
*
      IMPLICIT NONE
*----
*  SUBROUTINE ARGUMENTS
*----
      INTEGER N,NFI,NLONG,LC,NZON(NFI),NOM(N),KM(NLONG),MCU(LC),
     1 IM(NLONG),PREV(N),NEXT(N)
*----
*  LOCAL VARIABLES
*----
      INTEGER I,I1,I2,II,FOUN,FOUP,NOMI,NOMIN,NOMIP,NZI
*----
*  CONSTRUCT PREV & NEXT
*----
      DO I=1,N
         FOUN=-1
         FOUP=-1
*        current cell
         NOMI=NOM(I)
         IF((NOMI.LT.1).OR.(NOMI.GT.NFI)) THEN
            write(6,*) 'NOMI= ',NOMI,' I= ',I,' NFI= ',NFI
            CALL XABORT('MCGDSP: KM OVERFLOW.')
         ENDIF
         I1=IM(NOMI)
*        next cell
         IF(I.EQ.N) THEN
            NOMIN=-1
         ELSE
            NOMIN=NOM(I+1)
         ENDIF
*        previous cell
         IF(I.EQ.1) THEN
            NOMIP=-1
         ELSE
            NOMIP=NOM(I-1)
         ENDIF
*        
         NZI=NZON(NOMI)
         IF (NOMI.EQ.NOMIN) THEN
            IF (NZI.GE.0) THEN
               FOUN=0
            ELSE
               NOMIN=-1
            ENDIF
         ENDIF
         IF (NOMI.EQ.NOMIP) THEN
            IF (NZI.GE.0)  THEN
               FOUP=0
            ELSE
               NOMIP=-1
            ENDIF
         ENDIF
*
         I2=I1+KM(NOMI)
         I1=I1+1
         DO II=I1,I2
            IF ((FOUN.LT.0).AND.(MCU(II).EQ.NOMIN)) THEN
               FOUN=II
            ENDIF
            IF ((FOUP.LT.0).AND.(MCU(II).EQ.NOMIP)) THEN
               FOUP=II
            ENDIF
            IF ((FOUN.GE.0).AND.(FOUP.GE.0)) GOTO 10
         ENDDO
*        connectivity between NOMI and NOMIN and/or NOMIP not found
         WRITE(6,100) I,NOMI,NOMIN,NOMIP
         CALL PRINIM('NOM   ',NOM(1),N)
         CALL PRINIM('MCU   ',MCU(I1),KM(NOMI))
!         CALL XABORT('MCGDSP: FAILURE 1.')
 10      IF ((FOUN.LE.LC).AND.(FOUP.LE.LC)) THEN
            PREV(I)=FOUP
            NEXT(I)=FOUN
         ELSE             
            CALL XABORT('MCGDSP: CQ/CF OVERFLOW.')
         ENDIF
      ENDDO
*
 100  FORMAT(1X,'I=',I3,' NOMI=',I5,' NOMIN=',I5,' NOMIP=',I5)
*
      RETURN
      END