7. 정리 및 추가 용법. 7. 1 변수의 선언 Static variables Five intrinsic fortran data: integer, real, logical, character, complex Derived data types Type point Real::

Slides:



Advertisements
Similar presentations
Things that Come in Arrays
Advertisements

879 CISC Parallel Computation High Performance Fortran (HPF) Ibrahim Halil Saruhan Although the [Fortran] group broke new ground …
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.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 2: Data types and addressing modes dr.ir. A.C. Verschueren.
Fortran Jordan Martin Steven Devine. Background Developed by IBM in the 1950s Designed for use in scientific and engineering fields Originally written.
Chapter 7:: Data Types Programming Language Pragmatics
Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved Floating-point Numbers.
The new features of Fortran 2003 David Muxworthy BSI Fortran Convenor.
Computational Methods of Scientific Programming Lecturers Thomas A Herring, Room A, Chris Hill, Room ,
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.
ICE1341 Programming Languages Spring 2005 Lecture #14 Lecture #14 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
Scientific Programming if( m.eq. 0 ) go to 40 do 30 i = 1,m dtemp = dx(i) dx(i) = dy(i) dy(i) = dtemp 30 continue if( n.lt. 3 ) return 40 mp1 = m + 1 do.
CHAPTER 8 ARRAYS  An array is a group of storage locations (elements) that have the same name.  The element of an array is distinguished by using the.
FORTRAN Short Course Week 2 Kate Thayer-Calder February 23, 2009.
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.
Chapter 11 Additional Intrinsic Data Types Dr. Ali Can Takinacı İstanbul Technical University Faculty of Naval Architecture and Ocean Engineering İstanbul.
Mixing Objects of Different Types Mixed Type Numeric Expressions Mixed Type Assignment Integer Division.
ISBN Chapter 6 Data Types. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.6-2 Figure 6.1 IEEE floating-point formats: (a)
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 3 Programming and Software.
Chapter 8 ARRAYS. 2 Array subscript expressions  Each subscript in an array element designator is an expression of integer type. It need not be a constant.
FORTRAN.  Fortran or FORmula TRANslation was developed in the 1950's by IBM as an alternative to Assembly Language. First successfull high level language.
3. Basic Imperative Programming Elements HTML version.
Introduction to Fortran 90 Si Liu July 19, 2010 NCAR/CISL/OSD/HSS Consulting Services Group.
Structured Data Types. Date Types We have seen various data types –Integer, Real, Character, Logical All these types define data values of different kinds.
Operations on data CHAPTER 4.
Generalized I/O. Mystery of stars I/O statements took the form read *, x, y,z print *, a,b,c Such I/O is said to be List-directed or in free format user.
Fortran: Specification Statements Session Six ICoCSIS.
1 Week 12 Arrays, vectors, matrices and cubes. Introduction to Scientific & Engineering Computing 2 Array subscript expressions n Each subscript in an.
Fortran: Program Units and Procedures Session Four ICoCSIS.
Multi-Dimensional Arrays
April 14, ICE 1341 – Programming Languages (Lecture #13) In-Young Ko Programming Languages (ICE 1341) Lecture #13 Programming Languages (ICE 1341)
C Tokens Identifiers Keywords Constants Operators Special symbols.
Scientific Computing Division A tutorial Introduction to Fortran Siddhartha Ghosh Consulting Services Group.
FORTRAN FORmula TRANslator -Anand Trivedi. HISTORY  Designed and written from scratch in by an IBM team lead by John W. Backus as the first.
How to Write a Fortran Jiffy (C)2005 Mark Rould University of Vermont.
I Power Int 2 Computing Software Development High Level Language Constructs.
Fortran 90, 95, and Fortran 90 ● Generalities: format changes, portable numerics ● Arrays: syntax, classes of arrays, dynamic storage ● Structures.
October 15, 2008HDF and HDF-EOS Workshop XII1 What will be new in HDF5?
1 Serial Run-time Error Detection and the Fortran Standard Glenn Luecke Professor of Mathematics, and Director, High Performance Computing Group Iowa State.
Some Fortran programming tips ATM 562 Fall 2015 Fovell (see also PDF file on class page) 1.
CHAPTER 9 MUTIDIMENSIONAL ARRAYS. Introduction to multidimensional Arrays and Multiply subscripted variables.
Other data types. Standard type sizes b Most machines store integers and reals in 4 bytes (32 bits) b Integers run from -2,147,483,648 to 2,147,483,647.
I Power Higher Computing Software Development High Level Language Constructs.
Beginning Fortran Fortran (77) Advanced 29 October 2009 *Black text on white background provided for easy printing.
Compilation Technology SCINET compiler workshop | February 17-18, 2009 © 2009 IBM Corporation Software Group Fortran 2003 Jim Xia IBM Toronto Lab
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Lecture III Start programming in Fortran Yi Lin Jan 11, 2007.
FORTRAN History. FORTRAN - Interesting Facts n FORTRAN is the oldest Language actively in use today. n FORTRAN is still used for new software development.
1 Data Types Primitive Data Types Character String Types User-Defined Ordinal Types Array Types Associative Arrays Record Types Union Types Pointer Types.
FORTRAN 90+ Yetmen Wang Fortran 90/95/2000 INTRODUCTION FORTRAN VERSIONS PROGRAM STRUCTURE NEW SOURCE FORM OO PROGRAMMING ARRAY PROGRAMMING SIGNIFICANT.
Fortran MATTHEW CARSON. History of FORTRAN FORTRAN ; First High Level Language FORTRAN I 1957; First Compiled Language FORTRAN II ; Independent.
More on F90 Outline: I.Parameter statements II.Comments III.Program layout-- execution part IV.if/then/else V.Case statements VI.do loops VII.goto VIII.Intrinsic.
19 - 2/25/2000AME 150L1 Solving Systems of Linear Equations.
Structures or Derived Types. Real Life Objects Often structured –Students, Employees, Cars, Accounts, Cricket matches, flats etc contain heterogeneous.
 Data Type is a basic classification which identifies different types of data.  Data Types helps in: › Determining the possible values of a variable.
Introduction to Fortran95 Programming Part II By Deniz Savas, CiCS, 2007
Click to edit Master title style Click to edit Master text styles –Second level Third level –Fourth level »Fifth level 1 Fundamentals of Programming Most.
Fortran Tutorial Fortran spaces for code qqqqqqCODE
소재수치해석 HW#3: Solve linear equations by inverse matrix
Alberto Fassò Endre Futó
Array processing and Matrix manipulation
Introduction to FORTRAN
Complex Data Types One very important measure of the “goodness” of a PL is the capability of its data types to model the problem space variables Design.
By Deniz Savas, CiCS, Shef. Univ., 2015
Chapter 6 Data Types.
FILE PROCESSING Opening Files Why Files?
Numerical Integration
Array processing and Matrix manipulation
Lecture 7: Types (Revised based on the Tucker’s slides) 10/4/2019
Presentation transcript:

7. 정리 및 추가 용법

7. 1 변수의 선언 Static variables Five intrinsic fortran data: integer, real, logical, character, complex Derived data types Type point Real:: x, y, z End type point type(point):: center, apex apex%x=0.0 apex%y=1.0 apex%z=2.0 Pointer 자료를 전혀 갖지 않는 대신에 다른 변수의 메모리의 주소를 가짐 Real, pointer:: p1 Real, target:: aa P1=> aa

kind Real value: mantissa, exponent 로 구성 Mantissa: 상수의 precision 을 결정함, 유효숫자 Exponent: 상수의 범위를 결정함 32bit 중 24bit 에는 mantissa 를 8bit 는 exponent 에 할당 System 마다 real 의 범위가 다른데 PC 의 경우 Mantissa: 6, exponent=7 Exponent range: to Double precision 으로 바꾸고 싶은 경우 kind 를 사용 Real(kind=2):: var

System 마다 kind 의 값이 다름 해당 시스템의 kind 의 값을 확인하는 방법 Kind_number=selected_real_kind (p=6, r=37) Real format rFw.d rEw.d : 지수형으로 씀  0.ddddE  ee w  d+7

7.2 Dimension ( 배열 ) A(1,1)A(1,2)A(1,3)A(1,4) A(2,1)A(2,2)A(2,3)A(2,4) A(3,1)A(3,2)A(3,3)A(3,4) row1 Column 1 row2 row3 A(1,1), A(2,1), A(3,1), A(1, 2), A(2,2), A(3,2), …………….

7.3 Procedures 1)Subroutine aaa(argument list) 2)Module : 독립적으로 compile 됨 sharing data module module procedure : contain subroutine 3) Function 하나의 값만 줌 intrinsic function 들 sin(a), exp(a),log(a), log10(a), mod(a,b) maxloc(array), maxval(array)

7.4 Where Where (mask expression) Statement Elsewhere Statement End where Where (value >0) Logval=log(value) Elsewhere logval=-999. End where Value 와 logval 은 배열임 Do i=1, ndim1 Do j=1, ndim2 If(value(I,j) >0 ) then Logval(I,j)=log(value(I,j)) Else Logval( I,j)=-999. Endif Enddo

7.5 Forall Forall (i=1:n, j=1:m, logical expression) Statement End forall Example Forall (i=1:n, j=1:m, work(I,j)/=0) Work(I,j)=1./work(I,j) End forall Do i=1, n do j=1,m if(work(I,j) /=0) then work(I,j)=1./work(I,j) Endif enddo

7.6 Allocatable array Real, allocatable, dimension(:,:) :: arr1 Allocate(list of arrays to allocate, stat=status) Deallocate(list of arrays to allocate, stat=status) Allocate(arr1(100,100), stat=status) Deallocate(arr1, stat=status)

7.7 파일 열기 닫기 Open(unit, file=‘filename’,status=‘unknown’, iostat=ierror) Open(unit, file=‘test.dat’, form=‘unformatted’, status=‘old’, &access=‘direct’, recl=40) Close(unit) Rewind(unit) : 다시 자료를 처음 줄로 옮김 Backspace(unit): 자료를 한 record 이전으로 옮김 Read(unit, *) : 10 번 파일을 unformat 으로 Read(unit, *, end=999) : 자료를 다 읽으면 999 로 감