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 writematrix(au,ad,irow,jq,neq,number)
20!
21!      writes an matrix to file (for debugging purposes)
22!
23      implicit none
24!
25      character*12 name
26      character*14 name2
27!
28      integer irow(*),jq(*),neq,i,j,k,number,ii,row,
29     &     column,idiff
30!
31      real*8 au(*),ad(*),help,aij,aji,diff,
32     &     maxdiff,maxhelp
33!
34      name='matrix_'//char(number+96)//'.out'
35      name2='matrix_'//char(number+96)//'_t.out'
36      open(10,file=name,status='unknown')
37      write(10,*) 'matrix number ',number
38!
39      do i=1,neq
40         if(ad(i).gt.1.e-20 .or. ad(i).lt. -1.e-20)then
41            write(10,*) 'row ',i,' value ',ad(i)
42         endif
43      enddo
44!
45      diff=0.0
46      idiff=0
47      maxdiff=0.0
48!
49      do i=1,neq
50         k=jq(i+1)-jq(i)
51         if(k.gt.0)write(10,*) 'comlumn ', i
52         help=0.0
53         do j=jq(i),jq(i+1)-1
54            aij=0.0
55            aji=0.0
56            row=i
57            column=irow(j)
58            aij=au(j)
59               write(10,100) i,irow(j),au(j)
60         enddo
61      enddo
62      write(10,*)'maxdiff_impuls',maxhelp
63!
64      close(10)
65 100  format('column ',i10,1x,'row ', i10,1x,'value ',e15.8)
66 101  format('column ',i10,1x,'row ', i10,1x,'value ',e15.8,
67     &     1x,'diff',e15.8)
68      return
69      end
70
71