(git:6a2e663)
string_table Module Reference

generates a unique id number for a string (str2id) that can be used two compare two strings. I.e. if (str1==str2) => str2id(str1)==str2id(str2) if (str1.NE.str2) => str2id(str1).NE.str2id(str2) and the other way around. Given an id, the string can be retrieved. More...

Functions/Subroutines

integer function, public str2id (str)
 returns a unique id for a given string, and stores the string for later retrieval using the id. More...
 
character(len=default_string_length) function, public id2str (id)
 returns the string associated with a given id More...
 
character(len=default_string_length) function, public s2s (str)
 converts a string in a string of default_string_length More...
 
subroutine, public string_table_allocate ()
 allocates the string table More...
 
subroutine, public string_table_deallocate (iw)
 deallocates the string table More...
 

Detailed Description

generates a unique id number for a string (str2id) that can be used two compare two strings. I.e. if (str1==str2) => str2id(str1)==str2id(str2) if (str1.NE.str2) => str2id(str1).NE.str2id(str2) and the other way around. Given an id, the string can be retrieved.

Note
the purpose of this routine is to speed up string handling, string searching, ... as an operation on an int is much faster than an operation on a long string.
History
9.2006 [Joost VandeVondele]
Author
Joost VandeVondele

Function/Subroutine Documentation

◆ str2id()

integer function, public string_table::str2id ( character(len=*)  str)

returns a unique id for a given string, and stores the string for later retrieval using the id.

Parameters
strthe string to be stored (default_string_length)
Returns
...
History
09.2006 created [Joost VandeVondele]
Note
pass literal strings using the s2s function, which converts strings of any length to default_string_length id=str2id(s2s("my short string"))

Definition at line 71 of file string_table.F.

Here is the caller graph for this function:

◆ id2str()

character(len=default_string_length) function, public string_table::id2str ( integer  id)

returns the string associated with a given id

Parameters
idthe id to be converted into a string
Returns
...
History
09.2006 created [Joost VandeVondele]
Note
only id's of previously 'registered' strings (str2id) should be passed, otherwise things crash

Definition at line 114 of file string_table.F.

Here is the caller graph for this function:

◆ s2s()

character(len=default_string_length) function, public string_table::s2s ( character(len=*)  str)

converts a string in a string of default_string_length

Parameters
str...
Returns
...
History
09.2006 created [Joost VandeVondele]
Note
useful to pass a literal string to str2id i.e. id=str2id(s2s("X"))

Definition at line 140 of file string_table.F.

Here is the caller graph for this function:

◆ string_table_allocate()

subroutine, public string_table::string_table_allocate

allocates the string table

History
09.2006 created [Joost VandeVondele]
Note
this needs to be done only once at program startup, before any use of other procedures of this module. The scope of this table is global

Definition at line 155 of file string_table.F.

Here is the caller graph for this function:

◆ string_table_deallocate()

subroutine, public string_table::string_table_deallocate ( integer, intent(in)  iw)

deallocates the string table

Parameters
iwa unit to which some info about the table usage can be printed
History
09.2006 created [Joost VandeVondele]
Note
This should be done before program termination, all associated ids become meaningless

Definition at line 169 of file string_table.F.

Here is the call graph for this function:
Here is the caller graph for this function: