{"id":67,"date":"2017-09-11T15:07:59","date_gmt":"2017-09-11T18:07:59","guid":{"rendered":"http:\/\/www.professores.uff.br\/diomarcesarlobao\/?page_id=67"},"modified":"2017-09-11T15:07:59","modified_gmt":"2017-09-11T18:07:59","slug":"array3-f","status":"publish","type":"page","link":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/array3-f\/","title":{"rendered":"array3.f"},"content":{"rendered":"<pre> PROGRAM ARRAY3\r\nc\r\nc    What if I don't know how much array space I will need when I first\r\nc    write my Fortran Program\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   Decide on space needed for the arrays\r\nc\r\n      NDAT=10\r\nc\r\nc   Tell the computer to grab space for your arrays.  You should have the\r\nc   \"STAT=\" portion of this statement to provide an error indicator. If\r\nc   you skip the optional STAT argument the code will terminate immediately\r\nc   on any allocation problem.\r\nc\r\n      ALLOCATE (A(1:NDAT),B(NDAT),C(NDAT),STAT=IERR)\r\n      PRINT *, 'ERROR FLAG =', IERR\r\nc\r\nc   Set values of A and B\r\nc\r\n      A(1:NDAT) = (\/( I, I=1,NDAT)\/)\r\n      B(1:NDAT) = (\/(I\/3, I=1,NDAT)\/)\r\nc\r\nc   Process as before\r\nc\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\nc\r\nc  Note modification of this write from array1.f and array2.f\r\nc\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      STOP\r\n      END<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PROGRAM ARRAY3 c c What if I don&#8217;t know how much array space I will need when I first c write my Fortran Program 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 arrays to be ALLOCATABLE c REAL, ALLOCATABLE :: A(:),B(:),C(:) REAL CSUM,CMAX,CMIN,AVERAGE c [&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-67","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/67","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=67"}],"version-history":[{"count":1,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/67\/revisions"}],"predecessor-version":[{"id":68,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/pages\/67\/revisions\/68"}],"wp:attachment":[{"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/media?parent=67"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/categories?post=67"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.professores.uff.br\/diomarcesarlobao\/wp-json\/wp\/v2\/tags?post=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}