m_String.F90 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  3. !-----------------------------------------------------------------------
  4. ! CVS m_String.F90,v 1.8 2007-11-06 00:03:32 jacob Exp
  5. ! CVS MCT_2_8_0
  6. !BOP -------------------------------------------------------------------
  7. !
  8. ! !MODULE: m_String - The String Datatype
  9. !
  10. ! !DESCRIPTION:
  11. ! The {\tt String} datatype is an encapsulated pointer to a one-dimensional
  12. ! array of single characters. This allows one to define variable-length
  13. ! strings, and arrays of variable-length strings.
  14. !
  15. ! !INTERFACE:
  16. module m_String
  17. ! !USES:
  18. ! No external modules are used in the declaration section of this module.
  19. implicit none
  20. private ! except
  21. ! !PUBLIC TYPES:
  22. public :: String ! The class data structure
  23. Type String
  24. #ifdef SEQUENCE
  25. sequence
  26. #endif
  27. character(len=1),dimension(:),pointer :: c
  28. End Type String
  29. ! !PUBLIC MEMBER FUNCTIONS:
  30. public :: toChar
  31. public :: char ! convert to a CHARACTER(*)
  32. public :: String_init
  33. public :: init ! set a CHARACTER(*) type to a String
  34. public :: String_clean
  35. public :: clean ! Deallocate memory occupied by a String
  36. public :: String_len
  37. public :: len ! length of a String
  38. public :: String_bcast
  39. public :: bcast ! Broadcast a String
  40. public :: String_mci ! Track memory used to store a String
  41. public :: String_mco
  42. public :: ptr_chars ! Assign a pointer to a String's
  43. ! character buffer
  44. interface char; module procedure &
  45. str2ch0_, &
  46. ch12ch0_
  47. end interface
  48. interface toChar; module procedure &
  49. str2ch0_, &
  50. ch12ch0_
  51. end interface
  52. interface String_init; module procedure &
  53. initc_, &
  54. initc1_, &
  55. inits_
  56. end interface
  57. interface init; module procedure &
  58. initc_, &
  59. initc1_, &
  60. inits_
  61. end interface
  62. interface String_clean; module procedure clean_; end interface
  63. interface clean; module procedure clean_; end interface
  64. interface String_len; module procedure len_; end interface
  65. interface len; module procedure len_; end interface
  66. interface String_bcast; module procedure bcast_; end interface
  67. interface bcast; module procedure bcast_; end interface
  68. interface String_mci; module procedure &
  69. mci0_, &
  70. mci1_, &
  71. mci2_, &
  72. mci3_
  73. end interface
  74. interface String_mco; module procedure &
  75. mco0_, &
  76. mco1_, &
  77. mco2_, &
  78. mco3_
  79. end interface
  80. interface ptr_chars; module procedure &
  81. ptr_chars_
  82. end interface
  83. ! !REVISION HISTORY:
  84. ! 22Apr98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  85. !EOP ___________________________________________________________________
  86. character(len=*),parameter :: myname='MCT(MPEU)::m_String'
  87. contains
  88. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  89. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  90. !BOP -------------------------------------------------------------------
  91. !
  92. ! !IROUTINE: str2ch0_ - Convert a String to a CHARACTER
  93. !
  94. ! !DESCRIPTION:
  95. ! This function returns the contents of the character buffer of the
  96. ! input {\tt String} argument {\tt str} as a {\tt CHARCTER} suitable
  97. ! for printing.
  98. !
  99. ! !INTERFACE:
  100. function str2ch0_(str)
  101. ! !USES:
  102. !
  103. ! No external modules are used by this function.
  104. implicit none
  105. ! !INPUT PARAMETERS:
  106. !
  107. type(String), intent(in) :: str
  108. ! !OUTPUT PARAMETERS:
  109. !
  110. character(len=size(str%c,1)) :: str2ch0_
  111. ! !REVISION HISTORY:
  112. ! 23Apr98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  113. !EOP ___________________________________________________________________
  114. character(len=*),parameter :: myname_=myname//'::str2ch0_'
  115. integer :: i
  116. do i=1,size(str%c)
  117. str2ch0_(i:i)=str%c(i)
  118. end do
  119. end function str2ch0_
  120. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  121. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  122. !BOP -------------------------------------------------------------------
  123. !
  124. ! !IROUTINE: ch12ch0_ - Convert a CHARACTER(:) to a CHARACTER(*)
  125. !
  126. ! !DESCRIPTION:
  127. ! This function takes an input one-dimensional array of single characters
  128. ! and returns a single character string.
  129. !
  130. ! !INTERFACE:
  131. function ch12ch0_(ch1)
  132. ! !USES:
  133. !
  134. ! No external modules are used by this function.
  135. implicit none
  136. ! !INPUT PARAMETERS:
  137. !
  138. character(len=1), dimension(:), intent(in) :: ch1
  139. ! !OUTPUT PARAMETERS:
  140. !
  141. character(len=size(ch1,1)) :: ch12ch0_
  142. ! !REVISION HISTORY:
  143. ! 22Apr98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  144. !EOP ___________________________________________________________________
  145. character(len=*),parameter :: myname_=myname//'::ch12ch0_'
  146. integer :: i
  147. do i=1,size(ch1)
  148. ch12ch0_(i:i)=ch1(i)
  149. end do
  150. end function ch12ch0_
  151. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  152. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  153. !BOP -------------------------------------------------------------------
  154. !
  155. ! !IROUTINE: initc_ - Create a String using a CHARACTER
  156. !
  157. ! !DESCRIPTION:
  158. ! This routine takes an input scalar {\tt CHARACTER} argument {\tt chr},
  159. ! and uses it to create the output {\tt String} argument {\tt str}.
  160. !
  161. ! !INTERFACE:
  162. subroutine initc_(str, chr)
  163. ! !USES:
  164. !
  165. use m_die, only : die,perr
  166. use m_mall,only : mall_mci,mall_ison
  167. implicit none
  168. ! !INPUT PARAMETERS:
  169. !
  170. character(len=*), intent(in) :: chr
  171. ! !OUTPUT PARAMETERS:
  172. !
  173. type(String), intent(out) :: str
  174. ! !REVISION HISTORY:
  175. ! 23Apr98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  176. !EOP ___________________________________________________________________
  177. character(len=*),parameter :: myname_=myname//'::initc_'
  178. integer :: ln,ier,i
  179. ln=len(chr)
  180. allocate(str%c(ln),stat=ier)
  181. if(ier /= 0) then
  182. call perr(myname_,'allocate()',ier)
  183. call die(myname_)
  184. endif
  185. if(mall_ison()) call mall_mci(str%c,myname)
  186. do i=1,ln
  187. str%c(i)=chr(i:i)
  188. end do
  189. end subroutine initc_
  190. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  191. ! Math and Computer Science Division, Argonne National Laboratory !
  192. !BOP -------------------------------------------------------------------
  193. !
  194. ! !IROUTINE: initc1_ - Create a String using a CHARACTER array
  195. !
  196. ! !DESCRIPTION:
  197. ! This routine takes an input {\tt CHARACTER(:)} argument {\tt chr},
  198. ! and uses it to create the output {\tt String} argument {\tt str}.
  199. !
  200. ! !INTERFACE:
  201. subroutine initc1_(str, chr)
  202. ! !USES:
  203. !
  204. use m_die, only : die,perr
  205. use m_mall,only : mall_mci,mall_ison
  206. implicit none
  207. ! !INPUT PARAMETERS:
  208. !
  209. character, dimension(:), intent(in) :: chr
  210. ! !OUTPUT PARAMETERS:
  211. !
  212. type(String), intent(out) :: str
  213. ! !REVISION HISTORY:
  214. ! 2Aug02 - J. Larson <larson@mcs.anl.gov> - initial prototype
  215. !EOP ___________________________________________________________________
  216. character(len=*),parameter :: myname_=myname//'::initc1_'
  217. integer :: ln,ier,i
  218. ln=size(chr)
  219. allocate(str%c(ln),stat=ier)
  220. if(ier /= 0) then
  221. call perr(myname_,'allocate()',ier)
  222. call die(myname_)
  223. endif
  224. if(mall_ison()) call mall_mci(str%c,myname)
  225. do i=1,ln
  226. str%c(i)=chr(i)
  227. end do
  228. end subroutine initc1_
  229. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  230. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  231. !BOP -------------------------------------------------------------------
  232. !
  233. ! !IROUTINE: inits_ - Initialization of a String from another String
  234. !
  235. ! !DESCRIPTION:
  236. ! This routine takes an input {\tt String} argument {\tt iStr} and
  237. ! creates an output {\tt String} argument {\tt oStr}. In other words,
  238. ! it copies {\tt iStr} to {\tt oStr}.
  239. !
  240. ! !INTERFACE:
  241. subroutine inits_(oStr, iStr)
  242. ! !USES:
  243. !
  244. use m_die, only : die
  245. use m_mall,only : mall_mci,mall_ison
  246. implicit none
  247. ! !INPUT PARAMETERS:
  248. !
  249. type(String), intent(in) :: iStr
  250. ! !OUTPUT PARAMETERS:
  251. !
  252. type(String), intent(out) :: oStr
  253. ! !REVISION HISTORY:
  254. ! 07Feb00 - Jing Guo <guo@dao.gsfc.nasa.gov>
  255. ! - initial prototype/prolog/code
  256. !EOP ___________________________________________________________________
  257. character(len=*),parameter :: myname_=myname//'::inits_'
  258. integer :: ln,ier,i
  259. ln=size(iStr%c)
  260. allocate(oStr%c(ln),stat=ier)
  261. if(ier /= 0) call die(myname_,'allocate()',ier)
  262. if(mall_ison()) call mall_mci(oStr%c,myname)
  263. do i=1,ln
  264. oStr%c(i)=iStr%c(i)
  265. end do
  266. end subroutine inits_
  267. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  268. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  269. !BOP -------------------------------------------------------------------
  270. !
  271. ! !IROUTINE: clean_ - Deallocate Memory Occupied by a String
  272. !
  273. ! !DESCRIPTION:
  274. ! This routine deallocates memory associated with the input/output
  275. ! {\tt String} argument {\tt str}. This amounts to deallocating
  276. ! {\tt str\%c}.
  277. !
  278. ! !INTERFACE:
  279. subroutine clean_(str)
  280. ! !USES:
  281. !
  282. use m_die, only : die,perr
  283. use m_mall,only : mall_mco,mall_ison
  284. implicit none
  285. ! !INPUT/OUTPUT PARAMETERS:
  286. !
  287. type(String), intent(inout) :: str
  288. ! !REVISION HISTORY:
  289. ! 23Apr98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  290. !EOP ___________________________________________________________________
  291. character(len=*),parameter :: myname_=myname//'::clean_'
  292. integer :: ier
  293. if(mall_ison()) call mall_mco(str%c,myname)
  294. deallocate(str%c,stat=ier)
  295. if(ier /= 0) then
  296. call perr(myname_,'deallocate()',ier)
  297. call die(myname_)
  298. endif
  299. end subroutine clean_
  300. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  301. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  302. !BOP -------------------------------------------------------------------
  303. !
  304. ! !IROUTINE: bcast_ - MPI Broadcast of a rank-0 String
  305. !
  306. ! !DESCRIPTION:
  307. ! This routine performs an MPI broadcast of the input/output {\tt String}
  308. ! argument {\tt Str} on a communicator associated with the Fortran integer
  309. ! handle {\tt comm}. The broadcast originates from the process with rank
  310. ! given by {\tt root} on {\tt comm}. The {\tt String} argument {\tt Str}
  311. ! is on entry valid only on the {\tt root} process, and is valid on exit
  312. ! on all processes on the communicator {\tt comm}. The success (failure)
  313. ! is signified by a zero (non-zero) value of the optional {\tt INTEGER}
  314. ! output argument {\tt stat}.
  315. !
  316. ! !INTERFACE:
  317. subroutine bcast_(Str, root, comm, stat)
  318. ! !USES:
  319. !
  320. use m_mpif90
  321. use m_die, only : perr,die
  322. use m_mall,only : mall_mci,mall_ison
  323. implicit none
  324. ! !INPUT PARAMETERS:
  325. !
  326. integer, intent(in) :: root
  327. integer, intent(in) :: comm
  328. ! !INPUT/OUTPUT PARAMETERS:
  329. !
  330. type(String), intent(inout) :: Str ! (IN) on the root,
  331. ! (OUT) elsewhere
  332. ! !OUTPUT PARAMETERS:
  333. !
  334. integer, optional, intent(out) :: stat
  335. ! !REVISION HISTORY:
  336. ! 27Apr98 - Jing Guo <guo@thunder> - initial prototype/prolog/code
  337. !EOP ___________________________________________________________________
  338. character(len=*),parameter :: myname_=myname//'::bcast_'
  339. integer :: ln,ier,myID
  340. if(present(stat)) stat=0
  341. call MP_comm_rank(comm,myID,ier)
  342. if(ier /= 0) then
  343. call MP_perr(myname_,'MP_comm_rank()',ier)
  344. if(.not.present(stat)) call die(myname_)
  345. stat=ier
  346. return
  347. endif
  348. if(myID==root) then
  349. ln=size(Str%c)
  350. if(ln<=0) call die(myname_,'size(Str%c) <= 0')
  351. endif
  352. call MPI_bcast(ln,1,MP_INTEGER,root,comm,ier)
  353. if(ier/=0) then
  354. call MP_perr(myname_,'MPI_bcast(ln)',ier)
  355. if(.not.present(stat)) call die(myname_)
  356. stat=ier
  357. return
  358. endif
  359. if(myID /= root) then
  360. allocate(Str%c(ln),stat=ier)
  361. if(ier /= 0) then
  362. call perr(myname_,'allocate()',ier)
  363. if(.not.present(stat)) call die(myname_)
  364. stat=ier
  365. return
  366. endif
  367. if(mall_ison()) call mall_mci(Str%c,myname)
  368. endif
  369. call MPI_bcast(Str%c(1),ln,MP_CHARACTER,root,comm,ier)
  370. if(ier/=0) then
  371. call MP_perr(myname_,'MPI_bcast(Str%c)',ier)
  372. if(.not.present(stat)) call die(myname_)
  373. stat=ier
  374. return
  375. endif
  376. end subroutine bcast_
  377. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  378. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  379. !BOP -------------------------------------------------------------------
  380. !
  381. ! !IROUTINE: mci0_ - checking in a String scalar
  382. !
  383. ! !DESCRIPTION:
  384. !
  385. ! !INTERFACE:
  386. subroutine mci0_(marg,thread)
  387. ! !USES:
  388. !
  389. use m_mall, only : mall_ci
  390. implicit none
  391. ! !INPUT PARAMETERS:
  392. !
  393. type(String), intent(in) :: marg
  394. character(len=*), intent(in) :: thread
  395. ! !REVISION HISTORY:
  396. ! 07Feb00 - Jing Guo <guo@dao.gsfc.nasa.gov>
  397. ! - initial prototype/prolog/code
  398. !EOP ___________________________________________________________________
  399. character(len=*),parameter :: myname_=myname//'::mci0_'
  400. call mall_ci(1,thread)
  401. end subroutine mci0_
  402. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  403. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  404. !BOP -------------------------------------------------------------------
  405. !
  406. ! !IROUTINE: mco0_ - checking out a String scalar
  407. !
  408. ! !DESCRIPTION:
  409. !
  410. ! !INTERFACE:
  411. subroutine mco0_(marg,thread)
  412. ! !USES:
  413. !
  414. use m_mall, only : mall_co
  415. implicit none
  416. type(String), intent(in) :: marg
  417. character(len=*),intent(in) :: thread
  418. ! !REVISION HISTORY:
  419. ! 07Feb00 - Jing Guo <guo@dao.gsfc.nasa.gov>
  420. ! - initial prototype/prolog/code
  421. !EOP ___________________________________________________________________
  422. character(len=*),parameter :: myname_=myname//'::mco0_'
  423. call mall_co(1,thread)
  424. end subroutine mco0_
  425. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  426. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  427. !BOP -------------------------------------------------------------------
  428. !
  429. ! !IROUTINE: mci1_ - checking in a String scalar
  430. !
  431. ! !DESCRIPTION:
  432. !
  433. ! !INTERFACE:
  434. subroutine mci1_(marg,thread)
  435. ! !USES:
  436. !
  437. use m_mall, only : mall_ci
  438. implicit none
  439. ! !INPUT PARAMETERS:
  440. !
  441. type(String), dimension(:), intent(in) :: marg
  442. character(len=*), intent(in) :: thread
  443. ! !REVISION HISTORY:
  444. ! 07Feb00 - Jing Guo <guo@dao.gsfc.nasa.gov>
  445. ! - initial prototype/prolog/code
  446. !EOP ___________________________________________________________________
  447. character(len=*),parameter :: myname_=myname//'::mci1_'
  448. call mall_ci(size(marg),thread)
  449. end subroutine mci1_
  450. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  451. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  452. !BOP -------------------------------------------------------------------
  453. !
  454. ! !IROUTINE: mco1_ - checking out a String scalar
  455. !
  456. ! !DESCRIPTION:
  457. !
  458. ! !INTERFACE:
  459. subroutine mco1_(marg,thread)
  460. ! !USES:
  461. !
  462. use m_mall, only : mall_co
  463. implicit none
  464. ! !INPUT PARAMETERS:
  465. !
  466. type(String), dimension(:), intent(in) :: marg
  467. character(len=*), intent(in) :: thread
  468. ! !REVISION HISTORY:
  469. ! 07Feb00 - Jing Guo <guo@dao.gsfc.nasa.gov>
  470. ! - initial prototype/prolog/code
  471. !EOP ___________________________________________________________________
  472. character(len=*),parameter :: myname_=myname//'::mco1_'
  473. call mall_co(size(marg),thread)
  474. end subroutine mco1_
  475. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  476. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  477. !BOP -------------------------------------------------------------------
  478. !
  479. ! !IROUTINE: mci2_ - checking in a String scalar
  480. !
  481. ! !DESCRIPTION:
  482. !
  483. ! !INTERFACE:
  484. subroutine mci2_(marg, thread)
  485. ! !USES:
  486. !
  487. use m_mall, only : mall_ci
  488. implicit none
  489. ! !INPUT PARAMETERS:
  490. !
  491. type(String), dimension(:,:), intent(in) :: marg
  492. character(len=*), intent(in) :: thread
  493. ! !REVISION HISTORY:
  494. ! 07Feb00 - Jing Guo <guo@dao.gsfc.nasa.gov>
  495. ! - initial prototype/prolog/code
  496. !EOP ___________________________________________________________________
  497. character(len=*),parameter :: myname_=myname//'::mci2_'
  498. call mall_ci(size(marg),thread)
  499. end subroutine mci2_
  500. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  501. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  502. !BOP -------------------------------------------------------------------
  503. !
  504. ! !IROUTINE: mco2_ - checking out a String scalar
  505. !
  506. ! !DESCRIPTION:
  507. !
  508. ! !INTERFACE:
  509. subroutine mco2_(marg,thread)
  510. ! !USES:
  511. !
  512. use m_mall, only : mall_co
  513. implicit none
  514. ! !INPUT PARAMETERS:
  515. !
  516. type(String), dimension(:,:), intent(in) :: marg
  517. character(len=*), intent(in) :: thread
  518. ! !REVISION HISTORY:
  519. ! 07Feb00 - Jing Guo <guo@dao.gsfc.nasa.gov>
  520. ! - initial prototype/prolog/code
  521. !EOP ___________________________________________________________________
  522. character(len=*),parameter :: myname_=myname//'::mco2_'
  523. call mall_co(size(marg),thread)
  524. end subroutine mco2_
  525. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  526. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  527. !BOP -------------------------------------------------------------------
  528. !
  529. ! !IROUTINE: mci3_ - checking in a String scalar
  530. !
  531. ! !DESCRIPTION:
  532. !
  533. ! !INTERFACE:
  534. subroutine mci3_(marg,thread)
  535. ! !USES:
  536. !
  537. use m_mall, only : mall_ci
  538. implicit none
  539. ! !INPUT PARAMETERS:
  540. !
  541. type(String), dimension(:,:,:), intent(in) :: marg
  542. character(len=*), intent(in) :: thread
  543. ! !REVISION HISTORY:
  544. ! 07Feb00 - Jing Guo <guo@dao.gsfc.nasa.gov>
  545. ! - initial prototype/prolog/code
  546. !EOP ___________________________________________________________________
  547. character(len=*),parameter :: myname_=myname//'::mci3_'
  548. call mall_ci(size(marg),thread)
  549. end subroutine mci3_
  550. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  551. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  552. !BOP -------------------------------------------------------------------
  553. !
  554. ! !IROUTINE: mco3_ - checking out a String scalar
  555. !
  556. ! !DESCRIPTION:
  557. !
  558. ! !INTERFACE:
  559. subroutine mco3_(marg,thread)
  560. ! !USES:
  561. !
  562. use m_mall, only : mall_co
  563. implicit none
  564. ! !INPUT PARAMETERS:
  565. !
  566. type(String), dimension(:,:,:), intent(in) :: marg
  567. character(len=*), intent(in) :: thread
  568. ! !REVISION HISTORY:
  569. ! 07Feb00 - Jing Guo <guo@dao.gsfc.nasa.gov>
  570. ! - initial prototype/prolog/code
  571. !EOP ___________________________________________________________________
  572. character(len=*),parameter :: myname_=myname//'::mco3_'
  573. call mall_co(size(marg),thread)
  574. end subroutine mco3_
  575. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  576. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  577. !BOP -------------------------------------------------------------------
  578. !
  579. ! !IROUTINE: len_ = len of a String
  580. !
  581. ! !DESCRIPTION:
  582. !
  583. ! !INTERFACE:
  584. integer function len_(str)
  585. ! !USES:
  586. !
  587. ! No external modules are used by this function.
  588. implicit none
  589. ! !INPUT PARAMETERS:
  590. !
  591. type(String),intent(in) :: str
  592. ! !REVISION HISTORY:
  593. ! 10Apr00 - Jing Guo <guo@dao.gsfc.nasa.gov>
  594. ! - initial prototype/prolog/code
  595. !EOP ___________________________________________________________________
  596. character(len=*),parameter :: myname_=myname//'::len_'
  597. len_=size(str%c)
  598. end function len_
  599. !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  600. ! NASA/GSFC, Data Assimilation Office, Code 910.3, GEOS/DAS !
  601. !BOP -------------------------------------------------------------------
  602. !
  603. ! !IROUTINE: ptr_chars_ - direct
  604. !
  605. ! !DESCRIPTION:
  606. ! This pointer-valued function provides a direct interface to the
  607. ! character buffer in the input {\tt String} argument {\tt str}. That
  608. ! is, {\tt ptr\_chars\_ => str\%c}.
  609. !
  610. ! !INTERFACE:
  611. function ptr_chars_(str)
  612. ! !USES:
  613. !
  614. ! No external modules are used by this function.
  615. implicit none
  616. ! !INPUT PARAMETERS:
  617. !
  618. type(String), intent(in) :: str
  619. ! !OUTPUT PARAMETERS:
  620. !
  621. character(len=1), dimension(:), pointer :: ptr_chars_
  622. ! !REVISION HISTORY:
  623. ! 10Apr00 - Jing Guo <guo@dao.gsfc.nasa.gov>
  624. ! - initial prototype/prolog/code
  625. !EOP ___________________________________________________________________
  626. character(len=*),parameter :: myname_=myname//'::ptr_chars_'
  627. ptr_chars_ => str%c
  628. end function ptr_chars_
  629. end module m_String