moved a function
This commit is contained in:
parent
67c606db47
commit
c3c6caafb8
@ -1,7 +1,7 @@
|
||||
!-----------------------------------------------------------------------
|
||||
!
|
||||
! project "gravity field"
|
||||
!
|
||||
!-
|
||||
! test program for the project "gravity field"
|
||||
!-
|
||||
!-----------------------------------------------------------------------
|
||||
program essai
|
||||
use realfield
|
||||
@ -64,33 +64,6 @@ subroutine build_and_write_a_field(szx, szy, moon, fname)
|
||||
|
||||
end subroutine
|
||||
|
||||
!-----------------------------------------------------------------------
|
||||
!-
|
||||
! Compute the gravity field in a pre-allocated array relative
|
||||
! to the massbody 'moon'. Nobody know where the magic number
|
||||
! come from, sorry.
|
||||
!-
|
||||
subroutine compute_a_field(field, moon)
|
||||
real, dimension(:,:), intent(out) :: field
|
||||
type(massbody), intent(in) :: moon
|
||||
|
||||
integer :: ix, iy
|
||||
real :: fx, fy
|
||||
real :: grav
|
||||
|
||||
! print *, "pic size ", ubound(field, 1), "W", ubound(field, 2), "H"
|
||||
! print *, "mass body ", moon
|
||||
|
||||
do ix=1, ubound(field, 1)
|
||||
fx = real(ix)
|
||||
do iy=1, ubound(field, 2)
|
||||
fy = real(iy)
|
||||
grav = compute_gravity(fx, fy, moon)
|
||||
field(ix,iy) = grav
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
!-----------------------------------------------------------------------
|
||||
!-----------------------------------------------------------------------
|
||||
|
||||
|
@ -36,6 +36,34 @@ function compute_gravity(fx, fy, body)
|
||||
end function
|
||||
|
||||
!-----------------------------------------------------------------------
|
||||
!-
|
||||
! Compute the gravity field in a pre-allocated array relative
|
||||
! to the massbody 'moon'. Nobody know where the magic number
|
||||
! come from, sorry.
|
||||
!-
|
||||
subroutine compute_a_field(field, moon)
|
||||
real, dimension(:,:), intent(out) :: field
|
||||
type(massbody), intent(in) :: moon
|
||||
|
||||
integer :: ix, iy
|
||||
real :: fx, fy
|
||||
real :: grav
|
||||
|
||||
! print *, "pic size ", ubound(field, 1), "W", ubound(field, 2), "H"
|
||||
! print *, "mass body ", moon
|
||||
|
||||
do ix=1, ubound(field, 1)
|
||||
fx = real(ix)
|
||||
do iy=1, ubound(field, 2)
|
||||
fy = real(iy)
|
||||
grav = compute_gravity(fx, fy, moon)
|
||||
field(ix,iy) = grav
|
||||
enddo
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
!-----------------------------------------------------------------------
|
||||
|
||||
!-----------------------------------------------------------------------
|
||||
|
||||
end module
|
||||
|
Loading…
Reference in New Issue
Block a user