summaryrefslogtreecommitdiff
path: root/Dragon/src/B1SOL.f
blob: 00598bd1e46d81455b6715fac544f37a6a376886 (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
*DECK B1SOL
      SUBROUTINE B1SOL(NGRO,B,IER)
*
*-----------------------------------------------------------------------
*
*Purpose:
* Solution of a system of linear equations that appear in a B1 method.
* Use ALSBD.f for solution in thermal groups.
*
*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): A. Hebert
*
*Parameters: input
* NGRO    order of the coefficient matrix.
*
*Parameters: input/output
* B       coefficient matrix augmented with the right hand vector on
*         input and solution vector, starting at B(1,NGRO+1) at output.
*
*Parameters: output
* IER     error flag (execution failure if IER.ne.0).
*
*-----------------------------------------------------------------------
*
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
*----
*  SUBROUTINE ARGUMENTS
*----
      INTEGER NGRO,IER
      DOUBLE PRECISION B(NGRO,NGRO+1)
*
      IER=0
      NGROIN=0
      DO 30 I=1,NGRO
      DO 10 J=I+1,NGRO
      IF(B(I,J).NE.0.0D0) GO TO 40
   10 CONTINUE
      NGROIN=I
      IF(B(I,I).EQ.0.0D0) THEN
        IER=-1
        RETURN
      ENDIF
      ZGAR=B(I,NGRO+1)
      DO 20 J=1,I-1
      ZGAR=ZGAR-B(I,J)*B(J,NGRO+1)
   20 CONTINUE
      B(I,NGRO+1)=ZGAR/B(I,I)
   30 CONTINUE
   40 IF(NGROIN.EQ.NGRO) RETURN
      DO 60 I=NGROIN+1,NGRO
      ZGAR=B(I,NGRO+1)
      DO 50 J=1,NGROIN
      ZGAR=ZGAR-B(I,J)*B(J,NGRO+1)
   50 CONTINUE
      B(I,NGRO+1)=ZGAR
   60 CONTINUE
      CALL ALSBD(NGRO-NGROIN,1,B(NGROIN+1,NGROIN+1),IER,NGRO)
      RETURN
      END