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 surfaceinteractions(inpc,textpart,matname,nmat,nmat_,
20     &  irstrt,istep,istat,n,iline,ipol,inl,ipoinp,inp,nrhcon,ipoinpc,
21     &  imat,ier)
22!
23!     reading the input deck: *SURFACE INTERACTION
24!
25      implicit none
26!
27      character*1 inpc(*)
28      character*80 matname(*)
29      character*132 textpart(16)
30!
31      integer nmat,nmat_,istep,istat,n,key,i,irstrt(*),iline,ipol,inl,
32     &  ipoinp(2,*),inp(3,*),nrhcon(*),ipoinpc(0:*),imat,ier
33!
34      if((istep.gt.0).and.(irstrt(1).ge.0)) then
35         write(*,*) '*ERROR reading *SURFACE INTERACTION:'
36         write(*,*) '       *SURFACE INTERACTION should be placed'
37         write(*,*) '       before all step definitions'
38         ier=1
39         return
40      endif
41!
42      nmat=nmat+1
43      if(nmat.gt.nmat_) then
44         write(*,*)
45     &       '*ERROR reading *SURFACE INTERACTION: increase nmat_'
46         ier=1
47         return
48      endif
49      imat=nmat
50!
51      do i=2,n
52         if(textpart(i)(1:5).eq.'NAME=') then
53            matname(nmat)=textpart(i)(6:85)
54            if(textpart(i)(86:86).ne.' ') then
55               write(*,*) '*ERROR reading *SURFACE INTERACTION:'
56               write(*,*) '       name too long'
57               write(*,*) '       (more than 80 characters)'
58               write(*,*) '       interaction name:',textpart(i)(1:132)
59               ier=1
60               return
61            endif
62            exit
63         else
64            write(*,*) '*WARNING reading *SURFACE INTERACTION:'
65            write(*,*) '         parameter not recognized:'
66            write(*,*) '         ',
67     &                 textpart(i)(1:index(textpart(i),' ')-1)
68            call inputwarning(inpc,ipoinpc,iline,
69     &"*SURFACE INTERACTION%")
70         endif
71      enddo
72!
73!     a fictitious nonzero number of density values is stored in nrhcon
74!     for contact calculations in which all materials are required to
75!     have a density assigned (e.g. dynamic calculations). This is needed
76!     since a surface interaction is internally treated as material
77!
78      nrhcon(nmat)=-1
79!
80      call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
81     &     ipoinp,inp,ipoinpc)
82!
83      return
84      end
85
86