1!     CalculiX - A 3-dimensional finite element program
2!              Copyright (C) 1998-2021 Guido Dhondt
3!
4!     This program is free software; you can redistribute it and/or
5!     modify it under the terms of the GNU General Public License as
6!     published by the Free Software Foundation(version 2);
7!
8!
9!     This program is distributed in the hope that it will be useful,
10!     but WITHOUT ANY WARRANTY; without even the implied warranty of
11!     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12!     GNU General Public License for more details.
13!
14!     You should have received a copy of the GNU General Public License
15!     along with this program; if not, write to the Free Software
16!     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17!
18      subroutine materialdata_sp(elcon,nelcon,imat,ntmat_,i,t1l,
19     &  elconloc,kode,plicon,nplicon,npmat_,plconloc,ncmat_)
20!
21      implicit none
22!
23!     determines the material data for element i
24!
25      integer nelcon(2,*),imat,i,k,kin,ntmat_,nelconst,kode,
26     &  itemp,ncmat_,id,nplicon(0:ntmat_,*),npmat_
27!
28      real*8 elcon(0:ncmat_,ntmat_,*),t1l,elconloc(*),
29     &   plicon(0:2*npmat_,ntmat_,*),plconloc(802)
30!
31!
32!
33!     nelconst: # constants read from file
34!
35!     calculating the hardening coefficients
36!
37!     for the calculation of the spring stiffness, the whole curve
38!     has to be stored:
39!     plconloc(2*k-1), k=1...200: displacement
40!     plconloc(2*k),k=1...200:    force
41!
42      if(kode.lt.-50) then
43         if(npmat_.eq.0) then
44            plconloc(801)=0.5d0
45            plconloc(802)=0.5d0
46         else
47            plconloc(1)=0.d0
48            plconloc(2)=0.d0
49            plconloc(3)=0.d0
50            plconloc(801)=nplicon(1,imat)+0.5d0
51            plconloc(802)=0.5d0
52!
53!     nonlinear spring characteristic or gap conductance characteristic
54!
55            if(nplicon(1,imat).ne.0) then
56!
57               if(nplicon(0,imat).eq.1) then
58                  id=-1
59               else
60                  call ident2(plicon(0,1,imat),t1l,nplicon(0,imat),
61     &                 2*npmat_+1,id)
62               endif
63!
64               if(nplicon(0,imat).eq.0) then
65                  continue
66               elseif((nplicon(0,imat).eq.1).or.(id.eq.0).or.
67     &                 (id.eq.nplicon(0,imat))) then
68                  if(id.le.0) then
69                     itemp=1
70                  else
71                     itemp=id
72                  endif
73                  kin=0
74                  call plcopy(plicon,nplicon,plconloc,npmat_,ntmat_,
75     &                 imat,itemp,i,kin)
76                  if((id.eq.0).or.(id.eq.nplicon(0,imat))) then
77                  endif
78               else
79                  kin=0
80                  call plmix(plicon,nplicon,plconloc,npmat_,ntmat_,
81     &                 imat,id+1,t1l,i,kin)
82               endif
83            endif
84         endif
85      else
86!
87!     linear spring characteristic
88!
89         nelconst=nelcon(1,imat)
90         call ident2(elcon(0,1,imat),t1l,nelcon(2,imat),ncmat_+1,id)
91         if(nelcon(2,imat).eq.0) then
92            continue
93         elseif(nelcon(2,imat).eq.1) then
94            do k=1,nelconst
95               elconloc(k)=elcon(k,1,imat)
96            enddo
97         elseif(id.eq.0) then
98            do k=1,nelconst
99               elconloc(k)=elcon(k,1,imat)
100            enddo
101         elseif(id.eq.nelcon(2,imat)) then
102            do k=1,nelconst
103               elconloc(k)=elcon(k,id,imat)
104            enddo
105         else
106            do k=1,nelconst
107               elconloc(k)=elcon(k,id,imat)+
108     &              (elcon(k,id+1,imat)-elcon(k,id,imat))*
109     &              (t1l-elcon(0,id,imat))/
110     &              (elcon(0,id+1,imat)-elcon(0,id,imat))
111            enddo
112         endif
113      endif
114!
115      return
116      end
117
118