The new features of Fortran 2003 David Muxworthy BSI Fortran Convenor.

Slides:



Advertisements
Similar presentations
MPI 2.2 William Gropp. 2 Scope of MPI 2.2 Small changes to the standard. A small change is defined as one that does not break existing correct MPI 2.0.
Advertisements

Chapter 11 Operator Overloading; String and Array Objects Chapter 11 Operator Overloading; String and Array Objects Part I.
Chapter 7 Introduction to Procedures. So far, all programs written in such way that all subtasks are integrated in one single large program. There is.
Programming Languages and Paradigms The C Programming Language.
Elementary Data Types Prof. Alamdeep Singh. Scalar Data Types Scalar data types represent a single object, i.e. only one value can be derived. In general,
Fortran: Array Features Session Five ICoCSIS. Outline 1.Zero-sized Array 2.Assumed-shaped Array 3.Automatic Objects 4.Allocation of Data 5.Elemental Operations.
Arrays Array Terminology Declarations Visualisation of Arrays Array Conformance Array Element Ordering Array Syntax Whole Array Expressions Array Sections.
Functions & Subroutines HTML version DFMain.chm. Types of subprograms Internal External Module Pure Elemental Recursive Optional arguments Generic Defined.
Introduction to Fortran Fortran Evolution Drawbacks of FORTRAN 77 Fortran 90 New features Advantages of Additions.
Fortran 9x HTML version. New F90 features Free source form Modules User-defined data types and operators Generic user-defined procedures Interface blocks.
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
Chapter 10 Modules and programming with subroutines.
Elementary Data Types Scalar Data Types Numerical Data Types Other
CSE S. Tanimoto Syntax and Types 1 Representation, Syntax, Paradigms, Types Representation Formal Syntax Paradigms Data Types Type Inference.
Chapter 9 Modules and Programming with Functions.
FORTRAN.  Fortran or FORmula TRANslation was developed in the 1950's by IBM as an alternative to Assembly Language. First successfull high level language.
1 Introduction to C++ Programming Concept Basic C++ C++ Extension from C.
CHAPTER 6 FILE PROCESSING. 2 Introduction  The most convenient way to process involving large data sets is to store them into a file for later processing.
ISBN Chapter 9 Subprograms and Functions –Design Issues –Local Referencing Environments –Parameter-Passing Methods –Parameters that are Subprogram.
Data Types.
C++ fundamentals.
CSE 341, S. Tanimoto Concepts 1- 1 Programming Language Concepts Formal Syntax Paradigms Data Types Polymorphism.
Intermediate PHP (2) File Input/Output & User Defined Functions.
Fortran: Specification Statements Session Six ICoCSIS.
Block-Structured Procedural Languages Lecture 11: Dolores Zage.
Introduction to FORTRAN
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
1 Week 12 Arrays, vectors, matrices and cubes. Introduction to Scientific & Engineering Computing 2 Array subscript expressions n Each subscript in an.
Imperative Programming
Fortran: Program Units and Procedures Session Four ICoCSIS.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
Requirements for Fortran Procedures and Progress David Muxworthy BSI Fortran Convenor Prepared for the BCS FSG meeting on 10 March 2005 Almost all.
Fortran: Expressions and Assignments Session Two ICoCSIS.
CSE 425: Object-Oriented Programming I Object-Oriented Programming A design method as well as a programming paradigm –For example, CRC cards, noun-verb.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Tuc Goodwin  Object and Component-Oriented Programming  Classes in C#  Scope and Accessibility  Methods and Properties  Nested.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object.
Module and Data Sharing. Programming in the Large Software, in general, is large having multiple units Multiple units designed and developed independently.
CIS-165 C++ Programming I CIS-165 C++ Programming I Bergen Community College Prof. Faisal Aljamal.
1 SystemVerilog Enhancement Requests Daniel Schostak Principal Engineer February 26 th 2010.
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
XLF 9.1 Ian J. Bush Computational Science and Engineering Department CCLRC Daresbury Laboratory Warrington WA4 4AD
Week 3 Let's review! Fundamental data types List-directed input/output.
CSC3315 (Spring 2008)1 CSC 3315 Subprograms Hamid Harroud School of Science and Engineering, Akhawayn University
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Extensions to I/O Tom Clune SIVO Fortran 2003 Series March 11, 2008.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
INPUT / OUTPUT STATEMENTS
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
ISBN Chapter 6 Data Types Introduction Primitive Data Types User-Defined Ordinal Types.
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
Parameterized modules, BITS, and other features that may or may not be included in the revision of Fortran 2003 David Muxworthy BSI Fortran Convenor Prepared.
Compilation Technology SCINET compiler workshop | February 17-18, 2009 © 2009 IBM Corporation Software Group Fortran 2003 Jim Xia IBM Toronto Lab
Object Oriented Software Development 4. C# data types, objects and references.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
EEL 3801 C++ as an Enhancement of C. EEL 3801 – Lotzi Bölöni Comments  Can be done with // at the start of the commented line.  The end-of-line terminates.
1 CSE Programming in C++. 2 Overview Sign roster list Syllabus and Course Policies Introduction to C++ About Lab 1 Fill Questionnaire.
Programming Fundamentals Enumerations and Functions.
Scalar and composite data Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
CSI 3125, Data Types, page 1 Data types Outline Primitive data types Structured data types Strings Enumerated types Arrays Records Pointers Reading assignment.
C Language VIVA Questions with Answers
Representation, Syntax, Paradigms, Types
C++, OBJECT ORIENTED PROGRAMMING
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
Representation, Syntax, Paradigms, Types
CSCE 330 Programming Language Structures Ch.2: Syntax and Semantics
Representation, Syntax, Paradigms, Types
Representation, Syntax, Paradigms, Types
Programming Languages and Paradigms
Presentation transcript:

The new features of Fortran 2003 David Muxworthy BSI Fortran Convenor

Pages in Fortran Standards

Major extensions Standardized interoperability with C Object-oriented support Derived-type enhancements IEEE 754 support Numerous data manipulation enhancements Numerous input/output enhancements

Minor incompatibilities with Fortran 95 carriage control for printer output has been removed from the standard list-directed and namelist output of real zeros is changed output of real zeros in these contexts always uses F rather than E format if the processor can distinguish +0.0 and -0.0, use is made of this by ATAN2 and by LOG, SQRT if they have complex arguments e.g. result of ATAN2 or LOG may be -π rather than π

Characters and source form the default character set is extended to include: ~ | \ [ ] { # grave accent, circumflex accent (but not acute accent) only [ and ] are used and are synonyms for (/ and /) variable names may be to 63 characters statements may be up to 256 lines

'International' (non-anglophone) usage explicit accommodation of characters (but not necessary for processors to support 10646) ability to specify decimal separator in internal or external files as POINT or COMMA

Data types and specifications Many new facilities, including: deferred type parameters length type parameters of certain entities may be changed during execution VOLATILE attribute for interacting with non-Fortran processes ASYNCHRONOUS attribute for specifying that a variable may be subject to asynchronous input/output type specification for array constructors, e.g. [CHARACTER(LEN=8) :: ’Fortran’, ’C’, ’Algol 68’]

More data manipulation enhancements specification and initialization expressions are extended by removal of some restrictions complex literals are extended to accept named constants, e.g. (0., PI) where PI is a previously declared real constant MIN and MAX extended to accept character arguments

Derived type enhancements the kind, length and shape of derived type components may be specified when the type is used different components may have different accessibility improved structure constructors finalizers derived-type input/output components may be allocatable

ASSOCIATE construct This allows a complex expression or object to be denoted by a simple symbol Examples: associate ( z => exp(-(x**2+y**2)) * cos(theta) ) print *, a+z, a-z end associate associate ( array => ax%b(i,:)%c ) array(n)%ev = array(n-1)%ev end associate

Enumerators Enumerators are provided to interoperate with the corresponding C enumeration type Example: enum, bind(c) enumerator :: red = 4, blue = 9 enumerator yellow end enum

Procedure pointers Pointers are extended to point to procedures, as well as variables, using a new PROCEDURE statement. Example: procedure (real_func), pointer :: p=> null() where the interface to real_func has already been defined... p => bessel write (*, *) p(2.5) !-- bessel(2.5)

Input/output enhancements There are many detailed enhancements, including: asynchronous transfer stream, rather than record, access named constants for preconnected units FLUSH statement access to error messages derived-type i/o control over rounding mode at internal to external real number conversion

IEEE support If the processor supports some or all of IEC (IEEE 754) arithmetic, the standard provides facilities to: query which IEEE facilities are provided access the facilities for IEEE arithmetic, exception handling, rounding, use of certain IEEE functions, etc.

Enhanced access to system environment new procedures, including GET_COMMAND GET_COMMAND_ARGUMENT GET_ENVIRONMENT_VARIABLE COMMAND_ARGUMENT_COUNT IOMSG=character-variable specifier in OPEN, CLOSE, READ, WRITE

Interoperability with C Uses intrinsic module ISO_C_BINDING to define named constants and derived types allows for interoperability of: intrinsic types pointer types derived types scalars and arrays procedures and procedure interfaces C global variables C functions but not (yet): procedures with data pointer, allocatable, assumed-shape array or optional dummy arguments

Interoperability with C example part 1 C Function Prototype: int C_Library_Function(void* sendbuf, int sendcount, int *recvcounts); Fortran Module: module ftn_c interface integer (c_int) function C_Library_Function & (sendbuf, sendcount, recvcounts), & bind(c,name=’C_Library_Function’) use iso_c_binding implicit none type (c_ptr), value :: sendbuf integer (c_int), value :: sendcount type (c_ptr), value :: recvcounts end function C_Library_Function end interface end module ftn_c

Interoperability with C example part 2 Fortran Calling Sequence: use iso_c_binding, only: c_int, c_float, c_loc use ftn_c... real (c_float), target :: send(100) integer (c_int) :: sendcount integer (c_int), allocatable, target :: recvcounts(100)... allocate( recvcounts(100) )... call C_Library_Function(c_loc(send), sendcount, & c_loc(recvcounts))

Object-oriented support enhanced data abstraction one type may extend the definition of another polymorphism allows type of a variable to vary at run time dynamic type allocation SELECT TYPE construct type-bound procedures

Further information For a far more detailed (38 page) overview of the new features in Fortran 2003 relative to Fortran 95 see "The New Features of Fortran 2003" by John Reid, at ftp://ftp.nag.co.uk/sc22wg5/N1601-N1650/N1648.pdf