17 implicit real*8 (a-h,o-z)
19 dimension ndiv(6), nntyp(0:11)
21 integer(kind=kint) :: PAR_CEL_TYP
22 type (hecmwST_local_mesh) :: hecMESH
33 do icel0= 1, hecmesh%n_adapt_act_elem_341
34 icel_par= hecmesh%adapt_act_elem_341(icel0)
37 if (hecmesh%elem_ID(2*icel_par).eq.hecmesh%my_rank)
then
43 is= hecmesh%elem_node_index(icel_par-1)
44 n1= hecmesh%elem_node_item (is+1)
45 n2= hecmesh%elem_node_item (is+2)
46 n3= hecmesh%elem_node_item (is+3)
47 n4= hecmesh%elem_node_item (is+4)
55 nnn= hecmesh%n_adapt_edge
63 ndiv(1)= hecmesh%adapt_iemb(ie1)
64 ndiv(2)= hecmesh%adapt_iemb(ie2)
65 ndiv(3)= hecmesh%adapt_iemb(ie3)
66 ndiv(4)= hecmesh%adapt_iemb(ie4)
67 ndiv(5)= hecmesh%adapt_iemb(ie5)
68 ndiv(6)= hecmesh%adapt_iemb(ie6)
70 ndivsum= ndiv(1)+ndiv(2)+ndiv(3)+ndiv(4)+ndiv(5)+ndiv(6)
71 par_cel_typ= hecmesh%elem_type(npar)
74 is= hecmesh%adapt_children_index(npar-1)
84 hecmesh%adapt_children_item(2*is1)= -1
85 hecmesh%adapt_children_item(2*is2)= -1
86 hecmesh%adapt_children_item(2*is3)= -1
87 hecmesh%adapt_children_item(2*is4)= -1
88 hecmesh%adapt_children_item(2*is5)= -1
89 hecmesh%adapt_children_item(2*is6)= -1
90 hecmesh%adapt_children_item(2*is7)= -1
91 hecmesh%adapt_children_item(2*is8)= -1
93 hecmesh%adapt_children_item(2*is1-1)= 0
94 hecmesh%adapt_children_item(2*is2-1)= 0
95 hecmesh%adapt_children_item(2*is3-1)= 0
96 hecmesh%adapt_children_item(2*is4-1)= 0
97 hecmesh%adapt_children_item(2*is5-1)= 0
98 hecmesh%adapt_children_item(2*is6-1)= 0
99 hecmesh%adapt_children_item(2*is7-1)= 0
100 hecmesh%adapt_children_item(2*is8-1)= 0
104 if (ndivsum.eq.0) ntyp= 0
107 if (ndivsum.eq.1 .and. ndiv(1).eq.1)
then
109 n5 = hecmesh%adapt_IWK(ie1)
111 hecmesh%adapt_type(npar)= ntyp
117 if (ndivsum.eq.1 .and. ndiv(2).eq.1)
then
119 n5 = hecmesh%adapt_IWK(ie2)
121 hecmesh%adapt_type(npar)= ntyp
127 if (ndivsum.eq.1 .and. ndiv(3).eq.1)
then
129 n5 = hecmesh%adapt_IWK(ie3)
131 hecmesh%adapt_type(npar)= ntyp
137 if (ndivsum.eq.1 .and. ndiv(4).eq.1)
then
139 n5 = hecmesh%adapt_IWK(ie4)
141 hecmesh%adapt_type(npar)= ntyp
147 if (ndivsum.eq.1 .and. ndiv(5).eq.1)
then
149 n5 = hecmesh%adapt_IWK(ie5)
151 hecmesh%adapt_type(npar)= ntyp
157 if (ndivsum.eq.1 .and. ndiv(6).eq.1)
then
159 n5 = hecmesh%adapt_IWK(ie6)
161 hecmesh%adapt_type(npar)= ntyp
167 if (ndivsum.eq.3 .and. ndiv(1).eq.1 .and. &
168 & ndiv(3).eq.1 .and. ndiv(5).eq.1)
then
170 n5 = hecmesh%adapt_IWK(ie1)
171 n6 = hecmesh%adapt_IWK(ie3)
172 n7 = hecmesh%adapt_IWK(ie5)
174 hecmesh%adapt_type(npar)= ntyp
182 if (ndivsum.eq.3 .and. ndiv(2).eq.1 .and. &
183 & ndiv(3).eq.1 .and. ndiv(6).eq.1)
then
185 n5 = hecmesh%adapt_IWK(ie2)
186 n6 = hecmesh%adapt_IWK(ie3)
187 n7 = hecmesh%adapt_IWK(ie6)
189 hecmesh%adapt_type(npar)= ntyp
197 if (ndivsum.eq.3 .and. ndiv(1).eq.1 .and. &
198 & ndiv(2).eq.1 .and. ndiv(4).eq.1)
then
200 n5 = hecmesh%adapt_IWK(ie1)
201 n6 = hecmesh%adapt_IWK(ie2)
202 n7 = hecmesh%adapt_IWK(ie4)
204 hecmesh%adapt_type(npar)= ntyp
212 if (ndivsum.eq.3 .and. ndiv(4).eq.1 .and. &
213 & ndiv(5).eq.1 .and. ndiv(6).eq.1)
then
215 n5 = hecmesh%adapt_IWK(ie4)
216 n6 = hecmesh%adapt_IWK(ie5)
217 n7 = hecmesh%adapt_IWK(ie6)
219 hecmesh%adapt_type(npar)= ntyp
227 if (ndivsum.eq.6)
then
229 n5 = hecmesh%adapt_IWK(ie1)
230 n6 = hecmesh%adapt_IWK(ie2)
231 n7 = hecmesh%adapt_IWK(ie3)
232 n8 = hecmesh%adapt_IWK(ie4)
233 n9 = hecmesh%adapt_IWK(ie5)
234 n0 = hecmesh%adapt_IWK(ie6)
236 hecmesh%adapt_type(npar)= ntyp
250 nntyp(ntyp)= nntyp(ntyp) + 1
259 hecmesh%n_adapt_elem_341_cur= hecmesh%n_adapt_elem_341_cur + 1
260 hecmesh%n_adapt_elem_cur = hecmesh%n_adapt_elem_cur + 1
262 icel = hecmesh%n_adapt_elem_cur
265 if (icel.gt.hecmesh%ne_array)
then
269 hecmesh%when_i_was_refined_elem(icel)= hecmesh%n_adapt
270 hecmesh%elem_node_index(icel)= hecmesh%elem_node_index(icel-1) + 4
272 is= hecmesh%elem_node_index(icel-1)
273 hecmesh%elem_node_item(is+1)= in1
274 hecmesh%elem_node_item(is+2)= in2
275 hecmesh%elem_node_item(is+3)= in3
276 hecmesh%elem_node_item(is+4)= in4
278 hecmesh%adapt_parent(2*icel-1)= hecmesh%elem_ID(2*npar-1)
279 hecmesh%adapt_parent(2*icel )= hecmesh%elem_ID(2*npar )
281 hecmesh%elem_ID(2*icel-1)= icoun + hecmesh%ne_internal
282 hecmesh%elem_ID(2*icel )= hecmesh%elem_ID(2*npar )
284 hecmesh%elem_mat_ID_item(icel)= hecmesh%elem_mat_ID_item(npar)
285 hecmesh%section_ID (icel)= hecmesh%section_ID (npar)
287 hecmesh%adapt_type(icel)= 0
289 if (ndivsum.eq.6)
then
290 hecmesh%adapt_level(icel)= hecmesh%adapt_level(npar) + 2
292 hecmesh%adapt_level(icel)= hecmesh%adapt_level(npar) + 1
295 is= hecmesh%adapt_children_index(npar-1)
296 hecmesh%adapt_children_item(2*(is+idchi)-1)= icel
297 hecmesh%adapt_children_item(2*(is+idchi)-1)= icoun + hecmesh%ne_internal
298 hecmesh%adapt_children_item(2*(is+idchi) )= hecmesh%my_rank
302 hecmesh%adapt_children_local(is+idchi)= icel
304 is= hecmesh%adapt_children_index(icel-1)
305 hecmesh%adapt_children_index(icel)= is + 8
316 hecmesh%adapt_children_item(2*is1)= -1
317 hecmesh%adapt_children_item(2*is2)= -1
318 hecmesh%adapt_children_item(2*is3)= -1
319 hecmesh%adapt_children_item(2*is4)= -1
320 hecmesh%adapt_children_item(2*is5)= -1
321 hecmesh%adapt_children_item(2*is6)= -1
322 hecmesh%adapt_children_item(2*is7)= -1
323 hecmesh%adapt_children_item(2*is8)= -1
325 hecmesh%adapt_children_item(2*is1-1)= 0
326 hecmesh%adapt_children_item(2*is2-1)= 0
327 hecmesh%adapt_children_item(2*is3-1)= 0
328 hecmesh%adapt_children_item(2*is4-1)= 0
329 hecmesh%adapt_children_item(2*is5-1)= 0
330 hecmesh%adapt_children_item(2*is6-1)= 0
331 hecmesh%adapt_children_item(2*is7-1)= 0
332 hecmesh%adapt_children_item(2*is8-1)= 0
334 hecmesh%elem_type (icel)= par_cel_typ
335 hecmesh%adapt_parent_type(icel)= hecmesh%adapt_type(npar)