File: derived_types_02.f90

package info (click to toggle)
lfortran 0.59.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 56,736 kB
  • sloc: cpp: 168,052; f90: 74,272; python: 17,537; ansic: 7,705; yacc: 2,345; sh: 1,334; fortran: 895; makefile: 37; javascript: 15
file content (55 lines) | stat: -rw-r--r-- 1,151 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
module a
implicit none

integer, parameter :: r8 = kind(0.d0)

type :: B
end type

type C
endtype

type, extends(B), public :: X
    private
    real(r8) :: r1

    type(C), pointer :: cc => null()
    real(r8), pointer :: r2(:) => null(), r3(:) => null()
contains
    private
    procedure, private :: p1
    procedure(something), private :: p1b
    procedure, pass(self) :: p2
    procedure :: proc_1, proc_2
    generic :: operator(/=) => p5, p6
    generic :: operator(+) => p8
    generic :: operator(.in.) => p7
    generic :: operator(.dot.) => p10
    generic :: operator(/) => p11
    generic :: assignment(=) => p9
    generic, public :: calcCoeffs => calcCoeffsReal, calcCoeffsKPoint
    generic, private :: name => sample
    generic :: p1 => p2;
    generic, public :: write(formatted) => t_write
    generic :: read(unformatted) => t_read
    final :: y
end type X

type matrix(k, b)
    integer, kind :: k = 4
    integer(8), len :: b
    real(k) :: element(b, b)
endtype matrix

contains

subroutine p1(this)
class(X), intent(out) :: this
end subroutine

subroutine p2(this)
class(X), intent(inout) :: this
end subroutine


end module