OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Public Member Functions | Private Member Functions | Private Attributes | List of all members
GenerateOpalSimulation Class Reference

#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...
 

Detailed Description

Definition at line 49 of file GenerateOpalSimulation.h.

Constructor & Destructor Documentation

◆ GenerateOpalSimulation()

GenerateOpalSimulation::GenerateOpalSimulation ( std::string  tmplFile,
std::string  varDictionary,
std::map< std::string, std::string >  userValues 
)
inline

Sets up the scaled variables and fills the dictionary with content of data file.

Parameters
[in]tmplFilefilename of template file
[in]varDictionaryfilename of data file
[in]userValuestemplate variables specified by the optimizer

Definition at line 61 of file GenerateOpalSimulation.h.

References dictionary_, fillDictionary(), scaleVars_, tmplFile_, and varDictionary_.

Here is the call graph for this function:

◆ ~GenerateOpalSimulation()

GenerateOpalSimulation::~GenerateOpalSimulation ( )
inline

Definition at line 75 of file GenerateOpalSimulation.h.

References dictionary_, and scaleVars_.

Member Function Documentation

◆ fillDictionary()

void GenerateOpalSimulation::fillDictionary ( )
inlineprivate

Parses the data file and insert all values into the dictionary.

The data file needs to conform to the specification:

  • comments start with a hash symbol (end of line comments possible),
  • a data row starts with the name of the template variable and the value is separated by at least one whitespace.

In some cases the simple parser may fail, the characters scanned when splitting data rows are

' ', \t

Definition at line 145 of file GenerateOpalSimulation.h.

References dictionary_, endl(), Hypervolume::fs, scale(), and varDictionary_.

Referenced by GenerateOpalSimulation().

Here is the call graph for this function:

◆ scale()

void GenerateOpalSimulation::scale ( std::string  name,
std::string *  value 
)
inlineprivate

Helper method to scale variable if necessary.

Definition at line 198 of file GenerateOpalSimulation.h.

References name, and scaleVars_.

Referenced by fillDictionary().

◆ writeInputFile()

void GenerateOpalSimulation::writeInputFile ( std::string  outputFile)
inline

Replace all template variables in template file with corresponding values from the dictionary and write file to disk

Parameters
[in]outputFilewrite resulting input file to this file

Definition at line 86 of file GenerateOpalSimulation.h.

References dictionary_, endl(), and tmplFile_.

Here is the call graph for this function:

Member Data Documentation

◆ dictionary_

std::map<std::string, std::string> GenerateOpalSimulation::dictionary_
private

holds parsed template data

Definition at line 128 of file GenerateOpalSimulation.h.

Referenced by fillDictionary(), GenerateOpalSimulation(), writeInputFile(), and ~GenerateOpalSimulation().

◆ scaleVars_

std::map<std::string, double> GenerateOpalSimulation::scaleVars_
private

holds all variables that need scaling

Definition at line 130 of file GenerateOpalSimulation.h.

Referenced by GenerateOpalSimulation(), scale(), and ~GenerateOpalSimulation().

◆ tmplFile_

std::string GenerateOpalSimulation::tmplFile_
private

template filename

Definition at line 124 of file GenerateOpalSimulation.h.

Referenced by GenerateOpalSimulation(), and writeInputFile().

◆ varDictionary_

std::string GenerateOpalSimulation::varDictionary_
private

data filename

Definition at line 126 of file GenerateOpalSimulation.h.

Referenced by fillDictionary(), and GenerateOpalSimulation().


The documentation for this class was generated from the following file: