container.f90 (561B)
1 submodule (parent) container 2 implicit none 3 4 contains 5 6 module procedure init 7 p%mother = mother 8 p%father = father 9 end procedure init 10 11 module subroutine harmonize(p) 12 type(parent_type), intent(inout) :: p 13 real :: avg 14 15 avg = 0.5 * (p%father + p%mother) 16 p%father = avg 17 p%mother = avg 18 end subroutine harmonize 19 20 module function parent_weight(p) result(w) 21 type(parent_type), intent(in) :: p 22 real :: w 23 24 w = p%mother**2 + p%father**2 25 end function parent_weight 26 27 end submodule container