{"id":77,"date":"2017-09-11T15:17:26","date_gmt":"2017-09-11T18:17:26","guid":{"rendered":"http:\/\/www.professores.uff.br\/diomarcesarlobao\/?page_id=77"},"modified":"2017-09-11T15:17:26","modified_gmt":"2017-09-11T18:17:26","slug":"array3e-f","status":"publish","type":"page","link":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/array3e-f\/","title":{"rendered":"array3e.f"},"content":{"rendered":"<pre> PROGRAM ARRAY3\r\nc\r\nc    This Program contains a misuse of the ALLOCATE statement\r\nc    Once you have set space for an array, you can't use ALLOCATE to\r\nc    stretch the size as more space is needed.\r\nc\r\nc     John Mahaffy 2\/2\/95\r\nc\r\n      IMPLICIT NONE\r\n      INTEGER I,J,IERR,N,NDAT\r\nc\r\nc    Declare A, B, and C to be arrays to be ALLOCATABLE\r\nc\r\n      REAL, ALLOCATABLE :: A(:),B(:),C(:)\r\n      REAL CSUM,CMAX,CMIN,AVERAGE\r\nc\r\nc\r\n      NDAT=10\r\n      ALLOCATE (A(1:NDAT),B(NDAT),C(NDAT))\r\n      A(1:NDAT) = (\/( I, I=1,NDAT)\/)\r\n      B(1:NDAT) = (\/(I\/3, I=1,NDAT)\/)\r\n      PRINT *, 'ERROR FLAG =', IERR\r\n      C(1:NDAT)=A(1:NDAT)+B(1:NDAT)\r\n      CSUM=SUM(C(1:NDAT))\r\n      CMIN=MINVAL(C(1:NDAT))\r\n      CMAX=MAXVAL(C(1:NDAT))\r\nC\r\n      AVERAGE=CSUM\/NDAT\r\n      WRITE(*,'(\/\/,'' RESULTS FOR ELEMENTS 1 THROUGH '',I3,'' OF C'')')\r\n     &amp; NDAT\r\n      WRITE(6,2002)AVERAGE,CMIN,CMAX\r\n 2002 FORMAT(' AVERAGE OF SELECTED ELEMENTS IN C = ', F8.3,\/,\r\n     &amp;       ' MINIMUM OF SELECTED ELEMENTS IN C = ', F8.3,\/,\r\n     &amp;       ' MAXIMUM OF SELECTED ELEMENTS IN C = ', F8.3)\r\n      WRITE(6,2003) C(1:NDAT)\r\n 2003 FORMAT(' C = ',\/,(1P,8E10.2))\r\nc\r\n      N=NDAT\r\n      NDAT=NDAT+5\r\n      ALLOCATE (A(1:NDAT),B(NDAT),C(NDAT),STAT=IERR)\r\n      PRINT *, 'ERROR FLAG =', IERR\r\n      C(N+1:NDAT)=5.0\r\n      WRITE(6,2003) C(1:NDAT)\r\n      STOP\r\n      END<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PROGRAM ARRAY3 c c This Program contains a misuse of the ALLOCATE statement c Once you have set space for an array, you can&#8217;t use ALLOCATE to c stretch the size as more space is needed. c c John Mahaffy 2\/2\/95 c IMPLICIT NONE INTEGER I,J,IERR,N,NDAT c c Declare A, B, and C to be [&hellip;]<\/p>\n","protected":false},"author":22,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[],"tags":[],"class_list":["post-77","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/77","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/comments?post=77"}],"version-history":[{"count":1,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/77\/revisions"}],"predecessor-version":[{"id":78,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/77\/revisions\/78"}],"wp:attachment":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/media?parent=77"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/categories?post=77"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/tags?post=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}