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 readsen(g0,dgdx,ndesi,nobject,nodedesi,jobnamef)
20!
21!     reads "raw" sensitivities to file jobname.sen
22!
23      implicit none
24!
25      character*132 jobnamef(*),cfile
26!
27      integer ndesi,nobject,nodedesi(*),i,j,idummy
28!
29      real*8 g0(*),dgdx(ndesi,*)
30!
31!
32!
33!     storing the objectives
34!
35      do i=1,132
36         cfile(i:i)=' '
37      enddo
38      do i=1,132
39         if(jobnamef(1)(i:i).eq.' ') exit
40         cfile(i:i)=jobnamef(1)(i:i)
41      enddo
42      cfile(i:i+4)='.sen0'
43      open(27,file=cfile,status='unknown')
44!
45c      read(27,*) g0(1)
46      read(27,*) (g0(j),j=1,nobject)
47!
48      close(27)
49!
50!     storing the sensitivity of the objectives
51!
52      cfile(i+4:i+4)='1'
53      open(27,file=cfile,status='unknown')
54!
55      do i=1,ndesi
56         read(27,*) idummy,(dgdx(i,j),j=1,nobject)
57         if(idummy.ne.nodedesi(i)) then
58            write(*,*) '*ERROR in readsen: design nodes not'
59            write(*,*) '       in correct ascending order in'
60            write(*,*) '       file',cfile
61         endif
62      enddo
63!
64      close(27)
65!
66      return
67      end
68
69