Modern Fortran in Practice

Author: Arjen Markus  

Publisher: Cambridge University Press‎

Publication year: 2012

E-ISBN: 9781139512428

P-ISBN(Paperback): 9781107603479

Subject: TP311 程序设计、软件工程

Keyword: 程序设计、软件工程

Language: ENG

Access to resources Favorite

Disclaimer: Any content in publications that violate the sovereignty, the constitution or regulations of the PRC is not accepted or approved by CNPIEC.

Modern Fortran in Practice

Description

From its earliest days, the Fortran programming language has been designed with computing efficiency in mind. The latest standard, Fortran 2008, incorporates a host of modern features, including object-orientation, array operations, user-defined types, and provisions for parallel computing. This tutorial guide shows Fortran programmers how to apply these features in twenty-first-century style: modular, concise, object-oriented, and resource-efficient, using multiple processors. It offers practical real-world examples of interfacing to C, memory management, graphics and GUIs, and parallel computing using MPI, OpenMP, and coarrays. The author also analyzes several numerical algorithms and their implementations and illustrates the use of several open source libraries. Full source code for the examples is available on the book's website.

Chapter

1.6 What Has Not Changed?

2: Array-Valued Functions

2.1 Passing Arrays

2.2 Elemental Functions and Automatic Reallocation

2.3 Two More Advanced Examples

Spacing of Irrational Numbers

QuickSort

2.4 Concise Style

3: Mathematical Abstractions

3.1 Automatic Differentiation

3.2 Integer Programming

3.3 Enumerating Solutions of Diophantine Equations

3.4 Delayed Evaluation

4: Memory Management

4.1 Flexible Arrays

4.2 Memory Leaks with Pointers

4.3 Extending an Array

4.4 Character Strings with Adjustable Length

4.5 Combining Automatic and Allocatable Arrays

4.6 Performance of Various Types of Arrays

4.7 Parametrized Derived Types

4.8 Avoiding Memory Leaks with Derived Types

4.9 Performance and Memory Access

5: An Interface Problem

5.1 Filling in the Parameters

5.2 Using a Pool of Data

5.3 Passing Extra Arguments

5.4 Control Structures

5.5 Dealing with Different Precisions

5.6 Overview

6: Interfacing to C: SQLite As an Example

6.1 Matching Data Types

6.2 Passing Arguments Between C and Fortran Routines

6.3 Naming and Calling Conventions

6.4 Dealing with Derived Types

6.5 Interfacing to SQLite

7: Graphics, GUIs, and the Internet

7.1 Plotting the Results

7.2 Graphical User-Interfaces

7.3 The Internet

7.4 Dealing with XML Files

8: Unit Testing

8.1 Testing Frameworks

8.2 Tridiagonal Matrices As an Example

8.3 Design and Implementation

8.4 Concluding Remarks

9: Code Reviews

9.1 Be Explicit

9.2 Don't Stray

9.3 Avoid Traps

Adequate Error Handling

Comparing Reals

9.4 Clean Code

10: Robust Implementation of Several Simple Algorithms

10.1 Related Approaches

10.2 Linear Interpolation

10.3 Basic Statistics

10.4 Finding the Roots of an Equation

11: Object-Oriented Programming

11.1 Extending Types and Type-Bound Procedures

11.2 Interfaces As Contracts

11.3 Using a Prototype Approach

11.4 Abstract Data Types and Generic Programming

11.5 Changing the Behavior of a Type

11.6 Design Patterns

The Factory Pattern

The Observer Pattern

12: Parallel Programming

12.1 Prime Numbers

OpenMP

MPI

Coarrays

12.2 Domain Decomposition

OpenMP

MPI

Coarrays

12.3 Alternatives

12.4 Overview

Appendix A: Tools for Development and Maintenance

A.1 The Compiler

A.2 Build Tools

A.3 Integrated Development Environments

A.4 Run-Time Checking

A.5 Version Control Systems

A.6 Documenting the Source Code

A.7 Code Coverage and Static Analysis

Appendix B: Caveats

B.1 Details of the Standard

B.2 Arrays

B.3 Dynamic Libraries

Appendix C: Trademarks

Bibliography

Index

The users who browse this book also browse