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
62 if (!optionsFile.good())
65 <<
"Failed to open dictionary file " << templateName
69 return dictionary(optionsFile);
73 void Foam::compileTemplate::setSubstitution
75 const Pair<word>& substitution
78 const word&
name(substitution.first());
79 word
type(substitution.second());
80 const word typeRenameMapName(
name +
"Renamed");
82 if (dict_.found(
name))
84 const HashSet<word> types(dict_.lookup(
name));
85 if (!types.found(
type))
88 <<
"Unknown " <<
name <<
" type " <<
type <<
nl
89 <<
"Supported " <<
name <<
" types: " << types
94 if (dict_.found(typeRenameMapName))
96 const HashTable<word> renameMap
98 dict_.lookup(typeRenameMapName)
101 if (renameMap.found(
type))
115 const word& templateName,
116 const word& instantiatedName,
122 name(instantiatedName),
123 optionsDict(templateName),
131 substitutions_(substitutions),
132 dict_(optionsDict(templateName))
134 compileFiles_ = {templateName +
"Template.C"};
138 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.