OPAL (Object Oriented Parallel Accelerator Library)
2.2.0
OPAL
|
Generates an OPAL input file from data and template file. More...
#include <GenerateOpalSimulation.h>
Public Member Functions | |
GenerateOpalSimulation (std::string tmplFile, std::string varDictionary, std::map< std::string, std::string > userValues) | |
~GenerateOpalSimulation () | |
void | writeInputFile (std::string outputFile) |
Private Member Functions | |
void | fillDictionary () |
void | scale (std::string name, std::string *value) |
Helper method to scale variable if necessary. More... | |
Private Attributes | |
std::string | tmplFile_ |
template filename More... | |
std::string | varDictionary_ |
data filename More... | |
std::map< std::string, std::string > | dictionary_ |
holds parsed template data More... | |
std::map< std::string, double > | scaleVars_ |
holds all variables that need scaling More... | |
Generates an OPAL input file from data and template file.
When running the optimizer with the OPAL forward solvers this utility class helps generating OPAL input files corresponding to the design variable values of the requested evaluation. Using the data file we start by generating the dictionary of known templates. When the input file is requested, all template variables in the template input file are replaced with values found in the dictionary.
TODO:
Definition at line 31 of file GenerateOpalSimulation.h.
|
inline |
Sets up the scaled variables and fills the dictionary with content of data file.
[in] | tmplFile | filename of template file |
[in] | varDictionary | filename of data file |
[in] | userValues | template variables specified by the optimizer |
Definition at line 43 of file GenerateOpalSimulation.h.
References dictionary_, fillDictionary(), scaleVars_, tmplFile_, and varDictionary_.
|
inline |
Definition at line 57 of file GenerateOpalSimulation.h.
References dictionary_, and scaleVars_.
|
inlineprivate |
Parses the data file and insert all values into the dictionary.
The data file needs to conform to the specification:
In some cases the simple parser may fail, the characters scanned when splitting data rows are
' ',
Definition at line 127 of file GenerateOpalSimulation.h.
References dictionary_, endl(), scale(), and varDictionary_.
Referenced by GenerateOpalSimulation().
|
inlineprivate |
Helper method to scale variable if necessary.
Definition at line 174 of file GenerateOpalSimulation.h.
References name, and scaleVars_.
Referenced by fillDictionary().
|
inline |
Replace all template variables in template file with corresponding values from the dictionary and write file to disk
[in] | outputFile | write resulting input file to this file |
Definition at line 68 of file GenerateOpalSimulation.h.
References dictionary_, endl(), Inform::precision(), and tmplFile_.
|
private |
holds parsed template data
Definition at line 110 of file GenerateOpalSimulation.h.
Referenced by fillDictionary(), GenerateOpalSimulation(), writeInputFile(), and ~GenerateOpalSimulation().
|
private |
holds all variables that need scaling
Definition at line 112 of file GenerateOpalSimulation.h.
Referenced by GenerateOpalSimulation(), scale(), and ~GenerateOpalSimulation().
|
private |
template filename
Definition at line 106 of file GenerateOpalSimulation.h.
Referenced by GenerateOpalSimulation(), and writeInputFile().
|
private |
data filename
Definition at line 108 of file GenerateOpalSimulation.h.
Referenced by fillDictionary(), and GenerateOpalSimulation().