open Subroutine

private subroutine open(self)

打开

Type Bound

pif_h5part_type

Arguments

Type IntentOptional Attributes Name
class(pif_h5part_type), intent(inout) :: self

Contents

Source Code


Source Code

    subroutine open (self)
        class(pif_h5part_type), intent(inout) :: self
        integer(8) :: istat

        allocate (self%z(self%numbers(4)), source=0.0_rk)

        self%istep = 0_8
        self%fid = h5pt_openw(cli_obj%working_directory.join.ioc_obj%output_file)
        if (self%fid == 0_8) then
            call terminal_obj%error('open pif--out h5part file failed')
        end if

        istat = h5pt_writefileattrib(self%fid, "DateTime", nowtime())
        istat = h5pt_writefileattrib(self%fid, "Creator", "SPX")
        istat = h5pt_writefileattrib(self%fid, "Project", "default")
        istat = h5pt_writefileattrib(self%fid, "Nreal, Nvirt, Ntotal, Dimension", &
                                     [self%numbers(1), self%numbers(3), self%numbers(4), 2], 4_8)
        istat = h5pt_writefileattrib(self%fid, "HSML", [self%ptc%hsml], 1_8)

        istat = h5pt_setnpoints(self%fid, int(self%numbers(4), 8))

        open (newunit=self%fid_stat, file=cli_obj%working_directory.join."STAT.csv", action='write')
        write (self%fid_stat, "(*(A10,:,','))") "Time/s", "X_MIN/m", "Y_MIN/m", "X_MAX/m", "Y_MAX/m"
        if (pif_obj%numbers(5) /= 0) then
            open (newunit=self%fid_float, file=cli_obj%working_directory.join."FLOAT.csv", action='write')
            write (self%fid_float, "(*(A10,:,','))") "Time/s", "X/m", "Y/m", "Fx/N", "Fy/N", "M/N*m"
        end if

    end subroutine open