function write_block_scratch(self, scratch, action, filename, name) result(error)
!< Write one block dataset on scratch files.
class(vtm_file), intent(inout) :: self !< VTM file.
integer(I4P), intent(in) :: scratch !< Scratch unit.
character(*), intent(in) :: action !< Action: [open, write].
character(*), intent(in), optional :: filename !< File name of VTK file grouped into current block.
character(*), intent(in), optional :: name !< Block name
integer(I4P) :: error !< Error status.
type(string) :: action_ !< Action string.
type(string) :: name_ !< Block name, local variable
action_ = trim(adjustl(action)) ; action_ = action_%upper()
select case(action_%chars())
case('OPEN')
open(newunit=self%scratch_unit(scratch), &
form='FORMATTED', &
action='READWRITE', &
status='SCRATCH', &
iostat=error)
name_ = '' ; if (present(name)) name_ = trim(adjustl(name))
write(self%scratch_unit(scratch), iostat=error, fmt='(A)') name_%chars()
case('WRITE')
if (present(filename)) write(self%scratch_unit(scratch), iostat=error, fmt='(A)') trim(filename)
endselect
endfunction write_block_scratch