Loading...
Searching...
No Matches
dictionaryValue Class Reference

The dictionaryValue substitution model. Dictionaries can be retrieved from an object registry, e.g. time, mesh, or from file. More...

#include <dictionaryValue.H>

Inheritance diagram for dictionaryValue:
Collaboration diagram for dictionaryValue:

Public Member Functions

 TypeName ("dictionaryValue")
 Runtime type information.
 dictionaryValue (const dictionary &dict, const Time &time)
 Constructor.
virtual ~dictionaryValue ()=default
 Destructor.
virtual bool valid (const word &keyName) const
 Return true of model applies to this keyName.
virtual bool apply (const word &key, string &buffer) const
 Apply substitutions to this string buffer.
virtual wordList keys () const
 Return a word list of the keys.
Public Member Functions inherited from substitutionModel
 TypeName ("substitutionModel")
 Runtime type information.
 declareRunTimeSelectionTable (autoPtr, substitutionModel, dictionary,(const dictionary &dict, const Time &time),(dict, time))
 substitutionModel (const dictionary &dict, const Time &time)
 Constructor.
virtual ~substitutionModel ()=default
 Destructor.
virtual bool update ()
 Update model local data.

Protected Member Functions

bool processDict (const dictionary &dict, const word &key, string &buffer) const
 Main function to process the dictionary.

Additional Inherited Members

Static Public Member Functions inherited from substitutionModel
static string keyify (const word &w)
 Return a key representation from a word.
static word cleanKey (const string &str)
 Clean the key text.
static wordList getKeys (string &buffer)
 Return all keys from a string buffer.
static void addBuiltinStr (const word &key, const string &value)
 Add a builtin to the hash table - does not overwrite.
template<class Type>
static void addBuiltin (const word &key, const Type &value)
 Add a builtin to the hash table - does not overwrite.
static bool containsBuiltin (const word &key)
 Return true if key is builtin.
static void setBuiltinStr (const word &key, const string &value)
 Set a builtin to the hash table.
template<class Type>
static void setBuiltin (const word &key, const Type &value)
 Set a builtin to the hash table.
static bool replaceBuiltin (const word &key, string &str)
 Replace key in string.
static bool replaceBuiltin (string &str)
 Replace all occurrences of key in string.
static void writeBuiltins (Ostream &os)
 Write all builtins to stream.
static autoPtr< substitutionModel > New (const dictionary &dict, const Time &time)
 Return a reference to the selected substitution model.
Static Public Attributes inherited from substitutionModel
static const word KEY_BEGIN = "{{"
 Keyword starting characters.
static const word KEY_END = "}}"
 Keyword ending characters.
static HashTable< stringbuiltin_
 Built-in substitutions.
Protected Attributes inherited from substitutionModel
const dictionary dict_
 Construction dictionary.
const Timetime_
 Reference to the time database.

Detailed Description

The dictionaryValue substitution model. Dictionaries can be retrieved from an object registry, e.g. time, mesh, or from file.

The example below shows how the keywords p_solver and u_solver are set by retrieving values from the fvSolution dictionary.

dictionaryValues1
{
    // Mandatory entries
    type        dictionaryValue;

    entries
    {
        p_solver    "solvers/p/solver";
        u_solver    "solvers/u/solver";
    }

    // Conditional entries

        // Option-1
        object      "fvSolution";  // registry-based retrieval
        // region      "fluidMesh";

        // Option-2
        // path        "<system>/fvSolution"; // file-based retrieval


    // Optional entries
    separator       <word>;

    // Inherited entries
    ...
}

The entries mean:

Property Description Type Reqd Deflt
type Type name: dictionaryValue word yes -
entries keyword lookup pairs dictionary yes -
object Name of registered dictionary string no -
region Name of mesh region word no region0
path Path to dictionary file string no -
separator Sep. when lookup value has multiple tokens word no -

The inherited entries are elaborated in:

Source files

Definition at line 139 of file dictionaryValue.H.

Constructor & Destructor Documentation

◆ dictionaryValue()

dictionaryValue ( const dictionary & dict,
const Time & time )

Constructor.

Definition at line 92 of file dictionaryValue.C.

References substitutionModel::cleanKey(), dict, e, Foam::exit(), Foam::FatalIOError, and FatalIOErrorInFunction.

Here is the call graph for this function:

◆ ~dictionaryValue()

virtual ~dictionaryValue ( )
virtualdefault

Destructor.

Member Function Documentation

◆ processDict()

bool processDict ( const dictionary & dict,
const word & key,
string & buffer ) const
protected

Main function to process the dictionary.

Definition at line 40 of file dictionaryValue.C.

References OCharStream::count(), dict, entry::dict(), dictionary::dictName(), Foam::endl(), entry::isDict(), substitutionModel::keyify(), string::replaceAll(), OCharStream::str(), entry::stream(), and WarningInFunction.

Referenced by apply().

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

◆ TypeName()

TypeName ( "dictionaryValue" )

Runtime type information.

References dict.

◆ valid()

bool valid ( const word & keyName) const
virtual

Return true of model applies to this keyName.

Implements substitutionModel.

Definition at line 140 of file dictionaryValue.C.

Referenced by apply().

Here is the caller graph for this function:

◆ apply()

bool apply ( const word & key,
string & buffer ) const
virtual

Apply substitutions to this string buffer.

Implements substitutionModel.

Definition at line 146 of file dictionaryValue.C.

References objectRegistry::cfindObject(), dictionary, Foam::endl(), IOstream::good(), path(), processDict(), substitutionModel::replaceBuiltin(), substitutionModel::time_, valid(), and WarningInFunction.

Here is the call graph for this function:

◆ keys()

Foam::wordList keys ( ) const
virtual

Return a word list of the keys.

Implements substitutionModel.

Definition at line 206 of file dictionaryValue.C.


The documentation for this class was generated from the following files:
  • src/functionObjects/utilities/foamReport/substitutionModels/dictionaryValue/dictionaryValue.H
  • src/functionObjects/utilities/foamReport/substitutionModels/dictionaryValue/dictionaryValue.C