1!
2!     CalculiX - A 3-dimensional finite element program
3!              Copyright (C) 1998-2021 Guido Dhondt
4!
5!     This program is free software; you can redistribute it and/or
6!     modify it under the terms of the GNU General Public License as
7!     published by the Free Software Foundation(version 2);
8!
9!
10!     This program is distributed in the hope that it will be useful,
11!     but WITHOUT ANY WARRANTY; without even the implied warranty of
12!     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13!     GNU General Public License for more details.
14!
15!     You should have received a copy of the GNU General Public License
16!     along with this program; if not, write to the Free Software
17!     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18!
19      subroutine greens(inpc,textpart,nmethod,
20     &  mei,iperturb,istep,istat,n,iline,ipol,inl,
21     &  ipoinp,inp,ithermal,isolver,xboun,nboun,ipoinpc,
22     &  ier)
23!
24!     reading the input deck: *GREEN
25!
26      implicit none
27!
28      character*1 inpc(*)
29      character*20 solver
30      character*132 textpart(16)
31!
32      integer nmethod,mei(4),istep,istat,iperturb(*),i,nboun,ier,
33     &  n,key,iline,ipol,inl,ipoinp(2,*),inp(3,*),ithermal(*),isolver,
34     &  ipoinpc(0:*)
35!
36      real*8 xboun(*)
37!
38      mei(4)=0
39!
40      if(istep.lt.1) then
41         write(*,*)
42     &      '*ERROR reading *GREEN: *GREEN can only be used'
43         write(*,*) '  within a STEP'
44         ier=1
45         return
46      endif
47!
48!     no heat transfer analysis
49!
50      if(ithermal(1).gt.1) then
51         ithermal(1)=1
52      endif
53!
54!     default solver
55!
56      solver='                    '
57      if(isolver.eq.0) then
58         solver(1:7)='SPOOLES'
59      elseif(isolver.eq.2) then
60         solver(1:16)='ITERATIVESCALING'
61      elseif(isolver.eq.3) then
62         solver(1:17)='ITERATIVECHOLESKY'
63      elseif(isolver.eq.4) then
64         solver(1:3)='SGI'
65      elseif(isolver.eq.5) then
66         solver(1:5)='TAUCS'
67      elseif(isolver.eq.7) then
68         solver(1:7)='PARDISO'
69      elseif(isolver.eq.8) then
70         solver(1:6)='PASTIX'
71      endif
72!
73      do i=2,n
74         if(textpart(i)(1:7).eq.'SOLVER=') then
75            read(textpart(i)(8:27),'(a20)') solver
76         elseif(textpart(i)(1:11).eq.'STORAGE=YES') then
77            mei(4)=1
78         else
79            write(*,*)
80     &        '*WARNING reading *GREEN: parameter not recognized:'
81            write(*,*) '         ',
82     &                 textpart(i)(1:index(textpart(i),' ')-1)
83            call inputwarning(inpc,ipoinpc,iline,
84     &"*GREEN%")
85         endif
86      enddo
87!
88      if(solver(1:7).eq.'SPOOLES') then
89         isolver=0
90      elseif(solver(1:16).eq.'ITERATIVESCALING') then
91         write(*,*) '*WARNING reading *GREEN: the iterative scaling'
92         write(*,*) '         procedure is not available for green'
93         write(*,*) '         calculations; the default solver is used'
94      elseif(solver(1:17).eq.'ITERATIVECHOLESKY') then
95         write(*,*) '*WARNING reading *GREEN: the iterative scaling'
96         write(*,*) '         procedure is not available for green'
97         write(*,*) '         calculations; the default solver is used'
98      elseif(solver(1:3).eq.'SGI') then
99         isolver=4
100      elseif(solver(1:5).eq.'TAUCS') then
101         isolver=5
102      elseif(solver(1:7).eq.'PARDISO') then
103         isolver=7
104      elseif(solver(1:6).eq.'PASTIX') then
105         isolver=8
106      else
107         write(*,*) '*WARNING reading *GREEN: unknown solver;'
108         write(*,*) '         the default solver is used'
109      endif
110!
111      if((isolver.eq.2).or.(isolver.eq.3)) then
112         write(*,*) '*ERROR reading *GREEN: the default solver ',
113     & solver
114         write(*,*) '       cannot be used for green calculations '
115         ier=1
116         return
117      endif
118!
119      nmethod=13
120      if(iperturb(1).gt.1) iperturb(1)=0
121!
122!     removing nonzero boundary conditions
123!
124      do i=1,nboun
125         xboun(i)=0.d0
126      enddo
127!
128      call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
129     &     ipoinp,inp,ipoinpc)
130!
131      return
132      end
133
134