You are previewing Modern Fortran.
O'Reilly logo
Modern Fortran

Book Description

Fortran is one of the oldest high-level languages and remains the premier language for writing code for science and engineering applications. This book is for anyone who uses Fortran, from the novice learner to the advanced expert. It describes best practices for programmers, scientists, engineers, computer scientists and researchers who want to apply good style and incorporate rigorous usage in their own Fortran code or to establish guidelines for a team project. The presentation concentrates primarily on the characteristics of Fortran 2003, while also describing methods in Fortran 90/95 and valuable new features in Fortran 2008. The authors draw on more than a half century of experience writing production Fortran code to present clear succinct guidelines on formatting, naming, documenting, programming and packaging conventions and various programming paradigms such as parallel processing (including OpenMP, MPI and coarrays), OOP, generic programming and C language interoperability.

Table of Contents

  1. Cover
  2. Title Page
  3. Copyright Page
  4. Dedication
  5. Contents
  6. Source Code Listings
  7. Preface
    1. Audience
    2. General Considerations
    3. Organization
  8. 1. Introduction
    1. 1.1 Acknowledgments
    2. 1.2 Typographical Conventions
    3. 1.3 Source Code Listings
  9. 2. General Principles
  10. 3. Formatting Conventions
    1. 3.1 Source Form
    2. 3.2 Case
    3. 3.3 Indentation
    4. 3.4 White Space
    5. 3.5 Statements and Expressions
    6. 3.6 Symbols and Numbers
  11. 4. Naming Conventions
    1. 4.1 Modules, Procedures, and Types
    2. 4.2 Supplemental Notation
    3. 4.3 Data Objects
    4. 4.4 Construct Blocks
  12. 5. Documentation Conventions
  13. 6. Programming Principles
    1. 6.1 Standards Conformance
    2. 6.2 Module Design
    3. 6.3 Procedure Arguments
    4. 6.4 Argument Verification
    5. 6.5 Recursive Procedure Design
    6. 6.6 State, Side Effects, and Thread Safety
  14. 7. Programming Conventions
    1. 7.1 Declaration and Initialization of Data Objects
    2. 7.2 Allocatable and Pointer Attributes
    3. 7.3 Dynamic Data Attributes
    4. 7.4 Control Flow
    5. 7.5 Character String Expressions
  15. 8. Input and Output
    1. 8.1 General I/O Operations
    2. 8.2 Formatted, Unformatted, and Stream I/O
    3. 8.3 Messages
  16. 9. Packaging Conventions
    1. 9.1 Files
    2. 9.2 External Procedures
    3. 9.3 Submodules
  17. 10. Generic Programming
    1. 10.1 Generic Code Techniques
    2. 10.2 Preprocessor Replication
  18. 11. Object Orientation
    1. 11.1 Type and Class Design
    2. 11.2 Creation, Construction, Initialization, and Assignment
    3. 11.3 Type-Bound Procedures and Procedure Pointer Components
    4. 11.4 Inheritance
    5. 11.5 Polymorphism
  19. 12. Parallel Processing
    1. 12.1 Preliminary Considerations
    2. 12.2 Parallel Program Patterns
    3. 12.3 Fortran 2008 Parallel Processing
  20. 13. Numerical Types, Kinds, and Operations
    1. 13.1 The Concept of KIND
    2. 13.2 Floating-Point Operations
    3. 13.3 Floating-Point Exceptions
    4. 13.4 Bit Manipulation
  21. 14. C Interoperability
  22. 15. Updating Old Programs
    1. 15.1 Statements
    2. 15.2 Techniques
    3. 15.3 Nonstandard Features
  23. A. Source Code
    1. A.1 Type_bound_demo
    2. A.2 Unlimited_demo
  24. B. Rule List
  25. Bibliography
  26. Index