@@ -91,6 +91,7 @@ module csv_module
9191                                 csv_get_value,&
9292                                 get_real_sp_column,&
9393                                 get_real_wp_column,&
94+                                  get_real_qp_column,&
9495                                 get_integer_column,&
9596                                 get_logical_column,&
9697                                 get_character_column,&
@@ -99,6 +100,7 @@ module csv_module
99100        procedure  ::  csv_get_value
100101        procedure  ::  get_real_sp_column
101102        procedure  ::  get_real_wp_column
103+         procedure  ::  get_real_qp_column
102104        procedure  ::  get_integer_column
103105        procedure  ::  get_logical_column
104106        procedure  ::  get_character_column
@@ -453,6 +455,14 @@ subroutine add_cell(me,val,int_fmt,real_fmt,trim_str)
453455            end  if 
454456            write (real_val,fmt= rfmt,iostat= istat) val
455457            write (me% iunit,fmt= ' (A)' = ' NO' = istat) trim (adjustl (real_val))
458+         type  is  (real (qp))
459+             if  (present (real_fmt)) then 
460+                 rfmt =  trim (adjustl (real_fmt))
461+             else 
462+                 rfmt =  default_real_fmt
463+             end  if 
464+             write (real_val,fmt= rfmt,iostat= istat) val
465+             write (me% iunit,fmt= ' (A)' = ' NO' = istat) trim (adjustl (real_val))
456466        type  is  (logical )
457467            if  (val) then 
458468                write (me% iunit,fmt= ' (A)' = ' NO' = istat) me% logical_true_string
@@ -756,6 +766,31 @@ pure elemental subroutine to_real_wp(str,val,status_ok)
756766    end subroutine to_real_wp
757767! *****************************************************************************************
758768
769+ ! *****************************************************************************************
770+ ! >
771+ !   Convert a string to a `real(qp)`
772+ 
773+     pure elemental subroutine to_real_qp(str,val,status_ok)
774+ 
775+     implicit none 
776+ 
777+     character (len=* ),intent (in ) ::  str
778+     real (qp),intent (out ) ::  val
779+     logical ,intent (out ) ::  status_ok
780+ 
781+     integer  ::  istat  ! ! read `iostat` error code
782+ 
783+     read (str,fmt=* ,iostat= istat) val
784+     if  (istat== 0 ) then 
785+         status_ok =  .true. 
786+     else 
787+         status_ok =  .false. 
788+         val =  zero
789+     end if 
790+ 
791+     end subroutine to_real_qp
792+ ! *****************************************************************************************
793+ 
759794! *****************************************************************************************
760795! >
761796!   Convert a string to a `integer(ip)`
@@ -924,6 +959,8 @@ subroutine csv_get_value(me,row,col,val,status_ok)
924959        call  to_real_sp(me% csv_data(row,col)% str,val,status_ok)
925960    type  is  (real (wp))
926961        call  to_real_wp(me% csv_data(row,col)% str,val,status_ok)
962+     type  is  (real (qp))
963+         call  to_real_qp(me% csv_data(row,col)% str,val,status_ok)
927964    type  is  (logical )
928965        call  to_logical(me% csv_data(row,col)% str,val,status_ok)
929966    type  is  (character (len=* ))
@@ -1003,6 +1040,10 @@ subroutine get_column(me,icol,r,status_ok)
10031040                    if  (me% verbose) write (error_unit,' (A)' 
10041041                        ' Error converting string to real(real64): ' // trim (me% csv_data(i,icol)% str)
10051042                    r(i) =  zero
1043+                 type  is  (real (qp))
1044+                     if  (me% verbose) write (error_unit,' (A)' 
1045+                         ' Error converting string to real(real128): ' // trim (me% csv_data(i,icol)% str)
1046+                     r(i) =  zero
10061047                type  is  (logical )
10071048                    if  (me% verbose) write (error_unit,' (A)' 
10081049                        ' Error converting string to logical: ' // trim (me% csv_data(i,icol)% str)
@@ -1068,6 +1109,30 @@ subroutine get_real_wp_column(me,icol,r,status_ok)
10681109    end  subroutine  get_real_wp_column 
10691110! *****************************************************************************************
10701111
1112+ ! *****************************************************************************************
1113+ ! >
1114+ !   Return a column from a CSV file as a `real(qp)` vector.
1115+ 
1116+     subroutine  get_real_qp_column (me ,icol ,r ,status_ok )
1117+ 
1118+     implicit none 
1119+ 
1120+     class(csv_file),intent (inout ) ::  me
1121+     integer ,intent (in ) ::  icol  ! ! column number
1122+     real (qp),dimension (:),allocatable ,intent (out ) ::  r
1123+     logical ,intent (out ) ::  status_ok
1124+ 
1125+     if  (allocated (me% csv_data)) then 
1126+         allocate (r(me% n_rows))  !  size the output vector
1127+         call  me% get_column(icol,r,status_ok)
1128+     else 
1129+         if  (me% verbose) write (error_unit,' (A,1X,I5)' ' Error: class has not been initialized' 
1130+         status_ok =  .false. 
1131+     end if 
1132+ 
1133+     end  subroutine  get_real_qp_column 
1134+ ! *****************************************************************************************
1135+ 
10711136! *****************************************************************************************
10721137! >
10731138!   Return a column from a CSV file as a `integer(ip)` vector.
0 commit comments