Fortran Reference Guide - ?· Fortran Reference Guide Version 2018 | iii Chapter 2. Fortran Data Types.....16

Download Fortran Reference Guide - ?· Fortran Reference Guide Version 2018 | iii Chapter 2. Fortran Data Types.....16

Post on 15-Sep-2018

214 views

Category:

Documents

1 download

Embed Size (px)

TRANSCRIPT

<ul><li><p>FORTRAN REFERENCE GUIDE</p><p>Version2018</p></li><li><p>Fortran Reference Guide Version2018|ii</p><p>TABLE OF CONTENTS</p><p>Preface............................................................................................................ xvAudience Description......................................................................................... xvCompatibility and Conformance to Standards............................................................ xvOrganization................................................................................................... xviHardware and Software Constraints...................................................................... xviiConventions................................................................................................... xviiRelated Publications........................................................................................ xviii</p><p>Chapter1.Language Overview............................................................................... 11.1.Elements of a Fortran Program Unit.................................................................. 1</p><p>1.1.1.Fortran Statements................................................................................. 11.1.2.Free and Fixed Source............................................................................. 21.1.3.Statement Ordering................................................................................. 2</p><p>1.2.The Fortran Character Set.............................................................................. 31.3.Free Form Formatting................................................................................... 41.4.Fixed Formatting..........................................................................................5</p><p>1.4.1.Column Formatting..................................................................................51.4.2.Fixed Format Label Field.......................................................................... 51.4.3.Fixed Format Continuation Field................................................................. 51.4.4.Fixed Format Statement Field.................................................................... 61.4.5.Fixed Format Debug Statements..................................................................61.4.6.Tab Formatting.......................................................................................61.4.7.Fixed Input File Format Summary................................................................ 6</p><p>1.5. Include Fortran Source Files............................................................................ 71.6.Components of Fortran Statements................................................................... 7</p><p>1.6.1.Symbolic Names..................................................................................... 81.7.Expressions.................................................................................................8</p><p>1.7.1.Forming Expressions.................................................................................81.7.2.Expression Precedence Rules...................................................................... 91.7.3.Arithmetic Expressions............................................................................. 91.7.4.Relational Expressions.............................................................................111.7.5.Logical Expressions................................................................................ 121.7.6.Character Expressions............................................................................. 121.7.7.Character Concatenation......................................................................... 12</p><p>1.8.Symbolic Name Scope.................................................................................. 131.9.Assignment Statements.................................................................................13</p><p>1.9.1.Arithmetic Assignment............................................................................ 131.9.2.Logical Assignment.................................................................................141.9.3.Character Assignment............................................................................. 14</p><p>1.10.Listing Controls.........................................................................................151.11.OpenMP Directives..................................................................................... 15</p></li><li><p>Fortran Reference Guide Version2018|iii</p><p>Chapter2.Fortran Data Types.............................................................................. 162.1. Intrinsic Data Types..................................................................................... 16</p><p>2.1.1.Kind Parameter..................................................................................... 162.1.2.Number of Bytes Specification.................................................................. 17</p><p>2.2.Constants................................................................................................. 192.2.1. Integer Constants.................................................................................. 192.2.2.Binary, Octal and Hexadecimal Constants..................................................... 202.2.3.Real Constants......................................................................................202.2.4.Double Precision Constants.......................................................................202.2.5.Complex Constants................................................................................ 212.2.6.Double Complex Constants....................................................................... 212.2.7.Logical Constants.................................................................................. 212.2.8.Character Constants............................................................................... 222.2.9.Parameter Constants.............................................................................. 22</p><p>2.3.Structure Constructors................................................................................. 222.4.Derived Types............................................................................................ 242.5.Deferred Type Parameters............................................................................. 25</p><p>2.5.1.Typed Allocation................................................................................... 252.6.Arrays......................................................................................................25</p><p>2.6.1.Array Declaration Element....................................................................... 262.6.2.Deferred Shape Arrays............................................................................ 262.6.3. Subscripts............................................................................................272.6.4.Character Substring................................................................................272.6.5.Array Constructor Syntax......................................................................... 27</p><p>2.7.Fortran Pointers and Targets.......................................................................... 282.8.Fortran Binary, Octal and Hexadecimal Constants.................................................28</p><p>2.8.1.Octal and Hexadecimal Constants - Alternate Forms........................................ 292.9.Hollerith Constants......................................................................................302.10. Structures............................................................................................... 31</p><p>2.10.1.Records............................................................................................. 322.10.2.UNION and MAP Declarations................................................................... 332.10.3.Data Initialization................................................................................ 34</p><p>2.11.Pointer Variables....................................................................................... 352.11.1.Restrictions........................................................................................ 352.11.2.Pointer Assignment............................................................................... 36</p><p>Chapter3.Fortran Statements.............................................................................. 373.1.Statement Format Overview.......................................................................... 37</p><p>3.1.1.Definition of Statement-related Terms.........................................................373.1.2.Origin of Statement............................................................................... 383.1.3.List-related Notation.............................................................................. 38</p><p>3.2.Fortran Statement Summary Table................................................................... 383.3.ACCEPT....................................................................................................433.4.ARRAY......................................................................................................44</p></li><li><p>Fortran Reference Guide Version2018|iv</p><p>3.5. BYTE....................................................................................................... 453.6.DECODE....................................................................................................463.7.DOUBLE COMPLEX....................................................................................... 473.8.DOUBLE PRECISION...................................................................................... 483.9. ENCODE................................................................................................... 493.10.END MAP.................................................................................................503.11.END STRUCTURE........................................................................................503.12.END UNION.............................................................................................. 503.13. INCLUDE................................................................................................. 513.14.MAP.......................................................................................................523.15.POINTER (Cray).........................................................................................533.16.PROTECTED..............................................................................................553.17.RECORD.................................................................................................. 553.18.REDIMENSION............................................................................................563.19.RETURN.................................................................................................. 573.20. STRUCTURE..............................................................................................583.21.UNION.................................................................................................... 593.22.VOLATILE.................................................................................................613.23.WAIT......................................................................................................62</p><p>Chapter4.Fortran Arrays.................................................................................... 644.1.Array Types............................................................................................... 64</p><p>4.1.1.Explicit Shape Arrays..............................................................................654.1.2.Assumed Shape Arrays............................................................................ 654.1.3.Deferred Shape Arrays............................................................................ 654.1.4.Assumed Size Arrays...............................................................................65</p><p>4.2.Array Specification...................................................................................... 654.2.1.Explicit Shape Arrays..............................................................................654.2.2.Assumed Shape Arrays............................................................................ 664.2.3.Deferred Shape Arrays............................................................................ 664.2.4.Assumed Size Arrays...............................................................................66</p><p>4.3.Array Subscripts and Access........................................................................... 664.3.1.Array Sections and Subscript Triplets...........................................................674.3.2.Array Sections and Vector Subscripts...........................................................67</p><p>4.4.Array Constructors...................................................................................... 68Chapter5. Input and Output.................................................................................69</p><p>5.1.File Access Methods.....................................................................................695.1.1.Standard Preconnected Units.................................................................... 70</p><p>5.2.Opening and Closing Files............................................................................. 705.2.1.Direct Access Files.................................................................................705.2.2.Closing a File....................................................................................... 71</p><p>5.3.Data Transfer Statements..............................................................................735.4.Unformatted Data Transfer............................................................................ 735.5.Formatted Data Transfer...............................................................................74</p></li><li><p>Fortran Reference Guide Version2018|v</p><p>5.5.1.Implied DO List Input Output List...............................................................745.5.2.Format Specifications............................................................................. 75</p><p>5.5.2.1.A Format Control Character Data........................................................765.5.2.2.B Format Control Binary Data............................................................ 775.5.2.3.D Format Control Real Double Precision Data with Exponent........................775.5.2.4.d Format Control Decimal specifier..................................................... 775.5.2.5.E Format Control Real Single Precision Data with Exponent.........................785.5.2.6.EN Format Control........................................................................... 785.5.2.7.ES Format Control............................................................................ 785.5.2.8.F Format Control - Real Single Precision Data...........................................785.5.2.9.G Format Control.............................................................................795...</p></li></ul>