Add a vector to a CSV file. Each element is added as a cell to the current line.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(csv_file), | intent(inout) | :: | me | |||
class(*), | intent(in), | dimension(:) | :: | val |
the values to add |
|
character(len=*), | intent(in), | optional | :: | int_fmt |
if |
|
character(len=*), | intent(in), | optional | :: | real_fmt |
if |
|
logical, | intent(in), | optional | :: | trim_str |
if |
subroutine add_vector(me,val,int_fmt,real_fmt,trim_str) implicit none class(csv_file),intent(inout) :: me class(*),dimension(:),intent(in) :: val !! the values to add character(len=*),intent(in),optional :: int_fmt !! if `val` is an integer, use !! this format string. character(len=*),intent(in),optional :: real_fmt !! if `val` is a real, use !! this format string. logical,intent(in),optional :: trim_str !! if `val` is a string, then trim it. integer :: i !! counter do i=1,size(val) #if ( defined __GFORTRAN__ ) && ( __GNUC__ <= 10 ) ! This is a stupid workaround for gfortran bugs (tested with 7.2.0) select type (val) type is (character(len=*)) call me%add(val(i),int_fmt,real_fmt,trim_str) class default call me%add(val(i),int_fmt,real_fmt,trim_str) end select #else call me%add(val(i),int_fmt,real_fmt,trim_str) #endif end do end subroutine add_vector