30 use dc_trace,
only: beginsub, endsub, dbgmessage
33 integer,
intent(in):: dimord1, dimord2
34 logical,
intent(in),
optional:: count_compact
35 logical,
intent(out):: err
38 integer:: ndimsp, stat, idim1, idim2
40 character(*),
parameter:: subname =
'GTVarExchDim'
44 if (
present(count_compact))
then
45 direct_mode = count_compact
47 call beginsub(subname)
48 if (dimord1 < 1 .or. dimord2 < 1)
then
49 call endsub(subname,
"negative dimord=%d %d invalid", i=(/dimord1, dimord2/))
54 call endsub(subname,
"variable invalid")
56 else if (dimord1 > ndimsp .or. dimord2 > ndimsp)
then
57 call endsub(subname,
"dimord=%d %d not exist", i=(/dimord1, dimord2/))
64 if (.not. direct_mode)
then
67 if (idim1 < 0 .or. idim2 < 0)
then
68 call endsub(subname,
"dimord=%d %d not found after compaction", &
69 & i=(/dimord1, dimord2/))
79 map(idim1) = map(idim2)