2 ! Test fix for PR47082, in which an ICE in the ALLOCATE at line 248.
4 ! Contributed by Salvatore Filippone <salvatore.filippone@uniroma2.it>
9 module procedure psb_init
13 module procedure psb_exit
17 module procedure psb_info
20 integer, private, save :: nctxt=0
27 subroutine psb_init(ictxt,np,basectxt,ids)
29 integer, intent(out) :: ictxt
30 integer, intent(in), optional :: np, basectxt, ids(:)
36 end subroutine psb_init
38 subroutine psb_exit(ictxt,close)
40 integer, intent(inout) :: ictxt
41 logical, intent(in), optional :: close
43 nctxt = max(0, nctxt - 1)
45 end subroutine psb_exit
48 subroutine psb_info(ictxt,iam,np)
52 integer, intent(in) :: ictxt
53 integer, intent(out) :: iam, np
58 end subroutine psb_info
61 end module psb_penv_mod
64 module psb_indx_map_mod
71 integer :: global_rows = -1
72 integer :: global_cols = -1
73 integer :: local_rows = -1
74 integer :: local_cols = -1
79 end module psb_indx_map_mod
83 module psb_gen_block_map_mod
86 type, extends(psb_indx_map) :: psb_gen_block_map
87 integer :: min_glob_row = -1
88 integer :: max_glob_row = -1
89 integer, allocatable :: loc_to_glob(:), srt_l2g(:,:), vnl(:)
92 procedure, pass(idxmap) :: gen_block_map_init => block_init
94 end type psb_gen_block_map
100 subroutine block_init(idxmap,ictxt,nl,info)
103 class(psb_gen_block_map), intent(inout) :: idxmap
104 integer, intent(in) :: ictxt, nl
105 integer, intent(out) :: info
107 integer :: iam, np, i, j, ntot
108 integer, allocatable :: vnl(:)
111 call psb_info(ictxt,iam,np)
117 allocate(vnl(0:np),stat=info)
126 vnl(1:np) = vnl(0:np-1)
129 vnl(i) = vnl(i) + vnl(i-1)
131 if (ntot /= vnl(np)) then
132 ! !$ write(0,*) ' Mismatch in block_init ',ntot,vnl(np)
135 idxmap%global_rows = ntot
136 idxmap%global_cols = ntot
137 idxmap%local_rows = nl
138 idxmap%local_cols = nl
142 idxmap%min_glob_row = vnl(iam)+1
143 idxmap%max_glob_row = vnl(iam+1)
144 call move_alloc(vnl,idxmap%vnl)
145 allocate(idxmap%loc_to_glob(nl),stat=info)
151 end subroutine block_init
153 end module psb_gen_block_map_mod
156 module psb_descriptor_type
163 integer, allocatable :: matrix_data(:)
164 integer, allocatable :: halo_index(:)
165 integer, allocatable :: ext_index(:)
166 integer, allocatable :: ovrlap_index(:)
167 integer, allocatable :: ovrlap_elem(:,:)
168 integer, allocatable :: ovr_mst_idx(:)
169 integer, allocatable :: bnd_elem(:)
170 class(psb_indx_map), allocatable :: indxmap
171 integer, allocatable :: lprm(:)
172 type(psb_desc_type), pointer :: base_desc => null()
173 integer, allocatable :: idx_space(:)
174 end type psb_desc_type
177 end module psb_descriptor_type
179 module psb_cd_if_tools_mod
181 use psb_descriptor_type
182 use psb_gen_block_map_mod
185 subroutine psb_cdcpy(desc_in, desc_out, info)
186 use psb_descriptor_type
191 type(psb_desc_type), intent(in) :: desc_in
192 type(psb_desc_type), intent(out) :: desc_out
193 integer, intent(out) :: info
194 end subroutine psb_cdcpy
198 end module psb_cd_if_tools_mod
200 module psb_cd_tools_mod
202 use psb_cd_if_tools_mod
206 subroutine psb_cdall(ictxt, desc, info,mg,ng,vg,vl,flag,nl,repl, globalcheck)
207 use psb_descriptor_type
209 Integer, intent(in) :: mg,ng,ictxt, vg(:), vl(:),nl
210 integer, intent(in) :: flag
211 logical, intent(in) :: repl, globalcheck
212 integer, intent(out) :: info
213 type(psb_desc_type), intent(out) :: desc
215 optional :: mg,ng,vg,vl,flag,nl,repl, globalcheck
216 end subroutine psb_cdall
220 end module psb_cd_tools_mod
221 module psb_base_tools_mod
223 end module psb_base_tools_mod
225 subroutine psb_cdall(ictxt, desc, info,mg,ng,vg,vl,flag,nl,repl, globalcheck)
226 use psb_descriptor_type
227 use psb_gen_block_map_mod
228 use psb_base_tools_mod, psb_protect_name => psb_cdall
230 Integer, intent(in) :: mg,ng,ictxt, vg(:), vl(:),nl
231 integer, intent(in) :: flag
232 logical, intent(in) :: repl, globalcheck
233 integer, intent(out) :: info
234 type(psb_desc_type), intent(out) :: desc
236 optional :: mg,ng,vg,vl,flag,nl,repl, globalcheck
237 integer :: err_act, n_, flag_, i, me, np, nlp, nnv, lr
238 integer, allocatable :: itmpsz(:)
243 desc%base_desc => null()
244 if (allocated(desc%indxmap)) then
245 write(0,*) 'Allocated on an intent(OUT) var?'
248 allocate(psb_gen_block_map :: desc%indxmap, stat=info)
250 select type(aa => desc%indxmap)
251 type is (psb_gen_block_map)
252 call aa%gen_block_map_init(ictxt,nl,info)
261 end subroutine psb_cdall
263 ! { dg-final { cleanup-modules "psb_penv_mod psb_indx_map_mod psb_gen_block_map_mod psb_descriptor_type psb_cd_if_tools_mod psb_cd_tools_mod psb_base_tools_mod" } }