-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmisc.f90
More file actions
57 lines (56 loc) · 2.22 KB
/
misc.f90
File metadata and controls
57 lines (56 loc) · 2.22 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
51
52
53
54
55
56
57
Module mMisc
!Tue a module for small usefull routines that doesn't fit in anywhere else, but is used through different modules
implicit none
interface LoadOptionalParam
module procedure LoadOptionalParam_int, LoadOptionalParam_real, LoadOptionalParam_real2
end interface
contains
Function LoadOptionalParam_int(DefaultValue,iParam)
!Tue Dec, 2014
!This function is used to load optional parameters
!IO
!DefaultValue -> A default value which we load if the optional parameter does not exist.
!iParam -> the optional parameter that we want to load
implicit none
integer, intent(in) :: DefaultValue
integer, intent(in),optional :: iParam
integer :: LoadOptionalParam_int
if(present(iParam)) then
LoadOptionalParam_int=iParam
else
LoadOptionalParam_int=DefaultValue
end if
end function LoadOptionalParam_int
Function LoadOptionalParam_real(DefaultValue,iParam)
!Tue Dec, 2014
!This function is used to load optional parameters
!IO
!DefaultValue -> A default value which we load if the optional parameter does not exist.
!iParam -> the optional parameter that we want to load
implicit none
real*8, intent(in) :: DefaultValue
real*8, intent(in),optional :: iParam
real*8 :: LoadOptionalParam_real
if(present(iParam)) then
LoadOptionalParam_real=iParam
else
LoadOptionalParam_real=DefaultValue
end if
end function LoadOptionalParam_real
Function LoadOptionalParam_real2(DefaultValue,iParam)
!Tue Dec, 2014
!This function is used to load optional parameters
!IO
!DefaultValue -> A default value which we load if the optional parameter does not exist.
!iParam -> the optional parameter that we want to load
implicit none
integer, intent(in) :: DefaultValue
real*8, intent(in),optional :: iParam
real*8 :: LoadOptionalParam_real2
if(present(iParam)) then
LoadOptionalParam_real2=iParam
else
LoadOptionalParam_real2=DefaultValue
end if
end function LoadOptionalParam_real2
end module mMisc