Loading...
Searching...
No Matches
Functions/Subroutines
gtvarclose.f90 File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine gtvarclose (var, err)
 

Function/Subroutine Documentation

◆ gtvarclose()

subroutine gtvarclose ( type(gt_variable), intent(in), target  var,
logical, intent(out), optional  err 
)

Definition at line 13 of file gtvarclose.f90.

14 !
15 !== 変数の終了処理
16 !
17 ! 変数 *var* の終了処理を行います。Open または Create されたものは
18 ! プログラムの最後に必ずこのサブルーチンを用いて終了処理を行ってください。
19 !
20 ! 終了処理の際にエラーが生じた場合、メッセージを出力してプログラムは
21 ! 強制終了します。*err* を与えてある場合にはこの引数に .true.
22 ! が返り、プログラムは終了しません。
23 !
24 use gtdata_types, only: gt_variable
25 use gtdata_internal_map, only: vtb_class_netcdf, &
31 use dc_trace, only: beginsub, endsub, dbgmessage
32 implicit none
33 type(GT_VARIABLE), intent(in), target:: var
34 logical, intent(out), optional:: err
35 integer:: vid, class, cid
36 logical:: action, myerr
37continue
38 call beginsub('gtvarclose', fmt='var=%d', i=(/var%mapid/))
39 call map_lookup(var, vid=vid)
40 call maptabdelete(var, myerr)
41 if (myerr) goto 999
42 ! vid が 0 になるのは dup_dimmap で作られたハンドル
43 if (vid == 0) goto 999
44 call vartablelookup(vid, class, cid)
45 call vartabledelete(vid, action, myerr)
46 if (myerr) goto 999
47 if (.not. action) then
48 call dbgmessage('refcount decrement only, no close internal var')
49 goto 999
50 else if (class == vtb_class_netcdf) then
51 call close(gd_nc_variable(cid), myerr)
52 if (myerr) goto 999
53 else
54 call storeerror(gt_ebadvar, "GTVarClose", err)
55 call endsub('GTVarClose', 'badvar')
56 myerr = .true.
57 endif
58999 continue
59 call endsub('gtvarclose')
60 if (present(err)) err = myerr
subroutine, public storeerror(number, where, err, cause_c, cause_i)
Definition dc_error.f90:830
integer, parameter, public gt_ebadvar
Definition dc_error.f90:539
integer, parameter, public dc_noerr
Definition dc_error.f90:509
subroutine, public map_lookup(var, vid, map, ndims)
subroutine, public maptabdelete(var, err)
subroutine, public vartabledelete(vid, action, err)
subroutine, public vartablelookup(vid, class, cid)
integer, parameter, public vtb_class_netcdf

References dc_error::dc_noerr, dc_error::gt_ebadvar, gtdata_internal_map::map_lookup(), gtdata_internal_map::maptabdelete(), dc_error::storeerror(), gtdata_internal_vartable::vartabledelete(), and gtdata_internal_vartable::vartablelookup().

Here is the call graph for this function: