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 fixnode(nobject,nk,set,nset,istartset,iendset,
20     &     ialset,iobject,nodedesiinv,dgdxglob,objectset)
21!
22!     determination of the fixed nodes for the sensitivity analysis
23!
24      implicit none
25!
26      character*81 objectset(5,*),set(*)
27!
28      integer nk,nobject,nset,istartset(*),iendset(*),ialset(*),id,
29     &     iobject,nodedesiinv(*),i,j,node
30!
31      real*8 dgdxglob(2,nk,nobject)
32!
33!     determining the set of fixed nodes
34!
35c      do i=1,nset
36c        if(objectset(3,iobject).eq.set(i)) exit
37c      enddo
38      call cident81(set,objectset(3,iobject),nset,id)
39      i=nset+1
40      if(id.gt.0) then
41        if(objectset(3,iobject).eq.set(id)) then
42          i=id
43        endif
44      endif
45!
46      if(i.le.nset) then
47!
48        do j=istartset(i),iendset(i)
49          if(ialset(j).gt.0) then
50            node=ialset(j)
51            if(nodedesiinv(node).eq.1) then
52              dgdxglob(1,node,iobject)=1.0d0
53              dgdxglob(2,node,iobject)=1.0d0
54            endif
55          else
56            node=ialset(j-2)
57            do
58              node=node-ialset(j)
59              if(node.ge.ialset(j-1)) exit
60              if(nodedesiinv(node).eq.1) then
61                dgdxglob(1,node,iobject)=1.0d0
62                dgdxglob(2,node,iobject)=1.0d0
63              endif
64            enddo
65          endif
66        enddo
67      endif
68!
69      return
70      end
71