Langage Fortran (Base) Anne Fouilloux Patrick Corde a.c.fouilloux@geo.uio.no Pa
Langage Fortran (Base) Anne Fouilloux Patrick Corde a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr 5 février 2020 Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 1 / 268 Table des matières I 1 Introduction Historique bibliographie documentation 2 Généralités Bases de numération Représentation des données Représentation des entiers Représentation des réels Représentation des complexes Représentation des logiques Représentation des caractères Jeu de caractères Notion d’unité de programme Éléments syntaxiques Format libre Commentaires 3 Déclarations Identificateurs Différents types Syntaxe Le type CHARACTER Instruction IMPLICIT NONE Constantes littérales Constantes entières Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 2 / 268 Table des matières II Constantes réelles simple précision Constantes réelles double précision Constantes complexes Constantes chaînes de caractères Initialisation L’instruction DATA Le symbole ” = ” Constantes symboliques Instruction EQUIVALENCE 4 Opérateurs et expressions Opérateurs arithmétiques Opérateurs relationnels Opérateurs logiques Opérateur de concaténation Opérateur d’affectation Priorité des Opérateurs 5 Structures de contrôle Les tests Le bloc IF Le bloc SELECT-CASE Les itérations L’instruction GOTO Les bloucles DO 6 Tableaux Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 3 / 268 Table des matières III Déclaration Définitions (rang, profil, étendue) Initialisation Le symbole "=" Le constructeur de vecteurs L’instruction DATA Manipulation de tableaux Expressions de type tableau Sections de tableaux 7 Entrées-Sorties Introduction Accès séquentiel Fichier binaire séquentiel Fichier texte séquentiel Format d’édition I en lecture Formats d’édition F, E et D en lecture Format d’édition L en lecture Format d’édition A en lecture Format d’édition I en écriture Format d’édition F en écriture Formats d’édition E et D en écriture Format d’édition L en écriture Format d’édition A en écriture Format d’édition Litteral string Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 4 / 268 Table des matières IV Descripteurs de contrôle Facteur de répétition Réexploration d’un format Format libre Namelist Accès direct Fichier binaire à accès direct Fichier texte à accès direct Fichier temporaire Destruction d’un fichier Fichier interne Instructions de positionnement Instruction INQUIRE Formats BOZ Unités standards Instruction FORMAT Mots-clés END=, ERR= 8 Procédures Arguments Subroutines Fonctions Arguments de type chaîne de caractères Arguments de type tableau Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 5 / 268 Table des matières V Arguments de type procédure Procédures internes Durée de vie et visibilité des identificateurs Procédures intrinsèques 9 Common L’instruction COMMON Common blanc Common étiqueté Initialisation : BLOCK DATA Instruction SAVE et COMMON Règles et restrictions 10 Include La directive INCLUDE Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 6 / 268 Introduction 1 Introduction Historique bibliographie documentation 2 Généralités 3 Déclarations 4 Opérateurs et expressions 5 Structures de contrôle 6 Tableaux 7 Entrées-Sorties 8 Procédures 9 Common Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 7 / 268 Introduction 10 Include Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 8 / 268 Introduction Historique • Code machine (notation numérique en octal) ; • Assembleurs de codes mnémoniques ; • 1954 : projet création du premier langage symbolique FORTRAN par John Backus d’IBM (Mathematical FORmula TRANslating System) : • Efficacité du code généré (performance) ; • Langage quasi naturel pour scientifiques (productivité, maintenance, lisibilité). • 1957 : Livraison des premiers compilateurs ; • 1958 : Fortran II (IBM) ⇒sous-programmes compilables de façon indépendante. • Généralisation aux autres constructeurs mais : • divergences des extensions ⇒nécessité de normalisation ; • ASA American Standards Association (ANSI American Nat. Standards Institute). Comité chargé du développement d’une norme Fortran. • 1966 : Fortran IV (Fortran 66) ; • Évolution par extensions divergentes. . . • 1977 : Fortran V (Fortran 77). quasi compatible : aucune itération des boucles nulles (DO I=1,0) • Nouveautés principales : • type caractère ; • IF-THEN-ELSE ; • E/S accès direct et OPEN. Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 9 / 268 Introduction Historique • Travail des comités X3J3/ANSI et WG5/ISO pour moderniser Fortran 77 : • Standardisation : inclusion d’extensions ; • Développement : nouveaux concepts déjà exploités par langages plus récents APL, Algol, PASCAL, Ada ; . . . • Performances en calcul scientifique ; • Totalement compatible avec Fortran 77. • 1991/1992 : norme Fortran 90 (ISO et ANSI) ; • 1994 : premiers compilateurs Fortran 90 Cray et IBM ; • 1997 : norme Fortran 95 (ISO et ANSI) ; • 1999 : premiers compilateurs Fortran 95 sur Cray T3E puis IBM RS/6000 ; • septembre 2004 : norme Fortran 2003 (ISO et ANSI) ; • octobre 2010 : norme Fortran 2008 (ISO et ANSI). • novembre 2018 : norme Fortran 2018 (ISO et ANSI). Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 10 / 268 Introduction bibliographie • Adams, Brainerd, Hendrickson, Maine, Martin, Smith, The Fortran 2003 Handbook, Springer, 2009, (712 pages), ISBN 978-1-84628-378-9 ; • Walters S. Brainerd, Guide to Fortran 2008 Programming, Springer, 2015, ISBN 978-1-4471-6758-7 ; • Chivers Ian, Sleightholme Jane, Introduction to Programming with Fortran, 2015, ISBN 978-3-319-17701-4 ; • Michael Metcalf, John Reid, Malcom Cohen, Modern Fortran Explained, 2018, ISBN 978-0-19-881189-3 ; • Norman S. Clerman, Walter Spector, Modern Fortran : Style and Usage, Cambridge University Press, 2012, ISBN 978-0521730525 ; • Arjen Markus, Modern Fortran in Practice, Cambridge University Press, juin 2012, (272 pages), ISBN 978-1-10760-347-9 ; • Chamberland Luc, Fortran 90 : A Reference Guide, Prentice Hall, ISBN 0-13-397332-8 ; • Delannoy Claude, Programmer en Fortran 90 – Guide complet, Eyrolles, 1997, (413 pages), ISBN 2-212-08982-1 ; • Dubesset M., Vignes J., Les spécificités du Fortran 90, Éditions Technip, 1993, (400 pages), ISBN 2-7108-0652-5 ; • Ellis, Phillips, Lahey, Fortran 90 Programming, Addisson-Wesley, 1994, (825 pages), ISBN 0-201-54446-6 ; Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 11 / 268 Introduction bibliographie • Kerrigan James F., Migrating to Fortran 90, O’Reilly & Associates Inc., 1994, (389 pages), ISBN 1-56592-049-X ; • Lignelet P., Fortran 90 : approche par la pratique, Éditions Studio Image (série informatique), 1993, ISBN 2-909615-01-4 ; • Lignelet P., Manuel complet du langage Fortran 90 et Fortran 95, calcul intensif et génie logiciel, Col. Mesures physiques,Masson, 1996, (320 pages), ISBN 2-225-85229-4 ; • Lignelet P., Structures de données et leurs algorithmes avec Fortran 90 et Fortran 95, Masson, 1996, (360 pages), ISBN 2-225-85373-8 ; • Morgan and Schoenfelder, Programming in Fortran 90, Alfred Waller Ltd., 1993, ISBN 1-872474-06-3 ; • Michael Metcalf, John Reid, Malcom Cohen, • Fortran 90 explained, Science Publications, Oxford, 1994, (294 pages), ISBN 0-19-853772-7, Traduction française par Pichon B. et Caillat M., Fortran 90 : les concepts fondamentaux, Éditions AFNOR, 1993, ISBN 2-12-486513-7 ; • Fortran 95/2003 explained, Oxford University Press, 2004, (416 pages), ISBN 0-19-852693-8 ; • Modern Fortran Explained, 2011, ISBN 978-0-19-960142-4. • Olagnon Michel, Traitement de données numériques avec Fortran 90, Masson, 1996, (364 pages), ISBN 2-225-85259-6 ; • Redwine Cooper, Upgrading to Fortran 90, Springer, 1995, ISBN 0-387-97995-6 ; • International Standard ISO/IEC 1539-1:1997(E) Information technology - Progr. languages - Fortran - Part1 : Base language. Disponible auprès de l’AFNOR. Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 12 / 268 Introduction documentation • Documentation générale • Supports de cours Fortran IDRIS : http://www.idris.fr, choix « Supports de cours » puis « Fortran » • The Fortran Company : http://www.fortran.com • État d’avancement de l’intégration de la norme Fortran 2003 : http://fortranwiki.org/fortran/show/Fortran+2003+status • État d’avancement de l’intégration de la norme Fortran 2008 : http://fortranwiki.org/fortran/show/Fortran+2008+status Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 13 / 268 Généralités 1 Introduction 2 Généralités Bases de numération Représentation des données Jeu de caractères Notion d’unité de programme Éléments syntaxiques 3 Déclarations 4 Opérateurs et expressions 5 Structures de contrôle 6 Tableaux 7 Entrées-Sorties 8 Procédures 9 Common Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 14 / 268 Généralités 10 Include Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 15 / 268 Généralités Bases de numération Soit un nombre n dont l’écriture en base b est de la forme : (upup−1....u1u0)b avec : ∀i ∈{0, 1, ..., p} 0 ≤ui < b La valeur du nombre n en base 10 est : n10 = Pp i=0 uibi Les ordinateurs ne savent calculer qu’en base 2, de ce fait les données stockées dans la mémoire le sont sous la forme d’une suite de chiffres binaires 0 et 1 appelés bits abréviation de binary digits. Un ensemble de 8 bits s’appelle un octet. L’écriture des données en base 2 se révèle fastidieuse. Par commodité, on adopte plutôt la base 8 (base octale) ou la base 16 (hexadécimale) pour les définir. Anne Fouilloux Patrick Corde ( a.c.fouilloux@geo.uio.no Patrick.Corde@idris.fr ) Langage Fortran(Base) 5 février 2020 16 / 268 Généralités Bases de numération L’écriture d’un nombre en octal s’effectuera à l’aide des uploads/s1/ idris-fortran-base-cours.pdf
Documents similaires




-
34
-
0
-
0
Licence et utilisation
Gratuit pour un usage personnel Attribution requise- Détails
- Publié le Fev 13, 2022
- Catégorie Administration
- Langue French
- Taille du fichier 1.0061MB