Literature: Metcalf, Reid, Cohen: Modern Fortran Explained. (Oxford University Press, ); Haataja, Rahola, Ruokolainen: Fortran 95/ Fortran 95/ Explained - Metclaf. Reid. Cohen - Download as PDF File .pdf), Text File .txt) or read online. FORTRAN. provide not only a readable explanation of features, but also some rationale assimilate quickly those features in Fortran that are not in Fortran 95 ( Fortran.
|Language:||English, Spanish, Arabic|
|Genre:||Children & Youth|
|ePub File Size:||16.60 MB|
|PDF File Size:||14.60 MB|
|Distribution:||Free* [*Regsitration Required]|
Fortran 95/ Explained. Michael Metcalf. Formerly of CERN; Geneva, Switzerland. John Reid. JKR Associates, Oxfordshire and. Malcolm Cohen. Request PDF on ResearchGate | On Jan 1, , M. Metcalf and others published Fortran 95/ Explained. You must attribute the work to “Introduction to Programming using Fortran. 95/ /” (but not in any way that suggests that the author endorses you or your.
Reid and M. Greenough Note that we have changed the dummy parameters from type Circle to class Circle. By Hannes Uecker. For example, the algorithm to solve a system of ordinary differential equations ODE is pretty much fixed a loop over time, updating the solution and offering the possibility for outputting the 3 Note that the list of observers in the previous example is a polymorphic variable as well. Roberts
The Template Method pattern Because Fortran supports polymorphic variables — variables whose type is dynamic, rather than static — we can implement the Template Method pattern in an elegant way. Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. For example, the algorithm to solve a system of ordinary differential equations ODE is pretty much fixed a loop over time, updating the solution and offering the possibility for outputting the 3 Note that the list of observers in the previous example is a polymorphic variable as well.
In the code example below, we use different methods, like Euler, Heun, to name classical methods, in a general set up: Subroutine for storing the initial values! Function to compute the derivative! Derivative is array of! Interface function to hide the internal workings!
Function to actually compute the new values! Declaration of the functions! Definition of the specific methods for! General code! Specific methods!
We use module variables here, out of laziness! Better would be to use a derived type with all necessary! By selecting a different constant in the construction of the solver, we select whatever method we think is suitable — nothing else in the program is influenced. One thing should be noted: Just as with the first example an alternative for reverse communication we avoid module variables that way.
But I will leave that as an exercise. If we take the object-oriented facilities of Fortran , we can in fact expand this example in a completely different way: This could be relevant for investigating which formulations describe the underlying physics better: The interfaces end interface contains The specific classes we want for this computation!
Actual implementation: This puts them all together! We only need to select the implementation at the beginning.
Conclusion These examples show that Fortran offers features that help implement a large class of well- known design patterns. Sometimes the need to specify an interface in detail may make the code lengthier than seems necessary, but they make it possible for the compiler to check correct usage.
Gardner and Decyk indicate that object oriented techniques and object-oriented design patterns in particular are such a new subject in the context of Fortran that different interpretations by different authors are almost inevitable.
I agree: As they are the obvious means to achieve the isolation one requires in object-oriented programming, we must find ways to translate the concepts of object-oriented programming as found in the literature to Fortran. This will not always be easy or perhaps even possible without sacrificing some aspect.
But let us keep in mind that the various programming languages that are now claimed to be object-oriented use these concepts in different ways too. I would like to thank Henry Gardner for reviewing the text and for supplying useful comments as well as several references to papers on this same subject. References V.
Decyk and H. Dongarra, V. Eijkhout and A.
Gamma, R. Helm, R. Johnson, J. Vlissides Design Patterns: Gardner and V. Decyk Comments on the Arjen Markus article: Metcalf, J.
Reid and M. Norton, V.
Szymanski and H. Gardner The transition and adoption to modern programming concepts for scientific computing in Fortran Scientific Programming, april A. Shalloway and J. Related Papers. See Metcalf, Reid, and Cohen , p. Akin, E. Cambridge University Press. Bader, Reinhold Object-Oriented Features in Fortran Chin, L. Worth and C. Greenough Clerman, Norman S. Modern Fortran: Style and Usage. Cohen, M. Object orientation and Fortran Decyk, V.
Norton, and B. Object Oriented Fortran 90 Programming. Gray, M. Roberts Computers in Physics, 11, — Holcomb, K. Lemmon, D.