!
!  get_dble_value.f90
!
    subroutine get_dble_value(cmem,cname,dval,dz,ierr)
    use memory_pointers
    character (len=*) :: cmem,cname
    real (selected_int_kind (5)) :: dz(*),dval
    integer :: ierr
!    
    character (len=80) :: ctemp
    logical :: found
!
    integer ptr
!
    found = .false.
    if (cmem(1:7) == 'physics') then
!      
      do i=1,nphys
        ctemp = phys_ptrs(i)%name      
        if (ctemp(1:len(ctemp))==cname(1:len(cname))) then      
          ptr  = phys_ptrs(i)%ptr    
          dval = dz(ptr)
          found = .true.
          exit
        endif
      enddo        
    elseif (cmem(1:4) == 'coef') then
!      
      do i=1,ncoef
        ctemp = coef_ptrs(i)%name      
        if (ctemp(1:len(ctemp))==cname(1:len(cname))) then      
          ptr  = coef_ptrs(i)%ptr    
          dval = dz(ptr)
          found = .true.
          exit
        endif
      enddo 
    elseif (cmem(1:4) == 'cell') then
!      
      do i=1,ncell
        ctemp = cell_ptrs(i)%name      
        if (ctemp(1:len(ctemp))==cname(1:len(cname))) then      
          ptr  = cell_ptrs(i)%ptr    
          dval = dz(ptr)
          found = .true.
          exit
        endif
      enddo       
    elseif (cmem(1:9) == 'interface') then
!      
      do i=1,nint
        ctemp = int_ptrs(i)%name      
        if (ctemp(1:len(ctemp))==cname(1:len(cname))) then      
          ptr  = int_ptrs(i)%ptr    
          dval = dz(ptr)
          found = .true.
          exit
        endif
      enddo  
!             
!    if (cmem = 'task') then   
!    
    endif
!
    if (.not.found) then
      print *, 'Error in get dble value for:'//trim(cname)
      stop
    endif 
!    
    end subroutine get_dble_value