三角形メッシュ幾何量(重心・法線・AABB・代表長)を前計算して保持するモジュール。
座標をグリッドセル添字へ変換し、範囲外は端セルへ丸める。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_type), | intent(in) | :: | mesh | |||
| real(kind=dp), | intent(in) | :: | x | |||
| integer(kind=i32), | intent(in) | :: | axis |
3次元セル添字 (ix,iy,iz) をCSR一次元インデックスへ変換する。
| Type | Intent | Optional | 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 |
3次元ベクトルの外積を返す基本演算。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | a(3) | |||
| real(kind=dp), | intent(in) | :: | b(3) |
三角形頂点配列から mesh_type を初期化し、幾何キャッシュと要素電荷配列を準備する。
| Type | Intent | Optional | 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(:) |
periodic2 用に primitive cell メッシュを canonical unwrapped 形へ平行移動し、 幾何キャッシュと collision grid を再構築する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_type), | intent(inout) | :: | mesh | |||
| type(sim_config), | intent(in) | :: | sim |
頂点配列から重心・法線・AABB・代表長・collision grid を再構築する。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_type), | intent(inout) | :: | mesh |
三角形AABBを一様グリッドへ登録し、衝突判定の候補探索を高速化する。 要素数が少ない場合は線形探索にフォールバックする。
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(mesh_type), | intent(inout) | :: | mesh |
periodic2 collision で使う 2 軸周期設定を検証付きで解決する。
| Type | Intent | Optional | 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) |