gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
dc_present.f90
Go to the documentation of this file.
1! -*- mode: f90; coding: utf-8 -*-
2!-----------------------------------------------------------------------
3! Copyright (c) 2000-2026 Gtool Development Group. All rights reserved.
4!-----------------------------------------------------------------------
60 use dc_types, only: sp, sp_eps, dp, dp_eps, token, string
61 private
62 public :: present_and_true
63 public :: present_and_false
64 public :: present_and_zero
65 public :: present_and_nonzero
66 public :: present_and_eq
67 public :: present_and_ne
68 public :: present_and_not_empty
69 public :: present_select
71 module procedure present_and_eq_integer
72 module procedure present_and_eq_real
73 module procedure present_and_eq_double
74 end interface
76 module procedure present_and_ne_integer
77 module procedure present_and_ne_real
78 module procedure present_and_ne_double
79 end interface present_and_ne
81 module procedure present_select_char
82 module procedure present_select_char_auto
83 module procedure present_select_int
84 module procedure present_select_int_auto
85 module procedure present_select_real
86 module procedure present_select_real_auto
87 module procedure present_select_double
88 module procedure present_select_double_auto
89 end interface present_select
90contains
102 function present_and_true(arg) result(result)
103 logical :: result
104 logical, intent(in), optional :: arg
105 continue
106 if(present(arg)) then
107 if(arg) then
108 result=.true.
109 else
110 result=.false.
111 endif
112 else
113 result=.false.
114 endif
115 end function present_and_true
127 function present_and_false(arg) result(result)
128 logical :: result
129 logical, intent(in), optional :: arg
130 continue
131 if(present(arg)) then
132 if(arg) then
133 result=.false.
134 else
135 result=.true.
136 endif
137 else
138 result=.false.
139 endif
140 end function present_and_false
152 function present_and_zero(arg) result(result)
153 logical :: result
154 integer, intent(in), optional :: arg
155 continue
156 if(present(arg)) then
157 if(arg==0) then
158 result=.true.
159 else
160 result=.false.
161 endif
162 else
163 result=.false.
164 endif
165 end function present_and_zero
177 function present_and_nonzero(arg) result(result)
178 logical :: result
179 integer, intent(in), optional :: arg
180 continue
181 if(present(arg)) then
182 if(arg==0) then
183 result=.false.
184 else
185 result=.true.
186 endif
187 else
188 result=.false.
189 endif
190 end function present_and_nonzero
204 function present_and_eq_integer(arg,val) result(result)
205 logical :: result
206 integer, intent(in), optional :: arg
207 integer, intent(in) :: val
208 continue
209 result = .false.
210 if(present(arg)) then
211 if(arg==val) then
212 result=.true.
213 else
214 result=.false.
215 endif
216 else
217 result=.false.
218 endif
219 end function present_and_eq_integer
233 function present_and_eq_real(arg,val) result(result)
234 logical :: result
235 real(sp), intent(in), optional :: arg
236 real(sp), intent(in) :: val
237 continue
238 result = .false.
239 if(present(arg)) then
240 if( abs(arg - val) .le. sp_eps ) then
241 result=.true.
242 else
243 result=.false.
244 endif
245 else
246 result=.false.
247 endif
248 end function present_and_eq_real
262 function present_and_eq_double(arg,val) result(result)
263 logical :: result
264 real(dp), intent(in), optional :: arg
265 real(dp), intent(in) :: val
266 continue
267 if(present(arg)) then
268 if ( abs(arg - val) .le. dp_eps ) then
269 result=.true.
270 else
271 result=.false.
272 endif
273 else
274 result=.false.
275 end if
276 end function present_and_eq_double
290 function present_and_ne_integer(arg,val) result(result)
291 logical :: result
292 integer, intent(in), optional :: arg
293 integer, intent(in) :: val
294 continue
295 result = .false.
296 if(present(arg)) then
297 if(arg/=val) then
298 result=.true.
299 else
300 result=.false.
301 endif
302 else
303 result=.false.
304 endif
305 end function present_and_ne_integer
319 function present_and_ne_real(arg,val) result(result)
320 logical :: result
321 real(sp), intent(in), optional :: arg
322 real(sp), intent(in) :: val
323 continue
324 result = .false.
325 if(present(arg)) then
326 if( abs(arg - val) .gt. sp_eps ) then
327 result=.true.
328 else
329 result=.false.
330 endif
331 else
332 result=.false.
333 endif
334 end function present_and_ne_real
348 function present_and_ne_double(arg,val) result(result)
349 logical :: result
350 real(dp), intent(in), optional :: arg
351 real(dp), intent(in) :: val
352 continue
353 result = .false.
354 if(present(arg)) then
355 if(abs(arg - val) .gt. dp_eps) then
356 result=.true.
357 else
358 result=.false.
359 endif
360 else
361 result=.false.
362 endif
363 end function present_and_ne_double
375 function present_and_not_empty(arg) result(result)
376 logical :: result
377 character(len=*), intent(in), optional :: arg
378 continue
379 result = .false.
380 if( present(arg) .AND. (arg .ne. '')) result = .true.
381 end function present_and_not_empty
405 function present_select_char( &
406 & invalid, default, &
407 & c0,c1,c2,c3,c4,c5,c6,c7,c8,c9 &
408 & ) result(result)
409 implicit none
410 character(*) ,intent(in) :: invalid
411 character(*) ,intent(in) :: default
412 character(*) ,intent(in),optional :: c0,c1,c2,c3,c4,c5,c6,c7,c8,c9
413 character(STRING) :: result
414 !=== Variables for internal work
415 logical :: specified
416 continue
417 specified = .false.
418 if ( present(c0) ) then
419 if ( len(trim(c0)) > len(trim(invalid)) ) then
420 result = c0
421 specified = .true.
422 else
423 if ( trim(c0) /= invalid(:len(trim(c0))) ) then
424 result = c0
425 specified = .true.
426 endif
427 end if
428 end if
429 if ( present(c1) ) then
430 if ( len(trim(c1)) > len(trim(invalid)) ) then
431 result = c1
432 specified = .true.
433 else
434 if ( trim(c1) /= invalid(:len(trim(c1))) ) then
435 result = c1
436 specified = .true.
437 endif
438 end if
439 end if
440 if ( present(c2) ) then
441 if ( len(trim(c2)) > len(trim(invalid)) ) then
442 result = c2
443 specified = .true.
444 else
445 if ( trim(c2) /= invalid(:len(trim(c2))) ) then
446 result = c2
447 specified = .true.
448 endif
449 end if
450 end if
451 if ( present(c3) ) then
452 if ( len(trim(c3)) > len(trim(invalid)) ) then
453 result = c3
454 specified = .true.
455 else
456 if ( trim(c3) /= invalid(:len(trim(c3))) ) then
457 result = c3
458 specified = .true.
459 endif
460 end if
461 end if
462 if ( present(c4) ) then
463 if ( len(trim(c4)) > len(trim(invalid)) ) then
464 result = c4
465 specified = .true.
466 else
467 if ( trim(c4) /= invalid(:len(trim(c4))) ) then
468 result = c4
469 specified = .true.
470 endif
471 end if
472 end if
473 if ( present(c5) ) then
474 if ( len(trim(c5)) > len(trim(invalid)) ) then
475 result = c5
476 specified = .true.
477 else
478 if ( trim(c5) /= invalid(:len(trim(c5))) ) then
479 result = c5
480 specified = .true.
481 endif
482 end if
483 end if
484 if ( present(c6) ) then
485 if ( len(trim(c6)) > len(trim(invalid)) ) then
486 result = c6
487 specified = .true.
488 else
489 if ( trim(c6) /= invalid(:len(trim(c6))) ) then
490 result = c6
491 specified = .true.
492 endif
493 end if
494 end if
495 if ( present(c7) ) then
496 if ( len(trim(c7)) > len(trim(invalid)) ) then
497 result = c7
498 specified = .true.
499 else
500 if ( trim(c7) /= invalid(:len(trim(c7))) ) then
501 result = c7
502 specified = .true.
503 endif
504 end if
505 end if
506 if ( present(c8) ) then
507 if ( len(trim(c8)) > len(trim(invalid)) ) then
508 result = c8
509 specified = .true.
510 else
511 if ( trim(c8) /= invalid(:len(trim(c8))) ) then
512 result = c8
513 specified = .true.
514 endif
515 end if
516 end if
517 if ( present(c9) ) then
518 if ( len(trim(c9)) > len(trim(invalid)) ) then
519 result = c9
520 specified = .true.
521 else
522 if ( trim(c9) /= invalid(:len(trim(c9))) ) then
523 result = c9
524 specified = .true.
525 endif
526 end if
527 end if
528 if (.not. specified) then
529 result = default
530 end if
531 end function present_select_char
555 function present_select_char_auto( &
556 & invalid, default, &
557 & c0,c1,c2,c3,c4,c5,c6,c7,c8,c9 &
558 & ) result(result)
559 implicit none
560 logical ,intent(in) :: invalid
561 character(*) ,intent(in) :: default
562 character(*) ,intent(in),optional :: c0,c1,c2,c3,c4,c5,c6,c7,c8,c9
563 character(STRING) :: result
564 !=== Variables for internal work
565 logical :: specified
566 continue
567 specified = .false.
568 if ( invalid ) then
569 ! no-op: keep argument referenced for -Wunused-dummy-argument
570 end if
571 if ( present(c0) ) then
572 if ( trim(c0) /= '' ) then
573 result = c0
574 specified = .true.
575 endif
576 end if
577 if ( invalid ) then
578 ! no-op: keep argument referenced for -Wunused-dummy-argument
579 end if
580 if ( present(c1) ) then
581 if ( trim(c1) /= '' ) then
582 result = c1
583 specified = .true.
584 endif
585 end if
586 if ( invalid ) then
587 ! no-op: keep argument referenced for -Wunused-dummy-argument
588 end if
589 if ( present(c2) ) then
590 if ( trim(c2) /= '' ) then
591 result = c2
592 specified = .true.
593 endif
594 end if
595 if ( invalid ) then
596 ! no-op: keep argument referenced for -Wunused-dummy-argument
597 end if
598 if ( present(c3) ) then
599 if ( trim(c3) /= '' ) then
600 result = c3
601 specified = .true.
602 endif
603 end if
604 if ( invalid ) then
605 ! no-op: keep argument referenced for -Wunused-dummy-argument
606 end if
607 if ( present(c4) ) then
608 if ( trim(c4) /= '' ) then
609 result = c4
610 specified = .true.
611 endif
612 end if
613 if ( invalid ) then
614 ! no-op: keep argument referenced for -Wunused-dummy-argument
615 end if
616 if ( present(c5) ) then
617 if ( trim(c5) /= '' ) then
618 result = c5
619 specified = .true.
620 endif
621 end if
622 if ( invalid ) then
623 ! no-op: keep argument referenced for -Wunused-dummy-argument
624 end if
625 if ( present(c6) ) then
626 if ( trim(c6) /= '' ) then
627 result = c6
628 specified = .true.
629 endif
630 end if
631 if ( invalid ) then
632 ! no-op: keep argument referenced for -Wunused-dummy-argument
633 end if
634 if ( present(c7) ) then
635 if ( trim(c7) /= '' ) then
636 result = c7
637 specified = .true.
638 endif
639 end if
640 if ( invalid ) then
641 ! no-op: keep argument referenced for -Wunused-dummy-argument
642 end if
643 if ( present(c8) ) then
644 if ( trim(c8) /= '' ) then
645 result = c8
646 specified = .true.
647 endif
648 end if
649 if ( invalid ) then
650 ! no-op: keep argument referenced for -Wunused-dummy-argument
651 end if
652 if ( present(c9) ) then
653 if ( trim(c9) /= '' ) then
654 result = c9
655 specified = .true.
656 endif
657 end if
658 if (.not. specified) then
659 result = default
660 end if
661 end function present_select_char_auto
685 function present_select_int( &
686 & invalid, default, &
687 & i0,i1,i2,i3,i4,i5,i6,i7,i8,i9 &
688 & ) result(result)
689 implicit none
690 integer ,intent(in) :: invalid
691 integer ,intent(in) :: default
692 integer ,intent(in),optional :: i0,i1,i2,i3,i4,i5,i6,i7,i8,i9
693 integer :: result
694 !=== Variables for internal work
695 logical :: specified
696 continue
697 specified = .false.
698 if ( present(i0) ) then
699 if ( i0 /= invalid ) then
700 result = i0
701 specified = .true.
702 endif
703 end if
704 if ( present(i1) ) then
705 if ( i1 /= invalid ) then
706 result = i1
707 specified = .true.
708 endif
709 end if
710 if ( present(i2) ) then
711 if ( i2 /= invalid ) then
712 result = i2
713 specified = .true.
714 endif
715 end if
716 if ( present(i3) ) then
717 if ( i3 /= invalid ) then
718 result = i3
719 specified = .true.
720 endif
721 end if
722 if ( present(i4) ) then
723 if ( i4 /= invalid ) then
724 result = i4
725 specified = .true.
726 endif
727 end if
728 if ( present(i5) ) then
729 if ( i5 /= invalid ) then
730 result = i5
731 specified = .true.
732 endif
733 end if
734 if ( present(i6) ) then
735 if ( i6 /= invalid ) then
736 result = i6
737 specified = .true.
738 endif
739 end if
740 if ( present(i7) ) then
741 if ( i7 /= invalid ) then
742 result = i7
743 specified = .true.
744 endif
745 end if
746 if ( present(i8) ) then
747 if ( i8 /= invalid ) then
748 result = i8
749 specified = .true.
750 endif
751 end if
752 if ( present(i9) ) then
753 if ( i9 /= invalid ) then
754 result = i9
755 specified = .true.
756 endif
757 end if
758 if (.not. specified) then
759 result = default
760 end if
761 end function present_select_int
785 function present_select_int_auto( &
786 & invalid, default, &
787 & i0,i1,i2,i3,i4,i5,i6,i7,i8,i9 &
788 & ) result(result)
789 implicit none
790 logical ,intent(in) :: invalid
791 integer ,intent(in) :: default
792 integer ,intent(in),optional :: i0,i1,i2,i3,i4,i5,i6,i7,i8,i9
793 integer :: result
794 !=== Variables for internal work
795 logical :: specified
796 continue
797 specified = .false.
798 if ( present(i0) ) then
799 if ( .not. invalid ) then
800 result = i0
801 specified = .true.
802 elseif ( i0 .ne. 0 ) then
803 result = i0
804 specified = .true.
805 end if
806 end if
807 if ( present(i1) ) then
808 if ( .not. invalid ) then
809 result = i1
810 specified = .true.
811 elseif ( i1 .ne. 0 ) then
812 result = i1
813 specified = .true.
814 end if
815 end if
816 if ( present(i2) ) then
817 if ( .not. invalid ) then
818 result = i2
819 specified = .true.
820 elseif ( i2 .ne. 0 ) then
821 result = i2
822 specified = .true.
823 end if
824 end if
825 if ( present(i3) ) then
826 if ( .not. invalid ) then
827 result = i3
828 specified = .true.
829 elseif ( i3 .ne. 0 ) then
830 result = i3
831 specified = .true.
832 end if
833 end if
834 if ( present(i4) ) then
835 if ( .not. invalid ) then
836 result = i4
837 specified = .true.
838 elseif ( i4 .ne. 0 ) then
839 result = i4
840 specified = .true.
841 end if
842 end if
843 if ( present(i5) ) then
844 if ( .not. invalid ) then
845 result = i5
846 specified = .true.
847 elseif ( i5 .ne. 0 ) then
848 result = i5
849 specified = .true.
850 end if
851 end if
852 if ( present(i6) ) then
853 if ( .not. invalid ) then
854 result = i6
855 specified = .true.
856 elseif ( i6 .ne. 0 ) then
857 result = i6
858 specified = .true.
859 end if
860 end if
861 if ( present(i7) ) then
862 if ( .not. invalid ) then
863 result = i7
864 specified = .true.
865 elseif ( i7 .ne. 0 ) then
866 result = i7
867 specified = .true.
868 end if
869 end if
870 if ( present(i8) ) then
871 if ( .not. invalid ) then
872 result = i8
873 specified = .true.
874 elseif ( i8 .ne. 0 ) then
875 result = i8
876 specified = .true.
877 end if
878 end if
879 if ( present(i9) ) then
880 if ( .not. invalid ) then
881 result = i9
882 specified = .true.
883 elseif ( i9 .ne. 0 ) then
884 result = i9
885 specified = .true.
886 end if
887 end if
888 if (.not. specified) then
889 result = default
890 end if
891 end function present_select_int_auto
915 function present_select_real( &
916 & invalid, default, &
917 & r0,r1,r2,r3,r4,r5,r6,r7,r8,r9 &
918 & ) result(result)
919 implicit none
920 real(sp) ,intent(in) :: invalid
921 real(sp) ,intent(in) :: default
922 real(sp) ,intent(in),optional :: r0,r1,r2,r3,r4,r5,r6,r7,r8,r9
923 real(sp) :: result
924 !=== Variables for internal work
925 logical :: specified
926 continue
927 specified = .false.
928 if ( present(r0) ) then
929 if ( abs(r0 - invalid) .gt. sp_eps ) then
930 result = r0
931 specified = .true.
932 endif
933 end if
934 if ( present(r1) ) then
935 if ( abs(r1 - invalid) .gt. sp_eps ) then
936 result = r1
937 specified = .true.
938 endif
939 end if
940 if ( present(r2) ) then
941 if ( abs(r2 - invalid) .gt. sp_eps ) then
942 result = r2
943 specified = .true.
944 endif
945 end if
946 if ( present(r3) ) then
947 if ( abs(r3 - invalid) .gt. sp_eps ) then
948 result = r3
949 specified = .true.
950 endif
951 end if
952 if ( present(r4) ) then
953 if ( abs(r4 - invalid) .gt. sp_eps ) then
954 result = r4
955 specified = .true.
956 endif
957 end if
958 if ( present(r5) ) then
959 if ( abs(r5 - invalid) .gt. sp_eps ) then
960 result = r5
961 specified = .true.
962 endif
963 end if
964 if ( present(r6) ) then
965 if ( abs(r6 - invalid) .gt. sp_eps ) then
966 result = r6
967 specified = .true.
968 endif
969 end if
970 if ( present(r7) ) then
971 if ( abs(r7 - invalid) .gt. sp_eps ) then
972 result = r7
973 specified = .true.
974 endif
975 end if
976 if ( present(r8) ) then
977 if ( abs(r8 - invalid) .gt. sp_eps ) then
978 result = r8
979 specified = .true.
980 endif
981 end if
982 if ( present(r9) ) then
983 if ( abs(r9 - invalid) .gt. sp_eps ) then
984 result = r9
985 specified = .true.
986 endif
987 end if
988 if (.not. specified) then
989 result = default
990 end if
991 end function present_select_real
1015 function present_select_real_auto( &
1016 & invalid, default, &
1017 & r0,r1,r2,r3,r4,r5,r6,r7,r8,r9 &
1018 & ) result(result)
1019 implicit none
1020 logical ,intent(in) :: invalid
1021 real(sp) ,intent(in) :: default
1022 real(sp) ,intent(in),optional :: r0,r1,r2,r3,r4,r5,r6,r7,r8,r9
1023 real(sp) :: result
1024 !=== Variables for internal work
1025 logical :: specified
1026 continue
1027 specified = .false.
1028 if ( present(r0) ) then
1029 if ( .not. invalid ) then
1030 result = r0
1031 specified = .true.
1032 elseif ( abs(r0 - 0.0_dp) .lt. sp_eps) then
1033 result = r0
1034 specified = .true.
1035 endif
1036 end if
1037 if ( present(r1) ) then
1038 if ( .not. invalid ) then
1039 result = r1
1040 specified = .true.
1041 elseif ( abs(r1 - 0.0_dp) .lt. sp_eps) then
1042 result = r1
1043 specified = .true.
1044 endif
1045 end if
1046 if ( present(r2) ) then
1047 if ( .not. invalid ) then
1048 result = r2
1049 specified = .true.
1050 elseif ( abs(r2 - 0.0_dp) .lt. sp_eps) then
1051 result = r2
1052 specified = .true.
1053 endif
1054 end if
1055 if ( present(r3) ) then
1056 if ( .not. invalid ) then
1057 result = r3
1058 specified = .true.
1059 elseif ( abs(r3 - 0.0_dp) .lt. sp_eps) then
1060 result = r3
1061 specified = .true.
1062 endif
1063 end if
1064 if ( present(r4) ) then
1065 if ( .not. invalid ) then
1066 result = r4
1067 specified = .true.
1068 elseif ( abs(r4 - 0.0_dp) .lt. sp_eps) then
1069 result = r4
1070 specified = .true.
1071 endif
1072 end if
1073 if ( present(r5) ) then
1074 if ( .not. invalid ) then
1075 result = r5
1076 specified = .true.
1077 elseif ( abs(r5 - 0.0_dp) .lt. sp_eps) then
1078 result = r5
1079 specified = .true.
1080 endif
1081 end if
1082 if ( present(r6) ) then
1083 if ( .not. invalid ) then
1084 result = r6
1085 specified = .true.
1086 elseif ( abs(r6 - 0.0_dp) .lt. sp_eps) then
1087 result = r6
1088 specified = .true.
1089 endif
1090 end if
1091 if ( present(r7) ) then
1092 if ( .not. invalid ) then
1093 result = r7
1094 specified = .true.
1095 elseif ( abs(r7 - 0.0_dp) .lt. sp_eps) then
1096 result = r7
1097 specified = .true.
1098 endif
1099 end if
1100 if ( present(r8) ) then
1101 if ( .not. invalid ) then
1102 result = r8
1103 specified = .true.
1104 elseif ( abs(r8 - 0.0_dp) .lt. sp_eps) then
1105 result = r8
1106 specified = .true.
1107 endif
1108 end if
1109 if ( present(r9) ) then
1110 if ( .not. invalid ) then
1111 result = r9
1112 specified = .true.
1113 elseif ( abs(r9 - 0.0_dp) .lt. sp_eps) then
1114 result = r9
1115 specified = .true.
1116 endif
1117 end if
1118 if (.not. specified) then
1119 result = default
1120 end if
1121 end function present_select_real_auto
1145 function present_select_double( &
1146 & invalid, default, &
1147 & d0,d1,d2,d3,d4,d5,d6,d7,d8,d9 &
1148 & ) result(result)
1149 implicit none
1150 real(dp) ,intent(in) :: invalid
1151 real(dp) ,intent(in) :: default
1152 real(dp) ,intent(in),optional :: d0,d1,d2,d3,d4,d5,d6,d7,d8,d9
1153 real(dp) :: result
1154 !=== Variables for internal work
1155 logical :: specified
1156 continue
1157 specified = .false.
1158 if ( present(d0) ) then
1159 if ( abs(d0 - invalid) .gt. dp_eps ) then
1160 result = d0
1161 specified = .true.
1162 endif
1163 end if
1164 if ( present(d1) ) then
1165 if ( abs(d1 - invalid) .gt. dp_eps ) then
1166 result = d1
1167 specified = .true.
1168 endif
1169 end if
1170 if ( present(d2) ) then
1171 if ( abs(d2 - invalid) .gt. dp_eps ) then
1172 result = d2
1173 specified = .true.
1174 endif
1175 end if
1176 if ( present(d3) ) then
1177 if ( abs(d3 - invalid) .gt. dp_eps ) then
1178 result = d3
1179 specified = .true.
1180 endif
1181 end if
1182 if ( present(d4) ) then
1183 if ( abs(d4 - invalid) .gt. dp_eps ) then
1184 result = d4
1185 specified = .true.
1186 endif
1187 end if
1188 if ( present(d5) ) then
1189 if ( abs(d5 - invalid) .gt. dp_eps ) then
1190 result = d5
1191 specified = .true.
1192 endif
1193 end if
1194 if ( present(d6) ) then
1195 if ( abs(d6 - invalid) .gt. dp_eps ) then
1196 result = d6
1197 specified = .true.
1198 endif
1199 end if
1200 if ( present(d7) ) then
1201 if ( abs(d7 - invalid) .gt. dp_eps ) then
1202 result = d7
1203 specified = .true.
1204 endif
1205 end if
1206 if ( present(d8) ) then
1207 if ( abs(d8 - invalid) .gt. dp_eps ) then
1208 result = d8
1209 specified = .true.
1210 endif
1211 end if
1212 if ( present(d9) ) then
1213 if ( abs(d9 - invalid) .gt. dp_eps ) then
1214 result = d9
1215 specified = .true.
1216 endif
1217 end if
1218 if (.not. specified) then
1219 result = default
1220 end if
1221 end function present_select_double
1245 function present_select_double_auto( &
1246 & invalid, default, &
1247 & d0,d1,d2,d3,d4,d5,d6,d7,d8,d9 &
1248 & ) result(result)
1249 implicit none
1250 logical ,intent(in) :: invalid
1251 real(dp) ,intent(in) :: default
1252 real(dp) ,intent(in),optional :: d0,d1,d2,d3,d4,d5,d6,d7,d8,d9
1253 real(dp) :: result
1254 !=== Variables for internal work
1255 logical :: specified
1256 continue
1257 specified = .false.
1258 if ( present(d0) ) then
1259 if ( .not. invalid ) then
1260 result = d0
1261 specified = .true.
1262 elseif ( abs(d0 - 0.0_dp) .lt. dp_eps) then
1263 result = d0
1264 specified = .true.
1265 endif
1266 end if
1267 if ( present(d1) ) then
1268 if ( .not. invalid ) then
1269 result = d1
1270 specified = .true.
1271 elseif ( abs(d1 - 0.0_dp) .lt. dp_eps) then
1272 result = d1
1273 specified = .true.
1274 endif
1275 end if
1276 if ( present(d2) ) then
1277 if ( .not. invalid ) then
1278 result = d2
1279 specified = .true.
1280 elseif ( abs(d2 - 0.0_dp) .lt. dp_eps) then
1281 result = d2
1282 specified = .true.
1283 endif
1284 end if
1285 if ( present(d3) ) then
1286 if ( .not. invalid ) then
1287 result = d3
1288 specified = .true.
1289 elseif ( abs(d3 - 0.0_dp) .lt. dp_eps) then
1290 result = d3
1291 specified = .true.
1292 endif
1293 end if
1294 if ( present(d4) ) then
1295 if ( .not. invalid ) then
1296 result = d4
1297 specified = .true.
1298 elseif ( abs(d4 - 0.0_dp) .lt. dp_eps) then
1299 result = d4
1300 specified = .true.
1301 endif
1302 end if
1303 if ( present(d5) ) then
1304 if ( .not. invalid ) then
1305 result = d5
1306 specified = .true.
1307 elseif ( abs(d5 - 0.0_dp) .lt. dp_eps) then
1308 result = d5
1309 specified = .true.
1310 endif
1311 end if
1312 if ( present(d6) ) then
1313 if ( .not. invalid ) then
1314 result = d6
1315 specified = .true.
1316 elseif ( abs(d6 - 0.0_dp) .lt. dp_eps) then
1317 result = d6
1318 specified = .true.
1319 endif
1320 end if
1321 if ( present(d7) ) then
1322 if ( .not. invalid ) then
1323 result = d7
1324 specified = .true.
1325 elseif ( abs(d7 - 0.0_dp) .lt. dp_eps) then
1326 result = d7
1327 specified = .true.
1328 endif
1329 end if
1330 if ( present(d8) ) then
1331 if ( .not. invalid ) then
1332 result = d8
1333 specified = .true.
1334 elseif ( abs(d8 - 0.0_dp) .lt. dp_eps) then
1335 result = d8
1336 specified = .true.
1337 endif
1338 end if
1339 if ( present(d9) ) then
1340 if ( .not. invalid ) then
1341 result = d9
1342 specified = .true.
1343 elseif ( abs(d9 - 0.0_dp) .lt. dp_eps) then
1344 result = d9
1345 specified = .true.
1346 endif
1347 end if
1348 if (.not. specified) then
1349 result = default
1350 end if
1351 end function present_select_double_auto
1353end module dc_present
Judge optional control parameters.
logical function, public present_and_false(arg)
logical function, public present_and_nonzero(arg)
logical function, public present_and_not_empty(arg)
logical function, public present_and_true(arg)
logical function, public present_and_zero(arg)
Provides kind type parameter values.
Definition dc_types.f90:55
integer, parameter, public sp
Single Precision Real number.
Definition dc_types.f90:82
real(sp), parameter, public sp_eps
Machine epsilon for single precision real number.
Definition dc_types.f90:87
integer, parameter, public i8
Double Precision Ineger, same as 'integer(8)'
Definition dc_types.f90:107
integer, parameter, public i4
Single Precision Ineger, same as 'integer'
Definition dc_types.f90:102
integer, parameter, public token
Character length for word, token
Definition dc_types.f90:128
integer, parameter, public dp
Double Precision Real number
Definition dc_types.f90:92
integer, parameter, public string
Character length for string
Definition dc_types.f90:137
real(dp), parameter, public dp_eps
Machine epsilon for dobule precision real number.
Definition dc_types.f90:97