append_mesh_ids Subroutine

public subroutine append_mesh_ids(mesh_ids, add_ids)

既存の要素メッシュID配列へ追加分を連結する。

Arguments

Type IntentOptional Attributes Name
integer(kind=i32), intent(inout), allocatable :: mesh_ids(:)
integer(kind=i32), intent(in) :: add_ids(:)

Source Code

  subroutine append_mesh_ids(mesh_ids, add_ids)
    integer(i32), allocatable, intent(inout) :: mesh_ids(:)
    integer(i32), intent(in) :: add_ids(:)
    integer(i32), allocatable :: tmp(:)
    integer(i32) :: n0, n1

    n0 = size(mesh_ids)
    n1 = size(add_ids)
    allocate (tmp(n0 + n1))
    if (n0 > 0) tmp(1:n0) = mesh_ids
    if (n1 > 0) tmp(n0 + 1:n0 + n1) = add_ids
    call move_alloc(tmp, mesh_ids)
  end subroutine append_mesh_ids