Package PyFoam :: Package Basics :: Module TemplateFile :: Class TemplateFile
[hide private]
[frames] | no frames]

Class TemplateFile

source code

Works on template files. Does calculations between $$. Lines that start with $$ contain definitions

Instance Methods [hide private]
 
__init__(self, name=None, content=None)
Exactly one of the parameters must be specified
source code
 
writeToFile(self, outfile, vals)
In the template, replaces all the strings between $$ with the evaluation of the expressions and writes the results to a file
source code
 
getString(self, vals)
In the template, replaces all the strings between $$ with the evaluation of the expressions
source code
 
eval(self, input, vals)
Gets a string, replaces all the strings between $$ with the evaluation of the expressions
source code
Method Details [hide private]

__init__(self, name=None, content=None)
(Constructor)

source code 

Exactly one of the parameters must be specified

Parameters:
  • name - name of the template file.
  • content - Content of the template

writeToFile(self, outfile, vals)

source code 

In the template, replaces all the strings between $$ with the evaluation of the expressions and writes the results to a file

Parameters:
  • outfile - the resulting output file
  • vals - dictionary with the values

getString(self, vals)

source code 

In the template, replaces all the strings between $$ with the evaluation of the expressions

Parameters:
  • vals - dictionary with the values
Returns:
The string with the replaced expressions

eval(self, input, vals)

source code 

Gets a string, replaces all the strings between $$ with the evaluation of the expressions

Parameters:
  • input - the input string
  • vals - vector with the values or a dictionary
Returns:
The string with the replaced expressions