Skip to content

Commit 96c6148

Browse files
committed
Put min and maxes into a derived type
1 parent 9f89155 commit 96c6148

File tree

6 files changed

+25
-5
lines changed

6 files changed

+25
-5
lines changed

src/common/m_helper.fpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ module m_helper
3535
associated_legendre, &
3636
spherical_harmonic_func, &
3737
double_factorial, &
38-
factorial
38+
factorial, &
39+
s_update_cell_extremes
3940

4041
contains
4142

@@ -577,4 +578,19 @@ contains
577578
578579
end function factorial
579580
581+
pure elemental subroutine s_update_cell_extremes(extreme, m, n, p)
582+
type(cell_num_bounds), intent(out) :: extreme
583+
integer, intent(in) :: m, n, p
584+
585+
extreme%mn_max = max(m, n)
586+
extreme%np_max = max(n, p)
587+
extreme%mp_max = max(m, p)
588+
extreme%mnp_max = max(m, n, p)
589+
extreme%mn_min = min(m, n)
590+
extreme%np_min = min(n, p)
591+
extreme%mp_min = min(m, p)
592+
extreme%mnp_min = min(m, n, p)
593+
594+
end subroutine s_update_cell_extremes
595+
580596
end module m_helper

src/common/m_mpi_common.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ contains
6767
& (m + 2*buff_size + 1)* &
6868
& (n + 2*buff_size + 1)* &
6969
& (p + 2*buff_size + 1)/ &
70-
& ((mnp_min + 2*buff_size + 1))
70+
& ((cells_bounds%mnp_min + 2*buff_size + 1))
7171
else
7272
halo_size = -1 + buff_size*(v_size)* &
73-
& (mn_max + 2*buff_size + 1)
73+
& (cells_bounds%mn_max + 2*buff_size + 1)
7474
end if
7575
else
7676
halo_size = -1 + buff_size*(v_size)

src/post_process/m_global_parameters.fpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ module m_global_parameters
1919

2020
use m_thermochem, only: num_species, species_names
2121

22+
use m_helper, only: s_update_cell_extremes
23+
2224
implicit none
2325

2426
!> @name Logistics

src/pre_process/m_global_parameters.fpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ module m_global_parameters
1919

2020
use m_thermochem, only: num_species
2121

22+
use m_helper, only: s_update_cell_extremes
23+
2224
implicit none
2325

2426
! Logistics

src/simulation/m_global_parameters.fpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ module m_global_parameters
2121

2222
use m_helper_basic !< Functions to compare floating point numbers
2323

24+
use m_helper, only: s_update_cell_extremes
25+
2426
#ifdef MFC_OpenACC
2527
use openacc
2628
#endif

src/simulation/m_start_up.fpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ module m_start_up
6767
use ieee_arithmetic
6868

6969
use m_helper_basic !< Functions to compare floating point numbers
70-
71-
7270

7371
#ifdef MFC_OpenACC
7472
use openacc

0 commit comments

Comments
 (0)