2nd Edition
Classical Fortran Programming for Engineering and Scientific Applications, Second Edition
Classical FORTRAN: Programming for Engineering and Scientific Applications, Second Edition teaches how to write programs in the Classical dialect of FORTRAN, the original and still most widely recognized language for numerical computing. This edition retains the conversational style of the original, along with its simple, carefully chosen subset language and its focus on floating-point calculations.
New to the Second Edition
- Additional case study on file I/O
- More about CPU timing on Pentium processors
- More about the g77 compiler and Linux
With numerous updates and revisions throughout, this second edition continues to use case studies and examples to introduce the language elements and design skills needed to write graceful, correct, and efficient programs for real engineering and scientific applications. After reading this book, students will know what statements to use and where as well as why to avoid the others, helping them become expert FORTRAN programmers.
Introduction
Why Study Programming?
The Evolution of FORTRAN
Why Study FORTRAN?
Classical FORTRAN
About This Book
Advice to Instructors
About the Author
Acknowledgments
Disclaimers
Hello, World!
Case Study: A First FORTRAN Program
Compiling the Program
Running a Program in UNIX
Omissions
Expressions and Assignment Statements
Constants
Variables and Variable Names
Arithmetic Operators
Function References
Expressions
Assignment Statements
READ and PRINT
Omissions
Conditionals and Branching
Flowcharting
The GO TO Statement
The IF-THEN Construct
The Logical IF Statement
Flowcharting Reconsidered
Additional Examples
Omissions
Scalar Data Types
Integers
Reals
Roundoff Errors
Type Conversions
Case Study: Computing the Sine
Other Data Types
Some Special Values
Architectural Variations
Omissions
Arrays and DO Loops
Vectors
The DO Loop
Matrices
The Rules of DO Loops
Array Dimensioning
Case Study: Matrix Multiplication
Omissions
Subprograms
SUBROUTINE Subprograms
Call by Reference
FUNCTION Subprograms
Case Study: Bisection
Detecting First Entry
FORTRAN, System, and Library Routines
Conclusion and Omissions
Adjustable Dimensions and EXTERNAL
Adjustable Dimensions
EXTERNAL
Summary and Omissions
COMMON
Passing Data Through
Passing Data Around
Alignment
Formal Parameters and COMMON
Arrays in COMMON
BLOCK DATA
Omissions
Input and Output
READ and WRITE
Case Study: Descriptive Statistics
Implied DO Loops
Unit Assignments
Descriptive Statistics Revisited
Positioning in Files
Case Study: Merging Files
Unformatted I/O
Cautions and Omissions
Character Variables
How Characters Are Stored
Writing Out and Reading In Character Variables
Editing Character Strings
Object-Time FORMATs
Case Study: QUERY
CHARACTER Variables in Other Contexts
Character Graphics
Omissions
Memory Management Techniques
Passing Array Columns
Partitioning Workspace
Sharing Workspace
Sharing Constant Data
Storing a Symmetric Matrix
Sparse Matrix Techniques
Linked Lists
Omissions and Caveats
Design, Documentation, and Coding Style
The Craft of Programming
Design
Documentation
Coding Style
Hand-Checking
Testing, Revision, and Maintenance
Conclusion and Omissions
Archaic, Unusual, and Dangerous Usages
Source Form
Expressions and Assignment Statements
Conditionals and Transfer of Control
Scalar Data Types
Arrays and DO Loops
Subprograms
Adjustable Dimensions and EXTERNAL
COMMON
Input and Output
Character Variables
Case Study: A Legacy Code
Conclusion and Omissions
UNIX Issues
Using the Compiler
Operating System Services
Debugging and dbx
Automatic Compilation with make
Libraries
Writing Custom Manual Pages
Omissions
Measuring and Maximizing Serial Execution Speed
Measuring Serial Execution Speed
Tuning FORTRAN Source Code
Omissions
Vector and Parallel Processing
Vector Processing
Parallel Processing
Omissions
Modern Fortran and HPF
Fortran-90
High Performance Fortran
The Future of FORTRAN
Some Utility Routines
Number-Numeral Conversions
String Insertions
Attaching a File
Arithmetic with Two-Part Values
Measuring CPU Time
A Shell Script for Global Edits
Caveats and Omissions
Bibliography
Index
Exercises appear at the end of each chapter.
"I enjoyed this book a great deal, and I recommended it highly. Articulate and unambiguous, Kupferschmid can be strongly opinionated. Whether in agreement or with occasional skepticism, I found his ideas worthy of thoughtful consideration. I suggest that scientists and engineers regard them in that light as well."
—ThinkLoud, November 2017