gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
dc_string::get_array Interface Reference

Public Member Functions

subroutine str2ip (int_ptr, string_in)
subroutine str2rp (real_ptr, string_in)
subroutine str2dp (double_ptr, string_in)

Detailed Description

Definition at line 120 of file dc_string.f90.

Member Function/Subroutine Documentation

◆ str2dp()

subroutine dc_string::get_array::str2dp ( real(dp), dimension(:), pointer double_ptr,
character(len = *), intent(in) string_in )

Parse comma-separated string to double precision real array pointer

Parses string_in separated by comma "," and returns double precision real array pointer double_ptr(:). The array size is determined automatically based on string content. double_ptr must be null or undefined when passed. Memory leak occurs if already allocated.

Parameters
[out]double_ptrDouble precision real array pointer
[in]string_inComma-separated string

Definition at line 856 of file dc_string.f90.

857 real(DP), pointer:: double_ptr(:) !(out)
858 character(len = *), intent(in):: string_in
859 integer:: i, j, idx, nvalues
860 continue
861 nvalues = 1
862 i = 1
863 do
864 idx = index(string_in(i: ), ',')
865 if (idx == 0) exit
866 i = i + idx - 1 + 1
867 nvalues = nvalues + 1
868 enddo
869 allocate(double_ptr(nvalues))
870 i = 1
871 j = 1
872 do
873 idx = index(string_in(i: ), ',')
874 if (idx == 0) then
875 double_ptr(j) = stod(string_in(i: ))
876 exit
877 endif
878 double_ptr(j) = stod(string_in(i: i+idx-2))
879 i = i + idx - 1 + 1
880 j = j + 1
881 enddo

◆ str2ip()

subroutine dc_string::get_array::str2ip ( integer, dimension(:), pointer int_ptr,
character(len = *), intent(in) string_in )

Parse comma-separated string to integer array pointer

Parses string_in separated by comma "," and returns integer array pointer int_ptr(:). The array size is determined automatically based on string content. int_ptr must be null or undefined when passed. Memory leak occurs if already allocated.

Parameters
[out]int_ptrInteger array pointer
[in]string_inComma-separated string

Definition at line 760 of file dc_string.f90.

761 integer, pointer:: int_ptr(:) !(out)
762 character(len = *), intent(in):: string_in
763 integer:: i, j, idx, nvalues
764 continue
765 nvalues = 1
766 i = 1
767 do
768 idx = index(string_in(i: ), ',')
769 if (idx == 0) exit
770 i = i + idx - 1 + 1
771 nvalues = nvalues + 1
772 enddo
773 allocate(int_ptr(nvalues))
774 i = 1
775 j = 1
776 do
777 idx = index(string_in(i: ), ',')
778 if (idx == 0) then
779 int_ptr(j) = stoi(string_in(i: ))
780 exit
781 endif
782 int_ptr(j) = stoi(string_in(i: i+idx-2))
783 i = i + idx - 1 + 1
784 j = j + 1
785 enddo

◆ str2rp()

subroutine dc_string::get_array::str2rp ( real(sp), dimension(:), pointer real_ptr,
character(len = *), intent(in) string_in )

Parse comma-separated string to single precision real array pointer

Parses string_in separated by comma "," and returns single precision real array pointer real_ptr(:). The array size is determined automatically based on string content. real_ptr must be null or undefined when passed. Memory leak occurs if already allocated.

Parameters
[out]real_ptrSingle precision real array pointer
[in]string_inComma-separated string

Definition at line 808 of file dc_string.f90.

809 real(SP), pointer:: real_ptr(:) !(out)
810 character(len = *), intent(in):: string_in
811 integer:: i, j, idx, nvalues
812 continue
813 nvalues = 1
814 i = 1
815 do
816 idx = index(string_in(i: ), ',')
817 if (idx == 0) exit
818 i = i + idx - 1 + 1
819 nvalues = nvalues + 1
820 enddo
821 allocate(real_ptr(nvalues))
822 i = 1
823 j = 1
824 do
825 idx = index(string_in(i: ), ',')
826 if (idx == 0) then
827 real_ptr(j) = stor(string_in(i: ))
828 exit
829 endif
830 real_ptr(j) = stor(string_in(i: i+idx-2))
831 i = i + idx - 1 + 1
832 j = j + 1
833 enddo

The documentation for this interface was generated from the following file: