Skip to content

Commit 9b1099f

Browse files
committed
Fix element type setting in reading mesh data
1 parent 386891d commit 9b1099f

14 files changed

+173
-251
lines changed

src/Fortran_libraries/PARALLEL_src/COMM_src/calypso_mpi_logical.f90

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
!! integer, intent(in) :: root
1515
!! integer(kind = kint_gl), intent(in) :: count
1616
!! logical, intent(inout) :: buffer(count)
17+
!! subroutine calypso_mpi_allreduce_one_bin(bin_local, bin_global, &
18+
!! & operation)
19+
!! integer, intent(in) :: operation
20+
!! logical, intent(in) :: bin_local
21+
!! logical, intent(inout) :: bin_global
1722
!!@endverbatim
1823
!!
1924
!!@n @param icode error code
@@ -72,5 +77,24 @@ subroutine calypso_mpi_bcast_logical(buffer, count, root)
7277
end subroutine calypso_mpi_bcast_logical
7378
!
7479
! ---------------------------------------------------------------------
80+
!
81+
subroutine calypso_mpi_allreduce_one_bin(bin_local, bin_global, &
82+
& operation)
83+
!
84+
integer, intent(in) :: operation
85+
logical, intent(in) :: bin_local
86+
logical, intent(inout) :: bin_global
87+
!
88+
logical :: bin_lc(1), bin_gl(1)
89+
!
90+
!
91+
bin_lc(1) = bin_local
92+
call MPI_allREDUCE(bin_lc, bin_gl, 1, CALYPSO_LOGICAL, &
93+
& operation, CALYPSO_COMM, ierr_MPI)
94+
bin_global = bin_gl(1)
95+
!
96+
end subroutine calypso_mpi_allreduce_one_bin
97+
!
98+
! ---------------------------------------------------------------------
7599
!
76100
end module calypso_mpi_logical

src/Fortran_libraries/PARALLEL_src/MPI_IO/MPI_element_connect_IO.f90

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,14 @@ end subroutine mpi_read_num_element
109109
!
110110
subroutine mpi_read_element_info(IO_param, ele_IO)
111111
!
112-
use set_nnod_4_ele_by_type
112+
use calypso_mpi_int
113+
use set_element_data_4_IO
113114
!
114115
type(calypso_MPI_IO_params), intent(inout) :: IO_param
115116
type(element_data), intent(inout) :: ele_IO
116117
!
117-
integer (kind = kint) :: i, num_tmp
118+
integer(kind = kint) :: nnod_ele_lc
119+
integer(kind = kint) :: i, num_tmp
118120
!
119121
! ---- read element data -------
120122
call mpi_read_num_element(IO_param, ele_IO)
@@ -123,12 +125,9 @@ subroutine mpi_read_element_info(IO_param, ele_IO)
123125
call mpi_read_element_type &
124126
& (IO_param, iten, ele_IO%numele, ele_IO%elmtyp)
125127
!
126-
ele_IO%nnod_4_ele = 0
127-
do i = 1, ele_IO%numele
128-
call s_set_nnod_4_ele_by_type &
129-
& (ele_IO%elmtyp(i), ele_IO%nodelm(i))
130-
ele_IO%nnod_4_ele = max(ele_IO%nnod_4_ele,ele_IO%nodelm(i))
131-
end do
128+
call find_max_nnod_4_ele_by_eletype(ele_IO, nnod_ele_lc)
129+
call calypso_mpi_allreduce_one_int &
130+
& (nnod_ele_lc, ele_IO%nnod_4_ele, MPI_MAX)
132131
!
133132
call mpi_read_num_of_data(IO_param, num_tmp)
134133
call alloc_ele_connectivity(ele_IO)

src/Fortran_libraries/PARALLEL_src/MPI_IO/MPI_element_connect_IO_b.f90

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,13 @@ end subroutine mpi_read_number_of_element_b
122122
!
123123
subroutine mpi_read_element_info_b(IO_param, ele_IO)
124124
!
125-
use set_nnod_4_ele_by_type
125+
use calypso_mpi_int
126+
use set_element_data_4_IO
126127
!
127128
type(calypso_MPI_IO_params), intent(inout) :: IO_param
128129
type(element_data), intent(inout) :: ele_IO
129130
!
131+
integer(kind = kint) :: nnod_ele_lc
130132
integer(kind = kint_gl) :: num64
131133
integer(kind = kint) :: i
132134
!
@@ -137,12 +139,9 @@ subroutine mpi_read_element_info_b(IO_param, ele_IO)
137139
num64 = ele_IO%numele
138140
call mpi_read_int_vector_b(IO_param, num64, ele_IO%elmtyp)
139141
!
140-
ele_IO%nnod_4_ele = 0
141-
do i = 1, ele_IO%numele
142-
call s_set_nnod_4_ele_by_type &
143-
& (ele_IO%elmtyp(i), ele_IO%nodelm(i))
144-
ele_IO%nnod_4_ele = max(ele_IO%nnod_4_ele,ele_IO%nodelm(i))
145-
end do
142+
call find_max_nnod_4_ele_by_eletype(ele_IO, nnod_ele_lc)
143+
call calypso_mpi_allreduce_one_int &
144+
& (nnod_ele_lc, ele_IO%nnod_4_ele, MPI_MAX)
146145
!
147146
call alloc_ele_connectivity(ele_IO)
148147
!

src/Fortran_libraries/PARALLEL_src/MPI_ZLIB_IO/gz_MPI_element_connect_IO.f90

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,24 +110,23 @@ end subroutine gz_mpi_read_num_element
110110
!
111111
subroutine gz_mpi_read_element_info(IO_param, ele_IO)
112112
!
113-
use set_nnod_4_ele_by_type
113+
use calypso_mpi_int
114+
use set_element_data_4_IO
114115
!
115116
type(calypso_MPI_IO_params), intent(inout) :: IO_param
116117
type(element_data), intent(inout) :: ele_IO
117118
!
119+
integer(kind = kint) :: nnod_ele_lc
118120
integer (kind = kint) :: i, num_tmp
119121
!
120122
!
121123
call alloc_element_types(ele_IO)
122124
call gz_mpi_read_element_type &
123125
& (IO_param, iten, ele_IO%numele, ele_IO%elmtyp)
124126
!
125-
ele_IO%nnod_4_ele = 0
126-
do i = 1, ele_IO%numele
127-
call s_set_nnod_4_ele_by_type &
128-
& (ele_IO%elmtyp(i), ele_IO%nodelm(i))
129-
ele_IO%nnod_4_ele = max(ele_IO%nnod_4_ele,ele_IO%nodelm(i))
130-
end do
127+
call find_max_nnod_4_ele_by_eletype(ele_IO, nnod_ele_lc)
128+
call calypso_mpi_allreduce_one_int &
129+
& (nnod_ele_lc, ele_IO%nnod_4_ele, MPI_MAX)
131130
!
132131
call gz_mpi_read_num_of_data(IO_param, num_tmp)
133132
call alloc_ele_connectivity(ele_IO)

src/Fortran_libraries/PARALLEL_src/MPI_ZLIB_IO/gz_MPI_element_connect_IO_b.f90

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,13 @@ end subroutine gz_mpi_read_num_element_b
121121
subroutine gz_mpi_read_ele_info_b(IO_param, ele_IO)
122122
!
123123
use gz_MPI_binary_data_IO
124-
use set_nnod_4_ele_by_type
124+
use set_element_data_4_IO
125125
!
126+
use calypso_mpi_int
126127
type(calypso_MPI_IO_params), intent(inout) :: IO_param
127128
type(element_data), intent(inout) :: ele_IO
128129
!
130+
integer(kind = kint) :: nnod_ele_lc
129131
integer(kind = kint_gl) :: num64
130132
integer (kind = kint) :: i
131133
!
@@ -137,12 +139,9 @@ subroutine gz_mpi_read_ele_info_b(IO_param, ele_IO)
137139
call gz_mpi_read_int_vector_b &
138140
& (IO_param, num64, ele_IO%elmtyp)
139141
!
140-
ele_IO%nnod_4_ele = 0
141-
do i = 1, ele_IO%numele
142-
call s_set_nnod_4_ele_by_type &
143-
& (ele_IO%elmtyp(i), ele_IO%nodelm(i))
144-
ele_IO%nnod_4_ele = max(ele_IO%nnod_4_ele,ele_IO%nodelm(i))
145-
end do
142+
call find_max_nnod_4_ele_by_eletype(ele_IO, nnod_ele_lc)
143+
call calypso_mpi_allreduce_one_int &
144+
& (nnod_ele_lc, ele_IO%nnod_4_ele, MPI_MAX)
146145
!
147146
call alloc_ele_connectivity(ele_IO)
148147
!

src/Fortran_libraries/SERIAL_src/BASE/cal_minmax_and_stacks.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
!! subroutine s_cal_dbl_minmax_and_stacks(num_out, num_in, num_grp,&
2323
!! & istack_begin, istack_grp, ntot_grp, max_grp, min_grp)
2424
!!
25-
!! subroutine count_number_4_smp( np_smp, istart, iend, &
26-
!! & i_smp_stack, max_4_smp)
25+
!! subroutine count_number_4_smp(np_smp, istart, iend, &
26+
!! & i_smp_stack, max_4_smp)
2727
!! subroutine set_group_size_4_smp(np_smp, num_group, &
2828
!! & istack_group, istack_group_smp, max_4_smp)
2929
!!@endverbatim
@@ -215,7 +215,7 @@ end subroutine s_cal_dbl_minmax_and_stacks
215215
!-----------------------------------------------------------------------
216216
!
217217
subroutine count_number_4_smp(np_smp, istart, iend, &
218-
& i_smp_stack, max_4_smp)
218+
& i_smp_stack, max_4_smp)
219219
!
220220
integer(kind = kint), intent(in) :: np_smp
221221
integer(kind = kint), intent(in) :: istart, iend
@@ -253,7 +253,7 @@ subroutine set_group_size_4_smp(np_smp, num_group, &
253253
ist = istack_group(i_grp-1) + 1
254254
ied = istack_group(i_grp )
255255
call count_number_4_smp(np_smp, ist, ied, &
256-
& istack_group_smp(id_smp), imax )
256+
& istack_group_smp(id_smp), imax)
257257
max_4_smp = max(max_4_smp,imax)
258258
end do
259259
!

0 commit comments

Comments
 (0)