This lesson is in the early stages of development (Alpha version)

Intermediate Modern Fortran

Key Points

Connecting to ARCHER2 and transferring data
  • We should all understand and follow the [ARCHER2 Code of Conduct][archer2-tcoc] to ensure this course is conducted in the best teaching environment.

  • The course will be flexible to best meet the learning needs of the attendees.

  • Feedback is an essential part of our training to allow us to continue to improve and make sure the course is as useful as possible to attendees.

  • ARCHER2’s login address is login.archer2.ac.uk.

  • You have to change the default text password the first time you log in

  • MFA is mandatory in ARCHER2

Arrays
  • Fortran supports both static- and dynamic-sized arrays

  • Fortran arrays are objects, allowing out of bounds accesses to be checked

  • The bounds of an array can be set by the programmer

Arrays as arguments
  • Arrays passed as arguments retain their size, not their bounds

  • Array arguments behave as though passed by reference, however array sections may require copy-in, copy-out

More on pointers
  • Fortran pointers describe what they are pointing to, not only its address

  • We must take care when programming with pointers to avoid aliasing

  • Procedure pointers create a binding between a variable and a procedure

Derived types
  • Derived types enable creating custom data structures in Fortran.

  • Access to components of derived types can be controlled via the private attribute

Interfaces and overloading
  • Interfaces allow us to write generic, high-level code

  • Designing a generic interface requires care, particularly for generic operators

Type extension and polymorphism
Type-bound procedures
Generic input/output for derived types
Abstract types
Modules again
Unlimited polymorphic entities
Type parameters
Intrinsic modules
Interoperability with C