append_triangles Subroutine

public subroutine append_triangles(v0, v1, v2, add_v0, add_v1, add_v2)

既存三角形配列へ追加分を連結し、再確保後の配列へ差し替える。

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout), allocatable :: v0(:,:)
real(kind=dp), intent(inout), allocatable :: v1(:,:)
real(kind=dp), intent(inout), allocatable :: v2(:,:)
real(kind=dp), intent(in) :: add_v0(:,:)
real(kind=dp), intent(in) :: add_v1(:,:)
real(kind=dp), intent(in) :: add_v2(:,:)

Called by

proc~~append_triangles~~CalledByGraph proc~append_triangles append_triangles proc~build_template_mesh build_template_mesh proc~build_template_mesh->proc~append_triangles proc~build_mesh_from_config build_mesh_from_config proc~build_mesh_from_config->proc~build_template_mesh proc~load_or_init_run_state load_or_init_run_state proc~load_or_init_run_state->proc~build_mesh_from_config program~main main program~main->proc~load_or_init_run_state

Source Code

  subroutine append_triangles(v0, v1, v2, add_v0, add_v1, add_v2)
    real(dp), allocatable, intent(inout) :: v0(:, :), v1(:, :), v2(:, :)
    real(dp), intent(in) :: add_v0(:, :), add_v1(:, :), add_v2(:, :)
    real(dp), allocatable :: t0(:, :), t1(:, :), t2(:, :)
    integer :: n0, n1

    n0 = size(v0, 2)
    n1 = size(add_v0, 2)
    allocate (t0(3, n0 + n1), t1(3, n0 + n1), t2(3, n0 + n1))
    if (n0 > 0) then
      t0(:, 1:n0) = v0
      t1(:, 1:n0) = v1
      t2(:, 1:n0) = v2
    end if
    t0(:, n0 + 1:n0 + n1) = add_v0
    t1(:, n0 + 1:n0 + n1) = add_v1
    t2(:, n0 + 1:n0 + n1) = add_v2
    call move_alloc(t0, v0)
    call move_alloc(t1, v1)
    call move_alloc(t2, v2)
  end subroutine append_triangles