|
DOUG 0.2
|
00001 ! DOUG - Domain decomposition On Unstructured Grids 00002 ! Copyright (C) 1998-2006 Faculty of Computer Science, University of Tartu and 00003 ! Department of Mathematics, University of Bath 00004 ! 00005 ! This library is free software; you can redistribute it and/or 00006 ! modify it under the terms of the GNU Lesser General Public 00007 ! License as published by the Free Software Foundation; either 00008 ! version 2.1 of the License, or (at your option) any later version. 00009 ! 00010 ! This library is distributed in the hope that it will be useful, 00011 ! but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 ! Lesser General Public License for more details. 00014 ! 00015 ! You should have received a copy of the GNU Lesser General Public 00016 ! License along with this library; if not, write to the Free Software 00017 ! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 ! or contact the authors (University of Tartu, Faculty of Computer Science, Chair 00019 ! of Distributed Systems, Liivi 2, 50409 Tartu, Estonia, http://dougdevel.org, 00020 ! mailto:info(at)dougdevel.org) 00021 00023 program MatrixGen 00024 00025 use SpMtx_class 00026 00027 implicit none 00028 00029 #include<doug_config.h> 00030 00031 integer,parameter :: N=128*7 00032 character(*),parameter :: filename="matrix.out.xdr" 00033 type(SpMtx) :: A 00034 integer :: fHandler !< file Handler 00035 00036 A = LaplSpMtx_New(N) 00037 print*, A%nnz 00038 00039 #ifdef HAVE_LIBFXDR 00040 call WriteOutSparseAssembledHeader_XDR(filename, fHandler, A%nrows, A%nnz) 00041 call WriteOutSparseAssembledBulk_XDR(fHandler, A) 00042 #else 00043 print*, "ERROR: XDR was not compiled in" 00044 stop 1 00045 #endif 00046 00047 contains 00048 00049 00050 #ifdef HAVE_LIBFXDR 00051 !---------------------------------------------------------- 00054 subroutine WriteOutSparseAssembledHeader_XDR(filename, fHandler, n, nnz) 00055 implicit none 00056 include 'fxdr.inc' 00057 00058 character*(*),intent(in) :: filename 00059 integer ,intent(out) :: fHandler 00060 integer ,intent(out) :: n 00061 integer ,intent(out) :: nnz 00062 00063 integer :: ierr 00064 00065 fHandler = initxdr( trim(filename), 'w', .FALSE. ) 00066 ierr = ixdrint( fHandler, n ) 00067 ierr = ixdrint( fHandler, nnz ) 00068 00069 end subroutine WriteOutSparseAssembledHeader_XDR 00070 00071 !---------------------------------------------------------- 00074 subroutine WriteOutSparseAssembledBulk_XDR (fHandler, A) 00075 implicit none 00076 include 'fxdr.inc' 00077 00078 integer ,intent(in) :: fHandler 00079 type(SpMtx), intent(inout) :: A 00080 integer :: ierr, i 00081 00082 do i=1,A%nnz 00083 ierr = ixdrint( fHandler, A%indi(i) ) 00084 ierr = ixdrint( fHandler, A%indj(i) ) 00085 ierr = ixdrdouble( fHandler, A%val(i) ) 00086 enddo 00087 00088 end subroutine WriteOutSparseAssembledBulk_XDR 00089 00090 #endif 00091 00092 end program MatrixGen
1.7.3-20110217