FrontISTR 5.2.0
Large-scale structural analysis program with finit element method
Loading...
Searching...
No Matches
hecmw_adapt_cell_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_cell_comm_table
10!C***
11!C
12!C cell-based communication table
13!C
14subroutine hecmw_adapt_cell_comm_table (hecMESH)
15
16 use hecmw_util
19
20 implicit real*8 (a-h,o-z)
21
22 integer(kind=kint ), pointer :: wSI(:), wSE(:), wiI(:), wiE(:)
23 integer(kind=kint ), dimension(:), allocatable :: IW1, IW2
24
25 type (hecmwST_local_mesh) :: hecMESH
26
27 !C
28 !C-- init.
29 allocate (iw1(hecmesh%n_neighbor_pe))
30 allocate (wse(0:hecmesh%n_neighbor_pe), &
31 & wsi(0:hecmesh%n_neighbor_pe))
32 iw1 = 0
33 wse = 0
34 wsi = 0
35
36 !C
37 !C-- search IMPORT items
38 do icel= 1, hecmesh%n_elem
39 ih= hecmesh%elem_ID(2*icel)
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 !C
46 !C-- exchange INFO. on IMPORT item #
47 stime0= mpi_wtime()
49 & ( hecmesh%n_neighbor_pe, hecmesh%neighbor_pe, &
50 & wsi, wse, hecmesh%MPI_COMM, hecmesh%my_rank)
51 etime0= mpi_wtime()
52 commtime= commtime + etime0 - stime0
53
54 !C
55 !C-- IMPORT/EXPORT item #
56 do neib= 1, hecmesh%n_neighbor_pe
57 wsi(neib)= wsi(neib-1) + wsi(neib)
58 wse(neib)= wse(neib-1) + wse(neib)
59 enddo
60
61 !C
62 !C-- send as IMPORT/recv. as EXPORT
63 allocate (wii(wsi(hecmesh%n_neighbor_pe)))
64 allocate (wie(wse(hecmesh%n_neighbor_pe)))
65 ! JF
66 wii = 0
67 wie = 0
68
69 do icel= 1, hecmesh%n_elem
70 ih= hecmesh%elem_ID(2*icel)
71 if (ih.ne.hecmesh%my_rank) then
72 ihr = hecmesh%rev_neighbor_pe(ih)
73 iw1(ihr ) = iw1(ihr) + 1
74 wii(wsi(ihr-1)+iw1(ihr))= hecmesh%elem_ID(2*icel-1)
75 endif
76 enddo
77
78 len= max( wsi(hecmesh%n_neighbor_pe), wse(hecmesh%n_neighbor_pe),&
79 & hecmesh%n_elem)
80 deallocate (iw1)
81 allocate (iw1(len), iw2(len))
82 ! JF
83 iw1 = 0
84 iw2 = 0
85
86 stime0= mpi_wtime()
88 & (len, hecmesh%n_neighbor_pe, hecmesh%neighbor_pe, &
89 & wsi, wii, wse, wie, iw1, iw2, &
90 & hecmesh%MPI_COMM, hecmesh%my_rank, 1)
91 etime0= mpi_wtime()
92 commtime= commtime + etime0 - stime0
93
94 !C
95 !C-- find LOCAL CELL ID at DESTINY
96 do neib= 1, hecmesh%n_neighbor_pe
97 is= wse(neib-1)+1
98 ie= wse(neib )
99 ip= hecmesh%neighbor_pe(neib)
100 do k= is, ie
101 icel= wie(k)
102 call hecmw_adapt_local_cell_info (icel, icel0)
103 wie(k)= icel0
104 enddo
105 enddo
106
107 !C
108 !C-- reconstruct IMPORT table
109 deallocate (iw1)
110 allocate (iw1(hecmesh%n_neighbor_pe))
111
112 iw1= 0
113 do icel= 1, hecmesh%n_elem
114 ih= hecmesh%elem_ID(2*icel)
115 if (ih.ne.hecmesh%my_rank) then
116 ihr = hecmesh%rev_neighbor_pe(ih)
117 iw1(ihr ) = iw1(ihr) + 1
118 wii(wsi(ihr-1)+iw1(ihr))= icel
119 endif
120 enddo
121
122 !C
123 !C-- new ARRAY
124 allocate (hecmesh%adapt_import_elem_index(0:hecmesh%n_neighbor_pe))
125 allocate (hecmesh%adapt_export_elem_index(0:hecmesh%n_neighbor_pe))
126
127 do neib= 0, hecmesh%n_neighbor_pe
128 hecmesh%adapt_import_elem_index(neib)= wsi(neib)
129 hecmesh%adapt_export_elem_index(neib)= wse(neib)
130 enddo
131
132 maximport= wsi(hecmesh%n_neighbor_pe)
133 maxexport= wse(hecmesh%n_neighbor_pe)
134
135 allocate (hecmesh%adapt_import_elem_item(maximport))
136 allocate (hecmesh%adapt_export_elem_item(maxexport))
137 do k= 1, maximport
138 hecmesh%adapt_import_elem_item(k)= wii(k)
139 enddo
140 do k= 1, maxexport
141 hecmesh%adapt_export_elem_item(k)= wie(k)
142 enddo
143
144 deallocate (iw1,iw2)
145 deallocate (wse,wsi,wie,wii)
146
147 !C===
148contains
149 subroutine hecmw_adapt_local_cell_info (icel, in0)
150 do i0= 1, hecmesh%ne_internal
151 i= hecmesh%elem_internal_list(i0)
152 if (icel.eq.hecmesh%elem_ID(2*i-1)) then
153 in0= i
154 return
155 endif
156 enddo
157 end subroutine hecmw_adapt_local_cell_info
158end subroutine hecmw_adapt_cell_comm_table
subroutine hecmw_adapt_local_cell_info(icel, in0)
subroutine hecmw_adapt_cell_comm_table(hecmesh)
Adaptive Mesh Refinement.
Adaptive Mesh Refinement.
subroutine hecmw_adapt_item_send_recv(n, neibpetot, neibpe, stack_import, nod_import, stack_export, nod_export, ws, wr, solver_comm, my_rank, ntab)
Adaptive Mesh Refinement.
subroutine hecmw_adapt_stack_send_recv(neibpetot, neibpe, stack_import, stack_export, solver_comm, my_rank)
I/O and Utility.
Definition: hecmw_util_f.F90:7