-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTestClass.f90
More file actions
50 lines (42 loc) · 1.23 KB
/
Copy pathTestClass.f90
File metadata and controls
50 lines (42 loc) · 1.23 KB
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
module TestClassModule
use ErrorCriteriaModule
use ErrorInstanceModule
use ResultModule
implicit none
private
type, public :: TestClass
real :: stuff
type(ErrorCriteria) :: EH
contains
procedure, public :: init
procedure, public :: setStuff
procedure, public :: getStuff
procedure, public :: squareRoot
end type
contains
subroutine init(this)
class(TestClass) :: this
call this%EH%init()
end subroutine
subroutine setStuff(this, newStuff)
class(TestClass) :: this
real :: newStuff
this%stuff = newStuff
end subroutine
function getStuff(this) result(stuff)
class(TestClass) :: this
real :: stuff
stuff = this%stuff
end function
function squareRoot(this, input) result(r)
class(TestClass) :: this
real :: input
type(ErrorInstance) :: error
type(Result0D) :: r
error = this%EH%positive(input)
r = Result( &
data = sqrt(input), &
error = error &
)
end function
end module