gtool5 Fortran 90/95 Library 1.0.0-rc5
日本語
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dc_present::present_select Interface Reference

Public Member Functions

character(string) function present_select_char (invalid, default, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9)
 
character(string) function present_select_char_auto (invalid, default, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9)
 
integer function present_select_int (invalid, default, i0, i1, i2, i3, i4, i5, i6, i7, i8, i9)
 
integer function present_select_int_auto (invalid, default, i0, i1, i2, i3, i4, i5, i6, i7, i8, i9)
 
real(sp) function present_select_real (invalid, default, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9)
 
real(sp) function present_select_real_auto (invalid, default, r0, r1, r2, r3, r4, r5, r6, r7, r8, r9)
 
real(dp) function present_select_double (invalid, default, d0, d1, d2, d3, d4, d5, d6, d7, d8, d9)
 
real(dp) function present_select_double_auto (invalid, default, d0, d1, d2, d3, d4, d5, d6, d7, d8, d9)
 

Detailed Description

Definition at line 80 of file dc_present.f90.

Member Function/Subroutine Documentation

◆ present_select_char()

character(string) function dc_present::present_select::present_select_char ( character(*), intent(in)  invalid,
character(*), intent(in)  default,
character(*), intent(in), optional  c0,
character(*), intent(in), optional  c1,
character(*), intent(in), optional  c2,
character(*), intent(in), optional  c3,
character(*), intent(in), optional  c4,
character(*), intent(in), optional  c5,
character(*), intent(in), optional  c6,
character(*), intent(in), optional  c7,
character(*), intent(in), optional  c8,
character(*), intent(in), optional  c9 
)

Select the first valid optional argument (Char version)

Returns the first optional argument (c0-c9, i0-i9, r0-r9, or d0-d9) that is present and not equal to invalid. c0/i0/r0/d0 has the highest priority, c9/i9/r9/d9 has the lowest. If all optional arguments are absent or equal to invalid, default is returned.

Parameters
[in]invalidValue that marks an argument as invalid
[in]defaultDefault value to return if no valid argument found
Returns
The first valid optional argument or default

Definition at line 405 of file dc_present.f90.

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

◆ present_select_char_auto()

character(string) function dc_present::present_select::present_select_char_auto ( logical, intent(in)  invalid,
character(*), intent(in)  default,
character(*), intent(in), optional  c0,
character(*), intent(in), optional  c1,
character(*), intent(in), optional  c2,
character(*), intent(in), optional  c3,
character(*), intent(in), optional  c4,
character(*), intent(in), optional  c5,
character(*), intent(in), optional  c6,
character(*), intent(in), optional  c7,
character(*), intent(in), optional  c8,
character(*), intent(in), optional  c9 
)

Select the first valid optional argument (Char_auto version)

Returns the first optional argument (c0-c9, i0-i9, r0-r9, or d0-d9) that is present and not equal to invalid. c0/i0/r0/d0 has the highest priority, c9/i9/r9/d9 has the lowest. If all optional arguments are absent or equal to invalid, default is returned.

Parameters
[in]invalidValue that marks an argument as invalid
[in]defaultDefault value to return if no valid argument found
Returns
The first valid optional argument or default

Definition at line 555 of file dc_present.f90.

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

◆ present_select_double()

real(dp) function dc_present::present_select::present_select_double ( real(dp), intent(in)  invalid,
real(dp), intent(in)  default,
real(dp), intent(in), optional  d0,
real(dp), intent(in), optional  d1,
real(dp), intent(in), optional  d2,
real(dp), intent(in), optional  d3,
real(dp), intent(in), optional  d4,
real(dp), intent(in), optional  d5,
real(dp), intent(in), optional  d6,
real(dp), intent(in), optional  d7,
real(dp), intent(in), optional  d8,
real(dp), intent(in), optional  d9 
)

Select the first valid optional argument (Double version)

Returns the first optional argument (c0-c9, i0-i9, r0-r9, or d0-d9) that is present and not equal to invalid. c0/i0/r0/d0 has the highest priority, c9/i9/r9/d9 has the lowest. If all optional arguments are absent or equal to invalid, default is returned.

Parameters
[in]invalidValue that marks an argument as invalid
[in]defaultDefault value to return if no valid argument found
Returns
The first valid optional argument or default

Definition at line 1145 of file dc_present.f90.

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

References dc_types::dp_eps.

◆ present_select_double_auto()

real(dp) function dc_present::present_select::present_select_double_auto ( logical, intent(in)  invalid,
real(dp), intent(in)  default,
real(dp), intent(in), optional  d0,
real(dp), intent(in), optional  d1,
real(dp), intent(in), optional  d2,
real(dp), intent(in), optional  d3,
real(dp), intent(in), optional  d4,
real(dp), intent(in), optional  d5,
real(dp), intent(in), optional  d6,
real(dp), intent(in), optional  d7,
real(dp), intent(in), optional  d8,
real(dp), intent(in), optional  d9 
)

Select the first valid optional argument (Double_auto version)

Returns the first optional argument (c0-c9, i0-i9, r0-r9, or d0-d9) that is present and not equal to invalid. c0/i0/r0/d0 has the highest priority, c9/i9/r9/d9 has the lowest. If all optional arguments are absent or equal to invalid, default is returned.

Parameters
[in]invalidValue that marks an argument as invalid
[in]defaultDefault value to return if no valid argument found
Returns
The first valid optional argument or default

Definition at line 1245 of file dc_present.f90.

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

References dc_types::dp_eps.

◆ present_select_int()

integer function dc_present::present_select::present_select_int ( integer, intent(in)  invalid,
integer, intent(in)  default,
integer, intent(in), optional  i0,
integer, intent(in), optional  i1,
integer, intent(in), optional  i2,
integer, intent(in), optional  i3,
integer, intent(in), optional  i4,
integer, intent(in), optional  i5,
integer, intent(in), optional  i6,
integer, intent(in), optional  i7,
integer, intent(in), optional  i8,
integer, intent(in), optional  i9 
)

Select the first valid optional argument (Int version)

Returns the first optional argument (c0-c9, i0-i9, r0-r9, or d0-d9) that is present and not equal to invalid. c0/i0/r0/d0 has the highest priority, c9/i9/r9/d9 has the lowest. If all optional arguments are absent or equal to invalid, default is returned.

Parameters
[in]invalidValue that marks an argument as invalid
[in]defaultDefault value to return if no valid argument found
Returns
The first valid optional argument or default

Definition at line 685 of file dc_present.f90.

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

References dc_types::i4, and dc_types::i8.

◆ present_select_int_auto()

integer function dc_present::present_select::present_select_int_auto ( logical, intent(in)  invalid,
integer, intent(in)  default,
integer, intent(in), optional  i0,
integer, intent(in), optional  i1,
integer, intent(in), optional  i2,
integer, intent(in), optional  i3,
integer, intent(in), optional  i4,
integer, intent(in), optional  i5,
integer, intent(in), optional  i6,
integer, intent(in), optional  i7,
integer, intent(in), optional  i8,
integer, intent(in), optional  i9 
)

Select the first valid optional argument (Int_auto version)

Returns the first optional argument (c0-c9, i0-i9, r0-r9, or d0-d9) that is present and not equal to invalid. c0/i0/r0/d0 has the highest priority, c9/i9/r9/d9 has the lowest. If all optional arguments are absent or equal to invalid, default is returned.

Parameters
[in]invalidValue that marks an argument as invalid
[in]defaultDefault value to return if no valid argument found
Returns
The first valid optional argument or default

Definition at line 785 of file dc_present.f90.

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

References dc_types::i4, and dc_types::i8.

◆ present_select_real()

real(sp) function dc_present::present_select::present_select_real ( real(sp), intent(in)  invalid,
real(sp), intent(in)  default,
real(sp), intent(in), optional  r0,
real(sp), intent(in), optional  r1,
real(sp), intent(in), optional  r2,
real(sp), intent(in), optional  r3,
real(sp), intent(in), optional  r4,
real(sp), intent(in), optional  r5,
real(sp), intent(in), optional  r6,
real(sp), intent(in), optional  r7,
real(sp), intent(in), optional  r8,
real(sp), intent(in), optional  r9 
)

Select the first valid optional argument (Real version)

Returns the first optional argument (c0-c9, i0-i9, r0-r9, or d0-d9) that is present and not equal to invalid. c0/i0/r0/d0 has the highest priority, c9/i9/r9/d9 has the lowest. If all optional arguments are absent or equal to invalid, default is returned.

Parameters
[in]invalidValue that marks an argument as invalid
[in]defaultDefault value to return if no valid argument found
Returns
The first valid optional argument or default

Definition at line 915 of file dc_present.f90.

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

References dc_types::sp_eps.

◆ present_select_real_auto()

real(sp) function dc_present::present_select::present_select_real_auto ( logical, intent(in)  invalid,
real(sp), intent(in)  default,
real(sp), intent(in), optional  r0,
real(sp), intent(in), optional  r1,
real(sp), intent(in), optional  r2,
real(sp), intent(in), optional  r3,
real(sp), intent(in), optional  r4,
real(sp), intent(in), optional  r5,
real(sp), intent(in), optional  r6,
real(sp), intent(in), optional  r7,
real(sp), intent(in), optional  r8,
real(sp), intent(in), optional  r9 
)

Select the first valid optional argument (Real_auto version)

Returns the first optional argument (c0-c9, i0-i9, r0-r9, or d0-d9) that is present and not equal to invalid. c0/i0/r0/d0 has the highest priority, c9/i9/r9/d9 has the lowest. If all optional arguments are absent or equal to invalid, default is returned.

Parameters
[in]invalidValue that marks an argument as invalid
[in]defaultDefault value to return if no valid argument found
Returns
The first valid optional argument or default

Definition at line 1015 of file dc_present.f90.

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

References dc_types::sp_eps.


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