write_result_files Subroutine

public subroutine write_result_files(out_dir, mesh, stats, cfg, mpi_world_size, mesh_potential_v, charge_ledger, electrostatic_diagnostics)

解析結果を summary.txt / charges.csv / mesh_triangles.csv などとして保存する。

Arguments

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

出力先ディレクトリ。

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

書き出し対象のメッシュ。

type(sim_stats), intent(in) :: stats

書き出し対象の統計値。

type(app_config), intent(in) :: cfg

出力設定を含むアプリ設定。

integer(kind=i32), intent(in), optional :: mpi_world_size
real(kind=dp), intent(in), optional :: mesh_potential_v(:)
type(charge_ledger_type), intent(in), optional :: charge_ledger
type(electrostatic_diagnostics_type), intent(in), optional :: electrostatic_diagnostics

Calls

proc~~write_result_files~~CallsGraph proc~write_result_files write_result_files proc~begin_checkpoint_publish begin_checkpoint_publish proc~write_result_files->proc~begin_checkpoint_publish proc~ensure_output_dir ensure_output_dir proc~write_result_files->proc~ensure_output_dir proc~atomic_rename atomic_rename proc~begin_checkpoint_publish->proc~atomic_rename proc~create_directories create_directories proc~ensure_output_dir->proc~create_directories

Called by

proc~~write_result_files~~CalledByGraph proc~write_result_files write_result_files program~main main program~main->proc~write_result_files

Source Code

  subroutine write_result_files( &
    out_dir, mesh, stats, cfg, mpi_world_size, mesh_potential_v, charge_ledger, electrostatic_diagnostics &
    )
    character(len=*), intent(in) :: out_dir
    type(mesh_type), intent(in) :: mesh
    type(sim_stats), intent(in) :: stats
    type(app_config), intent(in) :: cfg
    integer(i32), intent(in), optional :: mpi_world_size
    real(dp), intent(in), optional :: mesh_potential_v(:)
    type(charge_ledger_type), intent(in), optional :: charge_ledger
    type(electrostatic_diagnostics_type), intent(in), optional :: electrostatic_diagnostics
    call ensure_output_dir(out_dir)
    call begin_checkpoint_publish(out_dir)
    call write_summary_file( &
      out_dir, mesh, stats, cfg, mpi_world_size=mpi_world_size, charge_ledger=charge_ledger, &
      electrostatic_diagnostics=electrostatic_diagnostics &
      )
    call write_charges_file(out_dir, mesh)
    if (cfg%write_mesh_potential) then
      if (.not. present(mesh_potential_v)) then
        error stop 'write_result_files: mesh_potential_v is required when write_mesh_potential is enabled.'
      end if
      call write_mesh_potential_file(out_dir, mesh, mesh_potential_v)
    end if
    call write_mesh_file(out_dir, mesh)
    call write_mesh_sources_file(out_dir, mesh, cfg)
    if (present(charge_ledger)) call write_charge_ledger_file(out_dir, charge_ledger)
  end subroutine write_result_files