{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture_notes_summary4

# Lecture_notes_summary4 - Chapter 5 Object Oriented...

This preview shows pages 1–3. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Chapter 5 Object Oriented Programming 5.1 Derived Types They are a way to group connected variables. Where you declare variables you make up your own data type Derived Type ex1 TYPE COORDINATES REAL ( KIND =dp) : : x , y , z END TYPE COORDINATES TYPE (COORDINATES) : : point1 , point2 point1%x=1.0 point1%y=2.0 point1%z=3.0 write ( ∗ , ∗ ) point1 point2=coordinates ( 4. 0 , 5. 0 , 6. 0) write ( ∗ , ∗ ) point2 5.2 Modules In general Modules have the form General Module Structure MODULE module name s t a t i c data d e f i n i t i o n s CONTAINS functions , subroutines and i n t e r f a c e s ENDMODULE module name double example double.f90 MODULE double IMPLICIT NONE INTEGER , PARAMETER : : DP = SELECTED REAL KIND(P=15) ENDMODULE double Now in your main program you start 13 MAT 5939-03 Pierre Garreau main.f90 Program main use double IMPLICIT NONE . . . 5.3 Interfaces So now we know the major two features of modules. We can organize data and functions. Now lets learn about interfaces which will make this module easier to use. So to do this we first need two functions. We’ll make twointerfaces which will make this module easier to use....
View Full Document

{[ snackBarMessage ]}

### Page1 / 4

Lecture_notes_summary4 - Chapter 5 Object Oriented...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online