| IGLib 1.5 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Properties | Private Attributes | List of all members
IG.Num.SimKosecFileManagerBase Class Referenceabstract

File manager for interfacing (for optimization purposes) the simulation code of Gregor Kosec. More...

Inheritance diagram for IG.Num.SimKosecFileManagerBase:
[legend]
Collaboration diagram for IG.Num.SimKosecFileManagerBase:
[legend]

## Classes
class | InputFieldDefinition
| Contains data about a field that is recoginzed in the input file, such as field identification number, name, and description. This class is immutable except for Description, and it is thread safe in the scope of intended use. More...

## Public Member Functions
string | GetPath (string relativePath)
| Returns full path of the file or directory with the specified relative path within the data and messages exchange directory. More...
virtual void | SaveInput ()
| Saves contents of the simulation input file. Usually the contents is generated by taking the contents of the template input file and making some modification in it in order to reflect the current values of optimization parameters. More...
void | UpdateDefaultInputValues ()
| Updates the input field values for which default values are defined on the list DefaultInputValues. More...
string | GetOptimizationParametersDefinedFromInput (int which)
| Returns value of the specified input (optimization) parameter obtained from the current contents of simulation input, according to the definition of direct mapping between this parameter and scalar input field value. If mapping is not defined for the component specified then null is returned. Returned value is obtained by GetInputFieldValue. More...
void | GetOptimizationParametersDefinedFromInput (IVector param)
| Gets current values of input (optimization) parameters obtained from the current contents of simulation input, according to the definitions of direct mappings between input parameters and scalar input field values. Values are written to components of the provided vector. Vector is not resized, therefore it must be of correct dimension. Those components for which direct mapping between a specific input parameter and scalar input field in simulation input is not defined, are not obtained and stored in vector components (i.e., eventual previous values are preserved). Returned value is obtained by GetInputFieldValue. More...
virtual void | UpdateOptimizationParametersDefined (IVector parameters)
| Updates simulation inputs according to the values of input (optimization) parameters for those parameters for which direct mapping to input fields are defined. More...
void | UpdateInputDefined (IVector parameters)
| Updates simulation input with default values and with values of optimization parameters for which direct mappings to input fields are defined (the latter only when vector of parameters is specified, i.e. not null). More...
virtual InputFieldDefinition | GetInputFieldDefinition (int fieldId)
| Returns an input field definition that corresponds to the specified field ID. Exception is thrown if the field with this ID is not yet contained in input field definitions. More...
virtual InputFieldDefinition | GetInputFieldDefinition (string fieldName)
| Returns an input field definition that corresponds to the specified field name. Exception is thrown if definition with this name does not yet exist. More...
virtual InputFieldDefinition | GetInputFieldDefinition (int fieldId, string fieldName)
| Returns an input field definition that corresponds to the specified field ID and field name. If a matching definition is already included then that definition is returned, if not then definition is created anew. Exception is thrown if neither of this can be done. More...
virtual InputFieldDefinition | GetInputFieldDefinition (int fieldId, string fieldName, string fieldDescription)
| Returns an input field definition that corresponds to the specified field ID and field name. If a matching definition is already included then that definition is returned, if not then definition is created anew. Exception is thrown if neither of this can be done. More...
virtual void | AddInputFieldDefinition (InputFieldDefinition def)
| Adds a new input field definition. Name of the definition must be unique (not already added). More...
virtual void | AddInputFieldDefinitions (params InputFieldDefinition[] definitions)
| Adds a set of input field definitions by calling See also AddInputFieldDefinition . More...
void | ClearInputFieldDefinition (int fieldId)
| Removes the specified input field definition from the stored collection of definitions. More...
void | ClearinputfieldDefinition (string fieldName)
| Removes the specified input field definition from the stored collection of definitions. More...
void | ClearInputFieldDefinition (int fieldId, string fieldName)
| Removes the specified input field definition from the stored collection of definitions. More...
void | ClearinputFieldDefinitions ()
| Clears all input fielddefinitions. More...
virtual void | RemoveInputFieldDefinitions ()
void | SetInputFieldValue (string fieldName, string fieldValue)
| Sets the sepcified input field to the specified value. This is done by appending a corresponding text to the contents of the input file (at this stage, the file is not modified yet). More...
void | SetInputFieldValue (int fieldId, string fieldValue)
| Sets the sepcified input field to the specified value. This is done by appending a corresponding text to the contents of the input file (at this stage, the file is not modified yet). More...
void | SetInputFieldValue (int fieldId, string fieldName, string fieldValue)
| Sets the sepcified input field to the specified value. This is done by appending a corresponding text to the contents of the input file (at this stage, the file is not modified yet). More...
void | SetInputFieldValue (InputFieldDefinition def, string fieldValue)
| Sets the sepcified input field to the specified value. This is done by appending a corresponding text to the contents of the input file (at this stage, the file is not modified yet). More...
void | AddInputComment (string commentString)
| Adds comment to the input file. More...
string | GetInputFieldValue (string fieldName)
| Returns value of the sepcified input field. More...
string | GetInputFieldValue (int fieldId)
| Returns value of the sepcified input field. More...
string | GetInputFieldValue (int fieldId, string fieldName)
| Returns value of the sepcified input field. More...
string | GetInputFieldValue (InputFieldDefinition def)
| Returns the value of the specified input field, which is obtained from the contents of teh input file. More...
abstract bool | RepairInputParameters (IVector parameters)
| Repairs simulation parameters, if necessary, in such a way that values are consistent with simuation data (e.g. spacing of nodes). More...
virtual void | ReadInputParameters (ref IVector inputParameters)
| Reads optimization input parameters form the file at a standard location. More...
virtual void | WriteInputParameters (IVector inputParameters)
| Writes optimization input parameters to the standard location. More...
virtual void | DeleteOutputFiles ()
| Deletes the output files. More...
virtual void | ReadOutputValues (ref IVector outputValues)
| Reads optimization output values form the file at a standard location. More...
virtual void | WriteOutputValues (IVector outputValues)
| Writes optimization ouptut values to the standard location. More...
void | RunSimulator ()
| Runs the simulaor interfaced by the current object. This method only runs the simulator, it does not prepare any input. More...
void | RunSimulator (string[] commandlineArguments)
| Runns the simulator with the specified command-line arguments. Warning: this method should be used for testing only because the command-line arguments that should be passed to the simulator are specified by the interrface rules and can not be specified arbitrarily. Otherwise, run the overloaded method with no arguments. This method only runs the simulator, it does not prepare any input. More...
void | CalculateVectorResponse (IVector inputParameters, ref IVector outputValues)
| Calculates simulator's response for the specified input parameters. More...
void | WriteToConsole ()
| Writes data about the current object to console. Normally, toString() will be used for that, but sometimed this method is used because it is more suitable for debugging. More...
override string | ToString ()
| Returns string representation of the current object. More...

## Protected Member Functions
| SimKosecFileManagerBase (string dataDirectory)
| Constructs a new file manager for interfacing simulator of Gregor Kosec. More...
abstract void | Init ()
| Initializes internal variables. Called at the beginning of all constructors. More...
virtual void | InstallInputFields ()
| Installs data about input fields that can be queried and set in the input file. More...
abstract void | InstallInputMappings ()
| Installs definitions of default values of input fields that are automatically set before running the simulation, and eventually definitios for mappings between (optimization) input parameters and input fields in input file. More...
virtual InputFieldDefinition | GetDefinition (List< InputFieldDefinition > list, int id, string name)
| Finds and returns the specified input field definition on the specified list. More...
void | AddDefaultInputValues (params InputFieldDefinition[] definitions)
| Adds a set of default input values to the list DefaultInputValues of default values. These values will be set when input file is prepared. More...
InputFieldDefinition | GetDefaultInputValue (int id, string name)
| Finds and returns the specified deefault input value definition. See also GetDefinition More...
void | AddOptimizationParameterDefinitions (params InputFieldDefinition[] definitions)
| Adds a set of optimization parameter definitions to the list. Each definitios specifies which parameter in the simulation input file corresponds to a given optimization parameter. It is alloved that some definitions are null. The corresponding optimization parameters will not be mapped automatically to input fields by functions such as UpdateOptimizationParametersDefined, but tehir mapping must be provided specially in definitions of (usually overridden) functions such as UpdateInputParametersManual. More...
InputFieldDefinition | GetOptimizationParameterDefinition (int id, string name)
| Finds and returns the specified optimization parameter definition. See also GetDefinition More...
abstract void | GetInputParametersManual (ref IVector inputParameters)
| Gets the current values of input parameters form the input file. This method must be overridden in derived concrete classes. More...
abstract void | UpdateInputParametersManual (IVector inputParameters)
| Prepares current values of input parameters in the simulation input that will be written to the simulation input file. This method must be overridden in derived concrete classes. Only mappings form input parameters to simulation input that are manually defined must be performed by this function, since automatic mappings are already included in functions such as WriteInputParameters. More...

## Protected Attributes
bool | _redirectOutput = false
string | _redirectedOutputPath = null
string | _directory = null
string | _csvSeparator = SimKosecConst.CsvSeparatorDefault
IBoundingBox | _inputParameterBounds

## Properties
object | Lock`[get]`
| This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock. More...
object | InternalLock`[get]`
| Used internally for locking access to internal fields. More...
bool | RedirectOutput`[get, set]`
| Gets or sets the plag indicating whether standard output will be redirected or not. More...
string | RedirectedOutputPath`[get, set]`
| Gets or sets path to the file where standard output will be redirected. Setting to null causes that output will not be redirected. More...
string | RedirectedOutputFileName`[get, set]`
| Gets or sets name of the file where output is redirected. More...
int | OutputLevel`[get, set]`
| Level of information that is output to the console by some methods. More...
virtual int | NumInputParameters`[get, set]`
| Number of input optimization parameters for the simulator. More...
virtual int | NumOutputValues`[get, set]`
| Number of optimization output values produced by the simulator. More...
string | DataDirectory`[get, protected set]`
| Directory for data and messages exchange through files. More...
string | CsvSeparator`[get, set]`
| Separator used to separate values in CSV files. More...
virtual string | TemplateInputPath`[get, protected set]`
| File path of the template analysis input file. This file is transcribed, with appropriate modification according to the optimization parameters, to the actual simulation input file. Setter takes only pure file name, without path information. If set to null then file path is set to null and will be recalculated when getter is called. More...
virtual string | InputPath`[get, protected set]`
| File path of the analysis input file. This file contains all the input data for the direct analysis. If set to null then file path is set to null and will be recalculated when getter is called. More...
virtual string | ExecutableFilename`[get, set]`
| File name of the executable that performs the direct analysis. More...
virtual string | ExecutablePath`[get, protected set]`
| File path of the analysis exeutable. If set to null then file path is set to null and will be recalculated when getter is called. More...
virtual string | OutputBaseDirpath`[get, protected set]`
| Path of the base directory where output files are located. Setter takes only pure directory name, without path information. If set to null then directory path is set to null and will be recalculated when getter is called. More...
virtual string | OutputDirpath`[get, protected set]`
| Path of the directory where output files are located. Setter takes only pure directory name, without path information. If set to null then directory path is set to null and will be recalculated when getter is called. More...
string | OptOutputCsvPath`[get, protected set]`
| File path of the analysis output file in CSV format. This file contains the pre-agreed set of output values obtained by post-processing of simulator results. If set to null then file path is set to null and will be recalculated when getter is called. More...
virtual string | InputFileContents`[get, protected set]`
| The current input file contents. By default this is obtained form the template input file. If the property is set to null at some point then it will be set to contents of the template input file at the first get access. More...
virtual string[][] | InputFileLines`[get, set]`
| The current input represented as an array of text lines. More...
List< InputFieldDefinition > | DefaultInputValues`[get]`
| List containing default values for input parameters, which will be set before the simulation input file is prepared, which makes possible to play with the definition of the template direct problem. More...
List< InputFieldDefinition > | OptimizationParameterDefinitions`[get]`
| List of definitions of direct mappings od input (optimization) parameters to input fields. Contains, for each input parameter, the definition of the input field that is represented by this parameter. This list can contain null references, which are usually for parameters that can not be directly mapped to scalar input fields defined in the simulation input file. More...
SortedDictionary< string, InputFieldDefinition > | InputFieldDefinitions`[get]`
| Gets the sorted dictionary that contains input field definitions. This should be used only exceptionally; use the higher level method for dealing with input field definitions. More...
virtual IBoundingBox | InputParameterBounds`[get, protected set]`
| Bounds on input parameters. More...
string[] | OneCommandArgument`[get]`
| Used to run the simulatior in the default case where there is only one command-line argument. More...
Properties inherited from IG.Lib.ILockable
object | Lock`[get]`

## Private Attributes
object | _mainLock = new object()
object | _internalLock = new object()
int | _outputLevel = Util.OutputLevel
int | _numInputParameters
int | _numOutputValues
string | _templateInputFilename = SimKosecConst.TemplateInputFileNameDefault
string | _templateInputPath
string | _inputFilename = SimKosecConst.InputFileNameDefault
string | _inputPath
string | _executableFilename = SimKosecConst.ExecutableFilenameDefault
string | _executablePath
string | _outputBaseDirname = SimKosecConst.OutputDirectortyBaseDefault
string | _outputBaseDirpath
string | _outputDirname
string | _outputDirpath
string | _optOutputCsvFilename = SimKosecConst.OptimizationOutputFileName
string | _optOutputCsvPath
string | xxxfjafjkasjflajfla = ""
string | _inputFileContents
string[][] | _inputFileLines
List< InputFieldDefinition > | _optimizationParameters = new List<InputFieldDefinition>()
List< InputFieldDefinition > | _defaultInputValues = new List<InputFieldDefinition>()
SortedDictionary< string, InputFieldDefinition > | _inputFields = new SortedDictionary<string, InputFieldDefinition>()
string[] | _oneCommandArgument = new string[1]

## Detailed Description

File manager for interfacing (for optimization purposes) the simulation code of Gregor Kosec.

$A Igor Aug11;

## Constructor & Destructor Documentation

IG.Num.SimKosecFileManagerBase.SimKosecFileManagerBase | ( | string | dataDirectory | ) |
| inline protected

Constructs a new file manager for interfacing simulator of Gregor Kosec.

Parameters

  dataDirectory | Data directory for simulation code. This directory usually contains the simulator as well as the input files, and output is written to the specified locations within the directory.

## Member Function Documentation

abstract void IG.Num.SimKosecFileManagerBase.Init | ( |  | ) |
| protected pure virtual

Initializes internal variables. Called at the beginning of all constructors.

To be overridden in derived classes!

Implemented in IG.Num.SimKosecFileManagerConv2, and IG.Num.SimKosecFileManagerConvBase.

virtual void IG.Num.SimKosecFileManagerBase.InstallInputFields | ( |  | ) |
| inline protected virtual

Installs data about input fields that can be queried and set in the input file.

Reimplemented in IG.Num.SimKosecFileManagerConvBase.

abstract void IG.Num.SimKosecFileManagerBase.InstallInputMappings | ( |  | ) |
| protected pure virtual

Installs definitions of default values of input fields that are automatically set before running the simulation, and eventually definitios for mappings between (optimization) input parameters and input fields in input file.

The latter are eventually used when for each input (optimization) parameter there exists a field that corresponds to that parameter. Many times this is not true because a single optimization parameters can affect a whole set of input fields.

When running simulator by calling CalculateVectorResponse, input is prepared in the following order: First default parameters are set, then automatic mappings are performed (if any are defined) and finally the manual mappings are performed by calling UpdateInputParametersManual, thus manually defined parameter mapping overrides all others when defined.

Implemented in IG.Num.SimKosecFileManagerConvBase.

string IG.Num.SimKosecFileManagerBase.GetPath | ( | string | relativePath | ) |
| inline

Returns full path of the file or directory with the specified relative path within the data and messages exchange directory.

Parameters

  relativePath | Relative path (with respect to data and messages exchange directory)

virtual void IG.Num.SimKosecFileManagerBase.SaveInput | ( |  | ) |
| inline virtual

Saves contents of the simulation input file. Usually the contents is generated by taking the contents of the template input file and making some modification in it in order to reflect the current values of optimization parameters.

virtual InputFieldDefinition IG.Num.SimKosecFileManagerBase.GetDefinition | ( | List< InputFieldDefinition > | list,
|  | int | id,
|  | string | name
| ) |  |
| inline protected virtual

Finds and returns the specified input field definition on the specified list.

Parameters

  list | List that is searched for the specified definition.
  id | ID of the definiton. If less or equal to 0 then definition is searched only by field name.
  name | Field name that it searched for. If id is greater than 0 then the definition that is found must have matching names and IDs, otherwise exception is thrown.

Returns
  The definition form the list that matched the specified field ID and/or field name, or null if such a definitio is not found on the list.

References IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Id, and IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Name.

void IG.Num.SimKosecFileManagerBase.AddDefaultInputValues | ( | params InputFieldDefinition[] | definitions | ) |
| inline protected

Adds a set of default input values to the list DefaultInputValues of default values. These values will be set when input file is prepared.

Parameters

  definitions |

References IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Id, and IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Name.

InputFieldDefinition IG.Num.SimKosecFileManagerBase.GetDefaultInputValue | ( | int | id,
|  | string | name
| ) |  |
| inline protected

Finds and returns the specified deefault input value definition.

See also
  GetDefinition

Parameters

  list | List that is searched for the specified definition.
  id | ID of the definiton. If less or equal to 0 then definition is searched only by field name.
  name | Field name that it searched for. If id is greater than 0 then the definition that is found must have matching names and IDs, otherwise exception is thrown.

Returns
  The definition form the list that matched the specified field ID and/or field name, or null if such a definitio is not found on the list.

void IG.Num.SimKosecFileManagerBase.UpdateDefaultInputValues | ( |  | ) |
| inline

Updates the input field values for which default values are defined on the list DefaultInputValues.

References IG.Num.SimKosecFileManagerBase.InputFieldDefinition.DefaultValue, and IG.Num.SimKosecFileManagerBase.InputFieldDefinition.DefaultValueDefined.

void IG.Num.SimKosecFileManagerBase.AddOptimizationParameterDefinitions | ( | params InputFieldDefinition[] | definitions | ) |
| inline protected

Adds a set of optimization parameter definitions to the list. Each definitios specifies which parameter in the simulation input file corresponds to a given optimization parameter. It is alloved that some definitions are null. The corresponding optimization parameters will not be mapped automatically to input fields by functions such as UpdateOptimizationParametersDefined, but tehir mapping must be provided specially in definitions of (usually overridden) functions such as UpdateInputParametersManual.

Parameters

  definitions | Definitions to be added. If any of them is null then an ArgumentException is thrown.

InputFieldDefinition IG.Num.SimKosecFileManagerBase.GetOptimizationParameterDefinition | ( | int | id,
|  | string | name
| ) |  |
| inline protected

Finds and returns the specified optimization parameter definition.

See also
  GetDefinition

Parameters

  list | List that is searched for the specified definition.
  id | ID of the definiton. If less or equal to 0 then definition is searched only by field name.
  name | Field name that it searched for. If id is greater than 0 then the definition that is found must have matching names and IDs, otherwise exception is thrown.

Returns
  The definition form the list that matched the specified field ID and/or field name, or null if such a definitio is not found on the list.

string IG.Num.SimKosecFileManagerBase.GetOptimizationParametersDefinedFromInput | ( | int | which | ) |
| inline

Returns value of the specified input (optimization) parameter obtained from the current contents of simulation input, according to the definition of direct mapping between this parameter and scalar input field value. If mapping is not defined for the component specified then null is returned. Returned value is obtained by GetInputFieldValue.

Parameters

  which | Specifies which optimization parameter is returned.

Returns
  Value of the specified input (optimization) parameter if direct mapping between that parameter and a scalar simulation input field is defined, or null if such mapping is not defined.

void IG.Num.SimKosecFileManagerBase.GetOptimizationParametersDefinedFromInput | ( | IVector | param | ) |
| inline

Gets current values of input (optimization) parameters obtained from the current contents of simulation input, according to the definitions of direct mappings between input parameters and scalar input field values. Values are written to components of the provided vector. Vector is not resized, therefore it must be of correct dimension. Those components for which direct mapping between a specific input parameter and scalar input field in simulation input is not defined, are not obtained and stored in vector components (i.e., eventual previous values are preserved). Returned value is obtained by GetInputFieldValue.

Parameters

  param | Vector of parameters that are provided.

virtual void IG.Num.SimKosecFileManagerBase.UpdateOptimizationParametersDefined | ( | IVector | parameters | ) |
| inline virtual

Updates simulation inputs according to the values of input (optimization) parameters for those parameters for which direct mapping to input fields are defined.

Throws exception if the number of definitions is greater than 0 but also greater than dimension of the specified parameter vector (i.e. all definitions must be used, if any defined).

Parameters

  parameters | Vector of values of input (optimization) parameters to be mapped to simulation input.

Exceptions

  ArgumentException | If number of definitions of parameters installed is greater than 0 but the specified vector of parameters is null or of dimension smaller than the number of definitions.

void IG.Num.SimKosecFileManagerBase.UpdateInputDefined | ( | IVector | parameters | ) |
| inline

Updates simulation input with default values and with values of optimization parameters for which direct mappings to input fields are defined (the latter only when vector of parameters is specified, i.e. not null).

Parameters

  parameters | Vector of input (optimization) parameters.

virtual InputFieldDefinition IG.Num.SimKosecFileManagerBase.GetInputFieldDefinition | ( | int | fieldId | ) |
| inline virtual

Returns an input field definition that corresponds to the specified field ID. Exception is thrown if the field with this ID is not yet contained in input field definitions.

Parameters

  fieldId | Input field ID. Should be greater than 0.

virtual InputFieldDefinition IG.Num.SimKosecFileManagerBase.GetInputFieldDefinition | ( | string | fieldName | ) |
| inline virtual

Returns an input field definition that corresponds to the specified field name. Exception is thrown if definition with this name does not yet exist.

Parameters

  fieldName | Input field name.

virtual InputFieldDefinition IG.Num.SimKosecFileManagerBase.GetInputFieldDefinition | ( | int | fieldId,
|  | string | fieldName
| ) |  |
| inline virtual

Returns an input field definition that corresponds to the specified field ID and field name. If a matching definition is already included then that definition is returned, if not then definition is created anew. Exception is thrown if neither of this can be done.

Parameters

  fieldId | Input field ID. Less or equal to 0 means undefined.
  fieldName | Input field name.

virtual InputFieldDefinition IG.Num.SimKosecFileManagerBase.GetInputFieldDefinition | ( | int | fieldId,
|  | string | fieldName,
|  | string | fieldDescription
| ) |  |
| inline virtual

Returns an input field definition that corresponds to the specified field ID and field name. If a matching definition is already included then that definition is returned, if not then definition is created anew. Exception is thrown if neither of this can be done.

Parameters

  fieldId | Input field ID. Less or equal to 0 means undefined.
  fieldName | Input field name.
  fieldDescription | Input field description.

References IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Description, IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Id, and IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Name.

virtual void IG.Num.SimKosecFileManagerBase.AddInputFieldDefinition | ( | InputFieldDefinition | def | ) |
| inline virtual

Adds a new input field definition. Name of the definition must be unique (not already added).

Parameters

  def | Input field definition to be added.

References IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Id, and IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Name.

virtual void IG.Num.SimKosecFileManagerBase.AddInputFieldDefinitions | ( | params InputFieldDefinition[] | definitions | ) |
| inline virtual

Adds a set of input field definitions by calling

See also
  AddInputFieldDefinition

.

Parameters

  definitions | Definitions to be added (can be null).

void IG.Num.SimKosecFileManagerBase.ClearInputFieldDefinition | ( | int | fieldId | ) |
| inline

Removes the specified input field definition from the stored collection of definitions.

Parameters

  fieldId | Field ID of the definiiton to be removed. Must be greater than 0.

void IG.Num.SimKosecFileManagerBase.ClearinputfieldDefinition | ( | string | fieldName | ) |
| inline

Removes the specified input field definition from the stored collection of definitions.

Parameters

  fieldName | Field name of the definition to be removed.

void IG.Num.SimKosecFileManagerBase.ClearInputFieldDefinition | ( | int | fieldId,
|  | string | fieldName
| ) |  |
| inline

Removes the specified input field definition from the stored collection of definitions.

Parameters

  fieldId | Field ID. This is used to find the input field definition if field name is not specified.
  fieldName | Field name. If not specified the field ID is used to find the definition to be removed, otherwise field ID is just used to check if the field name is consistent with ID.

References IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Id, and IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Name.

void IG.Num.SimKosecFileManagerBase.ClearinputFieldDefinitions | ( |  | ) |
| inline

Clears all input fielddefinitions.

virtual void IG.Num.SimKosecFileManagerBase.RemoveInputFieldDefinitions | ( |  | ) |
| inline virtual

void IG.Num.SimKosecFileManagerBase.SetInputFieldValue | ( | string | fieldName,
|  | string | fieldValue
| ) |  |
| inline

Sets the sepcified input field to the specified value. This is done by appending a corresponding text to the contents of the input file (at this stage, the file is not modified yet).

Parameters

  fieldName | Name of the field to be set.
  fieldValue | Value to be assigned to the specified field.

void IG.Num.SimKosecFileManagerBase.SetInputFieldValue | ( | int | fieldId,
|  | string | fieldValue
| ) |  |
| inline

Sets the sepcified input field to the specified value. This is done by appending a corresponding text to the contents of the input file (at this stage, the file is not modified yet).

Parameters

  fieldId | Id of the field to be set.
  fieldValue | Value to be assigned to the specified field.

void IG.Num.SimKosecFileManagerBase.SetInputFieldValue | ( | int | fieldId,
|  | string | fieldName,
|  | string | fieldValue
| ) |  |
| inline

Sets the sepcified input field to the specified value. This is done by appending a corresponding text to the contents of the input file (at this stage, the file is not modified yet).

Parameters

  fieldId | Id of the field to be set.
  fieldName | Name of the field to be set.
  fieldValue | Value to be assigned to the specified field.

void IG.Num.SimKosecFileManagerBase.SetInputFieldValue | ( | InputFieldDefinition | def,
|  | string | fieldValue
| ) |  |
| inline

Sets the sepcified input field to the specified value. This is done by appending a corresponding text to the contents of the input file (at this stage, the file is not modified yet).

Parameters

  def | Definition of the input field to be set.
  fieldValue | Value to be assigned to the field.

References IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Id, and IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Name.

void IG.Num.SimKosecFileManagerBase.AddInputComment | ( | string | commentString | ) |
| inline

Adds comment to the input file.

Parameters

  commentString | Comment text.

References IG.Num.SimKosecConst.CommentLineString.

string IG.Num.SimKosecFileManagerBase.GetInputFieldValue | ( | string | fieldName | ) |
| inline

Returns value of the sepcified input field.

Parameters

  fieldName | Name of the field to be set.

string IG.Num.SimKosecFileManagerBase.GetInputFieldValue | ( | int | fieldId | ) |
| inline

Returns value of the sepcified input field.

Parameters

  fieldId | Id of the field to be set.

string IG.Num.SimKosecFileManagerBase.GetInputFieldValue | ( | int | fieldId,
|  | string | fieldName
| ) |  |
| inline

Returns value of the sepcified input field.

Parameters

  fieldId | Id of the field to be set.
  fieldName | Name of the field to be set.

string IG.Num.SimKosecFileManagerBase.GetInputFieldValue | ( | InputFieldDefinition | def | ) |
| inline

Returns the value of the specified input field, which is obtained from the contents of teh input file.

Parameters

  def | Definition data for the input field whose value is to be returned.

Current contents of the input file are stored in the internal structure (lines of text split in such a way that ID, field name and value can be readily obtained). When input field values are added, this data is modified such that changes are immediately taken into account. Algorithm for this is rather naive (complete input is invalidated upon each change), therefore it is recommended to first querry all the necessary parameters and then change anything, or to perform all the changes first and then query input field values.

References IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Id, and IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Name.

abstract void IG.Num.SimKosecFileManagerBase.GetInputParametersManual | ( | ref IVector | inputParameters | ) |
| protected pure virtual

Gets the current values of input parameters form the input file. This method must be overridden in derived concrete classes.

Parameters

  inputParameters | Vector object where current values of input parameters are stored.

Implemented in IG.Num.SimKosecFileManagerConv3, and IG.Num.SimKosecFileManagerConv2.

abstract bool IG.Num.SimKosecFileManagerBase.RepairInputParameters | ( | IVector | parameters | ) |
| pure virtual

Repairs simulation parameters, if necessary, in such a way that values are consistent with simuation data (e.g. spacing of nodes).

Parameters

  parameters | Vector of parameters to be repaired. Repaired values are stored in the same vector.

Returns
  true if parameters were corrected, false otherwise.

Implemented in IG.Num.SimKosecFileManagerConv3, and IG.Num.SimKosecFileManagerConv2.

abstract void IG.Num.SimKosecFileManagerBase.UpdateInputParametersManual | ( | IVector | inputParameters | ) |
| protected pure virtual

Prepares current values of input parameters in the simulation input that will be written to the simulation input file. This method must be overridden in derived concrete classes. Only mappings form input parameters to simulation input that are manually defined must be performed by this function, since automatic mappings are already included in functions such as WriteInputParameters.

Parameters

  inputParameters | Vector of input (optimization) parameter values to be set.

Implemented in IG.Num.SimKosecFileManagerConv3, and IG.Num.SimKosecFileManagerConv2.

virtual void IG.Num.SimKosecFileManagerBase.ReadInputParameters | ( | ref IVector | inputParameters | ) |
| inline virtual

Reads optimization input parameters form the file at a standard location.

Parameters

  inputParameters | Reference to an object where input parameters are stored. If number of inpput parameters is defined then the provided vector is resized if necessary. Otherwise, the vector provided must be of correct dimension.

References IG.Num.VectorBase.Resize().

virtual void IG.Num.SimKosecFileManagerBase.WriteInputParameters | ( | IVector | inputParameters | ) |
| inline virtual

Writes optimization input parameters to the standard location.

Parameters

  outputValues | Parameters to be written.

virtual void IG.Num.SimKosecFileManagerBase.DeleteOutputFiles | ( |  | ) |
| inline virtual

Deletes the output files.

It is recommendable to delete simulation output before running simulation. In this way, one would know if the simulation program has been broken because the output file would not exist or would be corrupted (otherwise, one could simply read the output file genenerated in some previout run, without noticing that something is wrong).

virtual void IG.Num.SimKosecFileManagerBase.ReadOutputValues | ( | ref IVector | outputValues | ) |
| inline virtual

Reads optimization output values form the file at a standard location.

Parameters

  outputValues | Reference to an object where output parameters will be stored.

References IG.Num.VectorBase.LoadCsv().

virtual void IG.Num.SimKosecFileManagerBase.WriteOutputValues | ( | IVector | outputValues | ) |
| inline virtual

Writes optimization ouptut values to the standard location.

Parameters

  outputValues | Values to be written.

References IG.Num.VectorBase.SaveCsv().

void IG.Num.SimKosecFileManagerBase.RunSimulator | ( |  | ) |
| inline

Runs the simulaor interfaced by the current object. This method only runs the simulator, it does not prepare any input.

References IG.Lib.UtilSystem.GetRelativePath().

void IG.Num.SimKosecFileManagerBase.RunSimulator | ( | string[] | commandlineArguments | ) |
| inline

Runns the simulator with the specified command-line arguments. Warning: this method should be used for testing only because the command-line arguments that should be passed to the simulator are specified by the interrface rules and can not be specified arbitrarily. Otherwise, run the overloaded method with no arguments. This method only runs the simulator, it does not prepare any input.

Parameters

  commandlineArguments | Command-line arguments that are passed to the simulator program.

References IG.Lib.UtilSystem.ExecuteSystemCommand().

void IG.Num.SimKosecFileManagerBase.CalculateVectorResponse | ( | IVector | inputParameters,
|  | ref IVector | outputValues
| ) |  |
| inline

Calculates simulator's response for the specified input parameters.

Parameters

  inputParameters | Input parameters for which response is calculated.
  outputValues | Vector object where the calculated response is stored after calculation.

Implements IG.Num.IResponseEvaluatorVectorSimple.

References IG.Lib.StopWatch.Start(), IG.Lib.StopWatch.Stop(), IG.Lib.StopWatch.Time, IG.Num.IVector.ToStringMath(), and IG.Lib.StopWatch.TotalTime.

void IG.Num.SimKosecFileManagerBase.WriteToConsole | ( |  | ) |
| inline

Writes data about the current object to console. Normally, toString() will be used for that, but sometimed this method is used because it is more suitable for debugging.

References IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Id, and IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Name.

override string IG.Num.SimKosecFileManagerBase.ToString | ( |  | ) |
| inline

Returns string representation of the current object.

References IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Id, and IG.Num.SimKosecFileManagerBase.InputFieldDefinition.Name.

## Member Data Documentation

object IG.Num.SimKosecFileManagerBase._mainLock = new object()
| private

object IG.Num.SimKosecFileManagerBase._internalLock = new object()
| private

bool IG.Num.SimKosecFileManagerBase._redirectOutput = false
| protected

string IG.Num.SimKosecFileManagerBase._redirectedOutputPath = null
| protected

int IG.Num.SimKosecFileManagerBase._outputLevel = Util.OutputLevel
| private

int IG.Num.SimKosecFileManagerBase._numInputParameters
| private

int IG.Num.SimKosecFileManagerBase._numOutputValues
| private

string IG.Num.SimKosecFileManagerBase._directory = null
| protected

string IG.Num.SimKosecFileManagerBase._csvSeparator = SimKosecConst.CsvSeparatorDefault
| protected

string IG.Num.SimKosecFileManagerBase._templateInputFilename = SimKosecConst.TemplateInputFileNameDefault
| private

string IG.Num.SimKosecFileManagerBase._templateInputPath
| private

string IG.Num.SimKosecFileManagerBase._inputFilename = SimKosecConst.InputFileNameDefault
| private

string IG.Num.SimKosecFileManagerBase._inputPath
| private

string IG.Num.SimKosecFileManagerBase._executableFilename = SimKosecConst.ExecutableFilenameDefault
| private

string IG.Num.SimKosecFileManagerBase._executablePath
| private

string IG.Num.SimKosecFileManagerBase._outputBaseDirname = SimKosecConst.OutputDirectortyBaseDefault
| private

string IG.Num.SimKosecFileManagerBase._outputBaseDirpath
| private

string IG.Num.SimKosecFileManagerBase._outputDirname
| private

string IG.Num.SimKosecFileManagerBase._outputDirpath
| private

string IG.Num.SimKosecFileManagerBase._optOutputCsvFilename = SimKosecConst.OptimizationOutputFileName
| private

string IG.Num.SimKosecFileManagerBase._optOutputCsvPath
| private

string IG.Num.SimKosecFileManagerBase.xxxfjafjkasjflajfla = ""
| private

string IG.Num.SimKosecFileManagerBase._inputFileContents
| private

string [][] IG.Num.SimKosecFileManagerBase._inputFileLines
| private

List<InputFieldDefinition> IG.Num.SimKosecFileManagerBase._optimizationParameters = new List<InputFieldDefinition>()
| private

List<InputFieldDefinition> IG.Num.SimKosecFileManagerBase._defaultInputValues = new List<InputFieldDefinition>()
| private

SortedDictionary<string, InputFieldDefinition> IG.Num.SimKosecFileManagerBase._inputFields = new SortedDictionary<string, InputFieldDefinition>()
| private

IBoundingBox IG.Num.SimKosecFileManagerBase._inputParameterBounds
| protected

string [] IG.Num.SimKosecFileManagerBase._oneCommandArgument = new string[1]
| private

## Property Documentation

object IG.Num.SimKosecFileManagerBase.Lock
| get

This object's central lock object to be used by other object. Do not use this object for locking in class' methods, for this you should use InternalLock.

object IG.Num.SimKosecFileManagerBase.InternalLock
| get protected

Used internally for locking access to internal fields.

bool IG.Num.SimKosecFileManagerBase.RedirectOutput
| get set

Gets or sets the plag indicating whether standard output will be redirected or not.

If this flag is set to true but path to the file (property RedirectedOutputPath) where output is redirected is not specified yet then this path will be generated form path to input file (just the ".out" extension is added).

string IG.Num.SimKosecFileManagerBase.RedirectedOutputPath
| get set

Gets or sets path to the file where standard output will be redirected. Setting to null causes that output will not be redirected.

string IG.Num.SimKosecFileManagerBase.RedirectedOutputFileName
| get set

Gets or sets name of the file where output is redirected.

Setting to null or empty string means that output will not be redirected.

Setting to non-empty string means that output will be redirected to the file named as set by this property, and residing in data directory (property DataDirectory).

Getter just returns the current state of matters (null if output is not redirected, file name otherwise).

int IG.Num.SimKosecFileManagerBase.OutputLevel
| get set

Level of information that is output to the console by some methods.

virtual int IG.Num.SimKosecFileManagerBase.NumInputParameters
| get set

Number of input optimization parameters for the simulator.

virtual int IG.Num.SimKosecFileManagerBase.NumOutputValues
| get set

Number of optimization output values produced by the simulator.

string IG.Num.SimKosecFileManagerBase.DataDirectory
| get protected set

Directory for data and messages exchange through files.

string IG.Num.SimKosecFileManagerBase.CsvSeparator
| get set

Separator used to separate values in CSV files.

virtual string IG.Num.SimKosecFileManagerBase.TemplateInputPath
| get protected set

File path of the template analysis input file. This file is transcribed, with appropriate modification according to the optimization parameters, to the actual simulation input file. Setter takes only pure file name, without path information. If set to null then file path is set to null and will be recalculated when getter is called.

virtual string IG.Num.SimKosecFileManagerBase.InputPath
| get protected set

File path of the analysis input file. This file contains all the input data for the direct analysis. If set to null then file path is set to null and will be recalculated when getter is called.

virtual string IG.Num.SimKosecFileManagerBase.ExecutableFilename
| get set

File name of the executable that performs the direct analysis.

virtual string IG.Num.SimKosecFileManagerBase.ExecutablePath
| get protected set

File path of the analysis exeutable. If set to null then file path is set to null and will be recalculated when getter is called.

virtual string IG.Num.SimKosecFileManagerBase.OutputBaseDirpath
| get protected set

Path of the base directory where output files are located. Setter takes only pure directory name, without path information. If set to null then directory path is set to null and will be recalculated when getter is called.

virtual string IG.Num.SimKosecFileManagerBase.OutputDirpath
| get protected set

Path of the directory where output files are located. Setter takes only pure directory name, without path information. If set to null then directory path is set to null and will be recalculated when getter is called.

string IG.Num.SimKosecFileManagerBase.OptOutputCsvPath
| get protected set

File path of the analysis output file in CSV format. This file contains the pre-agreed set of output values obtained by post-processing of simulator results. If set to null then file path is set to null and will be recalculated when getter is called.

virtual string IG.Num.SimKosecFileManagerBase.InputFileContents
| get protected set

The current input file contents. By default this is obtained form the template input file. If the property is set to null at some point then it will be set to contents of the template input file at the first get access.

virtual string [][] IG.Num.SimKosecFileManagerBase.InputFileLines
| get set

The current input represented as an array of text lines.

List<InputFieldDefinition> IG.Num.SimKosecFileManagerBase.DefaultInputValues
| get protected

List containing default values for input parameters, which will be set before the simulation input file is prepared, which makes possible to play with the definition of the template direct problem.

List<InputFieldDefinition> IG.Num.SimKosecFileManagerBase.OptimizationParameterDefinitions
| get protected

List of definitions of direct mappings od input (optimization) parameters to input fields. Contains, for each input parameter, the definition of the input field that is represented by this parameter. This list can contain null references, which are usually for parameters that can not be directly mapped to scalar input fields defined in the simulation input file.

SortedDictionary<string, InputFieldDefinition> IG.Num.SimKosecFileManagerBase.InputFieldDefinitions
| get protected

Gets the sorted dictionary that contains input field definitions. This should be used only exceptionally; use the higher level method for dealing with input field definitions.

virtual IBoundingBox IG.Num.SimKosecFileManagerBase.InputParameterBounds
| get protected set

Bounds on input parameters.

string [] IG.Num.SimKosecFileManagerBase.OneCommandArgument
| get protected

Used to run the simulatior in the default case where there is only one command-line argument.

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

- igbase/interfaces/simulations/Kosec/SimKosecFileManagerBase.cs