FrontISTR  5.7.0
Large-scale structural analysis program with finit element method
hecmw_adapt_repro_comm_table.f90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
2 ! Copyright (c) 2019 FrontISTR Commons
3 ! This software is released under the MIT License, see LICENSE.txt
4 !-------------------------------------------------------------------------------
6 
7 !C
8 !C***
9 !C*** hecmw_adapt_REPRO_COMM_TABLE
10 !C***
11 !C
12 !C reproduce COMMUNICATION table
13 !C
14 subroutine hecmw_adapt_repro_comm_table (hecMESH)
15 
16  use hecmw_util
20 
21  integer(kind=kint ), pointer :: wSI(:), wSE(:), wiI(:), wiE(:)
22  integer(kind=kint ), allocatable :: IW1(:), IW2(:)
23 
24  type (hecmwST_local_mesh) :: hecMESH
25 
26  !C
27  !C-- init.
28  allocate (iw1(hecmesh%n_neighbor_pe))
29  iw1 = 0
30 
31  allocate (wse(0:hecmesh%n_neighbor_pe), wsi(0:hecmesh%n_neighbor_pe))
32  wse = 0
33  wsi = 0
34 
35  !C
36  !C-- search IMPORT items
37  do in= 1, hecmesh%n_adapt_node_cur
38  is= hecmesh%adapt_NEWtoOLD_node(in)
39  ih= hecmesh%node_ID(2*is)
40  if (ih.ne.hecmesh%my_rank) then
41  ihr = hecmesh%rev_neighbor_pe(ih)
42  wsi(ihr)= wsi(ihr) + 1
43  endif
44  enddo
45 
46  !C
47  !C-- exchange INFO. on IMPORT item #
49  & ( hecmesh%n_neighbor_pe, hecmesh%neighbor_pe, wsi, wse, &
50  & hecmesh%MPI_COMM, hecmesh%my_rank)
51 
52  !C
53  !C-- IMPORT/EXPORT item #
54  do neib= 1, hecmesh%n_neighbor_pe
55  wsi(neib)= wsi(neib-1) + wsi(neib)
56  wse(neib)= wse(neib-1) + wse(neib)
57  enddo
58 
59  !C
60  !C-- send as IMPORT/recv. as EXPORT
61 
62  allocate (wii(wsi(hecmesh%n_neighbor_pe)))
63  allocate (wie(wse(hecmesh%n_neighbor_pe)))
64  wii = 0
65  wie = 0
66 
67  do in= 1, hecmesh%n_adapt_node_cur
68  is= hecmesh%adapt_NEWtoOLD_node(in)
69  ih= hecmesh%node_ID(2*is)
70  if (ih.ne.hecmesh%my_rank) then
71  ihr = hecmesh%rev_neighbor_pe(ih)
72  iw1(ihr ) = iw1(ihr) + 1
73  wii(wsi(ihr-1)+iw1(ihr))= hecmesh%node_ID(2*is-1)
74  endif
75  enddo
76  deallocate (iw1)
77 
78  n= hecmesh%n_adapt_node_cur
79  len= max(wsi(hecmesh%n_neighbor_pe),wse(hecmesh%n_neighbor_pe),n)
80  allocate (iw1(len), iw2(len))
81  iw1 = 0
82  iw2 = 0
83 
85  & (len, hecmesh%n_neighbor_pe, hecmesh%neighbor_pe, &
86  & wsi, wii, wse, wie, iw1, iw2, &
87  & hecmesh%MPI_COMM, hecmesh%my_rank, 1)
88 
89  !C
90  !C-- reconstruct IMPORT table
91 
92  deallocate (iw1)
93  allocate (iw1(hecmesh%n_neighbor_pe))
94  iw1 = 0
95 
96  do in= 1, hecmesh%n_adapt_node_cur
97  is= hecmesh%adapt_NEWtoOLD_node(in)
98  ih= hecmesh%node_ID(2*is)
99  if (ih.ne.hecmesh%my_rank) then
100  ihr = hecmesh%rev_neighbor_pe(ih)
101  iw1(ihr ) = iw1(ihr) + 1
102  wii(wsi(ihr-1)+iw1(ihr))= in
103  endif
104  enddo
105 
106  !C
107  !C-- new ARRAY
108  allocate (hecmesh%adapt_import_new_index(0:hecmesh%n_neighbor_pe))
109  allocate (hecmesh%adapt_export_new_index(0:hecmesh%n_neighbor_pe))
110 
111  do neib= 0, hecmesh%n_neighbor_pe
112  hecmesh%adapt_import_new_index(neib)= wsi(neib)
113  hecmesh%adapt_export_new_index(neib)= wse(neib)
114  enddo
115 
116  maximport= wsi(hecmesh%n_neighbor_pe)
117  maxexport= wse(hecmesh%n_neighbor_pe)
118 
119  allocate (hecmesh%adapt_import_new_item(maximport))
120  allocate (hecmesh%adapt_export_new_item(maxexport))
121 
122  do k= 1, maximport
123  hecmesh%adapt_import_new_item(k)= wii(k)
124  enddo
125  do k= 1, maxexport
126  hecmesh%adapt_export_new_item(k)= wie(k)
127  enddo
128 
129  deallocate (iw1,iw2)
130  deallocate (wse,wsi,wie,wii)
131  !C===
132 
133 end subroutine hecmw_adapt_repro_comm_table
hecmw_adapt_item_sr
Adaptive Mesh Refinement.
Definition: hecmw_adapt_item_sr.f90:7
hecmw_adapt_int_sr
Adaptive Mesh Refinement.
Definition: hecmw_adapt_int_sr.f90:7
hecmw_adapt_repro_comm_table
subroutine hecmw_adapt_repro_comm_table(hecMESH)
Adaptive Mesh Refinement.
Definition: hecmw_adapt_repro_comm_table.f90:15
hecmw_adapt_item_sr::hecmw_adapt_item_send_recv
subroutine hecmw_adapt_item_send_recv(N, NEIBPETOT, NEIBPE, STACK_IMPORT, NOD_IMPORT, STACK_EXPORT, NOD_EXPORT, WS, WR, SOLVER_COMM, my_rank, NTAB)
Definition: hecmw_adapt_item_sr.f90:21
hecmw_util
I/O and Utility.
Definition: hecmw_util_f.F90:7
hecmw_adapt_stack_sr::hecmw_adapt_stack_send_recv
subroutine hecmw_adapt_stack_send_recv(NEIBPETOT, NEIBPE, STACK_IMPORT, STACK_EXPORT, SOLVER_COMM, my_rank)
Definition: hecmw_adapt_stack_sr.f90:19
hecmw_adapt_stack_sr
Adaptive Mesh Refinement.
Definition: hecmw_adapt_stack_sr.f90:7