build_template_mesh Subroutine

public subroutine build_template_mesh(cfg, mesh)

有効なテンプレートを連結し、1つのメッシュへまとめる。

Arguments

Type IntentOptional Attributes Name
type(app_config), intent(in) :: cfg

テンプレート設定を含むアプリ設定。

type(mesh_type), intent(out) :: mesh

連結後の三角形メッシュ。


Calls

proc~~build_template_mesh~~CallsGraph proc~build_template_mesh build_template_mesh proc~append_mesh_ids append_mesh_ids proc~build_template_mesh->proc~append_mesh_ids proc~append_triangles append_triangles proc~build_template_mesh->proc~append_triangles proc~build_one_template build_one_template proc~build_template_mesh->proc~build_one_template proc~init_mesh init_mesh proc~build_template_mesh->proc~init_mesh proc~lower_ascii lower_ascii proc~build_one_template->proc~lower_ascii proc~make_annulus make_annulus proc~build_one_template->proc~make_annulus proc~make_box make_box proc~build_one_template->proc~make_box proc~make_cylinder make_cylinder proc~build_one_template->proc~make_cylinder proc~make_disk make_disk proc~build_one_template->proc~make_disk proc~make_plane make_plane proc~build_one_template->proc~make_plane proc~make_plate_hole make_plate_hole proc~build_one_template->proc~make_plate_hole proc~make_sphere make_sphere proc~build_one_template->proc~make_sphere proc~update_mesh_geometry update_mesh_geometry proc~init_mesh->proc~update_mesh_geometry proc~make_annulus->proc~init_mesh proc~push_tri push_tri proc~make_annulus->proc~push_tri proc~make_box->proc~init_mesh proc~make_box->proc~push_tri proc~make_cylinder->proc~init_mesh proc~make_cylinder->proc~push_tri proc~make_disk->proc~make_annulus proc~make_plane->proc~init_mesh proc~make_plate_hole->proc~init_mesh proc~make_plate_hole->proc~push_tri proc~ray_to_rectangle ray_to_rectangle proc~make_plate_hole->proc~ray_to_rectangle proc~transition_corner_count transition_corner_count proc~make_plate_hole->proc~transition_corner_count proc~transition_corners transition_corners proc~make_plate_hole->proc~transition_corners proc~make_sphere->proc~init_mesh proc~make_sphere->proc~push_tri proc~sph sph proc~make_sphere->proc~sph proc~build_collision_grid build_collision_grid proc~update_mesh_geometry->proc~build_collision_grid proc~cross~2 cross proc~update_mesh_geometry->proc~cross~2 proc~cell_id~2 cell_id proc~build_collision_grid->proc~cell_id~2 proc~coord_to_cell~2 coord_to_cell proc~build_collision_grid->proc~coord_to_cell~2 proc~edge_order_index edge_order_index proc~transition_corner_count->proc~edge_order_index proc~transition_corners->proc~transition_corner_count proc~corner_between corner_between proc~transition_corners->proc~corner_between proc~edge_next_ccw edge_next_ccw proc~transition_corners->proc~edge_next_ccw

Called by

proc~~build_template_mesh~~CalledByGraph proc~build_template_mesh build_template_mesh 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 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