next up previous contents
Next: 18 The List Datatype Up: 3 Documentation of MPEU Previous: 3 Documentation of MPEU   Contents

Subsections

17 The String Datatype

17.1 Module m_String - The String Datatype (Source File: m_String.F90)

The String datatype is an encapsulated pointer to a one-dimensional array of single characters. This allows one to define variable-length strings, and arrays of variable-length strings.


INTERFACE:

 
  module m_String
USES:
   No external modules are used in the declaration section of this module.
 
       implicit none
 
       private	! except
PUBLIC TYPES:
 
       public :: String		! The class data structure
 
     Type String
 #ifdef SEQUENCE
       sequence
 #endif
       character(len=1),dimension(:),pointer :: c
     End Type String
PUBLIC MEMBER FUNCTIONS:
 
       public :: toChar		
       public :: char		! convert to a CHARACTER(*)
 
       public :: String_init
       public :: init		! set a CHARACTER(*) type to a String
 
       public :: String_clean
       public :: clean		! Deallocate memory occupied by  a String
 
       public :: String_len
       public :: len		! length of a String
 
       public :: String_bcast
       public :: bcast		! Broadcast a String
 
       public :: String_mci      ! Track memory used to store a String
       public :: String_mco
 
       public :: ptr_chars       ! Assign a pointer to a String's
                                 ! character buffer
 
   interface char;  module procedure	&
 	str2ch0_,	&
 	ch12ch0_
   end interface
 
   interface toChar;  module procedure	&
 	str2ch0_,	&
 	ch12ch0_
   end interface
 
   interface String_init;  module procedure	&
 	initc_,		&
 	initc1_,	&
 	inits_
   end interface
 
   interface init;  module procedure	&
 	initc_,		&
 	initc1_,	&
 	inits_
   end interface
 
   interface String_clean; module procedure clean_; end interface
   interface clean; module procedure clean_; end interface
   interface String_len; module procedure len_; end interface
   interface len; module procedure len_; end interface
   interface String_bcast; module procedure bcast_; end interface
   interface bcast; module procedure bcast_; end interface
 
   interface String_mci; module procedure	&
     mci0_,	&
     mci1_,	&
     mci2_,	&
     mci3_
   end interface
 
   interface String_mco; module procedure	&
     mco0_,	&
     mco1_,	&
     mco2_,	&
     mco3_
   end interface
 
   interface ptr_chars; module procedure	&
     ptr_chars_
   end interface
REVISION HISTORY:
   	22Apr98 - Jing Guo <guo@thunder> - initial prototype/prolog/code

17.1.1 str2ch0_ - Convert a String to a CHARACTER

This function returns the contents of the character buffer of the input String argument str as a CHARCTER suitable for printing.


INTERFACE:

 
  function str2ch0_(str)
USES:
   No external modules are used by this function.
 
      implicit none
INPUT PARAMETERS:
      type(String),              intent(in) :: str
OUTPUT PARAMETERS:
      character(len=size(str%c,1))            :: str2ch0_
 
REVISION HISTORY:
   	23Apr98 - Jing Guo <guo@thunder> - initial prototype/prolog/code

17.1.2 ch12ch0_ - Convert a CHARACTER(:) to a CHARACTER(*)

This function takes an input one-dimensional array of single characters and returns a single character string.


INTERFACE:

 
  function ch12ch0_(ch1)
USES:
   No external modules are used by this function.
 
       implicit none
INPUT PARAMETERS:
       character(len=1), dimension(:), intent(in) :: ch1
OUTPUT PARAMETERS:
       character(len=size(ch1,1))                   :: ch12ch0_
REVISION HISTORY:
   	22Apr98 - Jing Guo <guo@thunder> - initial prototype/prolog/code

17.1.3 initc_ - Create a String using a CHARACTER

This routine takes an input scalar CHARACTER argument chr, and uses it to create the output String argument str.


INTERFACE:

 
  subroutine initc_(str, chr)
USES:
       use m_die, only : die,perr
       use m_mall,only : mall_mci,mall_ison
  
       implicit none
INPUT PARAMETERS:
       character(len=*), intent(in)  :: chr
OUTPUT PARAMETERS:
       type(String),     intent(out) :: str
REVISION HISTORY:
   	23Apr98 - Jing Guo <guo@thunder> - initial prototype/prolog/code

17.1.4 initc1_ - Create a String using a CHARACTER array

This routine takes an input CHARACTER(:) argument chr, and uses it to create the output String argument str.


INTERFACE:

 
  subroutine initc1_(str, chr)
USES:
       use m_die, only : die,perr
       use m_mall,only : mall_mci,mall_ison
  
       implicit none
INPUT PARAMETERS:
       character,     dimension(:), intent(in)  :: chr
OUTPUT PARAMETERS:
       type(String),                intent(out) :: str
REVISION HISTORY:
    2Aug02 - J. Larson <larson@mcs.anl.gov> - initial prototype

17.1.5 inits_ - Initialization of a String from another String

This routine takes an input String argument iStr and creates an output String argument oStr. In other words, it copies iStr to oStr.


INTERFACE:

 
  subroutine inits_(oStr, iStr)
USES:
       use m_die, only : die
       use m_mall,only : mall_mci,mall_ison
 
       implicit none
INPUT PARAMETERS:
       type(String),  intent(in)  :: iStr
OUTPUT PARAMETERS:
       type(String),  intent(out) :: oStr
REVISION HISTORY:
   	07Feb00	- Jing Guo <guo@dao.gsfc.nasa.gov>
  		- initial prototype/prolog/code

17.1.6 clean_ - Deallocate Memory Occupied by a String

This routine deallocates memory associated with the input/output String argument str. This amounts to deallocating str%c.


INTERFACE:

 
  subroutine clean_(str)
USES:
       use m_die, only : die,perr
       use m_mall,only : mall_mco,mall_ison
 
       implicit none
INPUT/OUTPUT PARAMETERS:
       type(String), intent(inout) :: str
REVISION HISTORY:
   	23Apr98 - Jing Guo <guo@thunder> - initial prototype/prolog/code

17.1.7 bcast_ - MPI Broadcast of a rank-0 String

This routine performs an MPI broadcast of the input/output String argument Str on a communicator associated with the Fortran integer handle comm. The broadcast originates from the process with rank given by root on comm. The String argument Str is on entry valid only on the root process, and is valid on exit on all processes on the communicator comm. The success (failure) is signified by a zero (non-zero) value of the optional INTEGER output argument stat.


INTERFACE:

 
  subroutine bcast_(Str, root, comm, stat)
USES:
       use m_mpif90
       use m_die, only : perr,die
       use m_mall,only : mall_mci,mall_ison
 
       implicit none
INPUT PARAMETERS:
       integer,           intent(in)    :: root
       integer,           intent(in)    :: comm
INPUT/OUTPUT PARAMETERS:
       type(String),      intent(inout) :: Str ! (IN) on the root, 
                                               ! (OUT) elsewhere
OUTPUT PARAMETERS:
       integer, optional, intent(out)   :: stat
REVISION HISTORY:
   	27Apr98 - Jing Guo <guo@thunder> - initial prototype/prolog/code

17.1.8 mci0_ - checking in a String scalar


INTERFACE:

 
  subroutine mci0_(marg,thread)
USES:
       use m_mall, only : mall_ci
 
       implicit none
INPUT PARAMETERS:
       type(String),     intent(in) :: marg
       character(len=*), intent(in) :: thread
REVISION HISTORY:
   	07Feb00	- Jing Guo <guo@dao.gsfc.nasa.gov>
  		- initial prototype/prolog/code

17.1.9 mco0_ - checking out a String scalar


INTERFACE:

 
  subroutine mco0_(marg,thread)
USES:
       use m_mall, only : mall_co
 
       implicit none
 
       type(String),    intent(in) :: marg
       character(len=*),intent(in) :: thread
REVISION HISTORY:
   	07Feb00	- Jing Guo <guo@dao.gsfc.nasa.gov>
  		- initial prototype/prolog/code

17.1.10 mci1_ - checking in a String scalar


INTERFACE:

 
  subroutine mci1_(marg,thread)
USES:
       use m_mall, only : mall_ci
 
       implicit none
INPUT PARAMETERS:
       type(String),     dimension(:), intent(in) :: marg
       character(len=*),               intent(in) :: thread
REVISION HISTORY:
   	07Feb00	- Jing Guo <guo@dao.gsfc.nasa.gov>
  		- initial prototype/prolog/code

17.1.11 mco1_ - checking out a String scalar


INTERFACE:

 
  subroutine mco1_(marg,thread)
USES:
       use m_mall, only : mall_co
 
       implicit none
INPUT PARAMETERS:
       type(String),     dimension(:), intent(in) :: marg
       character(len=*),               intent(in) :: thread
REVISION HISTORY:
   	07Feb00	- Jing Guo <guo@dao.gsfc.nasa.gov>
  		- initial prototype/prolog/code

17.1.12 mci2_ - checking in a String scalar


INTERFACE:

 
  subroutine mci2_(marg, thread)
USES:
       use m_mall, only : mall_ci
 
       implicit none
INPUT PARAMETERS:
       type(String),     dimension(:,:), intent(in) :: marg
       character(len=*),                 intent(in) :: thread
REVISION HISTORY:
   	07Feb00	- Jing Guo <guo@dao.gsfc.nasa.gov>
  		- initial prototype/prolog/code

17.1.13 mco2_ - checking out a String scalar


INTERFACE:

 
  subroutine mco2_(marg,thread)
USES:
       use m_mall, only : mall_co
 
       implicit none
INPUT PARAMETERS:
       type(String),     dimension(:,:), intent(in) :: marg
       character(len=*),                 intent(in) :: thread
REVISION HISTORY:
   	07Feb00	- Jing Guo <guo@dao.gsfc.nasa.gov>
  		- initial prototype/prolog/code

17.1.14 mci3_ - checking in a String scalar


INTERFACE:

 
  subroutine mci3_(marg,thread)
USES:
       use m_mall, only : mall_ci
 
       implicit none
INPUT PARAMETERS:
       type(String),     dimension(:,:,:), intent(in) :: marg
       character(len=*),                   intent(in) :: thread
REVISION HISTORY:
   	07Feb00	- Jing Guo <guo@dao.gsfc.nasa.gov>
  		- initial prototype/prolog/code

17.1.15 mco3_ - checking out a String scalar


INTERFACE:

 
  subroutine mco3_(marg,thread)
USES:
       use m_mall, only : mall_co
 
       implicit none
INPUT PARAMETERS:
       type(String),     dimension(:,:,:), intent(in) :: marg
       character(len=*),                   intent(in) :: thread
REVISION HISTORY:
   	07Feb00	- Jing Guo <guo@dao.gsfc.nasa.gov>
  		- initial prototype/prolog/code

17.1.16 len_ = len of a String


INTERFACE:

 
  integer function len_(str)
USES:
   No external modules are used by this function.
 
       implicit none
INPUT PARAMETERS:
       type(String),intent(in) :: str
REVISION HISTORY:
   	10Apr00	- Jing Guo <guo@dao.gsfc.nasa.gov>
  		- initial prototype/prolog/code

17.1.17 ptr_chars_ - direct

This pointer-valued function provides a direct interface to the character buffer in the input String argument str. That is, ptr_chars_ => str%c.


INTERFACE:

 
  function ptr_chars_(str)
USES:
   No external modules are used by this function.
 
       implicit none
INPUT PARAMETERS:
       type(String),                   intent(in) :: str
OUTPUT PARAMETERS:
       character(len=1), dimension(:), pointer    :: ptr_chars_
REVISION HISTORY:
   	10Apr00	- Jing Guo <guo@dao.gsfc.nasa.gov>
  		- initial prototype/prolog/code



next up previous contents
Next: 18 The List Datatype Up: 3 Documentation of MPEU Previous: 3 Documentation of MPEU   Contents
jacob@mcs.anl.gov