bem_importers Module

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


Uses

  • module~~bem_importers~~UsesGraph module~bem_importers bem_importers iso_fortran_env iso_fortran_env module~bem_importers->iso_fortran_env 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 module~bem_kinds->iso_fortran_env module~bem_mesh->module~bem_kinds module~bem_mesh->module~bem_types ieee_arithmetic ieee_arithmetic module~bem_mesh->ieee_arithmetic module~bem_panel_geometry bem_panel_geometry module~bem_mesh->module~bem_panel_geometry module~bem_periodic2_axes bem_periodic2_axes module~bem_mesh->module~bem_periodic2_axes module~bem_triangle_quadrature bem_triangle_quadrature module~bem_mesh->module~bem_triangle_quadrature module~bem_types->module~bem_kinds module~bem_outflow_spectrum bem_outflow_spectrum module~bem_types->module~bem_outflow_spectrum module~bem_outflow_spectrum->module~bem_kinds sheath_model sheath_model module~bem_outflow_spectrum->sheath_model module~bem_panel_geometry->module~bem_kinds module~bem_panel_geometry->ieee_arithmetic module~bem_periodic2_axes->module~bem_kinds module~bem_periodic2_axes->module~bem_types module~bem_string_utils bem_string_utils module~bem_periodic2_axes->module~bem_string_utils module~bem_triangle_quadrature->module~bem_kinds module~bem_triangle_quadrature->module~bem_panel_geometry module~bem_constants bem_constants module~bem_triangle_quadrature->module~bem_constants module~bem_constants->module~bem_kinds

Used by

  • module~~bem_importers~~UsedByGraph module~bem_importers bem_importers module~bem_app_config_mesh_runtime bem_app_config_mesh_runtime module~bem_app_config_mesh_runtime->module~bem_importers module~bem_app_config_runtime bem_app_config_runtime module~bem_app_config_runtime->module~bem_app_config_mesh_runtime 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_runtime module~bem_simulator->module~bem_app_config module~bem_simulator_io bem_simulator_io module~bem_simulator_io->module~bem_app_config_runtime module~bem_simulator_io->module~bem_simulator module~bem_simulator_loop bem_simulator_loop module~bem_simulator_loop->module~bem_app_config_runtime module~bem_simulator_loop->module~bem_simulator module~bem_zhao_outflow_refresh bem_zhao_outflow_refresh module~bem_simulator_loop->module~bem_zhao_outflow_refresh module~bem_simulator_charge bem_simulator_charge module~bem_simulator_charge->module~bem_simulator module~bem_simulator_particles bem_simulator_particles module~bem_simulator_particles->module~bem_simulator module~bem_simulator_stats bem_simulator_stats module~bem_simulator_stats->module~bem_simulator module~bem_zhao_outflow_refresh->module~bem_app_config program~main main program~main->module~bem_app_config program~main->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 read_obj_line(u, line, ios)

OBJの1行を長さ制限なしで読み、行末の CR を除く。 固定長バッファで読むと長い面行が短い有効な面へ切り詰められるため、 非前進読込で行末まで連結する。

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: u

読み込み中の装置番号。

character(len=:), intent(out), allocatable :: line

読み込んだ1行(行末の改行と CR を除く)。

integer, intent(out) :: ios

0 なら1行を読んだ。ファイル終端または読込失敗では非0。

public pure subroutine next_face_token(s, pos, first, last)

面行の pos 以降にある次の空白区切りトークンの範囲を返す。 計数パスと解析パスが同じ規則でトークンを数えるための共通 tokenizer。

Arguments

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

f で始まる左詰めの面行。

integer, intent(inout) :: pos

走査開始位置。戻り値はトークン直後の位置。

integer, intent(out) :: first

トークン先頭位置。トークンがなければ first > last。

integer, intent(out) :: last

トークン先頭位置。トークンがなければ first > last。 トークン末尾位置。

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)

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), allocatable :: idx(:)

public subroutine strip_cr(line)

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

Arguments

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

処理対象の行文字列。