33 const Foam::wordList Foam::compileTemplate::codeKeys(wordList::null());
35 const Foam::wordList Foam::compileTemplate::codeDictVars(wordList::null());
37 Foam::wordList Foam::compileTemplate::compileFiles_(wordList::null());
44 const word& instantiatedName
47 fileName templateFileName(instantiatedName);
48 templateFileName.replaceAll(
',',
'_');
49 templateFileName.replaceAll(
'<',
'_');
50 templateFileName.replaceAll(
'>',
'_');
52 return templateFileName;
58 const word& templateName
63 if (!optionsFile.good())
66 <<
"Failed to open dictionary file " << templateName
70 return dictionary(optionsFile);
74 void Foam::compileTemplate::setSubstitution
76 const Pair<word>& substitution
79 const word&
name(substitution.first());
80 word
type(substitution.second());
81 const word typeRenameMapName(
name +
"Renamed");
83 if (dict_.found(
name))
85 const HashSet<word> types(dict_.lookup(
name));
86 if (!types.found(
type))
89 <<
"Unknown " <<
name <<
" type " <<
type <<
nl
90 <<
"Supported " <<
name <<
" types: " << types
95 if (dict_.found(typeRenameMapName))
97 const HashTable<word> renameMap
99 dict_.lookup(typeRenameMapName)
102 if (renameMap.found(
type))
116 const word& templateName,
117 const word& instantiatedName,
123 name(instantiatedName),
124 optionsDict(templateName),
132 substitutions_(substitutions),
133 dict_(optionsDict(templateName))
135 compileFiles_ = {templateName +
"Template.C"};
139 setSubstitution(substitutions_[i]);
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
#define forAll(list, i)
Loop across all elements in list.
Base class for coded functionObjects, fvModels, Function1, Function2.
bool updateLibrary(const dictionary &dict) const
Update library from given updated dictionary as required.
compileTemplate(const word &templateName, const word &instantiatedName, const List< Pair< word >> &substitutions)
Construct from name and dictionary.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
HashTable< string > & varSubstitutions()
static fileName resolveTemplate(const fileName &templateName)
Resolve code-template via Foam::findConfigFile.
A class for handling file names.
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.