22 subroutine concat_int_list(inlist, n_in, outlist)
23 integer,
allocatable,
intent(in) :: inlist(:)
24 integer,
intent(in) :: n_in
25 integer,
pointer,
intent(inout) :: outlist(:)
27 integer :: i, n_ori, n_new, lbd
28 integer,
allocatable :: tmp(:)
31 lbd = lbound(outlist,1)
35 tmp(i) = outlist(lbd+i-1)
41 allocate(outlist(lbd:lbd+n_new-1))
43 outlist(lbd+i-1) = tmp(i)
46 outlist(lbd+i-1+n_ori) = inlist(i)
52 subroutine add_newelements_to_hecmesh( etype, elems, sectionID, hecMESH )
53 integer,
intent(in) :: etype
54 type( hecmwST_varray_int ),
allocatable,
intent(in) :: elems(:)
55 integer,
allocatable,
intent(in) :: sectionID(:)
56 type(hecmwST_local_mesh),
intent(inout) :: hecMESH
58 integer(kind=kint) :: i
59 integer(kind=kint) :: n_newelem, n_newelemnodes, nitem
60 integer(kind=kint),
allocatable :: iwork(:)
62 n_newelem =
size(elems)
67 allocate(iwork(0:n_newelemnodes))
70 iwork(1) = hecmesh%elem_type_index(hecmesh%n_elem_type)+n_newelem
71 call concat_int_list(iwork, 1, hecmesh%elem_type_index)
75 call concat_int_list(iwork, 1, hecmesh%elem_type_item)
78 iwork(1:n_newelem) = etype
79 call concat_int_list(iwork, n_newelem, hecmesh%elem_type)
82 call concat_int_list(sectionid, n_newelem, hecmesh%section_ID)
85 iwork(0) = hecmesh%elem_mat_ID_index(ubound(hecmesh%elem_mat_ID_index,1))
87 iwork(i) = iwork(i-1) + 1
89 call concat_int_list(iwork, n_newelem, hecmesh%elem_mat_ID_index)
94 iwork(0) = hecmesh%elem_node_index(ubound(hecmesh%elem_node_index,1))
98 call concat_int_list(iwork, n_newelem, hecmesh%elem_node_index)
105 n_newelemnodes = n_newelemnodes + nitem
107 call concat_int_list(iwork, n_newelemnodes, hecmesh%elem_node_item)
111 iwork(2*i-1) = hecmesh%n_elem + 1
114 call concat_int_list(iwork, 2*n_newelem, hecmesh%elem_ID)
120 call concat_int_list(iwork, n_newelem, hecmesh%global_elem_ID)
136 hecmesh%n_elem_type = hecmesh%n_elem_type + 1
142 subroutine reorder_tet1( nid, nodlocal )
143 integer,
intent(in) :: nid
144 integer,
intent(inout) :: nodlocal(4)
147 integer :: nodlocal_ori(4)
149 nodlocal_ori(1:4) = nodlocal(1:4)
152 if( nodlocal(i) == nid )
then
160 else if( idx == 2 )
then
161 nodlocal(1) = nodlocal_ori(2)
162 nodlocal(2) = nodlocal_ori(3)
163 nodlocal(3) = nodlocal_ori(1)
164 else if( idx == 3 )
then
165 nodlocal(1) = nodlocal_ori(3)
166 nodlocal(2) = nodlocal_ori(1)
167 nodlocal(3) = nodlocal_ori(2)
168 else if( idx == 4 )
then
169 nodlocal(1) = nodlocal_ori(4)
170 nodlocal(2) = nodlocal_ori(2)
171 nodlocal(3) = nodlocal_ori(1)
172 nodlocal(4) = nodlocal_ori(3)
177 subroutine reorder_tet1_edge( nid1, nid2, nodlocal )
178 integer,
intent(in) :: nid1
179 integer,
intent(in) :: nid2
180 integer,
intent(inout) :: nodlocal(4)
183 integer :: nodlocal_ori(4)
185 call reorder_tet1( nid1, nodlocal )
187 nodlocal_ori(1:4) = nodlocal(1:4)
190 if( nodlocal(i) == nid2 )
then
198 else if( idx == 3 )
then
199 nodlocal(2) = nodlocal_ori(3)
200 nodlocal(3) = nodlocal_ori(4)
201 nodlocal(4) = nodlocal_ori(2)
202 else if( idx == 4 )
then
203 nodlocal(2) = nodlocal_ori(4)
204 nodlocal(3) = nodlocal_ori(2)
205 nodlocal(4) = nodlocal_ori(3)
207 stop
"error in reorder_tet1_edge"
217 subroutine initialize_node_elem_list( hecMESH, n_elem_ori, is_selem_list, node_elem_list )
218 type(hecmwST_local_mesh),
target :: hecMESH
219 integer(kind=kint),
intent(in) :: n_elem_ori
220 logical,
allocatable,
intent(in) :: is_selem_list(:)
221 type( hecmwST_varray_int ),
allocatable,
intent(inout) :: node_elem_list(:)
223 integer(kind=kint) :: i, icel, iS, iE, nid
228 if( .not. is_selem_list(icel) ) cycle
230 is = hecmesh%elem_node_index(icel-1)+1
231 ie = hecmesh%elem_node_index(icel)
234 nid = hecmesh%elem_node_item(i)
241 subroutine create_node_smoothed_elements( hecMESH, node_elem_list, nselems, sectionID )
242 type(hecmwST_local_mesh),
intent(in) :: hecMESH
243 type( hecmwST_varray_int ),
allocatable,
intent(in) :: node_elem_list(:)
244 type( hecmwST_varray_int ),
allocatable,
intent(inout) :: nselems(:)
245 integer,
allocatable,
intent(inout) :: sectionID(:)
247 integer(kind=kint) :: n_nselems
248 type( hecmwST_varray_int ),
allocatable :: n_sections(:)
249 integer(kind=kint) :: i, j, k, icel, isect, iS, iE
250 integer(kind=kint) :: nodlocal(4)
256 do i=1,hecmesh%n_node
259 isect = hecmesh%section_ID(icel)
265 allocate(sectionid(n_nselems))
272 do i=1,hecmesh%n_node
275 n_nselems = n_nselems + 1
276 sectionid(n_nselems) = isect
279 if ( hecmesh%section_ID(icel) == isect )
then
280 is = hecmesh%elem_node_index(icel-1)+1
281 ie = hecmesh%elem_node_index(icel)
282 if( ie-is+1 /= 4 ) stop
"error in add_elemments_smoothed_by_node(1)"
283 nodlocal(1:4) = hecmesh%elem_node_item(is:ie)
284 call reorder_tet1( i, nodlocal )
297 subroutine add_elemments_smoothed_by_node( hecMESH, n_elem_ori, is_selem_list )
298 type(hecmwST_local_mesh),
target :: hecMESH
299 integer(kind=kint),
intent(in) :: n_elem_ori
300 logical,
allocatable,
intent(in) :: is_selem_list(:)
302 type( hecmwST_varray_int ),
allocatable :: node_elem_list(:)
303 type( hecmwST_varray_int ),
allocatable :: nselems(:)
304 integer,
allocatable :: sectionID(:)
308 call initialize_node_elem_list( hecmesh, n_elem_ori, is_selem_list, node_elem_list )
311 call create_node_smoothed_elements( hecmesh, node_elem_list, nselems, sectionid )
317 call add_newelements_to_hecmesh( 881, nselems, sectionid, hecmesh )
328 subroutine initialize_edge_elem_list( hecMESH, n_elem_ori, is_selem_list, edges, edge_elem_list )
329 type(hecmwST_local_mesh),
target :: hecMESH
330 integer(kind=kint),
intent(in) :: n_elem_ori
331 logical,
allocatable,
intent(in) :: is_selem_list(:)
332 integer,
allocatable,
intent(inout) :: edges(:)
333 type( hecmwST_varray_int ),
allocatable,
intent(inout) :: edge_elem_list(:)
335 type( hecmwST_varray_int ),
allocatable :: edge_con(:)
336 type( hecmwST_varray_int ),
allocatable :: edge_id(:)
337 integer(kind=kint) :: ndlocal(4)
338 integer(kind=kint),
parameter :: leid(2,6) = reshape((/1,2,2,3,3,1,1,4,2,4,3,4/),shape(leid))
340 integer(kind=kint) :: i, j, icel, iS, iE, nid1, nid2
341 integer(kind=kint) :: n_edges, edid
348 if( .not. is_selem_list(icel) ) cycle
350 is = hecmesh%elem_node_index(icel-1)+1
351 ie = hecmesh%elem_node_index(icel)
353 ndlocal(1:4) = hecmesh%elem_node_item(is:ie)
355 nid1 = ndlocal(leid(1,i))
356 nid2 = ndlocal(leid(2,i))
357 if( nid1 < nid2 )
then
367 do i=1,hecmesh%n_node
371 allocate(edges(2*n_edges))
374 do i=1,hecmesh%n_node
376 n_edges = n_edges + 1
377 edges(2*n_edges-1) = i
387 if( .not. is_selem_list(icel) ) cycle
389 is = hecmesh%elem_node_index(icel-1)+1
390 ie = hecmesh%elem_node_index(icel)
392 ndlocal(1:4) = hecmesh%elem_node_item(is:ie)
394 nid1 = ndlocal(leid(1,i))
395 nid2 = ndlocal(leid(2,i))
396 if( nid1 < nid2 )
then
410 subroutine create_edge_smoothed_elements( hecMESH, edges, edge_elem_list, eselems, sectionID )
411 type(hecmwST_local_mesh),
intent(in) :: hecMESH
412 integer(kind=kint),
allocatable,
intent(in) :: edges(:)
413 type( hecmwST_varray_int ),
allocatable,
intent(in) :: edge_elem_list(:)
414 type( hecmwST_varray_int ),
allocatable,
intent(inout) :: eselems(:)
415 integer,
allocatable,
intent(inout) :: sectionID(:)
417 integer(kind=kint) :: n_edges, n_eselems
418 type( hecmwST_varray_int ),
allocatable :: n_sections(:)
419 integer(kind=kint) :: i, j, k, icel, isect, iS, iE
420 integer(kind=kint) :: nodlocal(4)
422 n_edges =
size(edge_elem_list)
431 isect = hecmesh%section_ID(icel)
437 allocate(sectionid(n_eselems))
447 n_eselems = n_eselems + 1
448 sectionid(n_eselems) = isect
451 if ( hecmesh%section_ID(icel) == isect )
then
452 is = hecmesh%elem_node_index(icel-1)+1
453 ie = hecmesh%elem_node_index(icel)
454 if( ie-is+1 /= 4 ) stop
"error in add_elemments_smoothed_by_node(1)"
455 nodlocal(1:4) = hecmesh%elem_node_item(is:ie)
456 call reorder_tet1_edge( edges(2*i-1), edges(2*i), nodlocal )
470 subroutine add_elemments_smoothed_by_edge( hecMESH, n_elem_ori, is_selem_list )
471 type(hecmwST_local_mesh),
target :: hecMESH
472 integer(kind=kint),
intent(in) :: n_elem_ori
473 logical,
allocatable,
intent(in) :: is_selem_list(:)
475 integer,
allocatable :: edges(:)
476 type( hecmwST_varray_int ),
allocatable :: edge_elem_list(:)
477 type( hecmwST_varray_int ),
allocatable :: eselems(:)
478 integer,
allocatable :: sectionID(:)
482 call initialize_edge_elem_list( hecmesh, n_elem_ori, is_selem_list, edges, edge_elem_list )
485 call create_edge_smoothed_elements( hecmesh, edges, edge_elem_list, eselems, sectionid )
492 call add_newelements_to_hecmesh( 891, eselems, sectionid, hecmesh )
502 logical,
allocatable,
intent(in) :: is_selem_list(:)
504 integer(kind=kint) :: n_elem_ori
506 n_elem_ori = hecmesh%n_elem
508 call add_elemments_smoothed_by_node( hecmesh, n_elem_ori, is_selem_list )
510 call add_elemments_smoothed_by_edge( hecmesh, n_elem_ori, is_selem_list )