bem_mesh Module

三角形メッシュ幾何量(重心・法線・AABB・代表長)を前計算して保持するモジュール。


Uses

  • module~~bem_mesh~~UsesGraph module~bem_mesh bem_mesh module~bem_kinds bem_kinds module~bem_mesh->module~bem_kinds module~bem_string_utils bem_string_utils module~bem_mesh->module~bem_string_utils module~bem_types bem_types module~bem_mesh->module~bem_types iso_fortran_env iso_fortran_env module~bem_kinds->iso_fortran_env module~bem_types->module~bem_kinds

Used by

  • module~~bem_mesh~~UsedByGraph module~bem_mesh bem_mesh module~bem_app_config_runtime bem_app_config_runtime module~bem_app_config_runtime->module~bem_mesh module~bem_importers bem_importers module~bem_app_config_runtime->module~bem_importers module~bem_templates bem_templates module~bem_app_config_runtime->module~bem_templates module~bem_importers->module~bem_mesh module~bem_templates->module~bem_mesh program~main main program~main->module~bem_mesh module~bem_app_config bem_app_config program~main->module~bem_app_config module~bem_simulator bem_simulator program~main->module~bem_simulator module~bem_app_config->module~bem_app_config_runtime module~bem_simulator->module~bem_app_config module~bem_simulator_io bem_simulator_io module~bem_simulator_io->module~bem_simulator module~bem_simulator_loop bem_simulator_loop module~bem_simulator_loop->module~bem_simulator module~bem_simulator_stats bem_simulator_stats module~bem_simulator_stats->module~bem_simulator

Functions

public pure function coord_to_cell(mesh, x, axis) result(idx)

座標をグリッドセル添字へ変換し、範囲外は端セルへ丸める。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(in) :: mesh
real(kind=dp), intent(in) :: x
integer(kind=i32), intent(in) :: axis

Return Value integer(kind=i32)

public pure function cell_id(ix, iy, iz, nx, ny) result(cid)

3次元セル添字 (ix,iy,iz) をCSR一次元インデックスへ変換する。

Arguments

Type IntentOptional Attributes Name
integer(kind=i32), intent(in) :: ix
integer(kind=i32), intent(in) :: iy
integer(kind=i32), intent(in) :: iz
integer(kind=i32), intent(in) :: nx
integer(kind=i32), intent(in) :: ny

Return Value integer(kind=i32)

public pure function cross(a, b) result(c)

3次元ベクトルの外積を返す基本演算。

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: a(3)
real(kind=dp), intent(in) :: b(3)

Return Value real(kind=dp), (3)


Subroutines

public subroutine init_mesh(mesh, v0, v1, v2, q0, elem_mesh_id0)

三角形頂点配列から mesh_type を初期化し、幾何キャッシュと要素電荷配列を準備する。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(out) :: mesh

幾何キャッシュ(重心・法線・AABB)を含むメッシュ構造体。

real(kind=dp), intent(in) :: v0(:,:)
real(kind=dp), intent(in) :: v1(:,:)
real(kind=dp), intent(in) :: v2(:,:)
real(kind=dp), intent(in), optional :: q0(:)
integer(kind=i32), intent(in), optional :: elem_mesh_id0(:)

public subroutine prepare_periodic2_collision_mesh(mesh, sim)

periodic2 用に primitive cell メッシュを canonical unwrapped 形へ平行移動し、 幾何キャッシュと collision grid を再構築する。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(inout) :: mesh
type(sim_config), intent(in) :: sim

public subroutine update_mesh_geometry(mesh)

頂点配列から重心・法線・AABB・代表長・collision grid を再構築する。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(inout) :: mesh

public subroutine build_collision_grid(mesh)

三角形AABBを一様グリッドへ登録し、衝突判定の候補探索を高速化する。 要素数が少ない場合は線形探索にフォールバックする。

Arguments

Type IntentOptional Attributes Name
type(mesh_type), intent(inout) :: mesh

public subroutine resolve_periodic2_collision_config(sim, use_periodic2, periodic_axes, periodic_len)

periodic2 collision で使う 2 軸周期設定を検証付きで解決する。

Arguments

Type IntentOptional Attributes Name
type(sim_config), intent(in) :: sim
logical, intent(out) :: use_periodic2
integer(kind=i32), intent(out) :: periodic_axes(2)
real(kind=dp), intent(out) :: periodic_len(2)