8.3.3.3. Input file

Input file formats supported by TCodeEval objects, include:

  • TFlatScript, Input file is created from scratch. Values are given in order separated by a blank separator. The default behaviour with respect to strings and vectors for this file, is to look like the DataServer format (from the Launcher module): strings have no specific beginning/ending characters, as for the vectors whose delimiter is chosen to be a comma.

  • TLineScript, Input file is created from scratch. Each TAttribute values are written on a specific line. Changing attribute means changing line. It is the equivalent of the Column format (from the Launcher module).

  • TKeyScript, Input file is created from an original file. Each TAttribute is associated to a keyword. Values are substituted using a “keyword = value” pattern.

  • TFlagScript, Input file is created from a template file. Each TAttribute is associated to a keyword. Each keyword is substituted directly by the current value.

TXmlScript is not provided in this version

The addInput method is used to declare parameters for all these file types. For TFlatScript and TLineScript, it takes a single argument: a pointer to a TAttribute object, while in the two other cases, the same first argument is completed by a const char * for the key. The declaration order is only significant when no key is specified (so for the TFlatScript and TLineScript files).

# Input File Flat format case
finp1 = Relauncher.TFlatScript("input_rosenbrock_with_values_rows.dat")
finp1.addInput(x)  # Adding attributes in the correct order, one-by-one
finp1.addInput(y)

# Or Input File Key format case
kinp1 = Relauncher.TKeyScript("input_rosenbrock_with_keys.dat")
kinp1.addInput(x, "x")  # Adding attributes in the correct order, one-by-one
kinp1.addInput(y, "y")

Once done, the input files are provided to the TCodeEval object, using the addInputFile method, as shown below:

# Add to the TCodeEval
code = Relauncher.TCodeEval("rosenbrock -r")  # put "rosenbrock -k" instead for key
code.addInputFile(finp1)  # put kinp1 instead for key