MESH, PROBLEMS: Move procedure pointer to MESH.
This inverts the dependencies allowing for initiating module MESH from PROBLEMS. Signed-off-by: Grzegorz Kowal <grzegorz@amuncode.org>
This commit is contained in:
parent
384e1ab3d6
commit
40f3e24631
@ -28,18 +28,12 @@
|
|||||||
module mesh
|
module mesh
|
||||||
|
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
! import external subroutines
|
|
||||||
!
|
|
||||||
use timers, only : set_timer, start_timer, stop_timer
|
use timers, only : set_timer, start_timer, stop_timer
|
||||||
#endif /* PROFILE */
|
#endif /* PROFILE */
|
||||||
|
|
||||||
! module variables are not implicit by default
|
|
||||||
!
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
! timer indices
|
|
||||||
!
|
|
||||||
integer , save :: imi, ims, img, imu, ima, imp, imr
|
integer , save :: imi, ims, img, imu, ima, imp, imr
|
||||||
#endif /* PROFILE */
|
#endif /* PROFILE */
|
||||||
|
|
||||||
@ -51,9 +45,22 @@ module mesh
|
|||||||
end subroutine
|
end subroutine
|
||||||
end interface
|
end interface
|
||||||
|
|
||||||
|
! interfaces for the problem setup
|
||||||
|
!
|
||||||
|
abstract interface
|
||||||
|
subroutine setup_problem_iface(pdata)
|
||||||
|
use blocks, only : block_data
|
||||||
|
type(block_data), pointer, intent(inout) :: pdata
|
||||||
|
end subroutine
|
||||||
|
end interface
|
||||||
|
|
||||||
! pointer to the problem domain setup subroutine
|
! pointer to the problem domain setup subroutine
|
||||||
!
|
!
|
||||||
procedure(setup_domain_iface), pointer, save :: setup_domain => null()
|
procedure(setup_domain_iface) , pointer, save :: setup_domain => null()
|
||||||
|
|
||||||
|
! pointer to the problem initial setup subroutine
|
||||||
|
!
|
||||||
|
procedure(setup_problem_iface), pointer, save :: setup_problem => null()
|
||||||
|
|
||||||
! the handler of the mesh statistics file
|
! the handler of the mesh statistics file
|
||||||
!
|
!
|
||||||
@ -72,6 +79,7 @@ module mesh
|
|||||||
public :: initialize_mesh, finalize_mesh, print_mesh
|
public :: initialize_mesh, finalize_mesh, print_mesh
|
||||||
public :: generate_mesh, update_mesh
|
public :: generate_mesh, update_mesh
|
||||||
public :: redistribute_blocks, store_mesh_stats
|
public :: redistribute_blocks, store_mesh_stats
|
||||||
|
public :: setup_problem
|
||||||
|
|
||||||
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
!
|
!
|
||||||
@ -230,6 +238,8 @@ module mesh
|
|||||||
|
|
||||||
status = 0
|
status = 0
|
||||||
|
|
||||||
|
nullify(setup_problem)
|
||||||
|
|
||||||
if (master) close(funit)
|
if (master) close(funit)
|
||||||
|
|
||||||
call finalize_refinement(status)
|
call finalize_refinement(status)
|
||||||
@ -301,7 +311,6 @@ module mesh
|
|||||||
use helpers , only : print_section
|
use helpers , only : print_section
|
||||||
use iso_fortran_env, only : error_unit
|
use iso_fortran_env, only : error_unit
|
||||||
use mpitools , only : master, nproc, nprocs, npmax, nodes, lprocs
|
use mpitools , only : master, nproc, nprocs, npmax, nodes, lprocs
|
||||||
use problems , only : setup_problem
|
|
||||||
use refinement , only : check_refinement_criterion
|
use refinement , only : check_refinement_criterion
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
|
@ -32,46 +32,20 @@
|
|||||||
module problems
|
module problems
|
||||||
|
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
! include external procedures
|
|
||||||
!
|
|
||||||
use timers, only : set_timer, start_timer, stop_timer
|
use timers, only : set_timer, start_timer, stop_timer
|
||||||
#endif /* PROFILE */
|
#endif /* PROFILE */
|
||||||
|
|
||||||
! module variables are not implicit by default
|
|
||||||
!
|
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
! timer indices
|
|
||||||
!
|
|
||||||
integer, save :: imi, imu
|
integer, save :: imi, imu
|
||||||
#endif /* PROFILE */
|
#endif /* PROFILE */
|
||||||
|
|
||||||
! problem name
|
|
||||||
!
|
|
||||||
character(len=64), save :: problem_name = "none"
|
character(len=64), save :: problem_name = "none"
|
||||||
|
|
||||||
! interfaces for procedure pointers
|
|
||||||
!
|
|
||||||
abstract interface
|
|
||||||
subroutine setup_problem_iface(pdata)
|
|
||||||
use blocks, only : block_data
|
|
||||||
type(block_data), pointer, intent(inout) :: pdata
|
|
||||||
end subroutine
|
|
||||||
end interface
|
|
||||||
|
|
||||||
! pointer to the problem setup subroutine
|
|
||||||
!
|
|
||||||
procedure(setup_problem_iface), pointer, save :: setup_problem => null()
|
|
||||||
|
|
||||||
! by default everything is private
|
|
||||||
!
|
|
||||||
private
|
private
|
||||||
|
|
||||||
! declare public subroutines
|
|
||||||
!
|
|
||||||
public :: initialize_problems, finalize_problems
|
public :: initialize_problems, finalize_problems
|
||||||
public :: setup_problem
|
|
||||||
public :: problem_name
|
public :: problem_name
|
||||||
|
|
||||||
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
@ -102,6 +76,7 @@ module problems
|
|||||||
!
|
!
|
||||||
subroutine initialize_problems(problem, rcount, verbose, status)
|
subroutine initialize_problems(problem, rcount, verbose, status)
|
||||||
|
|
||||||
|
use mesh , only : setup_problem
|
||||||
use parameters , only : get_parameter
|
use parameters , only : get_parameter
|
||||||
use user_problem, only : initialize_user_problem, setup_user_problem
|
use user_problem, only : initialize_user_problem, setup_user_problem
|
||||||
|
|
||||||
@ -111,7 +86,7 @@ module problems
|
|||||||
integer , intent(in) :: rcount
|
integer , intent(in) :: rcount
|
||||||
logical , intent(in) :: verbose
|
logical , intent(in) :: verbose
|
||||||
integer , intent(out) :: status
|
integer , intent(out) :: status
|
||||||
!
|
|
||||||
!-------------------------------------------------------------------------------
|
!-------------------------------------------------------------------------------
|
||||||
!
|
!
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
@ -186,7 +161,7 @@ module problems
|
|||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer, intent(out) :: status
|
integer, intent(out) :: status
|
||||||
!
|
|
||||||
!-------------------------------------------------------------------------------
|
!-------------------------------------------------------------------------------
|
||||||
!
|
!
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
@ -195,8 +170,6 @@ module problems
|
|||||||
|
|
||||||
status = 0
|
status = 0
|
||||||
|
|
||||||
nullify(setup_problem)
|
|
||||||
|
|
||||||
call finalize_user_problem(status)
|
call finalize_user_problem(status)
|
||||||
|
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user