12.07.2015 Views

CAD in Civil Engineering - Baustatik-Info-Server

CAD in Civil Engineering - Baustatik-Info-Server

CAD in Civil Engineering - Baustatik-Info-Server

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Page 46 Computer Languages for Eng<strong>in</strong>eer<strong>in</strong>g - SS 13131132 write(io,*,iostat=ioerr) n1,n2 ! write the dimensions133 if (ioerr /= 0) then134 write(*,*) ’*** Error: writ<strong>in</strong>g not possible’135 iwritemat = -1 ! exit, if io error136 return137 endif138139 ! over the rows140 do i=1,n1141 write(io,*) (m(i,j),j=1,n2)142 enddo143144 iwritemat = 0 ! 0 return: everyth<strong>in</strong>g ok145 end function iwritemat146147 ! Read the dimension of a matrix from a file148 <strong>in</strong>teger function ireadmatdim(io,n1,n2)149150 <strong>in</strong>teger::io ! io channel151 <strong>in</strong>teger::n1,n2 ! dimensions of the matrix152 <strong>in</strong>teger::ioerr ! error flag153154 read(io,*,iostat=ioerr) n1,n2155 if (ioerr /= 0) then ! if io-error, perhaps a wrong format156 write(*,*) ’*** Error: wrong file format’157 ireadmatdim = -1158 return159 endif160161 ireadmatdim = 0162 end function ireadmatdim163164 ! read matrix data from a file165 !166 <strong>in</strong>teger function ireadmat(io,m,n1,n2)167 implicit none168169 <strong>in</strong>teger::io ! io channel number170 <strong>in</strong>teger::n1 ! number of rows171 <strong>in</strong>teger::n2 ! number of columns172 real(8), dimension(n1,n2):: m ! matrix data173 <strong>in</strong>teger::ioerr, i, j174175 ! over the rows176 do i=1,n1177 read(io,*,iostat=ioerr) (m(i,j),j=1,n2)178 if (ioerr /= 0) then ! important to check the read-io179 write(*,*)’*** Error: format’180 ireadmat = -1181 return182 endif183 enddo184185 ireadmat = 0186 end function ireadmatE. Baeck

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!