2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 09:57:15 +01:00
waf/demos/fortran/submodules/container.f90

28 lines
561 B
Fortran
Raw Permalink Normal View History

submodule (parent) container
implicit none
contains
module procedure init
p%mother = mother
p%father = father
end procedure init
module subroutine harmonize(p)
type(parent_type), intent(inout) :: p
real :: avg
avg = 0.5 * (p%father + p%mother)
p%father = avg
p%mother = avg
end subroutine harmonize
module function parent_weight(p) result(w)
type(parent_type), intent(in) :: p
real :: w
w = p%mother**2 + p%father**2
end function parent_weight
end submodule container