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 elementpernode(iponoel,inoel,lakon,ipkon,kon,ne)
20!
21      implicit none
22!
23      character*8 lakon(*)
24!
25      integer iponoel(*),inoel(2,*),ipkon(*),kon(*),i,j,ne,
26     &  inoelfree,nope,indexe,node
27!
28!
29!
30!     determining the elements belonging to the nodes of
31!     the elements
32!
33      inoelfree=1
34      do i=1,ne
35         if(ipkon(i).lt.0) cycle
36         if(lakon(i)(1:1).eq.'F') cycle
37         if(lakon(i)(4:4).eq.'2') then
38            nope=20
39         elseif(lakon(i)(4:4).eq.'8') then
40            nope=8
41         elseif(lakon(i)(4:4).eq.'4') then
42            nope=4
43         elseif(lakon(i)(4:5).eq.'10') then
44            nope=10
45         elseif(lakon(i)(4:4).eq.'6') then
46            nope=6
47         elseif(lakon(i)(4:5).eq.'15') then
48            nope=15
49         elseif((lakon(i)(1:2).eq.'ES').or.
50     &          (lakon(i)(1:2).eq.'ED')) then
51            read(lakon(i)(8:8),'(i1)') nope
52            nope=nope+1
53         else
54            cycle
55         endif
56         indexe=ipkon(i)
57         do j=1,nope
58            node=kon(indexe+j)
59            inoel(1,inoelfree)=i
60            inoel(2,inoelfree)=iponoel(node)
61            iponoel(node)=inoelfree
62            inoelfree=inoelfree+1
63         enddo
64      enddo
65!
66      return
67      end
68