Modern Fortran in Practice
From its earliest days, the Fortran programming language has been designed
puting efﬁciency in mind. The latest standard, Fortran 2008, incor-
porates a host of modern features, including object-orientation, array opera-
tions, user-deﬁned types, and provisions for puting.
This tutorial guide shows Fortran programmers how to apply these features
in twenty-ﬁrst-century style: modular, concise, object-oriented, and resource-
efﬁcient, using multiple processors. It offers practical real-world examples of
interfacing to C, memory management, graphics and GUIs, and -
puting 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.
Arjen Markus is a senior consultant at Deltares, an institute for applied research
in the ﬁeld of water, subsurface and infrastructure in herlands, where
he develops and maintains their numerical modeling programs and the tools
that pany them. He is an active contributor to the ACM newsletter
Fortran Forum and p.lang.fortran newsgroup.
with Foreword by Michael Metcalf
cambridge university press
Cambridge, New York, Melbourne, Madrid, Cape Town,
Singapore, Sao˜ Paulo, Delhi, Mexico City
Cambridge University Press
32 Avenue of the Americas, New York, NY 10013-2473, USA
Information on this title: 1107603479
c Arjen Markus 2012
This publication is in copyright. Subject to statutory exception
and to the provisions of relevant collective licensing agreements,
no reproduction of any part may take place without the written
permission of Cambridge University Press.
First published 2012
Printed in the United States of America
A catalog record for this publication is available from the British Library.
Library of Congress Cataloging in Publication Data
Modern Fortran in practice / Arjen Markus, Michael Metcalf.
Includes bibliographical references and index.
ISBN 978-1-107-01790-0 (hardback) – ISBN 978-1-107-60347-9 (pbk.)
1. Fortran 2008 (Computer program language) I. Metcalf, Michael. II. Title.
ISBN 978-1-107-01790-0 Hardback
ISBN 978-1-107-60347-9 Paperback
Additional resources for this publication at http://ﬂibs./examples-modern-fortran.html
Cambridge University Press has no responsibility for the persistence or accuracy of URLs for
external or third-party websites referred to in this publication and does not guarantee
that any content on such websites is, or will remain, accurate or appropriate.
"Eadem mutata resurgo"
(Loosely: though changed, I reappear as myself)
Inscription on the grave of Jacob Bernoulli,
referring to the logarithmic spiral.
In memory of my father
My parents taugh