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 substructuregenerates(inpc,textpart,nmethod,iperturb,
20     &  isolver,istep,istat,n,iline,ipol,inl,ipoinp,inp,
21     &  ithermal,ipoinpc,filab,ier)
22!
23!     reading the input deck: *SUBSTRUCTURE GENERATE
24!
25!     isolver=0: SPOOLES
26!             7: pardiso
27!             8: pastix
28!
29      implicit none
30!
31      character*1 inpc(*)
32      character*20 solver
33      character*87 filab(*)
34      character*132 textpart(16)
35!
36      integer nmethod,iperturb(*),isolver,istep,istat,n,key,i,
37     &  iline,ipol,inl,ipoinp(2,*),inp(3,*),ithermal(*),ipoinpc(0:*),
38     &  ier
39!
40      if((iperturb(1).eq.1).and.(istep.ge.1)) then
41         write(*,*) '*ERROR reading *SUBSTRUCTURE GENERATE:'
42         write(*,*) '       perturbation analysis is'
43         write(*,*) '       not provided in a *SUBSTRUCTURE'
44         write(*,*) '       GENERATE step.'
45         ier=1
46         return
47      endif
48!
49      if(istep.lt.1) then
50         write(*,*) '*ERROR reading *SUBSTRUCTURE GENERATE:'
51         write(*,*) '       *SUBSTRUCTURE GENERATE can only be used'
52         write(*,*) '       within a STEP'
53         ier=1
54         return
55      endif
56!
57!     no heat transfer analysis
58!
59      if(ithermal(1).gt.1) then
60         ithermal(1)=1
61      endif
62!
63!     default solver
64!
65      solver='                    '
66      if(isolver.eq.0) then
67         solver(1:7)='SPOOLES'
68      elseif(isolver.eq.2) then
69         solver(1:16)='ITERATIVESCALING'
70      elseif(isolver.eq.3) then
71         solver(1:17)='ITERATIVECHOLESKY'
72      elseif(isolver.eq.4) then
73         solver(1:3)='SGI'
74      elseif(isolver.eq.5) then
75         solver(1:5)='TAUCS'
76      elseif(isolver.eq.7) then
77         solver(1:7)='PARDISO'
78      elseif(isolver.eq.8) then
79         solver(1:6)='PASTIX'
80      endif
81!
82      do i=2,n
83         if(textpart(i)(1:7).eq.'SOLVER=') then
84            read(textpart(i)(8:27),'(a20)') solver
85         else
86            write(*,*) '*WARNING reading *SUBSTRUCTURE GENERATE:'
87            write(*,*) '         parameter not recognized:'
88            write(*,*) '         ',
89     &                 textpart(i)(1:index(textpart(i),' ')-1)
90            call inputwarning(inpc,ipoinpc,iline,
91     &"*SUBSTRUCTURE GENERATE%")
92         endif
93      enddo
94!
95      if(solver(1:7).eq.'SPOOLES') then
96         isolver=0
97      elseif(solver(1:7).eq.'PARDISO') then
98         isolver=7
99      elseif(solver(1:6).eq.'PASTIX') then
100         isolver=8
101      else
102         write(*,*) '*ERROR reading *SUBSTRUCTURE GENERATE:'
103         write(*,*) '       solver:',solver,'is not allowed.'
104         write(*,*) '       please specify SPOOLES or PARDISO'
105         ier=1
106         return
107      endif
108!
109      nmethod=11
110      filab(5)(1:4)='RF  '
111!
112      call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
113     &     ipoinp,inp,ipoinpc)
114!
115      return
116      end
117
118