既存三角形配列へ追加分を連結し、再確保後の配列へ差し替える。
| Type | Intent | Optional | 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(:,:) |
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