MAPL_DirPath.F90 Source File


This file depends on

sourcefile~~mapl_dirpath.f90~~EfferentGraph sourcefile~mapl_dirpath.f90 MAPL_DirPath.F90 sourcefile~constants.f90 Constants.F90 sourcefile~mapl_dirpath.f90->sourcefile~constants.f90 sourcefile~mapl_keywordenforcer.f90 MAPL_KeywordEnforcer.F90 sourcefile~mapl_dirpath.f90->sourcefile~mapl_keywordenforcer.f90 sourcefile~internalconstants.f90 InternalConstants.F90 sourcefile~constants.f90->sourcefile~internalconstants.f90 sourcefile~mathconstants.f90 MathConstants.F90 sourcefile~constants.f90->sourcefile~mathconstants.f90 sourcefile~physicalconstants.f90 PhysicalConstants.F90 sourcefile~constants.f90->sourcefile~physicalconstants.f90 sourcefile~physicalconstants.f90->sourcefile~mathconstants.f90

Files dependent on this one

sourcefile~~mapl_dirpath.f90~~AfferentGraph sourcefile~mapl_dirpath.f90 MAPL_DirPath.F90 sourcefile~base.f90 Base.F90 sourcefile~base.f90->sourcefile~mapl_dirpath.f90 sourcefile~mapl_capgridcomp.f90 MAPL_CapGridComp.F90 sourcefile~mapl_capgridcomp.f90->sourcefile~mapl_dirpath.f90 sourcefile~mapl_tilingregridder.f90 MAPL_TilingRegridder.F90 sourcefile~mapl_tilingregridder.f90->sourcefile~mapl_dirpath.f90 sourcefile~maplshared.f90 MaplShared.F90 sourcefile~maplshared.f90->sourcefile~mapl_dirpath.f90 sourcefile~test_dirpath.pf test_DirPath.pf sourcefile~test_dirpath.pf->sourcefile~mapl_dirpath.f90 sourcefile~comp_testing_driver.f90 Comp_Testing_Driver.F90 sourcefile~comp_testing_driver.f90->sourcefile~mapl_capgridcomp.f90 sourcefile~extdataroot_gridcomp.f90 ExtDataRoot_GridComp.F90 sourcefile~extdataroot_gridcomp.f90->sourcefile~maplshared.f90 sourcefile~mapl.f90 MAPL.F90 sourcefile~mapl.f90->sourcefile~base.f90 sourcefile~mapl_cap.f90 MAPL_Cap.F90 sourcefile~mapl_cap.f90->sourcefile~mapl_capgridcomp.f90 sourcefile~mapl_conservativeregridder.f90 MAPL_ConservativeRegridder.F90 sourcefile~mapl_conservativeregridder.f90->sourcefile~mapl_tilingregridder.f90 sourcefile~mapl_fractionalregridder.f90 MAPL_FractionalRegridder.F90 sourcefile~mapl_fractionalregridder.f90->sourcefile~mapl_tilingregridder.f90 sourcefile~mapl_generic.f90 MAPL_Generic.F90 sourcefile~mapl_generic.f90->sourcefile~maplshared.f90 sourcefile~mapl_nuopcwrappermod.f90 MAPL_NUOPCWrapperMod.F90 sourcefile~mapl_nuopcwrappermod.f90->sourcefile~base.f90 sourcefile~mapl_votingregridder.f90 MAPL_VotingRegridder.F90 sourcefile~mapl_votingregridder.f90->sourcefile~mapl_tilingregridder.f90 sourcefile~test_cfio_bundle.pf Test_CFIO_Bundle.pf sourcefile~test_cfio_bundle.pf->sourcefile~base.f90 sourcefile~tstqsat.f90 tstqsat.F90 sourcefile~tstqsat.f90->sourcefile~base.f90 sourcefile~ut_extdata.f90 ut_ExtData.F90 sourcefile~ut_extdata.f90->sourcefile~base.f90 sourcefile~utcfio_bundle.f90 utCFIO_Bundle.F90 sourcefile~utcfio_bundle.f90->sourcefile~base.f90

Source Code

#include "unused_dummy.H"

module MAPL_DirPathMod
   use MAPL_KeywordEnforcerMod
   use MAPL_Constants
   use gFTL_StringVector
   private

   public :: DirPath
   public :: dirpaths

   type, extends(StringVector) :: DirPath
      private
   contains
      procedure :: find
      procedure :: append
   end type DirPath

   type(DirPath) :: dirpaths

contains

   function find(this, file, unusable, rc) result(full_name)
      character(len=:), allocatable :: full_name
      class (DirPath), intent(in) :: this
      character(len=*), intent(in) :: file
      class (KeywordEnforcer), optional, intent(in) :: unusable
      integer, optional, intent(out) :: rc

      type (StringVectorIterator) :: iter
      character(len=:), pointer :: dir
      logical :: exist

      _UNUSED_DUMMY(unusable)

      iter = this%begin()
      do while (iter /= this%end())
         dir => iter%get()
         full_name = trim(dir) // '/' // file
         inquire(file=full_name, exist=exist)
         if (exist) then
            if (present(rc)) then
               rc = MAPL_SUCCESS
            end if
            return
         end if
         call iter%next()
      end do

      full_name = ''
      if (present(rc)) then
         rc = MAPL_FILE_NOT_FOUND
      end if
      
      
   end function find


   subroutine append(this, directory, unusable, rc)
      class (DirPath), intent(inout) :: this
      character(len=*), intent(in) :: directory
      class (KeywordEnforcer), optional, intent(in) :: unusable
      integer, optional, intent(out) :: rc

      _UNUSED_DUMMY(unusable)

      call this%push_back(directory)

      if (present(rc)) then
         rc = MAPL_SUCCESS
      end if
      
   end subroutine append

end module MAPL_DirPathMod