45 logical :: initialized = .false.
48 type(partition_transfer_t) :: m2c
51 integer,
allocatable :: m2c_mf_order(:)
54 integer,
allocatable :: m2c_cf_order(:,:)
59 type(partition_transfer_t) :: c2m
62 integer,
allocatable :: c2m_cf_order(:,:)
65 integer,
allocatable :: c2m_mf_order(:)
74 type(mesh_cube_parallel_map_t),
intent(out) :: this
75 type(mesh_t),
intent(in) :: mesh
76 type(cube_t),
intent(in) :: cube
78 integer :: ip, ixyz(3), lxyz(3), ipos, cube_np
80 integer,
allocatable :: cube_part_local(:)
81 integer(int64),
allocatable :: global_index(:)
82 integer(int64),
allocatable :: mf_order(:), cf_order(:)
84 type(dimensions_t),
allocatable :: part(:)
91 safe_allocate(part(1:cube%mpi_grp%size))
96 safe_allocate(cube_part_local(1:mesh%np))
97 safe_allocate(global_index(1:mesh%np))
101 ixyz = ixyz + cube%center
107 cube%mpi_grp, cube_part_local, &
108 this%m2c_nsend, this%m2c_nrec, mf_order, cf_order)
110 safe_allocate(this%m2c_mf_order(1:this%m2c_nsend))
111 safe_allocate(this%m2c_cf_order(1:this%m2c_nrec, 1:3))
114 this%m2c_mf_order = 0
116 do ip = 1, this%m2c_nsend
118 if (this%m2c_mf_order(ip) == 0)
then
119 write(
message(1),
'(a,i4,a,i4)')
"Error in mesh_cube_parallel_map_init (m2c): mesh point ", &
120 mf_order(ip),
" is not stored in partition ", mesh%pv%partno
125 do ip = 1, this%m2c_nrec
127 ixyz = ixyz + cube%center
130 write(
message(1),
'(a,3i4,a,i4)')
"Error in mesh_cube_parallel_map_init (m2c): cube point ", &
131 lxyz(1:3),
" is not stored in partition ", cube%mpi_grp%rank + 1
135 this%m2c_cf_order(ip, 1:3) = lxyz(1:3)
137 safe_deallocate_a(mf_order)
138 safe_deallocate_a(cf_order)
139 safe_deallocate_a(cube_part_local)
140 safe_deallocate_a(global_index)
144 assert(product(
i4_to_i8(cube%rs_n)) < huge(0_int32))
145 cube_np = product(cube%rs_n)
148 safe_allocate(cube_part_local(1:cube_np))
149 safe_allocate(global_index(1:cube_np))
151 do iz = part(cube%mpi_grp%rank+1)%start_xyz(3), part(cube%mpi_grp%rank+1)%end_xyz(3)
152 do iy = part(cube%mpi_grp%rank+1)%start_xyz(2), part(cube%mpi_grp%rank+1)%end_xyz(2)
153 do ix = part(cube%mpi_grp%rank+1)%start_xyz(1), part(cube%mpi_grp%rank+1)%end_xyz(1)
157 ixyz = ixyz - cube%center
160 if (ipg > 0 .and. ipg <= mesh%np_global)
then
162 global_index(ipos) = ipg
169 if (mesh%parallel_in_domains)
then
175 safe_deallocate_a(part)
179 mesh%mpi_grp, cube_part_local, &
180 this%c2m_nsend, this%c2m_nrec, cf_order, mf_order)
183 safe_allocate(this%c2m_cf_order(1:this%c2m_nsend, 1:3))
184 safe_allocate(this%c2m_mf_order(1:this%c2m_nrec))
185 do ip = 1, this%c2m_nsend
187 ixyz = ixyz + cube%center
190 write(
message(1),
'(a,3i4,a,i4)')
"Error in mesh_cube_parallel_map_init (c2m): cube point ", &
191 lxyz(1:3),
" is not stored in partition ", cube%mpi_grp%rank + 1
194 this%c2m_cf_order(ip, 1:3) = lxyz(1:3)
196 do ip = 1, this%c2m_nrec
198 if (this%c2m_mf_order(ip) == 0)
then
199 write(
message(1),
'(a,i3,a,i3)')
"Error in mesh_cube_parallel_map_init (c2m): mesh point ", &
200 mf_order(ip),
" is not stored in partition ", mesh%pv%partno
205 safe_deallocate_a(mf_order)
206 safe_deallocate_a(cf_order)
207 safe_deallocate_a(cube_part_local)
208 safe_deallocate_a(global_index)
210 this%initialized = .
true.
222 if (this%initialized)
then
223 safe_deallocate_a(this%m2c_mf_order)
224 safe_deallocate_a(this%m2c_cf_order)
225 safe_deallocate_a(this%c2m_mf_order)
226 safe_deallocate_a(this%c2m_cf_order)
229 this%initialized = .false.
logical function, public cube_global2local(cube, ixyz, lxyz)
True if global coordinates belong to this process. On output lxyz contains the local coordinates.
subroutine, public cube_partition(cube, part)
integer pure function, public cube_point_to_process(xyz, part)
This module implements the index, used for the mesh points.
subroutine, public mesh_cube_parallel_map_end(this)
subroutine, public mesh_cube_parallel_map_init(this, mesh, cube)
This module defines the meshes, which are used in Octopus.
subroutine, public mesh_global_index_to_coords(mesh, ipg, ix)
Given a global point index, this function returns the set of integer coordinates of the point.
integer(int64) function, public mesh_global_index_from_coords(mesh, ix)
This function returns the true global index of the point for a given vector of integer coordinates.
subroutine, public mesh_local_index_to_coords(mesh, ip, ix)
Given a local point index, this function returns the set of integer coordinates of the point.
integer function, public mesh_global2local(mesh, ipg)
This function returns the local mesh index for a given global index.
integer(int64) function, public mesh_local2global(mesh, ip)
This function returns the global mesh index for a given local index.
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
Some general things and nomenclature:
subroutine, public partition_transfer_init(this, np, global_index, mpi_grp_in, mpi_grp_out, part_out, nsend, nrec, order_in, order_out, inverse)
initialize the partition transfer object
subroutine, public partition_transfer_end(this)
subroutine, public profiling_out(label)
Increment out counter and sum up difference between entry and exit time.
subroutine, public profiling_in(label, exclude)
Increment in counter and save entry time.