2 ! { dg-require-visibility "" }
3 ! Test fix for PR47082, in which an ICE in the ALLOCATE at line 248.
5 ! Contributed by Salvatore Filippone <salvatore.filippone@uniroma2.it>
10 module procedure psb_init
14 module procedure psb_exit
18 module procedure psb_info
21 integer, private, save :: nctxt=0
28 subroutine psb_init(ictxt,np,basectxt,ids)
30 integer, intent(out) :: ictxt
31 integer, intent(in), optional :: np, basectxt, ids(:)
37 end subroutine psb_init
39 subroutine psb_exit(ictxt,close)
41 integer, intent(inout) :: ictxt
42 logical, intent(in), optional :: close
44 nctxt = max(0, nctxt - 1)
46 end subroutine psb_exit
49 subroutine psb_info(ictxt,iam,np)
53 integer, intent(in) :: ictxt
54 integer, intent(out) :: iam, np
59 end subroutine psb_info
62 end module psb_penv_mod
65 module psb_indx_map_mod
72 integer :: global_rows = -1
73 integer :: global_cols = -1
74 integer :: local_rows = -1
75 integer :: local_cols = -1
80 end module psb_indx_map_mod
84 module psb_gen_block_map_mod
87 type, extends(psb_indx_map) :: psb_gen_block_map
88 integer :: min_glob_row = -1
89 integer :: max_glob_row = -1
90 integer, allocatable :: loc_to_glob(:), srt_l2g(:,:), vnl(:)
93 procedure, pass(idxmap) :: gen_block_map_init => block_init
95 end type psb_gen_block_map
101 subroutine block_init(idxmap,ictxt,nl,info)
104 class(psb_gen_block_map), intent(inout) :: idxmap
105 integer, intent(in) :: ictxt, nl
106 integer, intent(out) :: info
108 integer :: iam, np, i, j, ntot
109 integer, allocatable :: vnl(:)
112 call psb_info(ictxt,iam,np)
118 allocate(vnl(0:np),stat=info)
127 vnl(1:np) = vnl(0:np-1)
130 vnl(i) = vnl(i) + vnl(i-1)
132 if (ntot /= vnl(np)) then
133 ! !$ write(0,*) ' Mismatch in block_init ',ntot,vnl(np)
136 idxmap%global_rows = ntot
137 idxmap%global_cols = ntot
138 idxmap%local_rows = nl
139 idxmap%local_cols = nl
143 idxmap%min_glob_row = vnl(iam)+1
144 idxmap%max_glob_row = vnl(iam+1)
145 call move_alloc(vnl,idxmap%vnl)
146 allocate(idxmap%loc_to_glob(nl),stat=info)
152 end subroutine block_init
154 end module psb_gen_block_map_mod
157 module psb_descriptor_type
164 integer, allocatable :: matrix_data(:)
165 integer, allocatable :: halo_index(:)
166 integer, allocatable :: ext_index(:)
167 integer, allocatable :: ovrlap_index(:)
168 integer, allocatable :: ovrlap_elem(:,:)
169 integer, allocatable :: ovr_mst_idx(:)
170 integer, allocatable :: bnd_elem(:)
171 class(psb_indx_map), allocatable :: indxmap
172 integer, allocatable :: lprm(:)
173 type(psb_desc_type), pointer :: base_desc => null()
174 integer, allocatable :: idx_space(:)
175 end type psb_desc_type
178 end module psb_descriptor_type
180 module psb_cd_if_tools_mod
182 use psb_descriptor_type
183 use psb_gen_block_map_mod
186 subroutine psb_cdcpy(desc_in, desc_out, info)
187 use psb_descriptor_type
192 type(psb_desc_type), intent(in) :: desc_in
193 type(psb_desc_type), intent(out) :: desc_out
194 integer, intent(out) :: info
195 end subroutine psb_cdcpy
199 end module psb_cd_if_tools_mod
201 module psb_cd_tools_mod
203 use psb_cd_if_tools_mod
207 subroutine psb_cdall(ictxt, desc, info,mg,ng,vg,vl,flag,nl,repl, globalcheck)
208 use psb_descriptor_type
210 Integer, intent(in) :: mg,ng,ictxt, vg(:), vl(:),nl
211 integer, intent(in) :: flag
212 logical, intent(in) :: repl, globalcheck
213 integer, intent(out) :: info
214 type(psb_desc_type), intent(out) :: desc
216 optional :: mg,ng,vg,vl,flag,nl,repl, globalcheck
217 end subroutine psb_cdall
221 end module psb_cd_tools_mod
222 module psb_base_tools_mod
224 end module psb_base_tools_mod
226 subroutine psb_cdall(ictxt, desc, info,mg,ng,vg,vl,flag,nl,repl, globalcheck)
227 use psb_descriptor_type
228 use psb_gen_block_map_mod
229 use psb_base_tools_mod, psb_protect_name => psb_cdall
231 Integer, intent(in) :: mg,ng,ictxt, vg(:), vl(:),nl
232 integer, intent(in) :: flag
233 logical, intent(in) :: repl, globalcheck
234 integer, intent(out) :: info
235 type(psb_desc_type), intent(out) :: desc
237 optional :: mg,ng,vg,vl,flag,nl,repl, globalcheck
238 integer :: err_act, n_, flag_, i, me, np, nlp, nnv, lr
239 integer, allocatable :: itmpsz(:)
244 desc%base_desc => null()
245 if (allocated(desc%indxmap)) then
246 write(0,*) 'Allocated on an intent(OUT) var?'
249 allocate(psb_gen_block_map :: desc%indxmap, stat=info)
251 select type(aa => desc%indxmap)
252 type is (psb_gen_block_map)
253 call aa%gen_block_map_init(ictxt,nl,info)
262 end subroutine psb_cdall