m_Permuter.F90 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284
  1. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  3. !-----------------------------------------------------------------------
  4. ! CVS m_Permuter.F90,v 1.4 2004-04-21 22:54:45 jacob Exp
  5. ! CVS MCT_2_8_0
  6. !BOP -------------------------------------------------------------------
  7. !
  8. ! !MODULE: m_Permuter - permute/unpermute
  9. !
  10. ! !DESCRIPTION:
  11. !
  12. ! !INTERFACE:
  13. module m_Permuter
  14. implicit none
  15. private ! except
  16. public :: permute
  17. public :: unpermute
  18. interface permute; module procedure &
  19. permutei_, & ! integer in place
  20. permuteio_, & ! integer with an output
  21. permutei1_, & ! integer in place
  22. permuteio1_, & ! integer with an output
  23. permuter_, & ! real in place
  24. permutero_, & ! real with an output
  25. permuter1_, & ! real in place
  26. permutero1_, & ! real with an output
  27. permuted_, & ! dble in place
  28. permutedo_, & ! dble with an output
  29. permuted1_, & ! dble in place
  30. permutedo1_, & ! dble with an output
  31. permutel_, & ! logical in place
  32. permutelo_, & ! logical with an output
  33. permutel1_, & ! logical in place
  34. permutelo1_ ! logical with an output
  35. end interface
  36. interface unpermute; module procedure &
  37. unpermutei_, & ! integer in place
  38. unpermuteio_, & ! integer with an output
  39. unpermutei1_, & ! integer in place
  40. unpermuteio1_, & ! integer with an output
  41. unpermuter_, & ! real in place
  42. unpermutero_, & ! real with an output
  43. unpermuter1_, & ! real in place
  44. unpermutero1_, & ! real with an output
  45. unpermuted_, & ! dble in place
  46. unpermutedo_, & ! dble with an output
  47. unpermuted1_, & ! dble in place
  48. unpermutedo1_, & ! dble with an output
  49. unpermutel_, & ! logical in place
  50. unpermutelo_, & ! logical with an output
  51. unpermutel1_, & ! logical in place
  52. unpermutelo1_ ! logical with an output
  53. end interface
  54. ! !REVISION HISTORY:
  55. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  56. ! - initial prototype/prolog/code
  57. !EOP ___________________________________________________________________
  58. character(len=*),parameter :: myname='MCT(MPEU)::m_Permuter'
  59. contains
  60. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  61. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  62. !BOP -------------------------------------------------------------------
  63. !
  64. ! !IROUTINE: permutei_ - permute an integer array according to indx[]
  65. !
  66. ! !DESCRIPTION:
  67. !
  68. ! !INTERFACE:
  69. subroutine permutei_(ary,indx,n)
  70. use m_die
  71. implicit none
  72. integer,dimension(:),intent(inout) :: ary
  73. integer,dimension(:),intent(in) :: indx
  74. integer, intent(in) :: n
  75. ! !REVISION HISTORY:
  76. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  77. ! - initial prototype/prolog/code
  78. !EOP ___________________________________________________________________
  79. character(len=*),parameter :: myname_=myname//'::permutei_'
  80. integer,allocatable,dimension(:) :: wk
  81. integer :: i,ier
  82. allocate(wk(n),stat=ier)
  83. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  84. call permuteio_(wk,ary,indx,n)
  85. do i=1,n
  86. ary(i)=wk(i)
  87. end do
  88. deallocate(wk,stat=ier)
  89. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  90. end subroutine permutei_
  91. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  92. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  93. !BOP -------------------------------------------------------------------
  94. !
  95. ! !IROUTINE: permuteio_ - permute an integer array according to indx[]
  96. !
  97. ! !DESCRIPTION:
  98. !
  99. ! !INTERFACE:
  100. subroutine permuteio_(aout,ary,indx,n)
  101. implicit none
  102. integer,dimension(:),intent(inout) :: aout
  103. integer,dimension(:),intent(in ) :: ary
  104. integer,dimension(:),intent(in) :: indx
  105. integer, intent(in) :: n
  106. ! !REVISION HISTORY:
  107. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  108. ! - initial prototype/prolog/code
  109. !EOP ___________________________________________________________________
  110. character(len=*),parameter :: myname_=myname//'::permuteio_'
  111. integer :: i,l
  112. do i=1,n
  113. l=indx(i)
  114. aout(i)=ary(l)
  115. end do
  116. end subroutine permuteio_
  117. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  118. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  119. !BOP -------------------------------------------------------------------
  120. !
  121. ! !IROUTINE: unpermutei_ - unpermute a _permuted_ integer array
  122. !
  123. ! !DESCRIPTION:
  124. !
  125. ! !INTERFACE:
  126. subroutine unpermutei_(ary,indx,n)
  127. use m_die
  128. implicit none
  129. integer,dimension(:),intent(inout) :: ary
  130. integer,dimension(:),intent(in) :: indx
  131. integer, intent(in) :: n
  132. ! !REVISION HISTORY:
  133. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  134. ! - initial prototype/prolog/code
  135. !EOP ___________________________________________________________________
  136. character(len=*),parameter :: myname_=myname//'::unpermutei_'
  137. integer,allocatable,dimension(:) :: wk
  138. integer :: i,ier
  139. allocate(wk(n),stat=ier)
  140. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  141. call unpermuteio_(wk,ary,indx,n)
  142. do i=1,n
  143. ary(i)=wk(i)
  144. end do
  145. deallocate(wk,stat=ier)
  146. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  147. end subroutine unpermutei_
  148. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  149. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  150. !BOP -------------------------------------------------------------------
  151. !
  152. ! !IROUTINE: unpermuteio_ - unpermute a _permuted_ integer array
  153. !
  154. ! !DESCRIPTION:
  155. !
  156. ! !INTERFACE:
  157. subroutine unpermuteio_(aout,ary,indx,n)
  158. implicit none
  159. integer,dimension(:),intent(inout) :: aout
  160. integer,dimension(:),intent(in) :: ary
  161. integer,dimension(:),intent(in) :: indx
  162. integer, intent(in) :: n
  163. ! !REVISION HISTORY:
  164. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  165. ! - initial prototype/prolog/code
  166. !EOP ___________________________________________________________________
  167. character(len=*),parameter :: myname_=myname//'::unpermuteio_'
  168. integer :: i,l
  169. do i=1,n
  170. l=indx(i)
  171. aout(l)=ary(i)
  172. end do
  173. end subroutine unpermuteio_
  174. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  175. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  176. !BOP -------------------------------------------------------------------
  177. !
  178. ! !IROUTINE: permuter_ - permute a real array according to indx[]
  179. !
  180. ! !DESCRIPTION:
  181. !
  182. ! !INTERFACE:
  183. subroutine permuter_(ary,indx,n)
  184. use m_die
  185. use m_realkinds,only : SP
  186. implicit none
  187. real(SP),dimension(:),intent(inout) :: ary
  188. integer ,dimension(:),intent(in) :: indx
  189. integer , intent(in) :: n
  190. ! !REVISION HISTORY:
  191. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  192. ! - initial prototype/prolog/code
  193. !EOP ___________________________________________________________________
  194. character(len=*),parameter :: myname_=myname//'::permuter_'
  195. real(kind(ary)),allocatable,dimension(:) :: wk
  196. integer :: i,ier
  197. allocate(wk(n),stat=ier)
  198. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  199. call permutero_(wk,ary,indx,n)
  200. do i=1,n
  201. ary(i)=wk(i)
  202. end do
  203. deallocate(wk,stat=ier)
  204. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  205. end subroutine permuter_
  206. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  207. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  208. !BOP -------------------------------------------------------------------
  209. !
  210. ! !IROUTINE: permutero_ - permute a real array according to indx[]
  211. !
  212. ! !DESCRIPTION:
  213. !
  214. ! !INTERFACE:
  215. subroutine permutero_(aout,ary,indx,n)
  216. use m_realkinds,only : SP
  217. implicit none
  218. real(SP),dimension(:),intent(inout) :: aout
  219. real(SP),dimension(:),intent(in) :: ary
  220. integer ,dimension(:),intent(in) :: indx
  221. integer , intent(in) :: n
  222. ! !REVISION HISTORY:
  223. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  224. ! - initial prototype/prolog/code
  225. !EOP ___________________________________________________________________
  226. character(len=*),parameter :: myname_=myname//'::permutero_'
  227. integer :: i,l
  228. do i=1,n
  229. l=indx(i)
  230. aout(i)=ary(l)
  231. end do
  232. end subroutine permutero_
  233. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  234. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  235. !BOP -------------------------------------------------------------------
  236. !
  237. ! !IROUTINE: unpermuter_ - unpermute a _permuted_ real array
  238. !
  239. ! !DESCRIPTION:
  240. !
  241. ! !INTERFACE:
  242. subroutine unpermuter_(ary,indx,n)
  243. use m_die
  244. use m_realkinds,only : SP
  245. implicit none
  246. real(SP),dimension(:),intent(inout) :: ary
  247. integer ,dimension(:),intent(in) :: indx
  248. integer , intent(in) :: n
  249. ! !REVISION HISTORY:
  250. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  251. ! - initial prototype/prolog/code
  252. !EOP ___________________________________________________________________
  253. character(len=*),parameter :: myname_=myname//'::unpermuter_'
  254. real(kind(ary)),allocatable,dimension(:) :: wk
  255. integer :: i,ier
  256. allocate(wk(n),stat=ier)
  257. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  258. call unpermutero_(wk,ary,indx,n)
  259. do i=1,n
  260. ary(i)=wk(i)
  261. end do
  262. deallocate(wk,stat=ier)
  263. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  264. end subroutine unpermuter_
  265. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  266. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  267. !BOP -------------------------------------------------------------------
  268. !
  269. ! !IROUTINE: unpermutero_ - unpermute a _permuted_ real array
  270. !
  271. ! !DESCRIPTION:
  272. !
  273. ! !INTERFACE:
  274. subroutine unpermutero_(aout,ary,indx,n)
  275. use m_realkinds,only : SP
  276. implicit none
  277. real(SP),dimension(:),intent(inout) :: aout
  278. real(SP),dimension(:),intent(in) :: ary
  279. integer ,dimension(:),intent(in) :: indx
  280. integer , intent(in) :: n
  281. ! !REVISION HISTORY:
  282. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  283. ! - initial prototype/prolog/code
  284. !EOP ___________________________________________________________________
  285. character(len=*),parameter :: myname_=myname//'::unpermutero_'
  286. integer :: i,l
  287. do i=1,n
  288. l=indx(i)
  289. aout(l)=ary(i)
  290. end do
  291. end subroutine unpermutero_
  292. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  293. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  294. !BOP -------------------------------------------------------------------
  295. !
  296. ! !IROUTINE: permuted_ - permute a double precision array
  297. !
  298. ! !DESCRIPTION:
  299. !
  300. ! !INTERFACE:
  301. subroutine permuted_(ary,indx,n)
  302. use m_die
  303. use m_realkinds,only : DP
  304. implicit none
  305. real(DP),dimension(:),intent(inout) :: ary
  306. integer ,dimension(:),intent(in) :: indx
  307. integer , intent(in) :: n
  308. ! !REVISION HISTORY:
  309. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  310. ! - initial prototype/prolog/code
  311. !EOP ___________________________________________________________________
  312. character(len=*),parameter :: myname_=myname//'::permuted_'
  313. real(kind(ary)),allocatable,dimension(:) :: wk
  314. integer :: i,ier
  315. allocate(wk(n),stat=ier)
  316. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  317. call permutedo_(wk,ary,indx,n)
  318. do i=1,n
  319. ary(i)=wk(i)
  320. end do
  321. deallocate(wk,stat=ier)
  322. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  323. end subroutine permuted_
  324. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  325. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  326. !BOP -------------------------------------------------------------------
  327. !
  328. ! !IROUTINE: permutedo_ - permute a double precision array
  329. !
  330. ! !DESCRIPTION:
  331. !
  332. ! !INTERFACE:
  333. subroutine permutedo_(aout,ary,indx,n)
  334. use m_realkinds,only : DP
  335. implicit none
  336. real(DP),dimension(:),intent(inout) :: aout
  337. real(DP),dimension(:),intent(in) :: ary
  338. integer ,dimension(:),intent(in) :: indx
  339. integer , intent(in) :: n
  340. ! !REVISION HISTORY:
  341. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  342. ! - initial prototype/prolog/code
  343. !EOP ___________________________________________________________________
  344. character(len=*),parameter :: myname_=myname//'::permutedo_'
  345. integer :: i,l
  346. do i=1,n
  347. l=indx(i)
  348. aout(i)=ary(l)
  349. end do
  350. end subroutine permutedo_
  351. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  352. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  353. !BOP -------------------------------------------------------------------
  354. !
  355. ! !IROUTINE: unpermuted_ - unpermute a double precision array
  356. !
  357. ! !DESCRIPTION:
  358. !
  359. ! !INTERFACE:
  360. subroutine unpermuted_(ary,indx,n)
  361. use m_die
  362. use m_realkinds,only : DP
  363. implicit none
  364. real(DP),dimension(:),intent(inout) :: ary
  365. integer ,dimension(:),intent(in) :: indx
  366. integer , intent(in) :: n
  367. ! !REVISION HISTORY:
  368. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  369. ! - initial prototype/prolog/code
  370. !EOP ___________________________________________________________________
  371. character(len=*),parameter :: myname_=myname//'::unpermuted_'
  372. real(kind(ary)),allocatable,dimension(:) :: wk
  373. integer :: i,ier
  374. allocate(wk(n),stat=ier)
  375. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  376. call unpermutedo_(wk,ary,indx,n)
  377. do i=1,n
  378. ary(i)=wk(i)
  379. end do
  380. deallocate(wk,stat=ier)
  381. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  382. end subroutine unpermuted_
  383. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  384. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  385. !BOP -------------------------------------------------------------------
  386. !
  387. ! !IROUTINE: unpermutedo_ - unpermute a double precision array
  388. !
  389. ! !DESCRIPTION:
  390. !
  391. ! !INTERFACE:
  392. subroutine unpermutedo_(aout,ary,indx,n)
  393. use m_realkinds,only : DP
  394. implicit none
  395. real(DP),dimension(:),intent(inout) :: aout
  396. real(DP),dimension(:),intent(in) :: ary
  397. integer ,dimension(:),intent(in) :: indx
  398. integer , intent(in) :: n
  399. ! !REVISION HISTORY:
  400. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  401. ! - initial prototype/prolog/code
  402. !EOP ___________________________________________________________________
  403. character(len=*),parameter :: myname_=myname//'::unpermutedo_'
  404. integer :: i,l
  405. do i=1,n
  406. l=indx(i)
  407. aout(l)=ary(i)
  408. end do
  409. end subroutine unpermutedo_
  410. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  411. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  412. !BOP -------------------------------------------------------------------
  413. !
  414. ! !IROUTINE: permutel_ - permute a real array according to indx[]
  415. !
  416. ! !DESCRIPTION:
  417. !
  418. ! !INTERFACE:
  419. subroutine permutel_(ary,indx,n)
  420. use m_die
  421. implicit none
  422. logical,dimension(:),intent(inout) :: ary
  423. integer,dimension(:),intent(in) :: indx
  424. integer, intent(in) :: n
  425. ! !REVISION HISTORY:
  426. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  427. ! - initial prototype/prolog/code
  428. !EOP ___________________________________________________________________
  429. character(len=*),parameter :: myname_=myname//'::permutel_'
  430. logical,allocatable,dimension(:) :: wk
  431. integer :: i,ier
  432. allocate(wk(n),stat=ier)
  433. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  434. call permutelo_(wk,ary,indx,n)
  435. do i=1,n
  436. ary(i)=wk(i)
  437. end do
  438. deallocate(wk,stat=ier)
  439. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  440. end subroutine permutel_
  441. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  442. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  443. !BOP -------------------------------------------------------------------
  444. !
  445. ! !IROUTINE: permutelo_ - permute a real array according to indx[]
  446. !
  447. ! !DESCRIPTION:
  448. !
  449. ! !INTERFACE:
  450. subroutine permutelo_(aout,ary,indx,n)
  451. implicit none
  452. logical,dimension(:),intent(inout) :: aout
  453. logical,dimension(:),intent(in) :: ary
  454. integer,dimension(:),intent(in) :: indx
  455. integer, intent(in) :: n
  456. ! !REVISION HISTORY:
  457. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  458. ! - initial prototype/prolog/code
  459. !EOP ___________________________________________________________________
  460. character(len=*),parameter :: myname_=myname//'::permutelo_'
  461. integer :: i,l
  462. do i=1,n
  463. l=indx(i)
  464. aout(i)=ary(l)
  465. end do
  466. end subroutine permutelo_
  467. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  468. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  469. !BOP -------------------------------------------------------------------
  470. !
  471. ! !IROUTINE: unpermutel_ - unpermute a _permuted_ logical array
  472. !
  473. ! !DESCRIPTION:
  474. !
  475. ! !INTERFACE:
  476. subroutine unpermutel_(ary,indx,n)
  477. use m_die
  478. implicit none
  479. logical,dimension(:),intent(inout) :: ary
  480. integer,dimension(:),intent(in) :: indx
  481. integer, intent(in) :: n
  482. ! !REVISION HISTORY:
  483. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  484. ! - initial prototype/prolog/code
  485. !EOP ___________________________________________________________________
  486. character(len=*),parameter :: myname_=myname//'::unpermutel_'
  487. logical,allocatable,dimension(:) :: wk
  488. integer :: i,ier
  489. allocate(wk(n),stat=ier)
  490. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  491. call unpermutelo_(wk,ary,indx,n)
  492. do i=1,n
  493. ary(i)=wk(i)
  494. end do
  495. deallocate(wk,stat=ier)
  496. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  497. end subroutine unpermutel_
  498. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  499. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  500. !BOP -------------------------------------------------------------------
  501. !
  502. ! !IROUTINE: unpermutelo_ - unpermute a _permuted_ logical array
  503. !
  504. ! !DESCRIPTION:
  505. !
  506. ! !INTERFACE:
  507. subroutine unpermutelo_(aout,ary,indx,n)
  508. implicit none
  509. logical,dimension(:),intent(inout) :: aout
  510. logical,dimension(:),intent(in) :: ary
  511. integer,dimension(:),intent(in) :: indx
  512. integer, intent(in) :: n
  513. ! !REVISION HISTORY:
  514. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  515. ! - initial prototype/prolog/code
  516. !EOP ___________________________________________________________________
  517. character(len=*),parameter :: myname_=myname//'::unpermutelo_'
  518. integer :: i,l
  519. do i=1,n
  520. l=indx(i)
  521. aout(l)=ary(i)
  522. end do
  523. end subroutine unpermutelo_
  524. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  525. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  526. !BOP -------------------------------------------------------------------
  527. !
  528. ! !IROUTINE: permutei1_ - permute an integer array according to indx[]
  529. !
  530. ! !DESCRIPTION:
  531. !
  532. ! !INTERFACE:
  533. subroutine permutei1_(ary,indx,n)
  534. use m_die
  535. implicit none
  536. integer,dimension(:,:),intent(inout) :: ary
  537. integer,dimension(:),intent(in) :: indx
  538. integer, intent(in) :: n
  539. ! !REVISION HISTORY:
  540. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  541. ! - initial prototype/prolog/code
  542. !EOP ___________________________________________________________________
  543. character(len=*),parameter :: myname_=myname//'::permutei1_'
  544. integer,allocatable,dimension(:,:) :: wk
  545. integer :: i,l,ier
  546. l=size(ary,1)
  547. allocate(wk(l,n),stat=ier)
  548. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  549. call permuteio1_(wk,ary,indx,n)
  550. do i=1,n
  551. ary(:,i)=wk(:,i)
  552. end do
  553. deallocate(wk,stat=ier)
  554. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  555. end subroutine permutei1_
  556. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  557. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  558. !BOP -------------------------------------------------------------------
  559. !
  560. ! !IROUTINE: permuteio1_ - permute an integer array according to indx[]
  561. !
  562. ! !DESCRIPTION:
  563. !
  564. ! !INTERFACE:
  565. subroutine permuteio1_(aout,ary,indx,n)
  566. implicit none
  567. integer,dimension(:,:),intent(inout) :: aout
  568. integer,dimension(:,:),intent(in ) :: ary
  569. integer,dimension(:),intent(in) :: indx
  570. integer, intent(in) :: n
  571. ! !REVISION HISTORY:
  572. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  573. ! - initial prototype/prolog/code
  574. !EOP ___________________________________________________________________
  575. character(len=*),parameter :: myname_=myname//'::permuteio1_'
  576. integer :: i,l,m
  577. m=min(size(aout,1),size(ary,1))
  578. do i=1,n
  579. l=indx(i)
  580. aout(1:m,i)=ary(1:m,l)
  581. end do
  582. end subroutine permuteio1_
  583. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  584. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  585. !BOP -------------------------------------------------------------------
  586. !
  587. ! !IROUTINE: unpermutei1_ - unpermute a _permuted_ integer array
  588. !
  589. ! !DESCRIPTION:
  590. !
  591. ! !INTERFACE:
  592. subroutine unpermutei1_(ary,indx,n)
  593. use m_die
  594. implicit none
  595. integer,dimension(:,:),intent(inout) :: ary
  596. integer,dimension(:),intent(in) :: indx
  597. integer, intent(in) :: n
  598. ! !REVISION HISTORY:
  599. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  600. ! - initial prototype/prolog/code
  601. !EOP ___________________________________________________________________
  602. character(len=*),parameter :: myname_=myname//'::unpermutei1_'
  603. integer,allocatable,dimension(:,:) :: wk
  604. integer :: i,l,ier
  605. l=size(ary,1)
  606. allocate(wk(l,n),stat=ier)
  607. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  608. call unpermuteio1_(wk,ary,indx,n)
  609. do i=1,n
  610. ary(:,i)=wk(:,i)
  611. end do
  612. deallocate(wk,stat=ier)
  613. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  614. end subroutine unpermutei1_
  615. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  616. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  617. !BOP -------------------------------------------------------------------
  618. !
  619. ! !IROUTINE: unpermuteio1_ - unpermute a _permuted_ integer array
  620. !
  621. ! !DESCRIPTION:
  622. !
  623. ! !INTERFACE:
  624. subroutine unpermuteio1_(aout,ary,indx,n)
  625. implicit none
  626. integer,dimension(:,:),intent(inout) :: aout
  627. integer,dimension(:,:),intent(in) :: ary
  628. integer,dimension(:),intent(in) :: indx
  629. integer, intent(in) :: n
  630. ! !REVISION HISTORY:
  631. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  632. ! - initial prototype/prolog/code
  633. !EOP ___________________________________________________________________
  634. character(len=*),parameter :: myname_=myname//'::unpermuteio1_'
  635. integer :: i,l,m
  636. m=min(size(aout,1),size(ary,1))
  637. do i=1,n
  638. l=indx(i)
  639. aout(1:m,l)=ary(1:m,i)
  640. end do
  641. end subroutine unpermuteio1_
  642. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  643. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  644. !BOP -------------------------------------------------------------------
  645. !
  646. ! !IROUTINE: permuter1_ - permute a real array according to indx[]
  647. !
  648. ! !DESCRIPTION:
  649. !
  650. ! !INTERFACE:
  651. subroutine permuter1_(ary,indx,n)
  652. use m_die
  653. use m_realkinds,only : SP
  654. implicit none
  655. real(SP),dimension(:,:),intent(inout) :: ary
  656. integer ,dimension(:),intent(in) :: indx
  657. integer , intent(in) :: n
  658. ! !REVISION HISTORY:
  659. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  660. ! - initial prototype/prolog/code
  661. !EOP ___________________________________________________________________
  662. character(len=*),parameter :: myname_=myname//'::permuter1_'
  663. real(kind(ary)),allocatable,dimension(:,:) :: wk
  664. integer :: i,l,ier
  665. l=size(ary,1)
  666. allocate(wk(l,n),stat=ier)
  667. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  668. call permutero1_(wk,ary,indx,n)
  669. do i=1,n
  670. ary(:,i)=wk(:,i)
  671. end do
  672. deallocate(wk,stat=ier)
  673. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  674. end subroutine permuter1_
  675. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  676. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  677. !BOP -------------------------------------------------------------------
  678. !
  679. ! !IROUTINE: permutero1_ - permute a real array according to indx[]
  680. !
  681. ! !DESCRIPTION:
  682. !
  683. ! !INTERFACE:
  684. subroutine permutero1_(aout,ary,indx,n)
  685. use m_realkinds,only : SP
  686. implicit none
  687. real(SP),dimension(:,:),intent(inout) :: aout
  688. real(SP),dimension(:,:),intent(in) :: ary
  689. integer ,dimension(:),intent(in) :: indx
  690. integer , intent(in) :: n
  691. ! !REVISION HISTORY:
  692. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  693. ! - initial prototype/prolog/code
  694. !EOP ___________________________________________________________________
  695. character(len=*),parameter :: myname_=myname//'::permutero1_'
  696. integer :: i,l,m
  697. m=min(size(aout,1),size(ary,1))
  698. do i=1,n
  699. l=indx(i)
  700. aout(1:m,i)=ary(1:m,l)
  701. end do
  702. end subroutine permutero1_
  703. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  704. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  705. !BOP -------------------------------------------------------------------
  706. !
  707. ! !IROUTINE: unpermuter1_ - unpermute a _permuted_ real array
  708. !
  709. ! !DESCRIPTION:
  710. !
  711. ! !INTERFACE:
  712. subroutine unpermuter1_(ary,indx,n)
  713. use m_die
  714. use m_realkinds,only : SP
  715. implicit none
  716. real(SP),dimension(:,:),intent(inout) :: ary
  717. integer ,dimension(:),intent(in) :: indx
  718. integer , intent(in) :: n
  719. ! !REVISION HISTORY:
  720. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  721. ! - initial prototype/prolog/code
  722. !EOP ___________________________________________________________________
  723. character(len=*),parameter :: myname_=myname//'::unpermuter1_'
  724. real(kind(ary)),allocatable,dimension(:,:) :: wk
  725. integer :: i,l,ier
  726. l=size(ary,1)
  727. allocate(wk(l,n),stat=ier)
  728. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  729. call unpermutero1_(wk,ary,indx,n)
  730. do i=1,n
  731. ary(:,i)=wk(:,i)
  732. end do
  733. deallocate(wk,stat=ier)
  734. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  735. end subroutine unpermuter1_
  736. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  737. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  738. !BOP -------------------------------------------------------------------
  739. !
  740. ! !IROUTINE: unpermutero1_ - unpermute a _permuted_ real array
  741. !
  742. ! !DESCRIPTION:
  743. !
  744. ! !INTERFACE:
  745. subroutine unpermutero1_(aout,ary,indx,n)
  746. use m_realkinds,only : SP
  747. implicit none
  748. real(SP),dimension(:,:),intent(inout) :: aout
  749. real(SP),dimension(:,:),intent(in) :: ary
  750. integer ,dimension(:),intent(in) :: indx
  751. integer , intent(in) :: n
  752. ! !REVISION HISTORY:
  753. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  754. ! - initial prototype/prolog/code
  755. !EOP ___________________________________________________________________
  756. character(len=*),parameter :: myname_=myname//'::unpermutero1_'
  757. integer :: i,l,m
  758. m=min(size(aout,1),size(ary,1))
  759. do i=1,n
  760. l=indx(i)
  761. aout(1:m,l)=ary(1:m,i)
  762. end do
  763. end subroutine unpermutero1_
  764. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  765. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  766. !BOP -------------------------------------------------------------------
  767. !
  768. ! !IROUTINE: permuted1_ - permute a double precision array
  769. !
  770. ! !DESCRIPTION:
  771. !
  772. ! !INTERFACE:
  773. subroutine permuted1_(ary,indx,n)
  774. use m_die
  775. use m_realkinds,only : DP
  776. implicit none
  777. real(DP),dimension(:,:),intent(inout) :: ary
  778. integer ,dimension(:),intent(in) :: indx
  779. integer , intent(in) :: n
  780. ! !REVISION HISTORY:
  781. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  782. ! - initial prototype/prolog/code
  783. !EOP ___________________________________________________________________
  784. character(len=*),parameter :: myname_=myname//'::permuted1_'
  785. real(kind(ary)),allocatable,dimension(:,:) :: wk
  786. integer :: i,l,ier
  787. l=size(ary,1)
  788. allocate(wk(l,n),stat=ier)
  789. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  790. call permutedo1_(wk,ary,indx,n)
  791. do i=1,n
  792. ary(:,i)=wk(:,i)
  793. end do
  794. deallocate(wk,stat=ier)
  795. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  796. end subroutine permuted1_
  797. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  798. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  799. !BOP -------------------------------------------------------------------
  800. !
  801. ! !IROUTINE: permutedo1_ - permute a double precision array
  802. !
  803. ! !DESCRIPTION:
  804. !
  805. ! !INTERFACE:
  806. subroutine permutedo1_(aout,ary,indx,n)
  807. use m_realkinds,only : DP
  808. implicit none
  809. real(DP),dimension(:,:),intent(inout) :: aout
  810. real(DP),dimension(:,:),intent(in) :: ary
  811. integer ,dimension(:),intent(in) :: indx
  812. integer , intent(in) :: n
  813. ! !REVISION HISTORY:
  814. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  815. ! - initial prototype/prolog/code
  816. !EOP ___________________________________________________________________
  817. character(len=*),parameter :: myname_=myname//'::permutedo1_'
  818. integer :: i,l,m
  819. m=min(size(aout,1),size(ary,1))
  820. do i=1,n
  821. l=indx(i)
  822. aout(1:m,i)=ary(1:m,l)
  823. end do
  824. end subroutine permutedo1_
  825. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  826. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  827. !BOP -------------------------------------------------------------------
  828. !
  829. ! !IROUTINE: unpermuted1_ - unpermute a double precision array
  830. !
  831. ! !DESCRIPTION:
  832. !
  833. ! !INTERFACE:
  834. subroutine unpermuted1_(ary,indx,n)
  835. use m_die
  836. use m_realkinds,only : DP
  837. implicit none
  838. real(DP),dimension(:,:),intent(inout) :: ary
  839. integer ,dimension(:),intent(in) :: indx
  840. integer , intent(in) :: n
  841. ! !REVISION HISTORY:
  842. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  843. ! - initial prototype/prolog/code
  844. !EOP ___________________________________________________________________
  845. character(len=*),parameter :: myname_=myname//'::unpermuted1_'
  846. real(kind(ary)),allocatable,dimension(:,:) :: wk
  847. integer :: i,l,ier
  848. l=size(ary,1)
  849. allocate(wk(l,n),stat=ier)
  850. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  851. call unpermutedo1_(wk,ary,indx,n)
  852. do i=1,n
  853. ary(:,i)=wk(:,i)
  854. end do
  855. deallocate(wk,stat=ier)
  856. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  857. end subroutine unpermuted1_
  858. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  859. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  860. !BOP -------------------------------------------------------------------
  861. !
  862. ! !IROUTINE: unpermutedo1_ - unpermute a double precision array
  863. !
  864. ! !DESCRIPTION:
  865. !
  866. ! !INTERFACE:
  867. subroutine unpermutedo1_(aout,ary,indx,n)
  868. use m_realkinds,only : DP
  869. implicit none
  870. real(DP),dimension(:,:),intent(inout) :: aout
  871. real(DP),dimension(:,:),intent(in) :: ary
  872. integer ,dimension(:),intent(in) :: indx
  873. integer , intent(in) :: n
  874. ! !REVISION HISTORY:
  875. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  876. ! - initial prototype/prolog/code
  877. !EOP ___________________________________________________________________
  878. character(len=*),parameter :: myname_=myname//'::unpermutedo1_'
  879. integer :: i,l,m
  880. m=min(size(aout,1),size(ary,1))
  881. do i=1,n
  882. l=indx(i)
  883. aout(1:m,l)=ary(1:m,i)
  884. end do
  885. end subroutine unpermutedo1_
  886. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  887. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  888. !BOP -------------------------------------------------------------------
  889. !
  890. ! !IROUTINE: permutel1_ - permute a real array according to indx[]
  891. !
  892. ! !DESCRIPTION:
  893. !
  894. ! !INTERFACE:
  895. subroutine permutel1_(ary,indx,n)
  896. use m_die
  897. implicit none
  898. logical,dimension(:,:),intent(inout) :: ary
  899. integer,dimension(:),intent(in) :: indx
  900. integer, intent(in) :: n
  901. ! !REVISION HISTORY:
  902. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  903. ! - initial prototype/prolog/code
  904. !EOP ___________________________________________________________________
  905. character(len=*),parameter :: myname_=myname//'::permutel1_'
  906. logical,allocatable,dimension(:,:) :: wk
  907. integer :: i,l,ier
  908. l=size(ary,1)
  909. allocate(wk(l,n),stat=ier)
  910. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  911. call permutelo1_(wk,ary,indx,n)
  912. do i=1,n
  913. ary(:,i)=wk(:,i)
  914. end do
  915. deallocate(wk,stat=ier)
  916. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  917. end subroutine permutel1_
  918. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  919. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  920. !BOP -------------------------------------------------------------------
  921. !
  922. ! !IROUTINE: permutelo1_ - permute a real array according to indx[]
  923. !
  924. ! !DESCRIPTION:
  925. !
  926. ! !INTERFACE:
  927. subroutine permutelo1_(aout,ary,indx,n)
  928. implicit none
  929. logical,dimension(:,:),intent(inout) :: aout
  930. logical,dimension(:,:),intent(in) :: ary
  931. integer,dimension(:),intent(in) :: indx
  932. integer, intent(in) :: n
  933. ! !REVISION HISTORY:
  934. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  935. ! - initial prototype/prolog/code
  936. !EOP ___________________________________________________________________
  937. character(len=*),parameter :: myname_=myname//'::permutelo1_'
  938. integer :: i,l,m
  939. m=min(size(aout,1),size(ary,1))
  940. do i=1,n
  941. l=indx(i)
  942. aout(1:m,i)=ary(1:m,l)
  943. end do
  944. end subroutine permutelo1_
  945. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  946. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  947. !BOP -------------------------------------------------------------------
  948. !
  949. ! !IROUTINE: unpermutel1_ - unpermute a _permuted_ logical array
  950. !
  951. ! !DESCRIPTION:
  952. !
  953. ! !INTERFACE:
  954. subroutine unpermutel1_(ary,indx,n)
  955. use m_die
  956. implicit none
  957. logical,dimension(:,:),intent(inout) :: ary
  958. integer,dimension(:),intent(in) :: indx
  959. integer, intent(in) :: n
  960. ! !REVISION HISTORY:
  961. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  962. ! - initial prototype/prolog/code
  963. !EOP ___________________________________________________________________
  964. character(len=*),parameter :: myname_=myname//'::unpermutel1_'
  965. logical,allocatable,dimension(:,:) :: wk
  966. integer :: i,l,ier
  967. l=size(ary,1)
  968. allocate(wk(l,n),stat=ier)
  969. if(ier/=0) call perr_die(myname_,'allocate()',ier)
  970. call unpermutelo1_(wk,ary,indx,n)
  971. do i=1,n
  972. ary(:,i)=wk(:,i)
  973. end do
  974. deallocate(wk,stat=ier)
  975. if(ier/=0) call perr_die(myname_,'deallocate()',ier)
  976. end subroutine unpermutel1_
  977. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  978. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  979. !BOP -------------------------------------------------------------------
  980. !
  981. ! !IROUTINE: unpermutelo1_ - unpermute a _permuted_ logical array
  982. !
  983. ! !DESCRIPTION:
  984. !
  985. ! !INTERFACE:
  986. subroutine unpermutelo1_(aout,ary,indx,n)
  987. implicit none
  988. logical,dimension(:,:),intent(inout) :: aout
  989. logical,dimension(:,:),intent(in) :: ary
  990. integer,dimension(:),intent(in) :: indx
  991. integer, intent(in) :: n
  992. ! !REVISION HISTORY:
  993. ! 25Aug99 - Jing Guo <guo@dao.gsfc.nasa.gov>
  994. ! - initial prototype/prolog/code
  995. !EOP ___________________________________________________________________
  996. character(len=*),parameter :: myname_=myname//'::unpermutelo1_'
  997. integer :: i,l,m
  998. m=min(size(aout,1),size(ary,1))
  999. do i=1,n
  1000. l=indx(i)
  1001. aout(1:m,l)=ary(1:m,i)
  1002. end do
  1003. end subroutine unpermutelo1_
  1004. end module m_Permuter