Fortran Dictionary objects for storing key/value pairs

Module dictionary_module

Defined at Dictionary.fpp lines 127-2662

A Dictionary object contains a list of keys(strings) and corresponding entries. Entries are a variable type, containing one of: ‘integer’, ‘real(dp)’, ‘complex(dp)’, ‘logical’, extendable_str or a 1-D array of any of those. 2-D arrays of integers and reals are also supported.

class quippy.dictionary_module.DictData(name=dictdata)[source]

Bases: FortranDerivedType

Defined at Dictionary.fpp lines 152-153

Attributes:
d

Element d ftype=integer pytype=int

property d

Element d ftype=integer pytype=int

Defined at Dictionary.fpp line 153

class quippy.dictionary_module.DictEntry(name=dictentry)[source]

Bases: FortranDerivedType

Defined at Dictionary.fpp lines 156-174

OMIT

Attributes:
c

Element c ftype=complex(dp) pytype=complex

c_a

Element c_a ftype=complex(dp) pytype=complex

d

Element d ftype=type(dictdata) pytype=Dictdata

i

Element i ftype=integer pytype=int

i_a

Element i_a ftype=integer pytype=int

i_a2

Element i_a2 ftype=integer pytype=int

l

Element l ftype=logical pytype=bool

l_a

Element l_a ftype=logical pytype=bool

len2

Element len2 ftype=integer pytype=int

len_bn

Element len_bn ftype=integer pytype=int

own_data

Element own_data ftype=logical pytype=bool

r

Element r ftype=real(dp) pytype=float

r_a

Element r_a ftype=real(dp) pytype=float

r_a2

Element r_a2 ftype=real(dp) pytype=float

s_a

Element s_a ftype=character(len=1) pytype=str

type_bn

Element type_bn ftype=integer pytype=int

Methods

print(self, key[, verbosity, file])

Defined at Dictionary.fpp lines 335-393

print(self, key[, verbosity, file])[source]

Defined at Dictionary.fpp lines 335-393

Parameters:
thisDictentry
keystr
verbosityint
fileInoutput
Print a DictEntry or a Dictionary
property c

Element c ftype=complex(dp) pytype=complex

Defined at Dictionary.fpp line 164

property c_a

Element c_a ftype=complex(dp) pytype=complex

Defined at Dictionary.fpp line 169

property d

Element d ftype=type(dictdata) pytype=Dictdata

Defined at Dictionary.fpp line 174

property i

Element i ftype=integer pytype=int

Defined at Dictionary.fpp line 162

property i_a

Element i_a ftype=integer pytype=int

Defined at Dictionary.fpp line 167

property i_a2

Element i_a2 ftype=integer pytype=int

Defined at Dictionary.fpp line 172

property l

Element l ftype=logical pytype=bool

Defined at Dictionary.fpp line 165

property l_a

Element l_a ftype=logical pytype=bool

Defined at Dictionary.fpp line 170

property len2

Element len2 ftype=integer pytype=int

Defined at Dictionary.fpp line 160

property len_bn

Element len_bn ftype=integer pytype=int

Defined at Dictionary.fpp line 159

property own_data

Element own_data ftype=logical pytype=bool

Defined at Dictionary.fpp line 161

True if we own the data and should free it in finalise()

property r

Element r ftype=real(dp) pytype=float

Defined at Dictionary.fpp line 163

property r_a

Element r_a ftype=real(dp) pytype=float

Defined at Dictionary.fpp line 168

property r_a2

Element r_a2 ftype=real(dp) pytype=float

Defined at Dictionary.fpp line 173

property s_a

Element s_a ftype=character(len=1) pytype=str

Defined at Dictionary.fpp line 171

property type_bn

Element type_bn ftype=integer pytype=int

Defined at Dictionary.fpp line 158

class quippy.dictionary_module.Dictionary(name=dictionary)[source]

Bases: FortranDerivedType

Defined at Dictionary.fpp lines 178-197

Fortran implementation of a dictionary to store key/value pairs of the following types:

  • Integer

  • Real

  • String

  • Complex

  • Logical

  • 1D integer array

  • 1D real array

  • 1D complex array

  • 1D logical array

  • 2D integer array

  • 2D real array

  • Arbitrary data, via Fortran transform() intrinsic

Attributes:
cache_invalid

Element cache_invalid ftype=integer pytype=int

key_cache_invalid

Element key_cache_invalid ftype=integer pytype=int

n

Element n ftype=integer pytype=int

Methods

add_array(*args, **kwargs)

Defined at Dictionary.fpp lines 268-282

deepcopy(self, from_[, error])

Defined at Dictionary.fpp lines 2593-2599

get_key(self, i[, error])

Defined at Dictionary.fpp lines 478-487

get_type_and_size(self, key, thesize2[, error])

Defined at Dictionary.fpp lines 489-502

get_value(*args, **kwargs)

Defined at Dictionary.fpp lines 247-254

has_key(self, key[, case_sensitive])

Defined at Dictionary.fpp lines 2242-2247

lookup_entry_i(self, key[, case_sensitive])

Defined at Dictionary.fpp lines 2218-2239

print(self[, verbosity, file])

Defined at Dictionary.fpp lines 412-420

print_keys(self[, verbosity, file])

Defined at Dictionary.fpp lines 395-410

read_string(self, str[, append, error])

Defined at Dictionary.fpp lines 1813-1848

remove_value(self, key)

Defined at Dictionary.fpp lines 1802-1811

set_value(*args, **kwargs)

Defined at Dictionary.fpp lines 224-233

set_value_pointer(*args, **kwargs)

Defined at Dictionary.fpp lines 236-243

subset(self, keys, out[, case_sensitive, ...)

Defined at Dictionary.fpp lines 2249-2268

swap(self, key1, key2[, case_sensitive, error])

Defined at Dictionary.fpp lines 2371-2398

write_string(self[, real_format, entry_sep, ...)

Defined at Dictionary.fpp lines 2043-2121

add_array(*args, **kwargs)[source]

Defined at Dictionary.fpp lines 268-282

Overloaded interface containing the following procedures:

_add_array_i _add_array_r _add_array_c _add_array_l _add_array_s _add_array_i2 _add_array_r2 _add_array_i_a _add_array_r_a _add_array_c_a _add_array_l_a _add_array_s_a _add_array_i2_a _add_array_r2_a

deepcopy(self, from_[, error])[source]

Defined at Dictionary.fpp lines 2593-2599

Parameters:
thisDictionary
from_Dictionary
errorint
Make a deep copy of ‘from’ in ‘this’, allocating new memory for array components
get_key(self, i[, error])[source]

Defined at Dictionary.fpp lines 478-487

Parameters:
thisDictionary
iint
errorint
Returns:
keystr
get_type_and_size(self, key, thesize2[, error])[source]

Defined at Dictionary.fpp lines 489-502

Parameters:
thisDictionary
keystr
thesize2int array
errorint
Returns:
type_bnint
thesizeint
get_value(*args, **kwargs)[source]

Defined at Dictionary.fpp lines 247-254

Overloaded interface containing the following procedures:

_get_value_i _get_value_r _get_value_c _get_value_l _get_value_i_a _get_value_r_a _get_value_c_a _get_value_l_a _get_value_s _get_value_s_a _get_value_s_a2 _get_value_d _get_value_i_a2 _get_value_r_a2 _get_value_dict

Get a value from a Dictionary

has_key(self, key[, case_sensitive])[source]

Defined at Dictionary.fpp lines 2242-2247

Parameters:
thisDictionary
keystr
case_sensitivebool
Returns:
dictionary_has_keybool
Return true if ‘key’ is in Dictionary or false if not
lookup_entry_i(self, key[, case_sensitive])[source]

Defined at Dictionary.fpp lines 2218-2239

Parameters:
thisDictionary
keystr
case_sensitivebool
Returns:
lookup_entry_iint
OMIT
print(self[, verbosity, file])[source]

Defined at Dictionary.fpp lines 412-420

Parameters:
thisDictionary
verbosityint
fileInoutput
Print a DictEntry or a Dictionary
print_keys(self[, verbosity, file])[source]

Defined at Dictionary.fpp lines 395-410

Parameters:
thisDictionary
verbosityint
fileInoutput
read_string(self, str[, append, error])[source]

Defined at Dictionary.fpp lines 1813-1848

Parameters:
thisDictionary
strstr
appendbool

If true, append to dictionary(default false)

errorint
Read into this dictionary from a string
remove_value(self, key)[source]

Defined at Dictionary.fpp lines 1802-1811

Parameters:
thisDictionary
keystr
Remove an entry from a Dictionary
set_value(*args, **kwargs)[source]

Defined at Dictionary.fpp lines 224-233

Overloaded interface containing the following procedures:

_set_value_none _set_value_i _set_value_r _set_value_c _set_value_l _set_value_i_a _set_value_r_a _set_value_c_a _set_value_l_a _set_value_s _set_value_s_a2 _set_value_s_a _set_value_d _set_value_i_a2 _set_value_r_a2 _set_value_dict

Set a value in a Dictionary

set_value_pointer(*args, **kwargs)[source]

Defined at Dictionary.fpp lines 236-243

Overloaded interface containing the following procedures:

_set_value_pointer_i _set_value_pointer_r _set_value_pointer_c _set_value_pointer_l _set_value_pointer_s _set_value_pointer_i2 _set_value_pointer_r2

subset(self, keys, out[, case_sensitive, out_no_initialise, error])[source]

Defined at Dictionary.fpp lines 2249-2268

Parameters:
thisDictionary
keysstr array
outDictionary
case_sensitivebool
out_no_initialisebool
errorint
swap(self, key1, key2[, case_sensitive, error])[source]

Defined at Dictionary.fpp lines 2371-2398

Parameters:
thisDictionary
key1str
key2str
case_sensitivebool
errorint
Swap the positions of two entries in the dictionary. Arrays are not moved in memory.
write_string(self[, real_format, entry_sep, char_a_sep, quote_char, error])[source]

Defined at Dictionary.fpp lines 2043-2121

Parameters:
thisDictionary
real_formatstr

Output format for reals, default is ‘f9.3’

entry_sepstr

Entry seperator, default is single space

char_a_sepstr

Output separator for character arrays, default is ‘,’

quote_charstr

Character to use to quote output fields containing whitespace, default is ‘”’

errorint
Returns:
dictionary_write_stringstr
Write a string representation of this dictionary
property cache_invalid

Element cache_invalid ftype=integer pytype=int

Defined at Dictionary.fpp line 196

non-zero on exit from set_value(), set_value_pointer(), add_array(), remove_entry() if any array memory locations changed

property key_cache_invalid

Element key_cache_invalid ftype=integer pytype=int

Defined at Dictionary.fpp line 197

non-zero on exit from set_value(), set_value_pointer(), add_array(), remove_entry() if any keys changed

property n

Element n ftype=integer pytype=int

Defined at Dictionary.fpp line 193

number of entries in use

class quippy.dictionary_module.c_dictionary_ptr_type(name=c_dictionary_ptr_type)[source]

Bases: FortranDerivedType

Defined at Dictionary.fpp lines 200-201

Attributes:
p

Element p ftype=type(dictionary) pytype=Dictionary

property p

Element p ftype=type(dictionary) pytype=Dictionary

Defined at Dictionary.fpp line 201

quippy.dictionary_module.get_c_key_len()[source]

Element c_key_len ftype=integer pytype=int

Defined at Dictionary.fpp line 148

quippy.dictionary_module.get_dict_n_fields()[source]

Element dict_n_fields ftype=integer pytype=int

Defined at Dictionary.fpp line 150

Maximum number of fields during parsing

quippy.dictionary_module.get_property_int()[source]

Element property_int ftype=integer pytype=int

Defined at Dictionary.fpp line 146

quippy.dictionary_module.get_property_logical()[source]

Element property_logical ftype=integer pytype=int

Defined at Dictionary.fpp line 146

quippy.dictionary_module.get_property_real()[source]

Element property_real ftype=integer pytype=int

Defined at Dictionary.fpp line 146

quippy.dictionary_module.get_property_str()[source]

Element property_str ftype=integer pytype=int

Defined at Dictionary.fpp line 146

quippy.dictionary_module.get_string_length()[source]

Element string_length ftype=integer pytype=int

Defined at Dictionary.fpp line 149

Maximum string length

quippy.dictionary_module.get_t_char()[source]

Element t_char ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_char_a()[source]

Element t_char_a ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_complex()[source]

Element t_complex ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_complex_a()[source]

Element t_complex_a ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_data()[source]

Element t_data ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_dict()[source]

Element t_dict ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_integer()[source]

Element t_integer ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_integer_a()[source]

Element t_integer_a ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_integer_a2()[source]

Element t_integer_a2 ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_logical()[source]

Element t_logical ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_logical_a()[source]

Element t_logical_a ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_none()[source]

Element t_none ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_real()[source]

Element t_real ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_real_a()[source]

Element t_real_a ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT

quippy.dictionary_module.get_t_real_a2()[source]

Element t_real_a2 ftype=integer pytype=int

Defined at Dictionary.fpp line 142

OMIT