| Path: | src/ansearchdim.f90 |
| Last Update: | Wed Jul 20 18:22:22 JST 2005 |
ansearchdim.f90 - search_dim(an_variable, name) Copyright (C) GFD Dennou Club, 2001. All rights reserved
| result : | integer |
| var : | type(AN_VARIABLE), intent(in) |
| name : | character(len = *), intent(in) |
integer function an_search_dim(var, name) result(result)
implicit none
type(AN_VARIABLE), intent(in):: var
character(len = *), intent(in):: name
type(an_variable_entry):: ent
integer:: stat, dimid, i
continue
call beginsub('an_search_dim', 'var=%d name=%c', i=(/var%id/), c1=trim(name))
result = nf_ebaddim
stat = vtable_lookup(var, ent)
if (stat /= NF_NOERR) goto 999
stat = nf_inq_dimid(ent%fileid, name, dimid)
if (stat /= NF_NOERR) goto 999
if (dimid == ent%dimid) then
result = 1
goto 999
endif
if (.not. associated(ent%dimids)) then
stat = gt_enomoredims
goto 999
endif
do, i = 1, size(ent%dimids)
if (ent%dimids(i) == dimid) then
result = i
goto 999
endif
enddo
999 continue
call endsub('an_search_dim', 'result=%d', i=(/result/))
return
end function