From e7c6a613ae2a66d7ae11ad27c0a171858841cbbf Mon Sep 17 00:00:00 2001 From: zoziha Date: Sat, 5 Nov 2022 15:06:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E9=94=99=E8=AF=AF=E7=9A=84=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/IO/O/save_h5part.f90 | 10 +++++----- src/sph.f90 | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/IO/O/save_h5part.f90 b/src/IO/O/save_h5part.f90 index e09fb84..900a51e 100644 --- a/src/IO/O/save_h5part.f90 +++ b/src/IO/O/save_h5part.f90 @@ -28,13 +28,13 @@ contains logical, intent(in) :: skip !! Skip
!! 跳过 integer(8) :: fid, status - logical :: cover; integer :: i + logical :: cover; integer :: i, stat real(rk), allocatable :: z(:, :) - if (is_exist(file).and..not.skip) then - write (*, '(a)', advance='no') input('The file already exists, will the original file be overwritten? (t/f):') - read (*, *) cover - if (.not. cover) return + if (is_exist(file) .and. .not. skip) then + write (*, '(a)', advance='no') input('The file already exists, will the original file be overwritten? (t/f): ') + read (*, *, iostat=stat) cover + if (.not. cover .or. stat /= 0) return end if fid = h5pt_openw(file) diff --git a/src/sph.f90 b/src/sph.f90 index 649ee20..635da69 100644 --- a/src/sph.f90 +++ b/src/sph.f90 @@ -25,7 +25,7 @@ contains !! 粒子域 select case (cmd_settings%type) case ("lua", "LUA") - write (*, '(a)') info('Pre-processing:Load lua script ...') + write (*, '(a)') info('Pre-processing: Load lua script ...') call load_lua_script(cmd_settings%working_dir.join.'pif.lua', region) case default @@ -52,13 +52,14 @@ contains type(region_t), intent(out) :: region !! Region
!! 计算域 logical :: cover + integer :: stat select case (cmd_settings%type) case ("vtk", "VTK") if (is_exist(cmd_settings%working_dir.join.'pif1.vtu') .and. .not. cmd_settings%skip) then - write (*, '(a)', advance='no') input('文件已存在,将覆盖原文件?(T/F):') - read (*, *) cover - if (.not. cover) return + write (*, '(a)', advance='no') input('The file already exists, will the original file be overwritten? (t/f): ') + read (*, *, iostat=stat) cover + if (.not. cover .or. stat /= 0) return end if write (*, '(a)') info('后处理:加载 h5part 文件') -- Gitee From 8c92ad72b351a4ce509b3cbd26c6d4f9ea923ddf Mon Sep 17 00:00:00 2001 From: zoziha Date: Sun, 6 Nov 2022 08:11:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?sph:=20=E5=B0=8F=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sph.f90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sph.f90 b/src/sph.f90 index 635da69..33e238d 100644 --- a/src/sph.f90 +++ b/src/sph.f90 @@ -7,12 +7,15 @@ module sph use seakeeping_filesystem, only: operator(.join.) use seakeeping_error_handling, only: fatal_error + use seakeeping_filesystem, only: is_exist use sph_command_line, only: pre_settings_t, post_settings_t use sph_region_type, only: region_t use sph_save_h5part, only: save_h5part use sph_load_h5part, only: load_h5part use sph_load_lua, only: load_lua_script use sph_terminal, only: info, error + use sph_save_vtk, only: save_vtk + use sph_terminal, only: input contains @@ -44,9 +47,6 @@ contains !> Post process for the results of the simulation
!> 对结果的后期处理 subroutine cmd_post(cmd_settings, region) - use seakeeping_filesystem, only: is_exist - use sph_save_vtk, only: save_vtk - use sph_terminal, only: input type(post_settings_t), intent(in) :: cmd_settings !! Post process settings
!! 后期处理设置 type(region_t), intent(out) :: region !! Region
@@ -62,8 +62,8 @@ contains if (.not. cover .or. stat /= 0) return end if - write (*, '(a)') info('后处理:加载 h5part 文件') - write (*, '(a)') info('后处理: 保存 vtk 格式') + write (*, '(a)') info('Post-processing: Load h5part file ...') + write (*, '(a)') info('Post-processing: save vtk file ...') call load_h5part(file=cmd_settings%working_dir.join.'pif-out.h5part', & nml=cmd_settings%working_dir.join.'pif.nml', & vtk=cmd_settings%working_dir, & @@ -71,7 +71,7 @@ contains func=save_vtk) case default - call fatal_error('不支持的后处理类型:'//cmd_settings%type) + call fatal_error('Unsupported post-processing type: '//cmd_settings%type) end select -- Gitee