From a8eea82f96a006a5e456a330babab91dacf4c12d Mon Sep 17 00:00:00 2001 From: CFLAG Date: Thu, 2 Nov 2023 10:14:20 +0100 Subject: [PATCH] Use decomp_2d_testing in io_visu.f90 (#278) * Update io_visu.f90 Use decomp_2d_testing * Fix previous commit Fix https://github.com/2decomp-fft/2decomp-fft/commit/0bd6de6f1a10647bf904702c89bf388b354655bf --- examples/io_test/io_visu.f90 | 46 ++++-------------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) diff --git a/examples/io_test/io_visu.f90 b/examples/io_test/io_visu.f90 index d88c3e9e..7cc82cd7 100644 --- a/examples/io_test/io_visu.f90 +++ b/examples/io_test/io_visu.f90 @@ -7,9 +7,10 @@ program visu use mpi use decomp_2d - use decomp_2d_mpi use decomp_2d_constants use decomp_2d_io + use decomp_2d_mpi + use decomp_2d_testing implicit none @@ -25,10 +26,7 @@ program visu logical :: dir_exists #endif - integer :: nargin, arg, FNLength, status, DecInd - integer :: i, j, k - integer :: ierr call init_example() @@ -45,7 +43,6 @@ subroutine init_example() integer :: resize_domain integer :: nranks_tot - character(len=80) :: InputFN call MPI_INIT(ierr) ! To resize the domain we need to know global number of ranks @@ -56,45 +53,12 @@ subroutine init_example() ny = ny_base * resize_domain nz = nz_base * resize_domain ! Now we can check if user put some inputs - ! Handle input file like a boss -- GD - nargin = command_argument_count() - if ((nargin == 0) .or. (nargin == 2) .or. (nargin == 5)) then - do arg = 1, nargin - call get_command_argument(arg, InputFN, FNLength, status) - read (InputFN, *, iostat=status) DecInd - if (arg == 1) then - p_row = DecInd - elseif (arg == 2) then - p_col = DecInd - elseif (arg == 3) then - nx = DecInd - elseif (arg == 4) then - ny = DecInd - elseif (arg == 5) then - nz = DecInd - end if - end do - else - ! nrank not yet computed we need to avoid write - ! for every rank - call MPI_COMM_RANK(MPI_COMM_WORLD, nrank, ierr) - if (nrank == 0) then - print *, "This Test takes no inputs or 2 inputs as" - print *, " 1) p_row (default=0)" - print *, " 2) p_col (default=0)" - print *, "or 5 inputs as" - print *, " 1) p_row (default=0)" - print *, " 2) p_col (default=0)" - print *, " 3) nx " - print *, " 4) ny " - print *, " 5) nz " - print *, "Number of inputs is not correct and the defult settings" - print *, "will be used" - end if - end if + call decomp_2d_testing_init(p_row, p_col, nx, ny, nz) call decomp_2d_init(nx, ny, nz, p_row, p_col) + call decomp_2d_testing_log() + call decomp_2d_io_init() call decomp_2d_init_io(io_name) call decomp_2d_register_variable(io_name, "u1.dat", 1, 0, output2D, mytype)