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!
20!     center of gravity of the projection of the vertices for
21!     visibility purposes
22!     exact integration for one triangle: routine cubtri
23!     if the surfaces are far enough away, one-point integration
24!     is used
25!
26      subroutine writeview(ntr,adview,auview,fenv,nzsrad,
27     &  jobnamef)
28!
29!     writing the viewfactors to file
30!
31      implicit none
32!
33      character*80 version
34      character*132 jobnamef(*),fnvw
35!
36      integer ntr,nzsrad,i,k
37!
38      real*8 adview(*),auview(*),fenv(*)
39!
40      write(*,*) 'Writing the viewfactors to file'
41      write(*,*)
42!
43      if(jobnamef(3)(1:1).eq.' ') then
44         do i=1,132
45            if(jobnamef(1)(i:i).eq.' ') exit
46         enddo
47         i=i-1
48         fnvw=jobnamef(1)(1:i)//'.vwf'
49      else
50         fnvw=jobnamef(3)
51      endif
52      open(10,file=fnvw,status='unknown',form='unformatted',
53     &     access='sequential',err=10)
54!
55      call getversion(version)
56!
57      write(10) version
58      write(10) (adview(k),k=1,ntr)
59      write(10) (auview(k),k=1,2*nzsrad)
60      write(10)(fenv(k),k=1,ntr)
61      close(10)
62!
63      return
64!
65 10   write(*,*) '*ERROR in writeview: could not open file ',fnvw
66      call exit(201)
67      end
68
69