Fortran Dictionary objects for storing key/value pairs

Module dictionary_module

Defined at Dictionary.fpp lines 127-2675

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: f90wrap.fortrantype.FortranDerivedType

Defined at Dictionary.fpp lines 151-152

Attributes
d

Element d ftype=integer pytype=int

property d

Element d ftype=integer pytype=int

Defined at Dictionary.fpp line 152

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

Bases: f90wrap.fortrantype.FortranDerivedType

Defined at Dictionary.fpp lines 155-173

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 334-392

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

Defined at Dictionary.fpp lines 334-392

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 163

property c_a

Element c_a ftype=complex(dp) pytype=complex

Defined at Dictionary.fpp line 168

property d

Element d ftype=type(dictdata) pytype=Dictdata

Defined at Dictionary.fpp line 173

property i

Element i ftype=integer pytype=int

Defined at Dictionary.fpp line 161

property i_a

Element i_a ftype=integer pytype=int

Defined at Dictionary.fpp line 166

property i_a2

Element i_a2 ftype=integer pytype=int

Defined at Dictionary.fpp line 171

property l

Element l ftype=logical pytype=bool

Defined at Dictionary.fpp line 164

property l_a

Element l_a ftype=logical pytype=bool

Defined at Dictionary.fpp line 169

property len2

Element len2 ftype=integer pytype=int

Defined at Dictionary.fpp line 159

property len_bn

Element len_bn ftype=integer pytype=int

Defined at Dictionary.fpp line 158

property own_data

Element own_data ftype=logical pytype=bool

Defined at Dictionary.fpp line 160

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 162

property r_a

Element r_a ftype=real(dp) pytype=float

Defined at Dictionary.fpp line 167

property r_a2

Element r_a2 ftype=real(dp) pytype=float

Defined at Dictionary.fpp line 172

property s_a

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

Defined at Dictionary.fpp line 170

property type_bn

Element type_bn ftype=integer pytype=int

Defined at Dictionary.fpp line 157

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

Bases: f90wrap.fortrantype.FortranDerivedType

Defined at Dictionary.fpp lines 177-196

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 267-281

deepcopy(self, from_[, error])

Defined at Dictionary.fpp lines 2606-2612

get_key(self, i[, error])

Defined at Dictionary.fpp lines 477-486

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

Defined at Dictionary.fpp lines 488-501

get_value(*args, **kwargs)

Defined at Dictionary.fpp lines 246-253

has_key(self, key[, case_sensitive])

Defined at Dictionary.fpp lines 2255-2260

lookup_entry_i(self, key[, case_sensitive])

Defined at Dictionary.fpp lines 2231-2252

print(self[, verbosity, file])

Defined at Dictionary.fpp lines 411-419

print_keys(self[, verbosity, file])

Defined at Dictionary.fpp lines 394-409

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

Defined at Dictionary.fpp lines 1826-1861

remove_value(self, key)

Defined at Dictionary.fpp lines 1815-1824

set_value(*args, **kwargs)

Defined at Dictionary.fpp lines 223-232

set_value_pointer(*args, **kwargs)

Defined at Dictionary.fpp lines 235-242

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

Defined at Dictionary.fpp lines 2262-2281

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

Defined at Dictionary.fpp lines 2384-2411

write_string(self[, real_format, entry_sep, …)

Defined at Dictionary.fpp lines 2056-2134

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

Defined at Dictionary.fpp lines 267-281

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 2606-2612

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 477-486

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

Defined at Dictionary.fpp lines 488-501

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

Defined at Dictionary.fpp lines 246-253

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 2255-2260

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 2231-2252

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

Defined at Dictionary.fpp lines 411-419

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

Defined at Dictionary.fpp lines 394-409

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

Defined at Dictionary.fpp lines 1826-1861

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 1815-1824

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

Defined at Dictionary.fpp lines 223-232

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 235-242

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 2262-2281

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

Defined at Dictionary.fpp lines 2384-2411

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 2056-2134

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 195

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 196

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 192

number of entries in use

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

Bases: f90wrap.fortrantype.FortranDerivedType

Defined at Dictionary.fpp lines 199-200

Attributes
p

Element p ftype=type(dictionary) pytype=Dictionary

property p

Element p ftype=type(dictionary) pytype=Dictionary

Defined at Dictionary.fpp line 200

quippy.dictionary_module.get_c_key_len()[source]

Element c_key_len ftype=integer pytype=int

Defined at Dictionary.fpp line 147

quippy.dictionary_module.get_dict_n_fields()[source]

Element dict_n_fields ftype=integer pytype=int

Defined at Dictionary.fpp line 149

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 145

quippy.dictionary_module.get_property_logical()[source]

Element property_logical ftype=integer pytype=int

Defined at Dictionary.fpp line 145

quippy.dictionary_module.get_property_real()[source]

Element property_real ftype=integer pytype=int

Defined at Dictionary.fpp line 145

quippy.dictionary_module.get_property_str()[source]

Element property_str ftype=integer pytype=int

Defined at Dictionary.fpp line 145

quippy.dictionary_module.get_string_length()[source]

Element string_length ftype=integer pytype=int

Defined at Dictionary.fpp line 148

Maximum string length

quippy.dictionary_module.get_t_char()[source]

Element t_char ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_char_a()[source]

Element t_char_a ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_complex()[source]

Element t_complex ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_complex_a()[source]

Element t_complex_a ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_data()[source]

Element t_data ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_dict()[source]

Element t_dict ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_integer()[source]

Element t_integer ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_integer_a()[source]

Element t_integer_a ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_integer_a2()[source]

Element t_integer_a2 ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_logical()[source]

Element t_logical ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_logical_a()[source]

Element t_logical_a ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_none()[source]

Element t_none ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_real()[source]

Element t_real ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_real_a()[source]

Element t_real_a ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT

quippy.dictionary_module.get_t_real_a2()[source]

Element t_real_a2 ftype=integer pytype=int

Defined at Dictionary.fpp line 141

OMIT