bem_importers Module

OBJメッシュを走査・解析し、内部 mesh_type へ変換するインポートモジュール。


Uses

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

Used by

  • module~~bem_importers~~UsedByGraph module~bem_importers bem_importers module~bem_app_config_runtime bem_app_config_runtime module~bem_app_config_runtime->module~bem_importers module~bem_app_config bem_app_config module~bem_app_config->module~bem_app_config_runtime module~bem_simulator bem_simulator module~bem_simulator->module~bem_app_config program~main main program~main->module~bem_app_config program~main->module~bem_simulator 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 is_vertex_line(line)

与えられた行がOBJ頂点行(v)かを判定する。

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: line

判定対象の1行文字列。

Return Value logical

public pure function is_face_line(line)

与えられた行がOBJ面行(f)かを判定する。

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: line

判定対象の1行文字列。

Return Value logical

public pure function count_face_tokens(line)

面行に含まれる頂点トークン数を数え、扇形分割時の三角形数算出に使う。

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: line

f で始まるOBJ面行。

Return Value integer(kind=i32)


Subroutines

public subroutine load_obj_mesh(path, mesh)

OBJファイルを2パス(件数取得→実データ読込)で読み込み、メッシュを構築する。

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: path

読み込むOBJファイルのパス。

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

OBJから構築した三角形メッシュ。

public subroutine build_mesh_from_indexed(vertices, faces, mesh)

頂点配列と三角形インデックス配列から面頂点配列(v0,v1,v2)を展開して初期化する。

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: vertices(:,:)
integer(kind=i32), intent(in) :: faces(:,:)
type(mesh_type), intent(out) :: mesh

展開後に初期化した三角形メッシュ。

public subroutine scan_obj(path, nvert, ntri)

OBJを行走査して頂点数と三角形分割後の面数を事前計数する。

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: path

走査対象のOBJファイルパス。

integer(kind=i32), intent(out) :: nvert

頂点行 v の総数。

integer(kind=i32), intent(out) :: ntri

頂点行 v の総数。 面行を扇形分割した後の三角形総数。

public subroutine parse_obj(path, vertices, faces)

OBJの頂点/面行を解析し、負インデックス対応で配列へ格納する。

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: path

読み込み対象のOBJファイルパス。

real(kind=dp), intent(out) :: vertices(:,:)
integer(kind=i32), intent(out) :: faces(:,:)

public subroutine parse_vertex_line(line, p)

v x y z 形式の頂点行を3次元座標へ変換する。

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: line

OBJ頂点行(例: v 0.0 1.0 2.0)。

real(kind=dp), intent(out) :: p(3)

public subroutine parse_face_line(line, nvert, idx, ntok)

f 行の頂点参照を抽出し、v/vt/vn 形式から頂点インデックスのみを取り出す。

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: line

OBJ面行(f i j k ...)。

integer(kind=i32), intent(in) :: nvert

負インデックス解決に使う現在有効な頂点数。

integer(kind=i32), intent(out) :: idx(:)
integer(kind=i32), intent(out) :: ntok

抽出した頂点参照トークン数。

public subroutine strip_cr(line)

行末の CR 文字 (char 13) をスペースに置換し、CRLF 改行の OBJ に対応する。

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(inout) :: line

処理対象の行文字列。