Apply policies(k) to the elements whose mesh_id is k, for k = 1..size(policies), in order.
Elements are grouped by mesh_id once, so each part costs only its own size. On failure the
parts before failed_mesh_id stay resolved and the failing part is left unchanged.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_type), | intent(inout) | :: | mesh | |||
| character(len=*), | intent(in) | :: | policies(:) | |||
| integer(kind=i32), | intent(out) | :: | status | |||
| character(len=*), | intent(out) | :: | message | |||
| integer(kind=i32), | intent(out) | :: | failed_mesh_id |
subroutine resolve_panel_surface_sides_by_mesh_id(mesh, policies, status, message, failed_mesh_id) type(mesh_type), intent(inout) :: mesh character(len=*), intent(in) :: policies(:) integer(i32), intent(out) :: status character(len=*), intent(out) :: message integer(i32), intent(out) :: failed_mesh_id integer(i32), allocatable :: part_start(:), part_fill(:), elements(:) integer(i32) :: i, k, nparts real(dp) :: coordinate_scale status = panel_surface_side_ok message = '' failed_mesh_id = 0_i32 nparts = int(size(policies), i32) allocate (part_start(nparts + 1_i32), part_fill(nparts), elements(mesh%nelem)) part_start = 0_i32 do i = 1_i32, mesh%nelem k = mesh%elem_mesh_id(i) if (k >= 1_i32 .and. k <= nparts) part_start(k + 1_i32) = part_start(k + 1_i32) + 1_i32 end do part_start(1) = 1_i32 do k = 1_i32, nparts part_start(k + 1_i32) = part_start(k + 1_i32) + part_start(k) end do part_fill = part_start(1:nparts) do i = 1_i32, mesh%nelem k = mesh%elem_mesh_id(i) if (k < 1_i32 .or. k > nparts) cycle elements(part_fill(k)) = i part_fill(k) = part_fill(k) + 1_i32 end do coordinate_scale = 0.0_dp do k = 1_i32, nparts if (is_outward_closed(policies(k))) then coordinate_scale = mesh_coordinate_scale(mesh) exit end if end do do k = 1_i32, nparts if (part_start(k + 1_i32) == part_start(k)) then status = panel_surface_side_invalid_policy message = 'surface side mesh_id selects no elements' else call resolve_element_sides( & mesh, policies(k), elements(part_start(k):part_start(k + 1_i32) - 1_i32), coordinate_scale, status, message & ) end if if (status /= panel_surface_side_ok) then failed_mesh_id = k return end if end do end subroutine resolve_panel_surface_sides_by_mesh_id