27 integer,
save :: numcall = 0
40 call hecmw_mat_dump_mm(hecmat)
42 call hecmw_mat_dump_csr(hecmat)
44 call hecmw_mat_dump_bsr(hecmat)
49 stop
"Exiting program after dumping matrix"
53 subroutine make_file_name(ext, fname)
57 write(fname,
"('dump_matrix_',I0,'_',I0,A)") &
59 end subroutine make_file_name
61 subroutine hecmw_mat_dump_mm( hecMAT )
64 integer,
parameter :: idump = 201
65 character(len=64) :: fname
66 integer :: i, j, i0, j0, idof, jdof, ii, jj
67 integer :: idxl0, idxl, idxd, idxu0, idxu
68 integer :: n, np, ndof, ndof2, nnz
69 character(len=64),
parameter :: lineformat =
"(I0,' ',I0,' ',e20.12e3)"
77 call make_file_name(
'.mm', fname)
79 open(idump, file=fname, status=
'replace', iostat=stat)
81 write(*,*)
'WARNING: cannot open file ', fname,
' for matrix dump'
85 write(idump,
"(A)")
'%%MatrixMarket matrix coordinate real general'
86 nnz = ndof2 * (n + hecmat%indexL(n) + hecmat%indexU(n))
87 write(idump,
"(I0,' ',I0,' ',I0)") n*ndof, np*ndof, nnz
94 do j = hecmat%indexL(i-1)+1,hecmat%indexL(i)
95 j0 = (hecmat%itemL(j)-1)*ndof
96 idxl0 = (j-1)*ndof2 + (idof-1)*ndof
100 write(idump,lineformat) ii, jj, hecmat%AL(idxl)
108 write(idump,lineformat) ii, jj, hecmat%D(idxd)
111 do j = hecmat%indexU(i-1)+1,hecmat%indexU(i)
112 j0 = (hecmat%itemU(j)-1)*ndof
113 idxu0 = (j-1)*ndof2 + (idof-1)*ndof
117 write(idump,lineformat) ii, jj, hecmat%AU(idxu)
124 end subroutine hecmw_mat_dump_mm
126 subroutine hecmw_mat_dump_csr( hecMAT )
129 integer,
parameter :: idump = 201
130 character(len=64) :: fname
131 integer :: i, j, i0, j0, idof, jdof, ii, jj
132 integer :: idx, idxd, idxl, idxu, idxl0, idxu0
133 integer :: n, np, ndof, ndof2, nnz, nnz1
134 character(len=64),
parameter :: lineformat =
"(e20.12e3)"
142 call make_file_name(
'.csr', fname)
144 open(idump, file=fname, status=
'replace', iostat=stat)
146 write(*,*)
'WARNING: cannot open file ', fname,
' for matrix dump'
150 write(idump,
"(A)")
'%%CSR matrix real general'
151 nnz = ndof2 * (n + hecmat%indexL(n) + hecmat%indexU(n))
152 write(idump,
"(A)")
'% nrow ncol nnonzero'
153 write(idump,
"(I0,' ',I0,' ',I0)") n*ndof, np*ndof, nnz
155 write(idump,
"(A)")
'% index(0:nrow)'
157 write(idump,
"(I0)") idx
159 nnz1 = ndof * ((hecmat%indexL(i)-hecmat%indexL(i-1)) + &
160 1 + (hecmat%indexU(i)-hecmat%indexU(i-1)))
163 write(idump,
"(I0)") idx
167 write(idump,
"(A)")
'% item(1:nnonzero)'
172 do j = hecmat%indexL(i-1)+1,hecmat%indexL(i)
173 j0 = (hecmat%itemL(j)-1)*ndof
176 write(idump,
"(I0)") jj
183 write(idump,
"(I0)") jj
186 do j = hecmat%indexU(i-1)+1,hecmat%indexU(i)
187 j0 = (hecmat%itemU(j)-1)*ndof
190 write(idump,
"(I0)") jj
196 write(idump,
"(A)")
'% value(1:nnonzero)'
203 do j = hecmat%indexL(i-1)+1,hecmat%indexL(i)
204 j0 = (hecmat%itemL(j)-1)*ndof
205 idxl0 = (j-1)*ndof2 + (idof-1)*ndof
209 write(idump,lineformat) hecmat%AL(idxl)
217 write(idump,lineformat) hecmat%D(idxd)
220 do j = hecmat%indexU(i-1)+1,hecmat%indexU(i)
221 j0 = (hecmat%itemU(j)-1)*ndof
222 idxu0 = (j-1)*ndof2 + (idof-1)*ndof
226 write(idump,lineformat) hecmat%AU(idxu)
233 end subroutine hecmw_mat_dump_csr
235 subroutine hecmw_mat_dump_bsr( hecMAT )
238 integer,
parameter :: idump = 201
239 character(len=64) :: fname
241 integer :: idx, idxl0, idxd0, idxu0
242 integer :: n, np, ndof, ndof2, nnz, nnz1
243 character(len=64),
parameter :: lineformat =
"(e20.12e3)"
251 call make_file_name(
'.bsr', fname)
253 open(idump, file=fname, status=
'replace', iostat=stat)
255 write(*,*)
'WARNING: cannot open file ', fname,
' for matrix dump'
259 write(idump,
"(A)")
'%%Block-CSR matrix real general'
260 nnz = n + hecmat%indexL(n) + hecmat%indexU(n)
261 write(idump,
"(A)")
'% nrow ncol nnonzero ndof'
262 write(idump,
"(I0,' ',I0,' ',I0,' ',I0)") n, np, nnz, ndof
264 write(idump,
"(A)")
'% index(0:nrow)'
266 write(idump,
"(I0)") idx
268 nnz1 = (hecmat%indexL(i)-hecmat%indexL(i-1)) + &
269 1 + (hecmat%indexU(i)-hecmat%indexU(i-1))
271 write(idump,
"(I0)") idx
274 write(idump,
"(A)")
'% item(1:nnonzero)'
277 do j = hecmat%indexL(i-1)+1,hecmat%indexL(i)
278 write(idump,
"(I0)") hecmat%itemL(j)
281 write(idump,
"(I0)") i
283 do j = hecmat%indexU(i-1)+1,hecmat%indexU(i)
284 write(idump,
"(I0)") hecmat%itemU(j)
288 write(idump,
"(A)")
'% value(1:nnonzero*ndof*ndof)'
292 do j = hecmat%indexL(i-1)+1,hecmat%indexL(i)
294 write(idump,lineformat) hecmat%AL(idxl0+1:idxl0+ndof2)
297 write(idump,lineformat) hecmat%D(idxd0+1:idxd0+ndof2)
298 idxd0 = idxd0 + ndof2
300 do j = hecmat%indexU(i-1)+1,hecmat%indexU(i)
302 write(idump,lineformat) hecmat%AU(idxu0+1:idxu0+ndof2)
307 end subroutine hecmw_mat_dump_bsr
312 integer,
parameter :: idump = 201
313 character(len=64) :: fname
315 integer :: n, np, ndof, ndof2
316 character(len=64),
parameter :: lineformat =
"(e20.12e3)"
325 call make_file_name(
'.rhs', fname)
327 open(idump, file=fname, status=
'replace', iostat=stat)
329 write(*,*)
'WARNING: cannot open file ', fname,
' for matrix dump'
333 write(idump,lineformat) hecmat%B(i)
342 integer,
parameter :: idump = 201
343 character(len=64) :: fname
345 integer :: n, np, ndof, ndof2
346 character(len=64),
parameter :: lineformat =
"(e20.12e3)"
355 call make_file_name(
'.sol', fname)
357 open(idump, file=fname, status=
'replace', iostat=stat)
359 write(*,*)
'WARNING: cannot open file ', fname,
' for matrix dump'
363 write(idump,lineformat) hecmat%X(i)