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 elemperorien(ipoorel,iorel,ielorien,ne,mi)
20!
21      implicit none
22!
23      integer ipoorel(*),iorel(2,*),i,ne,mi(*),ielorien(mi(3),*),
24     &  iorelfree,iorien
25!
26!
27!
28!     determining the elements belonging to the nodes of
29!     the elements
30!
31      iorelfree=1
32      do i=1,ne
33         iorien=max(0,ielorien(1,i))
34         if(iorien.eq.0) cycle
35         iorel(1,iorelfree)=i
36         iorel(2,iorelfree)=ipoorel(iorien)
37         ipoorel(iorien)=iorelfree
38         iorelfree=iorelfree+1
39      enddo
40!
41      return
42      end
43