MULTIPLE MODULES: Introduce interfaces for procedure pointers.
This change allows the code to be compiled with the PGI compilers, and at the same time does not affect the compilation with the GNU compilers. Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
parent
ec1274541b
commit
0a71fbc697
@ -61,26 +61,72 @@ module equations
|
||||
integer , save :: imi, imc, imf, imm, imp, imb
|
||||
#endif /* PROFILE */
|
||||
|
||||
! the number of independent variables
|
||||
!
|
||||
integer(kind=4) , save :: nv = 0
|
||||
|
||||
! interfaces for procedure pointers
|
||||
!
|
||||
interface
|
||||
subroutine prim2cons_iface(n, q, u)
|
||||
import :: nv
|
||||
integer , intent(in) :: n
|
||||
real(kind=8), dimension(nv,n), intent(in) :: q
|
||||
real(kind=8), dimension(nv,n), intent(out) :: u
|
||||
end subroutine
|
||||
subroutine cons2prim_iface(n, u, q)
|
||||
import :: nv
|
||||
integer , intent(in) :: n
|
||||
real(kind=8), dimension(nv,n), intent(in) :: u
|
||||
real(kind=8), dimension(nv,n), intent(out) :: q
|
||||
end subroutine
|
||||
subroutine fluxspeed_iface(n, q, u, f, cm, cp)
|
||||
import :: nv
|
||||
integer , intent(in) :: n
|
||||
real(kind=8), dimension(nv,n) , intent(in) :: q, u
|
||||
real(kind=8), dimension(nv,n) , intent(out) :: f
|
||||
real(kind=8), dimension(n) , optional, intent(out) :: cm, cp
|
||||
end subroutine
|
||||
function maxspeed_iface(qq) result(maxspeed)
|
||||
use coordinates, only : im, jm, km
|
||||
import :: nv
|
||||
real(kind=8), dimension(nv,im,jm,km), intent(in) :: qq
|
||||
real(kind=8) :: maxspeed
|
||||
end function
|
||||
subroutine esystem_roe_iface(x, y, q, c, r, l)
|
||||
import :: nv
|
||||
real(kind=8) , intent(in) :: x, y
|
||||
real(kind=8), dimension(nv) , intent(in) :: q
|
||||
real(kind=8), dimension(nv) , intent(inout) :: c
|
||||
real(kind=8), dimension(nv,nv), intent(inout) :: l, r
|
||||
end subroutine
|
||||
subroutine nr_iterate_iface(mm, bb, mb, en, dn, w, vv, info)
|
||||
real(kind=8), intent(in) :: mm, bb, mb, en, dn
|
||||
real(kind=8), intent(inout) :: w, vv
|
||||
logical , intent(out) :: info
|
||||
end subroutine
|
||||
end interface
|
||||
|
||||
! pointers to the conversion procedures
|
||||
!
|
||||
procedure(prim2cons_hd_iso) , pointer, save :: prim2cons => null()
|
||||
procedure(cons2prim_hd_iso) , pointer, save :: cons2prim => null()
|
||||
procedure(prim2cons_iface) , pointer, save :: prim2cons => null()
|
||||
procedure(cons2prim_iface) , pointer, save :: cons2prim => null()
|
||||
|
||||
! pointer to the flux procedure
|
||||
!
|
||||
procedure(fluxspeed_hd_iso) , pointer, save :: fluxspeed => null()
|
||||
procedure(fluxspeed_iface) , pointer, save :: fluxspeed => null()
|
||||
|
||||
! pointer to the maxspeed procedure
|
||||
!
|
||||
procedure(maxspeed_hd_iso) , pointer, save :: maxspeed => null()
|
||||
procedure(maxspeed_iface) , pointer, save :: maxspeed => null()
|
||||
|
||||
! pointer to the Roe eigensystem procedure
|
||||
!
|
||||
procedure(esystem_roe_hd_iso), pointer, save :: eigensystem_roe => null()
|
||||
procedure(esystem_roe_iface), pointer, save :: eigensystem_roe => null()
|
||||
|
||||
! pointer to the variable conversion method
|
||||
!
|
||||
procedure(nr_iterate_srhd_adi_1dw), pointer, save :: nr_iterate => null()
|
||||
procedure(nr_iterate_iface) , pointer, save :: nr_iterate => null()
|
||||
|
||||
! the system of equations and the equation of state
|
||||
!
|
||||
@ -91,10 +137,6 @@ module equations
|
||||
!
|
||||
character(len=32), save :: c2p = "1Dw"
|
||||
|
||||
! the number of independent variables
|
||||
!
|
||||
integer(kind=4) , save :: nv = 0
|
||||
|
||||
! direction indices
|
||||
!
|
||||
integer(kind=4) , save :: inx = 1, iny = 2, inz = 3
|
||||
|
@ -47,9 +47,16 @@ module evolution
|
||||
integer , save :: imi, ima, imt, imu, imf, iui, imv
|
||||
#endif /* PROFILE */
|
||||
|
||||
! interfaces for procedure pointers
|
||||
!
|
||||
abstract interface
|
||||
subroutine evolve_iface()
|
||||
end subroutine
|
||||
end interface
|
||||
|
||||
! pointer to the temporal integration subroutine
|
||||
!
|
||||
procedure(evolve_euler), pointer, save :: evolve => null()
|
||||
procedure(evolve_iface), pointer, save :: evolve => null()
|
||||
|
||||
! evolution parameters
|
||||
!
|
||||
|
@ -50,9 +50,19 @@ module gravity
|
||||
!
|
||||
logical, save :: gravity_enabled = .false.
|
||||
|
||||
! interfaces for procedure pointers
|
||||
!
|
||||
abstract interface
|
||||
subroutine gacc_iface(t, dt, x, y, z, acc)
|
||||
real(kind=8) , intent(in) :: t, dt
|
||||
real(kind=8) , intent(in) :: x, y, z
|
||||
real(kind=8), dimension(3), intent(out) :: acc
|
||||
end subroutine
|
||||
end interface
|
||||
|
||||
! pointer to the gravitational acceleration subroutine
|
||||
!
|
||||
procedure(gacc_none), pointer, save :: gravitational_acceleration => null()
|
||||
procedure(gacc_iface), pointer, save :: gravitational_acceleration => null()
|
||||
|
||||
! by default everything is private
|
||||
!
|
||||
|
@ -47,13 +47,35 @@ module interpolations
|
||||
integer , save :: imi, imr, imf, imc
|
||||
#endif /* PROFILE */
|
||||
|
||||
! interfaces for procedure pointers
|
||||
!
|
||||
abstract interface
|
||||
subroutine interfaces_iface(positive, h, q, qi)
|
||||
use coordinates, only : im , jm , km
|
||||
logical , intent(in) :: positive
|
||||
real(kind=8), dimension(NDIMS) , intent(in) :: h
|
||||
real(kind=8), dimension(im,jm,km) , intent(in) :: q
|
||||
real(kind=8), dimension(im,jm,km,2,NDIMS), intent(out) :: qi
|
||||
end subroutine
|
||||
subroutine reconstruct_iface(n, h, f, fl, fr)
|
||||
integer , intent(in) :: n
|
||||
real(kind=8) , intent(in) :: h
|
||||
real(kind=8), dimension(n), intent(in) :: f
|
||||
real(kind=8), dimension(n), intent(out) :: fl, fr
|
||||
end subroutine
|
||||
function limiter_iface(x, a, b) result(c)
|
||||
real(kind=8), intent(in) :: x, a, b
|
||||
real(kind=8) :: c
|
||||
end function
|
||||
end interface
|
||||
|
||||
! pointers to the reconstruction and limiter procedures
|
||||
!
|
||||
procedure(interfaces_tvd) , pointer, save :: interfaces => null()
|
||||
procedure(reconstruct) , pointer, save :: reconstruct_states => null()
|
||||
procedure(limiter_zero) , pointer, save :: limiter_tvd => null()
|
||||
procedure(limiter_zero) , pointer, save :: limiter_prol => null()
|
||||
procedure(limiter_zero) , pointer, save :: limiter_clip => null()
|
||||
procedure(interfaces_iface) , pointer, save :: interfaces => null()
|
||||
procedure(reconstruct_iface) , pointer, save :: reconstruct_states => null()
|
||||
procedure(limiter_iface) , pointer, save :: limiter_tvd => null()
|
||||
procedure(limiter_iface) , pointer, save :: limiter_prol => null()
|
||||
procedure(limiter_iface) , pointer, save :: limiter_clip => null()
|
||||
|
||||
! module parameters
|
||||
!
|
||||
|
@ -53,13 +53,31 @@ module schemes
|
||||
!
|
||||
logical , save :: states_4vec = .false.
|
||||
|
||||
! interfaces for procedure pointers
|
||||
!
|
||||
abstract interface
|
||||
subroutine update_flux_iface(dx, q, f)
|
||||
use coordinates , only : im, jm, km
|
||||
use equations , only : nv
|
||||
real(kind=8), dimension(NDIMS) , intent(in) :: dx
|
||||
real(kind=8), dimension( nv,im,jm,km), intent(in) :: q
|
||||
real(kind=8), dimension(NDIMS,nv,im,jm,km), intent(out) :: f
|
||||
end subroutine
|
||||
subroutine riemann_iface(n, ql, qr, f)
|
||||
use equations, only : nv
|
||||
integer , intent(in) :: n
|
||||
real(kind=8), dimension(nv,n), intent(inout) :: ql, qr
|
||||
real(kind=8), dimension(nv,n), intent(out) :: f
|
||||
end subroutine
|
||||
end interface
|
||||
|
||||
! pointer to the flux update procedure
|
||||
!
|
||||
procedure(update_flux_hd_iso), pointer, save :: update_flux => null()
|
||||
procedure(update_flux_iface), pointer, save :: update_flux => null()
|
||||
|
||||
! pointer to the Riemann solver
|
||||
!
|
||||
procedure(riemann_hd_iso_hll), pointer, save :: riemann => null()
|
||||
procedure(riemann_iface) , pointer, save :: riemann => null()
|
||||
|
||||
! by default everything is private
|
||||
!
|
||||
|
Loading…
x
Reference in New Issue
Block a user