Validation.F90 Source File


Files dependent on this one

sourcefile~~validation.f90~~AfferentGraph sourcefile~validation.f90 Validation.F90 sourcefile~add_child_by_name.f90 add_child_by_name.F90 sourcefile~add_child_by_name.f90->sourcefile~validation.f90 sourcefile~mapl_generic.f90~2 MAPL_Generic.F90 sourcefile~mapl_generic.f90~2->sourcefile~validation.f90 sourcefile~generic3g.f90 Generic3g.F90 sourcefile~generic3g.f90->sourcefile~mapl_generic.f90~2 sourcefile~mapl3_deprecated.f90 MAPL3_Deprecated.F90 sourcefile~mapl3_deprecated.f90->sourcefile~mapl_generic.f90~2 sourcefile~protoextdatagc.f90 ProtoExtDataGC.F90 sourcefile~protoextdatagc.f90->sourcefile~mapl_generic.f90~2 sourcefile~simpleleafgridcomp.f90 SimpleLeafGridComp.F90 sourcefile~simpleleafgridcomp.f90->sourcefile~mapl_generic.f90~2 sourcefile~simpleparentgridcomp.f90 SimpleParentGridComp.F90 sourcefile~simpleparentgridcomp.f90->sourcefile~mapl_generic.f90~2 sourcefile~test_runchild.pf Test_RunChild.pf sourcefile~test_runchild.pf->sourcefile~mapl_generic.f90~2 sourcefile~test_scenarios.pf Test_Scenarios.pf sourcefile~test_scenarios.pf->sourcefile~mapl_generic.f90~2 sourcefile~test_simpleleafgridcomp.pf Test_SimpleLeafGridComp.pf sourcefile~test_simpleleafgridcomp.pf->sourcefile~mapl_generic.f90~2 sourcefile~test_simpleparentgridcomp.pf Test_SimpleParentGridComp.pf sourcefile~test_simpleparentgridcomp.pf->sourcefile~mapl_generic.f90~2 sourcefile~cap.f90 Cap.F90 sourcefile~cap.f90->sourcefile~generic3g.f90 sourcefile~capgridcomp.f90 CapGridComp.F90 sourcefile~cap.f90->sourcefile~capgridcomp.f90 sourcefile~capgridcomp.f90->sourcefile~generic3g.f90 sourcefile~configurableleafgridcomp.f90 ConfigurableLeafGridComp.F90 sourcefile~configurableleafgridcomp.f90->sourcefile~generic3g.f90 sourcefile~configurableparentgridcomp.f90 ConfigurableParentGridComp.F90 sourcefile~configurableparentgridcomp.f90->sourcefile~generic3g.f90 sourcefile~extdatagridcomp.f90 ExtDataGridComp.F90 sourcefile~extdatagridcomp.f90->sourcefile~generic3g.f90 sourcefile~historycollectiongridcomp.f90 HistoryCollectionGridComp.F90 sourcefile~historycollectiongridcomp.f90->sourcefile~generic3g.f90 sourcefile~historycollectiongridcomp_private.f90 HistoryCollectionGridComp_private.F90 sourcefile~historycollectiongridcomp.f90->sourcefile~historycollectiongridcomp_private.f90 sourcefile~historycollectiongridcomp_private.f90->sourcefile~generic3g.f90 sourcefile~historygridcomp.f90 HistoryGridComp.F90 sourcefile~historygridcomp.f90->sourcefile~generic3g.f90 sourcefile~historygridcomp.f90->sourcefile~historycollectiongridcomp.f90 sourcefile~mapl3g.f90 mapl3g.F90 sourcefile~mapl3g.f90->sourcefile~generic3g.f90 sourcefile~mapl3g.f90->sourcefile~cap.f90 sourcefile~test_extdatagridcomp.pf Test_ExtDataGridComp.pf sourcefile~test_extdatagridcomp.pf->sourcefile~generic3g.f90 sourcefile~test_historygridcomp.pf Test_HistoryGridComp.pf sourcefile~test_historygridcomp.pf->sourcefile~generic3g.f90 sourcefile~geos.f90 GEOS.F90 sourcefile~geos.f90->sourcefile~mapl3g.f90 sourcefile~test_historycollectiongridcomp.pf Test_HistoryCollectionGridComp.pf sourcefile~test_historycollectiongridcomp.pf->sourcefile~historycollectiongridcomp_private.f90

Source Code

module mapl3g_Validation
   implicit none
   private
  
   public :: is_valid_name
  
  
   character(*), parameter :: LOWER = 'abcdefghijklmnopqrstuvwxyz'
   character(*), parameter :: UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
   character(*), parameter :: DIGITS = '0123456789'
   character(*), parameter :: ALPHANUMERIC = LOWER//UPPER//DIGITS

contains


   ! Component names and short names must:
   !  1. Have at least one character
   !  2. Begin with a letter
   !  3. Only consist of letters, digits, and underscores

   pure logical function is_valid_name(name) result(is_valid)
      character(len=*), intent(in) :: name

      is_valid =  len(name) > 0
      if (.not. is_valid) return

      is_valid = (verify(name(1:1), LOWER // UPPER) == 0)
      if (.not. is_valid) return
      
      is_valid = (verify(name(2:), LOWER // UPPER // DIGITS // '_') == 0)

   end function is_valid_name
  
end module mapl3g_Validation