Introduction to Fortran Programming. - Module -
|
|
- Richard Holmes
- 5 years ago
- Views:
Transcription
1 Introduction to Fortran Programming - Module -
2 Subprograms Subprograms are used to split program into separate smaller units. Internal subprograms are dependent parts of program. Fortran 90 has two types of subprograms: Functions and subroutines. Once each piece is working correctly, we can put the pieces together to build the program.
3 Program unit It is a physically complete sequence of program lines with end statement. Main program: The main program unit containing the first statement of the actual program. External subprogram: User-defined subprogram which is an independent program unit. Module (since Fotran90): A program unit which contains only declarations and external subprograms.
4 Program unit Main program ( program-name ) Internal functions Internal subroutines External Subprograms External functions External subroutines Module Today s topic!!
5 Module Module is a program unit that declares functions, subroutines, and shared variables together. Once of the functions added in Fortran 90. In Fortran90, it is recommended to use modules instead of external subprograms.
6 Module module Module_name [Specification part] contains [Defined function/subroutine] end module Module_name A non-executable statement Declare variables you want to share here. How to write functions and subroutines as usual!!
7 Use statement use Module_name A program module is made accessible to the various program units via use statement. Note that there are restrictions on variable reference. module testmod end module testmod program examp use testmod end program examp The module declaration is in front of the program to use. Write use statement before. Specify necessary modules in the use statement.
8 Compiling modules testmod.f90 module testmod contains end module main.f90 program main use testmod stop end program main Write the module name first. gfortran testmod.f90 main.f90
9 Example 1 Let r be a double-precision real type variable and adding a value appropriately. Create a module with functions and subroutines that calculate the volume of the sphere with radius r.
10 Example 1 volmod.f90 module volmod contains function dvolfunc(r) result(v) real(8) :: pi = acos(-1d0) real(8) :: V end function dvolfunc subroutine dvolsub(r,v) real(8) :: pi = acos(-1d0) real(8), intent(out) :: V end subroutine dvolsub end module volmod main.f90 program vol use volmod real(8) :: r, V r = 2d0 V = dvolfunc(r) call dvolsub(r,v) stop end program vol
11 Example 1 volmod.f90 module volmod contains function dvolfunc(r) result(v) real(8) :: pi = acos(-1d0) real(8) :: V end function dvolfunc subroutine dvolsub(r,v) real(8) :: pi = acos(-1d0) real(8), intent(out) :: V end subroutine dvolsub end module volmod main.f90 program vol use volmod real(8) :: r, V r = 2d0 V = dvolfunc(r) call dvolsub(r,v) stop end program vol Let s refer to pi in main program.
12 Example 1 volmod.f90 module volmod contains function dvolfunc(r) result(v) real(8) :: pi = acos(-1d0) real(8) :: V end function dvolfunc subroutine dvolsub(r,v) real(8) :: pi = acos(-1d0) real(8), intent(out) :: V end subroutine dvolsub end module volmod main.f90 program vol use volmod real(8) :: r, V r = 2d0 V = dvolfunc(r) call dvolsub(r,v) write(*,*) pi stop end program vol Let s refer to pi in main program. Error This is not possible.
13 Example 1 volmod.f90 module volmod real(8) :: pi = acos(-1d0) contains function dvolfunc(r) result(v) real(8) :: V end function dvolfunc subroutine dvolsub(r,v) real(8), intent(out) :: V end subroutine dvolsub end module volmod main.f90 program vol use volmod real(8) :: r, V r = 2d0 V = dvolfunc(r) Let s refer to pi in main program. Declare pi here. call dvolsub(r,v) write(*,*) pi stop end program vol Pi is the shared valiable Now it is possible.
14 Example 1 volmod.f90 module volmod real(8) :: pi = acos(-1d0) contains function dvolfunc(r) result(v) real(8) :: V end function dvolfunc subroutine dvolsub(r,v) real(8), intent(out) :: V end subroutine dvolsub end module volmod main.f90 program vol use volmod real(8) :: r, V r = 2d0 V = dvolfunc(r) pi = 0d0 call dvolsub(r,v) Let s refer to pi in main program. Declare pi here. write(*,*) pi stop end program vol Pi is the shared valiable Change the value of pi. Returning the wrong answer as pi was changed.
15 Example 1 volmod.f90 module volmod real(8),parameter :: pi = acos(-1d0) contains function dvolfunc(r) result(v) Declare pi as parameter real(8) :: V attribute. end function dvolfunc subroutine dvolsub(r,v) real(8), intent(out) :: V end subroutine dvolsub end module volmod main.f90 program vol use volmod real(8) :: r, V r = 2d0 V = dvolfunc(r) pi = 0d0 call dvolsub(r,v) write(*,*) pi stop end program vol Let s refer to pi in main program. Error Since pi is the parameter attribute. When trying to change, Error!
16 Example 2 Let r be a double-precision real type valiable of a onedimensional array and substitute a value appropriately. Add the function and subroutine that calculate the volume of the sphere with radius r to the module written in Example 1.
17 Example 2 module volmod real(8), parameter :: pi = acos(-1d0) contains function dvolfunc(r) result(v) real(8) :: V end function dvolfunc function dmvolfunc(r) result(v) (:) real(8) :: V(size(r)) end function dmvolfunc (Continue to the right ) subroutine dvolsub(r,v) real(8), intent(out) :: V end subroutine dvolsub subroutine dmvolsub(r,v) (:) real(8),intent(out) ::V(size(r)) end subroutine dmvolsub end module volmod
18 Example 2 Function / subroutine name should be different! Array declaration is the same as for internal functions! (Continue to the right) Array declaration is the same as for internal functions!
19
20
21
22
23
Introduction to Fortran Programming. -External subprograms-
Introduction to Fortran Programming -External subprograms- Subprograms Subprograms are used to split a program into separate smaller units. Internal subprograms are dependent parts of a program. Fortran
More informationIntroduction to Fortran Programming. -Internal subprograms (1)-
Introduction to Fortran Programming -Internal subprograms (1)- Subprograms Subprograms are used to split the program into separate smaller units. Internal subprogram is not an independent part of a program.
More informationReusing this material
Modules Reusing this material This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. http://creativecommons.org/licenses/by-ncsa/4.0/deed.en_us
More informationReview More Arrays Modules Final Review
OUTLINE 1 REVIEW 2 MORE ARRAYS Using Arrays Why do we need dynamic arrays? Using Dynamic Arrays 3 MODULES Global Variables Interface Blocks Modular Programming 4 FINAL REVIEW THE STORY SO FAR... Create
More informationGoals for This Lecture:
Goals for This Lecture: Learn a simple sorting algorithm Understand how compilation & linking of separate main program and subprogram files are accomplished. Understand how to use subprograms to create
More informationFORTRAN 90: Functions, Modules, and Subroutines. Meteorology 227 Fall 2017
FORTRAN 90: Functions, Modules, and Subroutines Meteorology 227 Fall 2017 Purpose First step in modular program design Cannot always anticipate all of the steps that will be needed to solve a problem Easier
More informationProgrammation in Fortran
Programmation in Fortran Adrien Poteaux CRIStAL, Université Lille Year 2017-2018 This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. http://creativecommons.org/licenses/by-nc-sa/3.0/
More informationComputational Astrophysics AS 3013
Computational Astrophysics AS 3013 Lecture 2: 1) F90 variable types 2) variable declaration 3) good programming style AS3013: F90 lecture2 1 Fortran 90 variable types integer whole numbers: 3, 244, -10,
More informationReview Functions Subroutines Flow Control Summary
OUTLINE 1 REVIEW 2 FUNCTIONS Why use functions How do they work 3 SUBROUTINES Why use subroutines? How do they work 4 FLOW CONTROL Logical Control Looping 5 SUMMARY OUTLINE 1 REVIEW 2 FUNCTIONS Why use
More informationSUBPROGRAMS AND MODULES
SUBPROGRAMS AND MODULES FORTRAN PROGRAMING Zerihun Alemayehu AAiT.CED Program structure Advantages of subprograms Program units can be written and tested independently A program unit that has a well defined
More informationSubroutines and Functions
Subroutines and Functions Procedures: Subroutines and Functions There are two types of procedures: SUBROUTINE: a parameterized named sequence of code which performs a specific task and can be invoked from
More informationOutline of Fortran 90 Topics
Outline of Fortran 90 Topics Overview of Computing Computer Organization Languages Problem Solving Data Fortran 90 Character Set Variables Basic Data Types Expressions Numeric Non-numeric Control Structures
More informationComputational Methods of Scientific Programming. Lecturers Thomas A Herring Chris Hill
12.010 Computational Methods of Scientific Programming Lecturers Thomas A Herring Chris Hill Review of Lecture 4 Looked at Fortran commands in more detail Looked at variables and constants IO commands:
More informationAMath 483/583 Lecture 8
AMath 483/583 Lecture 8 This lecture: Fortran subroutines and functions Arrays Dynamic memory Reading: class notes: Fortran Arrays class notes: Fortran Subroutines and Functions class notes: gfortran flags
More informationReflection Seismology (SCPY 482) An Introduction to Fortran 90 Programming
Reflection Seismology (SCPY 482) An Introduction to Fortran 90 Programming Chaiwoot Boonyasiriwat September 18, 2014 Outline Why Fortran 90? Hello World Compilation and Execution Recommended Program Structure
More informationComputational modeling
Computational modeling Lecture 3 : Random variables Theory: 1 Random variables Programming: 1 Implicit none statement 2 Modules 3 Outputs 4 Functions 5 Conditional statement Instructor : Cedric Weber Course
More informationFortran programming for beginner seismologists Lesson 6
IISEE lecture for group training (Seismological course) Fortran programming for beginner seismologists Lesson 6 Lecturer Tatsuhiko Hara Subprogram modules It is convenient to make a subprogram module which
More informationGoals for This Lecture:
Goals for This Lecture: Understand what modules are Understand what module procedures are and how to use them Understand explicit and implicit interfaces Understand what automatic arrays are and how to
More informationNumerical Modelling in Fortran: day 2. Paul Tackley, 2017
Numerical Modelling in Fortran: day 2 Paul Tackley, 2017 Goals for today Review main points in online materials you read for homework http://www.cs.mtu.edu/%7eshene/courses/cs201/notes/intro.html More
More information1. User-Defined Functions & Subroutines Part 2 Outline
User-Defined Functions Subroutines Part 2 Outline 1. User-Defined Functions Subroutines Part 2 Outline 2. Argument Order When Passing Arrays 3. Code Reuse Is GOOD GOOD GOOD 4. Reusing User-Defined Functions
More informationSubroutines, Functions and Modules
Subroutines, Functions and Modules Subdividing the Problem Most problems are thousands of lines of code. Few people can grasp all of the details. Good design principle: Exhibit the overall structure in
More informationMerge Sort. Run time typically depends on: Insertion sort can be faster than merge sort. Fast, able to handle any data
Run time typically depends on: How long things take to set up How many operations there are in each step How many steps there are Insertion sort can be faster than merge sort One array, one operation per
More informationPart (04) Introduction to Programming
Part (04) Introduction to Programming Dr. Ahmed M. ElShafee 1 Dr. Ahmed ElShafee, ACU : Summer 2014, Introduction to CS 1 EVOLUTION To write a program for a computer, we must use a computer language. A
More informationSubprograms. FORTRAN 77 Chapter 5. Subprograms. Subprograms. Subprograms. Function Subprograms 1/5/2014. Satish Chandra.
FORTRAN 77 Chapter 5 Satish Chandra satish0402@gmail.com When a programs is more than a few hundred lines long, it gets hard to follow. Fortran codes that solve real research problems often have tens of
More informationExtrinsic Procedures. Section 6
Section Extrinsic Procedures 1 1 1 1 1 1 1 1 0 1 This chapter defines the mechanism by which HPF programs may call non-hpf subprograms as extrinsic procedures. It provides the information needed to write
More informationAn interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s.
Using Monte Carlo to Estimate π using Buffon s Needle Problem An interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s. Here s the problem (in a simplified form). Suppose
More informationComputational Techniques I
Computational Techniques I Course Zero 2017-2018 Madrid Alicia Palacios, alicia.palacios@uam.es Cristina Sanz Sanz, cristina.sanz@uam.es Outline 1. Introduction: how to run, input 2. Data types 3. Declaration
More informationA quick guide to Fortran
A quick guide to Fortran Sergiy Bubin Department of Physics Nazarbayev University History of Fortran One of the oldest general purpose high-level computer languages First developed in 1957 at IBM in the
More informationDeveloping Algorithms
This scheme gives pupils a practical looking at developing algorithms firstly by looking at abstraction, decomposition and algorithmic thinking. Students then learn about the different techniques used
More informationNumerical Modelling in Fortran: day 7. Paul Tackley, 2017
Numerical Modelling in Fortran: day 7 Paul Tackley, 2017 Today s Goals 1. Makefiles 2. Intrinsic functions 3. Optimisation: Making your code run as fast as possible 4. Combine advection-diffusion and Poisson
More informationNumerical Modelling in Fortran: day 6. Paul Tackley, 2017
Numerical Modelling in Fortran: day 6 Paul Tackley, 2017 Today s Goals 1. Learn about pointers, generic procedures and operators 2. Learn about iterative solvers for boundary value problems, including
More informationKGEN: Fortran Kernel Generator. National Center for Atmospheric Research (NCAR) Youngsung Kim, John Dennis, Raghu R. Kumar, and Amogh Simha
KGEN: Fortran Kernel Generator Youngsung Kim, John Dennis, Raghu R. Kumar, and Amogh Simha National Center for Atmospheric Research (NCAR) Contents Introduction A kernel generation example Kernel generation
More informationUNIVERSITY OF OSLO Department of Geosciences. GEO4060: Intro to Fortran 2003 programming. Gunnar Wollan
UNIVERSITY OF OSLO Department of Geosciences GEO4060: Intro to Fortran 2003 programming Gunnar Wollan Spring 2014 Contents 1 Introduction 2 1.1 Why use Fortran?.................................... 2 1.2
More informationSpecial Topics: Programming Languages
Lecture #17 0 V22.0490.001 Special Topics: Programming Languages B. Mishra New York University. Lecture # 17 Lecture #17 1 Slide 1 Runtime Representations Variable Names Environment L-values Scope, Extent
More information1. User-Defined Functions & Subroutines Part 1 Outline
User-Defined Functions Subroutines Part 1 Outline 1. User-Defined Functions Subroutines Part 1 Outline 2. Intrinsic Functions Are Not Enough 3. User-Defined Functions 4. A User-Defined Function for Mean
More information7. Procedures and Structured Programming
7. Procedures and Structured Programming ONE BIG PROGRAM external procedure: separated small and reusable program units to conduct individual subtasks smaller main program Each program unit can be debugged
More informationSUBROUTINE subroutine-name (arg1, arg2,..., argn)
FORTRAN Subroutines Syntax Form 1 SUBROUTINE subroutine-name (arg1, arg2,..., argn) [specification part] [execution part] [subprogram part] subroutine-name Form 2 SUBROUTINE subroutine-name () [specification
More information2 Recommended books and a Web page
Fortran 95 for Fortran 77 users J.F.Harper School of Mathematics, Statistics and Computer Science Victoria University of Wellington First ed. 5 Apr 2006, latest amendments 23 May 2007 1 Introduction With
More informationLevel 3 Computing Year 2 Lecturer: Phil Smith
Level 3 Computing Year 2 Lecturer: Phil Smith Previously We started to build a GUI program using visual studio 2010 and vb.net. We have a form designed. We have started to write the code to provided the
More informationCME 213 S PRING Eric Darve
CME 213 S PRING 2017 Eric Darve PTHREADS pthread_create, pthread_exit, pthread_join Mutex: locked/unlocked; used to protect access to shared variables (read/write) Condition variables: used to allow threads
More informationLecture 1 arithmetic and functions
Lecture 1 arithmetic and functions MATH 190 WEBSITE: www.math.hawaii.edu/190 Open MATH 190 in a web browser. Read and accept the Terms of Acceptable Lab Use. Open Lecture 1. PREREQUISITE: You must have
More informationSOEE1160: Computers and Programming in Geosciences Semester /08. Dr. Sebastian Rost
SOEE1160 L3-1 Structured Programming SOEE1160: Computers and Programming in Geosciences Semester 2 2007/08 Dr. Sebastian Rost In a sense one could see a computer program as a recipe (this is pretty much
More informationISO/IEC : TECHNICAL CORRIGENDUM 2
ISO/IEC 1539-1:2010 - TECHNICAL CORRIGENDUM 2 ISO/IEC/JTC1/SC22/WG5-N1957 Notes for WG5: Edits included in this document from the interpretations in N1932 as amended by 12-193 and 12-194 and in N1949 as
More informationLevel 3 Computing Year 2 Lecturer: Phil Smith
Level 3 Computing Year 2 Lecturer: Phil Smith Introduction This unit aims to enable you to develop the skills and understanding required to design and develop procedural programming applications. Irrespective
More informationGoals for This Lecture:
Goals for This Lecture: Understand the various kinds of REAL types Understand how to select precision in a processor independent manner Introduction to Makefiles Kinds of REAL variables The default REAL
More informationSubprograms. Bilkent University. CS315 Programming Languages Pinar Duygulu
1 Subprograms CS 315 Programming Languages Pinar Duygulu Bilkent University Introduction 2 Two fundamental abstraction facilities Process abstraction Emphasized from early days Data abstraction Emphasized
More informationComputational modeling
Computational modeling Lecture 5 : Monte Carlo Integration Physics: Integration The Monte Carlo method Programming: Subroutine Differences Subroutine/Function The Fortran random number subroutine Monte
More informationStorage and Sequence Association
2 Section Storage and Sequence Association 1 1 HPF allows the mapping of variables across multiple processors in order to improve parallel 1 performance. FORTRAN and Fortran 0 both specify relationships
More informationUse a calculator and c = 2 π r to calculate the circumference of a circle with a radius of 1.0.
Floating Point Math Submitted by Andy Lindsay on Thu, 03/21/2013-16:37 original source: http://learn.parallax.com/propeller-c-start-simple/floating-point-math Lesson edited to work with Dev-C++ IDE by
More informationNO CALCULATOR ALLOWED!!
CPSC 203 500 EXAM TWO Fall 2005 NO CALCULATOR ALLOWED!! Full Name (Please Print): UIN: Score Possible Points Prog Points Part One 33 pts Part Two 30 pts Part Three 20 pts Part Four 25 pts Total 108 pts
More information41391 High performance computing: Miscellaneous parallel programmes in Fortran
1391 High performance computing: Miscellaneous parallel programmes in Fortran Nilas Mandrup Hansen, Ask Hjorth Larsen January 19, 0 1 Introduction This document concerns the implementation of a Fortran
More informationJanuary 23, HW 3 GeometricSolids Key. Fundamentals of Algebra. Geometric Solids. Homework #3. Key
Fundamentals of Algebra Geometric Solids Homework #3 Key 1 Problem #1 6 2 Problem #1 I Need To 6 I need to find the container that holds the largest volume of water, choosing between two cylinders and
More informationFORTRAN Block data subprograms 2. Common blocks 3. Entry points 4. Function subprograms 5. Main program 6. Subroutines
FORTRAN77 The first FORTRAN compiler was a milestone in the history of computing, at that time computers had very small memories (on the order of 15KB, it was common then to count memory capacities in
More informationRun-Time Data Structures
Run-Time Data Structures Static Structures For static structures, a fixed address is used throughout execution. This is the oldest and simplest memory organization. In current compilers, it is used for:
More informationPython. Olmo Zavala R. Python Exercises. Center of Atmospheric Sciences, UNAM. August 24, 2016
Exercises Center of Atmospheric Sciences, UNAM August 24, 2016 NAND Make function that computes the NAND. It should receive two booleans and return one more boolean. logical operators A and B, A or B,
More informationChapter 11 Introduction to Programming in C
Chapter 11 Introduction to Programming in C C: A High-Level Language Gives symbolic names for containers of values don t need to know which register or memory location Provides abstraction of underlying
More informationBinding and Variables
Binding and Variables 1. DEFINITIONS... 2 2. VARIABLES... 3 3. TYPE... 4 4. SCOPE... 4 5. REFERENCES... 7 6. ROUTINES... 9 7. ALIASING AND OVERLOADING... 10 8. GENERICS AND TEMPLATES... 12 A. Bellaachia
More informationnames names identifiers variables subroutines constants
names (source: Louden, "Programming Languages, Principles and Practices", 2nd Edition, Ch. 5, pp. 125-134)!p. 126: "A fundamental abstraction mechanism in a programming language is the use of names, or
More informationComputational Methods of Scientific Programming Fall 2008
MIT OpenCourseWare http://ocw.mit.edu 12.010 Computational Methods of Scientific Programming Fall 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
More informationFortran. (FORmula TRANslator) History
Fortran (FORmula TRANslator) History FORTRAN vs. Fortran 1954 FORTRAN first successful high level language John Backus (IBM) 1958 FORTRAN II (Logical IF, subroutines, functions) 1961 FORTRAN IV 1966 FORTRAN
More informationAn Introduction to Fortran
An Introduction to Fortran Sylvia Plöckinger March 10, 2011 Sylvia Plöckinger () An Introduction to Fortran March 10, 2011 1 / 43 General Information Find this file on: http://homepage.univie.ac.at/nigel.mitchell/numprac/
More information2. Basic Elements of Fortran
2. Basic Elements of Fortran Structure of a Fortran Program 31 characters must be in the 1st line if present declaration section program my_first_program! Declare variables integer :: i, j, k! i, j, k
More informationSize, Alignment, and Value Ranges of Data Types. Type Synonym Size Alignment Value Range. BYTE INTEGER*1 8 bits Byte
Chapter 2 2. Storage Mapping This chapter contains two sections: Alignment, Size, and Value Ranges describes how the Fortran compiler implements size and value ranges for various data types as well as
More informationDatatypes, Variables, and Operations
Datatypes, Variables, and Operations 1 Primitive Type Classification 2 Numerical Data Types Name Range Storage Size byte 2 7 to 2 7 1 (-128 to 127) 8-bit signed short 2 15 to 2 15 1 (-32768 to 32767) 16-bit
More informationInformation technology Programming languages Fortran Part 1: Base language
INTERNATIONAL STANDARD ISO/IEC 1539-1:2010 TECHNICAL CORRIGENDUM 2 Published 2013-06-01 INTERNATIONAL ORGANIZATION FOR STANDARDIZATION МЕЖДУНАРОДНАЯ ОРГАНИЗАЦИЯ ПО СТАНДАРТИЗАЦИИ ORGANISATION INTERNATIONALE
More informationENGINEERING 1020 Introduction to Computer Programming M A Y 2 6, R E Z A S H A H I D I
ENGINEERING 1020 Introduction to Computer Programming M A Y 2 6, 2 0 1 0 R E Z A S H A H I D I Today s class Constants Assignment statement Parameters and calling functions Expressions Mixed precision
More informationGeometric data structures:
Geometric data structures: Machine Learning for Big Data CSE547/STAT548, University of Washington Sham Kakade Sham Kakade 2017 1 Announcements: HW3 posted Today: Review: LSH for Euclidean distance Other
More informationIntroduction to Scientific Computing Languages
1 / 1 Introduction to Scientific Computing Languages Prof. Paolo Bientinesi pauldj@aices.rwth-aachen.de Languages for Scientific Computing 2 / 1 What is a programming language? Languages for Scientific
More informationFortran Introduction
26/10/2015 1 Background 2 Creating an Executable 3 Variables 4 Program Flow 5 Procedures 6 Input and Output 7 Deprecated Background In this opening section, I will talk briefly about The History of Fortran
More informationGoals for This Lecture:
Goals for This Lecture: Understand what function subprograms are Understand how to use function subprograms Understand the various kinds of REAL types Understand how to select precision in a processor
More informationIntroduction to Scientific Computing Languages
1 / 17 Introduction to Scientific Computing Languages Prof. Paolo Bientinesi pauldj@aices.rwth-aachen.de Languages for Scientific Computing 2 / 17 What is a programming language? Languages for Scientific
More informationUniversity of Maryland, College Park Department of Civil and Environmental Engineering ENCE 202 Computation Methods in Civil Engineering I
University of Maryland, College Park Department of Civil and Environmental Engineering ENCE 202 Computation Methods in Civil Engineering I Final Exam Closed Book & Notes Exam for two hours (120 minutes)
More informationComputational Methods of Scientific Programming. Lecturers Thomas A Herring Chris Hill
12.010 Computational Methods of Scientific Programming Lecturers Thomas A Herring Chris Hill Review of Lecture 5 Looked at Fortran commands in more detail Control through if and do statements. Logical
More information9. Linear Algebra Computation
9. Linear Algebra Computation Basic Linear Algebra Subprograms (BLAS) Routines that provide standard, low-level, building blocks for performing basic vector and matrix operations. Originally developed
More informationNumerical Modelling in Fortran: day 3. Paul Tackley, 2017
Numerical Modelling in Fortran: day 3 Paul Tackley, 2017 Today s Goals 1. Review subroutines/functions and finitedifference approximation from last week 2. Review points from reading homework Select case,
More informationProgramming by Delegation
Chapter 2 a Programming by Delegation I. Scott MacKenzie a These slides are mostly based on the course text: Java by abstraction: A client-view approach (4 th edition), H. Roumani (2015). 1 Topics What
More information3+2 3*2 3/2 3^2 3**2 In matlab, use ^ or ** for exponentiation. In fortran, use only ** not ^ VARIABLES LECTURE 1: ARITHMETIC AND FUNCTIONS
LECTURE 1: ARITHMETIC AND FUNCTIONS MATH 190 WEBSITE: www.math.hawaii.edu/ gautier/190.html PREREQUISITE: You must have taken or be taking Calculus I concurrently. If not taken here, specify the college
More information4. CONDITIONAL STATEMENTS (IF STRUCTURE)
4. CONDITIONAL STATEMENTS (IF STRUCTURE) n Example : Derive k using Fortran (n 100). k=1 $./a.out Type positive integer n (n This program returns different messages depending on input values.
More informationIntroduction to Fortran95 Programming Part I. By Deniz Savas, CiCS, Shef. Univ., 2018
Introduction to Fortran95 Programming Part I By Deniz Savas, CiCS, Shef. Univ., 2018 D.Savas@sheffield.ac.uk Fortran Standards Fortran 2 Fortran 4 Fortran 66 Fortran 77 : Character variables, File I/O
More informationDVRP Library Documentation
DVRP Library Documentation A Parallel Library for 3D-Visualization RRZN (http://www.rrzn.uni-hannover.de) Universität Hannover DVRP Library Documentation: A Parallel Library for 3D-Visualization by RRZN
More informationComputer Programming & Problem Solving ( CPPS ) Turbo C Programming For The PC (Revised Edition ) By Robert Lafore
Sir Syed University of Engineering and Technology. Computer ming & Problem Solving ( CPPS ) Functions Chapter No 1 Compiled By: Sir Syed University of Engineering & Technology Computer Engineering Department
More informationCMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 12, FALL 2012
CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 12, FALL 2012 TOPICS TODAY Assembling & Linking Assembly Language Separate Compilation in C Scope and Lifetime LINKING IN ASSEMBLY
More information1/29/2018. Starting a Program Executes its main Function. ECE 220: Computer Systems & Programming. The Function main Divides into Two Parts
University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 220: Computer Systems & Programming Starting a Program Executes its main Function Let s take a look at a C program
More informationFortran 2003 programming in GEF4510. Fall 2012
Fortran 2003 programming in GEF4510 Fall 2012 1 Course content 1. Fortran historical background, what, why and how 2. A short program converting from Farenheit to centigrades and vice versa 3. The variable
More informationArrays. Defining arrays, declaration and initialization of arrays. Designed by Parul Khurana, LIECA.
Arrays Defining arrays, declaration and initialization of arrays Introduction Many applications require the processing of multiple data items that have common characteristics (e.g., a set of numerical
More informationArtificial Intelligence in the World. Prof. Levy Fromm Institute Spring Session, 2017
Artificial Intelligence in the World Prof. Levy Fromm Institute Spring Session, 2017 Lecture 2 agenda What is software and how is it made? History of computing 1945 1965 Key people John von Neumann, John
More informationJava REPL Tutorial. -> System.out.println("Hi"); Hi
Java REPL Tutorial Introduction The Java REPL (Read-Evaluate-Print-Loop) is a command line tool that facilitates exploratory programming by providing interactive use of Java Programming Language elements.
More informationModularity and Reusability I. Functions and code reuse
Modularity and Reusability I Functions and code reuse Copyright 2006 2009 Stewart Weiss On being efficient When you realize that a piece of Perl code that you wrote may be useful in future programs, you
More informationMatlab as a calculator
Why Matlab? Matlab is an interactive, high-level, user-friendly programming and visualization environment. It allows much faster programs development in comparison with the traditional low-level compiled
More informationTask Automation. Anthony Scemama Labratoire de Chimie et Physique Quantiques IRSAMC (Toulouse)
Task Automation Anthony Scemama Labratoire de Chimie et Physique Quantiques IRSAMC (Toulouse) Introduction Many common tasks are repetitive Computers are better than humans
More informationProgramming Languages
Programming Languages Tevfik Koşar Lecture - VIII February 9 th, 2006 1 Roadmap Allocation techniques Static Allocation Stack-based Allocation Heap-based Allocation Scope Rules Static Scopes Dynamic Scopes
More informationGrade Weights. Language Design and Overview of COOL. CS143 Lecture 2. Programming Language Economics 101. Lecture Outline
Grade Weights Language Design and Overview of COOL CS143 Lecture 2 Project 0% I, II 10% each III, IV 1% each Midterm 1% Final 2% Written Assignments 10% 2.% each Prof. Aiken CS 143 Lecture 2 1 Prof. Aiken
More informationClasses and Objects 3/28/2017. How can multiple methods within a Java class read and write the same variable?
Peer Instruction 8 Classes and Objects How can multiple methods within a Java class read and write the same variable? A. Allow one method to reference a local variable of the other B. Declare a variable
More informationDate Lesson Text TOPIC Homework. SA of Prisms & Pyramids Pg. 441 # 1, 3, 5a, 7b, 11bc, 16. Surface Area of Cylinders WS 6.6
UNIT 6 MEASUREMENT Date Lesson Text TOPIC Homework May 6.1 8.1 May 4 6. 8. The Pythagorean Theorem Pg. 4 # 1ac, ac, ab, 4ac, 5, 7, 8, 10 Perimeter and Area (NO CIRCLES) Pg. 4 # 1acde, abdf,, 4, 11, 14,
More informationInheritance and object compatibility
Inheritance and object compatibility Object type compatibility An instance of a subclass can be used instead of an instance of the superclass, but not the other way around Examples: reference/pointer can
More informationChapter 8 ( ) Control Abstraction. Subprograms Issues related to subprograms How is control transferred to & from the subprogram?
Control Abstraction Chapter 8 (81 84) Control Abstraction: Subroutines and parameters Programmer defined control structures Subprograms Procedures Functions Coroutines Exception handlers Processes Subprograms
More informationSHAPE Returns the number of elements in each direction in an integer vector.
Chapter 5: Arrays An advantage fortran has over other programming languages is the ease with which it handles arrays. Because arrays are so easy to handle, fortran is an ideal choice when writing code
More informationA Brief Introduction to Fortran of 15
A Brief Introduction to Fortran 90 1 of 15 Data Types and Kinds Data types Intrisic data types (INTEGER, REAL,LOGICAL) derived data types ( structures or records in other languages) kind parameter (or
More informationChapter 10. Implementing Subprograms
Chapter 10 Implementing Subprograms Chapter 10 Topics The General Semantics of Calls and Returns Implementing Simple Subprograms Implementing Subprograms with Stack-Dynamic Local Variables Nested Subprograms
More informationOld Questions Name: a. if b. open c. output d. write e. do f. exit
Old Questions Name: Part I. Multiple choice. One point each. 1. Which of the following is not a Fortran keyword? a. if b. open c. output d. write e. do f. exit 2. How many times will the code inside the
More information