CAD in Civil Engineering - Baustatik-Info-Server
CAD in Civil Engineering - Baustatik-Info-Server
CAD in Civil Engineering - Baustatik-Info-Server
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Page 44 Computer Languages for Eng<strong>in</strong>eer<strong>in</strong>g - SS 1319 character(256)::logname ! name of the output file and <strong>in</strong>put file2021 logname = "arrays.log" ! <strong>in</strong>itialize the filename22 ! note: the file is written <strong>in</strong>to the23 ! projects folder2425 ! open the log file as a new blank file26 open(ionr,file=logname,status=’replace’,iostat=ioerr)27 ! .ne.28 if (ioerr /= 0) then29 write (*,*) ’*** Error: log file not opened!’30 stop31 endif3233 ! allocate the array b, an allocation error ist handled34 nDim = 335 allocate(b(nDim,nDim),stat=memstat)36 if (memstat /= 0) then37 write (*,*) ’*** Error: array b is not allocatable.’38 end if3940 ! allocation check: if b is not allocated, we stop41 if (.not. allocated(b)) then42 write (*,*) ’*** Error: array b not allocated’43 stop44 end if4546 ! <strong>in</strong>itialize array a and b with a special number pattern47 ! - over the rows (1st <strong>in</strong>dex)48 do i=1,34950 ! - over the columns51 do j=1,352 a(i,j) = i*10 +j53 b(i,j) = i*10 +j +100 ! +100, because we want to54 end do ! know, thats the b5556 end do5758 ! pr<strong>in</strong>t array data of a and b to the sceen59 write(*,’(3(f10.3,1x))’) ((a(i,j),j=1,3),i=1,3)60 write(*,’(3(f10.3,1x))’) ((b(i,j),j=1,3),i=1,3)6162 ! and write the array data of a and b <strong>in</strong>to the log file63 ! for later read<strong>in</strong>gs64 ioerr = iwritemat(ionr,a,3,3)65 ioerr = iwritemat(ionr,b,3,3)6667 ! if not longer needed, free the memory of array b68 deallocate(b,stat=memstat)69 ! close log file70 close(ionr)7172 ! open the log file to read the data of the first matrix73 open(ionr,file=logname,status=’old’,iostat=ioerr)74 if (ioerr /= 0) thenE. Baeck