線分 AABB と canonical mesh AABB の重なりから必要な image shift 範囲を決める。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_type), | intent(in) | :: | mesh | |||
| real(kind=dp), | intent(in) | :: | p0(3) | |||
| real(kind=dp), | intent(in) | :: | p1(3) | |||
| integer(kind=i32), | intent(in) | :: | axis | |||
| real(kind=dp), | intent(in) | :: | period_len | |||
| integer(kind=i32), | intent(out) | :: | nmin | |||
| integer(kind=i32), | intent(out) | :: | nmax |
subroutine compute_periodic_shift_bounds(mesh, p0, p1, axis, period_len, nmin, nmax) type(mesh_type), intent(in) :: mesh real(dp), intent(in) :: p0(3), p1(3) integer(i32), intent(in) :: axis real(dp), intent(in) :: period_len integer(i32), intent(out) :: nmin, nmax real(dp) :: seg_min, seg_max, mesh_min, mesh_max, tol seg_min = min(p0(axis), p1(axis)) seg_max = max(p0(axis), p1(axis)) mesh_min = mesh%grid_bb_min(axis) mesh_max = mesh%grid_bb_max(axis) tol = 1.0d-12*max(1.0d0, abs(seg_min), abs(seg_max), abs(mesh_min), abs(mesh_max), period_len) nmin = int(ceiling((seg_min - mesh_max - tol)/period_len), kind=i32) nmax = int(floor((seg_max - mesh_min + tol)/period_len), kind=i32) end subroutine compute_periodic_shift_bounds