有効なテンプレートを連結し、1つのメッシュへまとめる。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(app_config), | intent(in) | :: | cfg |
テンプレート設定を含むアプリ設定。 |
||
| type(mesh_type), | intent(out) | :: | mesh |
連結後の三角形メッシュ。 |
subroutine build_template_mesh(cfg, mesh) type(app_config), intent(in) :: cfg type(mesh_type), intent(out) :: mesh type(mesh_type) :: part real(dp), allocatable :: v0(:, :), v1(:, :), v2(:, :) integer(i32), allocatable :: elem_mesh_id(:), part_mesh_id(:) integer(i32) :: i, mesh_id allocate (v0(3, 0), v1(3, 0), v2(3, 0), elem_mesh_id(0)) mesh_id = 0_i32 if (.not. allocated(cfg%templates)) then error stop 'Template storage is not allocated in configuration.' end if if (cfg%n_templates > int(size(cfg%templates), i32)) then error stop 'Template count exceeds allocated storage.' end if do i = 1, cfg%n_templates if (.not. cfg%templates(i)%enabled) cycle mesh_id = mesh_id + 1_i32 call build_one_template(cfg%templates(i), part) call append_triangles(v0, v1, v2, part%v0, part%v1, part%v2) if (allocated(part_mesh_id)) deallocate (part_mesh_id) allocate (part_mesh_id(part%nelem)) part_mesh_id = mesh_id call append_mesh_ids(elem_mesh_id, part_mesh_id) end do if (size(v0, 2) == 0) then error stop 'No enabled template found in configuration.' end if call init_mesh(mesh, v0, v1, v2, elem_mesh_id0=elem_mesh_id) end subroutine build_template_mesh