IGLib  1.7.2
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType > Class Template Reference

Base class for building scalar functions from scripts. This is currently an interrmediate class between the DTO and scalar function, and will probably be gradually replaced. More...

+ Inheritance diagram for IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >:
+ Collaboration diagram for IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >:

Public Member Functions

 ScalarFunctionScriptControllerBase ()
 Default constructor, sets IsNull to true. More...
 
 ScalarFunctionScriptControllerBase (int spaceDimension)
 Constructor, prepares the current DTO for storing a scalar function of the specified dimension. More...
 
virtual string ConvertParameterNamesToString (params string[] parameterNames)
 Converts an array of parameter names to a delimited single string that contains these names, and returns this string. More...
 
virtual string[] ConvertParameterNamesToArray (string parameterNamesString)
 Converts a single string containing parameter names in delimited form to an array of individual parameter names, and returns this array. More...
 
virtual string ConvertFunctionDefinitionsToString (params string[] functionDefinitions)
 Converts an array of function definition strings to a delimited single string that contains these defintions, and returns this string. More...
 
virtual string[] ConvertFunctionDefinitionsToArray (string functionDefinitionsString)
 Converts a single string containing function definitions in delimited form to an array of individual function definition strings, and returns this array. More...
 
virtual string GetParametersString ()
 Returns function parameter names in form of delimited string that contains all function parameter names. More...
 
virtual void SetParametersString (string parametersString)
 Sets function parameter names through a string containing delimided parameters names. More...
 
string GetGradientDefinitionSingleString ()
 Returns a string that contains delimited definitions of all gradient components. More...
 
void SetGradientDefinitionSingleString (string definitionsString)
 Sets definitions of components of function gradients by specifying a string that contains these definitions in delimited form (without any enclosing brackets). More...
 
virtual void SetGradientComponentDefiniton (int whichComponent, string gradientComponentDefinition)
 Sets a definition of the specified gradient components. More...
 
virtual void InvalidateDimension ()
 Invalidates dimension of function domain. All dependent data is invalidated. More...
 
virtual void InvalidateParameterNames ()
 Invalidates names of parameters. This also means that function value definition and function gradient definitions are invalidated, if present. More...
 
virtual void InvalidateValueDefinition ()
 Invalidates definition of function value. More...
 
virtual void InvalidateGradientDefinition ()
 Invalidates definition of function gradient. More...
 
bool GetIsLoaderConsistent ()
 Returns a flag telling whether the loader is currently consistent with function definition contained in the DTO. More...
 
virtual ScalarFunctionLoader GetFunctionLoader ()
 Returns the loader that can create a scalar function according to the definition from the current DTO. More...
 
virtual void SetFunctionLoader (ScalarFunctionLoader loader)
 Sets the loader that can create a scalar function according to the definition from the current DTO. More...
 
LoadableScalarFunctionBase GetFunction ()
 Returns a scalar function that is created from the funciton definitio on the current function DTO. More...
 
void DataToFunctionLoader ()
 Copies data of the form to function loader. More...
 
virtual InputOutputDataDefiniton GetDataDefinitionObject (bool setBoundsAndDefaults=false, IBoundingBox inputBounds=null, IBoundingBox outputBounds=null)
 Creates and returns a data definition object for input parametera and output values of the current function DTO. More...
 
override string ToString ()
 Returns human readable string representation of the current object. More...
 

Static Public Member Functions

static void CreateParameterNamesArray (string namesString, string separator, ref string[] namesArray, bool trimSpaces=true)
 Parses a string that contains delimited parameter names, extract an array of individual parameter names from it, and stores names to the specified array (which is reallocated if necessary). More...
 
static void CreateParameterNamesArray (string namesString, string[] separators, ref string[] namesArray, bool trimSpaces=true, bool allowMultipleSeparators=false)
 Parses a string that contains delimited parameter names, extract an array of individual parameter names from it, and stores names to the specified array (which is reallocated if necessary). More...
 
static void CreateFunctionDefinitionsArray (string namesString, string separator, ref string[] namesArray, bool trimSpaces=true)
 Parses a string that contains delimited function definitions, extract an array of individual function definitions from it, and stores individual string definitions to the specified array (which is reallocated if necessary). More...
 
static void CreateFunctionDefinitionsArray (string namesString, string[] separators, ref string[] namesArray, bool trimSpaces=true, bool allowMultipleSeparators=false)
 Parses a string that contains delimited parameter names, extract an array of individual parameter names from it, and stores names to the specified array (which is reallocated if necessary). More...
 
static string CreateParameterNamesString (string[] namesArray, string separator, bool insertNewLines=false, bool insertSpaces=true)
 Constructs a delimited string cotaining parameter names, from the specified array of parameter names. More...
 
static string CreateFunctionDefinitionsString (string[] definitionsArray, string separator, bool insertNewLines=false, bool insertSpaces=true)
 Construct a delimited string cotaining function definitons, from the specified array of individual string function definitions. More...
 
static string[] GenerateParameterOrVariableNames (int dimension, string baseName="x", int startIndex=0, int numPlaces=2)
 Generates and returns an array of a specified number of variable or parameter names, composed of a base name and numerical string corresponding to the consecutive number of the variable. More...
 
static string GenerateFuctonParameterName (int whichParameter, string baseName="x", int startIndex=0, int numPlaces=2)
 Generates and returns a pre-defined name of the specified variable or function parameter , composed of the specified base name and numerical string corresponding to the consecutive number of the variable. More...
 
static string ToString (ScalarFunctionScriptControllerBase< ScalarFunctionType > sc)
 Returns a string representation of the specified ScalarFunctionScriptController object. More...
 
static void SaveJson (ScalarFunctionScriptController functionController, string filePath, InputOutputDataDefiniton dataDefinition)
 Saves (serializes) the specified script-based scalar function controller to the specified JSON file. If the file already exists, contents either overwrites the file or is appended at the end, dependent on the value of the append flag. More...
 
static void SaveJson (ScalarFunctionScriptController functionController, string filePath, bool append=false, InputOutputDataDefiniton dataDefinition=null)
 Saves (serializes) the specified script-based scalar function controller to the specified JSON file. If the file already exists, contents either overwrites the file or is appended at the end, dependent on the value of the append flag. More...
 
static void LoadJson (string filePath, ref ScalarFunctionScriptController controllerRestored)
 Restores (deserializes) a script-based scalar function controller from the specified file in JSON format. More...
 
static void LoadJson (string filePath, ref ScalarFunctionScriptController controllerRestored, ref ScalarFunctionScriptDto dto)
 Restores (deserializes) a script-based scalar function controller from the specified file in JSON format. More...
 
static void LoadJson (string filePath, ref ScalarFunctionScriptController controllerRestored, ref InputOutputDataDefiniton dataDef)
 Restores (deserializes) a script-based scalar function controller from the specified file in JSON format. More...
 
static void SaveCsv (IVector vec, string filePath)
 Saves the specified vector to a CSV file. It the specified file already exists then it is overwritten. Constant UtilCsv.DefaultCsvSeparator is used as separator. More...
 
static void SaveCsv (IVector vec, string filePath, string separator)
 Saves the specified vector to a CSV file. It the specified file already exists then it is overwritten. More...
 
static void SaveCsv (IVector vec, string filePath, bool append)
 Saves the specified vector to a CSV file. Constant UtilCsv.DefaultCsvSeparator is used as separator in CSV. More...
 
static void SaveCsv (IVector vec, string filePath, string separator, bool append)
 Saves the specified vector to a CSV file. More...
 
static void LoadCsv (string filePath, ref IVector vecRestored)
 Reads a vector from a CSV file. Constant UtilCsv.DefaultCsvSeparator is used as separator in CSV file. If there are no components then a null vector is returned by this method (no exceptions thrown). If there are more than one rows in the CSV file then vector is read from the first row. More...
 
static void LoadCsv (string filePath, string separator, ref IVector vecRestored)
 Reads a vector written in CSV format from a file. If there are no components then a null vector is returned by this method (no exceptions thrown). If there are more than one rows in the CSV file then vector is read from the first row. More...
 
static void LoadCsv (string filePath, int rowNum, ref IVector vecRestored)
 Reads a vector from the specified row of a CSV file. Constant UtilCsv.DefaultCsvSeparator is used as CSV separator. If the specified row does not exisist in the file then exception is thrown. More...
 
static void LoadCsv (string filePath, int rowNum, string separator, ref IVector vecRestored)
 Reads a vector from the specified row of a CSV file. If the specified row does not exisist in the file then exception is thrown. More...
 

Protected Member Functions

void CopyDataToFunctionLoader ()
 Copies function deffinition data from the current function DTO to the internal function loader. More...
 
void CopyDataToFunctionLoader (ScalarFunctionLoader loader)
 Copies function deffinition data from the current function DTO to the specified function loader. More...
 

Protected Attributes

string _name
 
string _parametersString
 
string _gradientsSingleString
 

Static Protected Attributes

static double _defaultLowerBound = 0.0
 
static double _defaultUpperBound = 1.0
 

Properties

virtual int Dimension [get, set]
 Dimension of the parameter space. More...
 
virtual string Name [get, set]
 Scalar function name. More...
 
virtual string Description [get, set]
 Scalar function description. More...
 
virtual bool IsValueDefined [get]
 Specifies whether value is defined for the funciton represented by the current DTO. More...
 
virtual bool IsGradientDefined [get]
 Specifies whether gradient is defined for the funciton represented by the current DTO. More...
 
virtual string ValueDefinitonString [get, set]
 Definition of function value. More...
 
virtual string[] ParameterNames [get, set]
 Names of function parameters. More...
 
virtual string[] GradientDefinitionStrings [get, set]
 Gradient definition strings (separately for each gradient component). More...
 
static string DefaultParameterNamesSeparator [get, protected set]
 Default parameter names separator, separates parametr names when stated in a single string. More...
 
static string DefaultFunctionsSeparator [get, private set]
 Default functions separator, separates string definitions of functions when stated in a single string. More...
 
string ParameterNamesSeparator [get, protected set]
 Separator string that is used to separate parameter names when stated in a single string. More...
 
string FunctionsSeparator [get, private set]
 Separator string that is used to separate function definitions when stated in a single state. More...
 
bool IsLoaderConsistent [get, set]
 A flag indicateing whether the loader is currently consistent with the function definition contained in the current DTO. More...
 
virtual ScalarFunctionLoader FunctionLoader [get, set]
 Object that is responsible for creation of scalar function objects that correspond to the definitions found on the current scalar function DTO. More...
 
LoadableScalarFunctionBase Function [get]
 Scalar function (of type IScalarFunction) created on basis of definition in this DTO. More...
 

Private Attributes

int _dimension
 
string _description
 
string _valueString
 
string[] _parameterNames
 
string[] _gradientDefinitionStrings
 
string _parameterNamesSeparator = DefaultParameterNamesSeparator
 
string _functionsSeparator = DefaultFunctionsSeparator
 
bool _isLoaderConsistent = false
 
ScalarFunctionLoader _functionLoader = null
 

Static Private Attributes

static string _defaultParameterNamesSeparator = ","
 
static string _defaultFunctionsSeparator = ";"
 

Detailed Description

Base class for building scalar functions from scripts. This is currently an interrmediate class between the DTO and scalar function, and will probably be gradually replaced.

Beside acting as a kind of data transfer object, this class provides a variety of manipulations that are necessary when defining scalar functions from scripts (i.e., from symbolic user definitions dhat are compiled by the JIT compiler).

Template Parameters
ScalarFunctionTypeType parameter specifying the specific scalar function type for which concrete DTO is designed.

$A Igor Feb16;

Type Constraints
ScalarFunctionType :class 
ScalarFunctionType :IScalarFunction 

Constructor & Destructor Documentation

IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.ScalarFunctionScriptControllerBase ( )
inline

Default constructor, sets IsNull to true.

IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.ScalarFunctionScriptControllerBase ( int  spaceDimension)
inline

Constructor, prepares the current DTO for storing a scalar function of the specified dimension.

Parameters
spaceDimensionNumber of parameters of the represented (script-constructed) scalar function.

Member Function Documentation

virtual string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.ConvertParameterNamesToString ( params string[]  parameterNames)
inlinevirtual

Converts an array of parameter names to a delimited single string that contains these names, and returns this string.

Parameters
parameterNamesarray of parameter names.
virtual string [] IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.ConvertParameterNamesToArray ( string  parameterNamesString)
inlinevirtual

Converts a single string containing parameter names in delimited form to an array of individual parameter names, and returns this array.

Parameters
parameterNamesString
virtual string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.ConvertFunctionDefinitionsToString ( params string[]  functionDefinitions)
inlinevirtual

Converts an array of function definition strings to a delimited single string that contains these defintions, and returns this string.

Parameters
functionDefinitionsarray of function definitions.
virtual string [] IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.ConvertFunctionDefinitionsToArray ( string  functionDefinitionsString)
inlinevirtual

Converts a single string containing function definitions in delimited form to an array of individual function definition strings, and returns this array.

Parameters
functionDefinitionsString
virtual string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.GetParametersString ( )
inlinevirtual

Returns function parameter names in form of delimited string that contains all function parameter names.

Referenced by IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.ToString().

virtual void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.SetParametersString ( string  parametersString)
inlinevirtual

Sets function parameter names through a string containing delimided parameters names.

Parameters
parametersStringString containing parameterr names.
string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.GetGradientDefinitionSingleString ( )
inline

Returns a string that contains delimited definitions of all gradient components.

Referenced by IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.ToString().

void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.SetGradientDefinitionSingleString ( string  definitionsString)
inline

Sets definitions of components of function gradients by specifying a string that contains these definitions in delimited form (without any enclosing brackets).

Parameters
definitionsStringString that contains delimited definitions of elements of function gradient.
virtual void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.SetGradientComponentDefiniton ( int  whichComponent,
string  gradientComponentDefinition 
)
inlinevirtual

Sets a definition of the specified gradient components.

Parameters
whichComponentSpecifies which gradient component's definition is set.
gradientComponentDefinitionString containing definition of the specified gradient component.
virtual void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.InvalidateDimension ( )
inlinevirtual

Invalidates dimension of function domain. All dependent data is invalidated.

virtual void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.InvalidateParameterNames ( )
inlinevirtual

Invalidates names of parameters. This also means that function value definition and function gradient definitions are invalidated, if present.

virtual void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.InvalidateValueDefinition ( )
inlinevirtual

Invalidates definition of function value.

virtual void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.InvalidateGradientDefinition ( )
inlinevirtual

Invalidates definition of function gradient.

static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.CreateParameterNamesArray ( string  namesString,
string  separator,
ref string[]  namesArray,
bool  trimSpaces = true 
)
inlinestatic

Parses a string that contains delimited parameter names, extract an array of individual parameter names from it, and stores names to the specified array (which is reallocated if necessary).

Parameters
namesStringString that contains delimited parameterr names.
separatorString separators that is used to delimit parameter names.
namesArrayReference to the array where extracted parameterr names are stored.
trimSpacesIf true then spaces and newlines are trimmed from parameter names. default is true.

Referenced by IG.Num.VectorFunctionScriptControllerBase< VectorFunctionType, ScalarFunctionControllerType, ScalarFunctionType >.ConvertParameterNamesToArray().

static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.CreateParameterNamesArray ( string  namesString,
string[]  separators,
ref string[]  namesArray,
bool  trimSpaces = true,
bool  allowMultipleSeparators = false 
)
inlinestatic

Parses a string that contains delimited parameter names, extract an array of individual parameter names from it, and stores names to the specified array (which is reallocated if necessary).

Parameters
namesStringString that contains delimited parameterr names.
separatorsA list of string separators that are used to delimit parameter names. Normally there will be onnly one separator (dependent on the allowMultipleSeparators ) parameter.
namesArrayReference to the array where extracted parameterr names are stored.
trimSpacesIf true then spaces and newlines are trimmed from parameter names. default is true.
allowMultipleSeparatorsIf true then multiple separators are allowed. Default is false.
static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.CreateFunctionDefinitionsArray ( string  namesString,
string  separator,
ref string[]  namesArray,
bool  trimSpaces = true 
)
inlinestatic

Parses a string that contains delimited function definitions, extract an array of individual function definitions from it, and stores individual string definitions to the specified array (which is reallocated if necessary).

Parameters
namesStringString that contains delimited function definitions.
separatorString separators that is used to delimit function definitions.
namesArrayReference to the array where extracted function definition strings are stored.
trimSpacesIf true then spaces and newlines are trimmed from function definition strings. Default is true.
static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.CreateFunctionDefinitionsArray ( string  namesString,
string[]  separators,
ref string[]  namesArray,
bool  trimSpaces = true,
bool  allowMultipleSeparators = false 
)
inlinestatic

Parses a string that contains delimited parameter names, extract an array of individual parameter names from it, and stores names to the specified array (which is reallocated if necessary).

Task is currently delegated to CreateFunctionDefinitionsArray(string, string[], ref string[], bool, bool).

Parameters
namesStringString that contains delimited parameterr names.
separatorsA list of string separators that are used to delimit parameter names. Normally there will be onnly one separator (dependent on the allowMultipleSeparators ) parameter.
namesArrayReference to the array where extracted parameterr names are stored.
trimSpacesIf true then spaces and newlines are trimmed from parameter names. default is true.
allowMultipleSeparatorsIf true then multiple separators are allowed. Default is false.
static string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.CreateParameterNamesString ( string[]  namesArray,
string  separator,
bool  insertNewLines = false,
bool  insertSpaces = true 
)
inlinestatic

Constructs a delimited string cotaining parameter names, from the specified array of parameter names.

Parameters
namesArrayArray of parameter names.
separatorSeparator used to delimit parameter names.
insertNewLinesIf true then newlines are also inserted between between individual parameter names (after separators).
insertSpacesIf true then spaces are also inserted between individual parameter names (after separators).
Returns
A single delimited string that contains the specified parameter names, without any enclosing backets.

Referenced by IG.Num.VectorFunctionScriptControllerBase< VectorFunctionType, ScalarFunctionControllerType, ScalarFunctionType >.ConvertParameterNamesToString().

static string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.CreateFunctionDefinitionsString ( string[]  definitionsArray,
string  separator,
bool  insertNewLines = false,
bool  insertSpaces = true 
)
inlinestatic

Construct a delimited string cotaining function definitons, from the specified array of individual string function definitions.

Work is delegated to CreateParameterNamesString(string [], string, bool, bool).

Parameters
definitionsArrayArray of parameter names.
separatorSeparator used to delimit function definitions.
insertNewLinesIf true then newlines are also inserted between between individual function definitions (after separators).
insertSpacesIf true then spaces are also inserted between individual function definitions (after separators).
Returns
A single delimited string that contains the specified function definitions, without any enclosing backets.
static string [] IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.GenerateParameterOrVariableNames ( int  dimension,
string  baseName = "x",
int  startIndex = 0,
int  numPlaces = 2 
)
inlinestatic

Generates and returns an array of a specified number of variable or parameter names, composed of a base name and numerical string corresponding to the consecutive number of the variable.

Parameters
dimensionNumber of variables.
baseNameBase for the parameter name.
startIndexAt which numbers parameterr count starts (default 0).
numPlacesNumber of places reserved for parameter's consecutive number (i.e. 2 in the sequence "x01", "x02", "x03", "x04" ...).

Referenced by IG.Num.VectorFunctionScriptControllerBase< VectorFunctionType, ScalarFunctionControllerType, ScalarFunctionType >.SynchronizeData().

static string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.GenerateFuctonParameterName ( int  whichParameter,
string  baseName = "x",
int  startIndex = 0,
int  numPlaces = 2 
)
inlinestatic

Generates and returns a pre-defined name of the specified variable or function parameter , composed of the specified base name and numerical string corresponding to the consecutive number of the variable.

Parameters
whichParameterIndex of the parameter or consecutive number of tje variable for which name is generated.
baseNameBase for the name.
startIndexAt which numbers parameterr count starts (default 0).
numPlacesNumber of places reserved for parameter's consecutive number (i.e. 2 in the sequence "x01", "x02", "x03", "x04" ...).
bool IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.GetIsLoaderConsistent ( )
inline

Returns a flag telling whether the loader is currently consistent with function definition contained in the DTO.

void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.CopyDataToFunctionLoader ( )
inlineprotected

Copies function deffinition data from the current function DTO to the internal function loader.

void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.CopyDataToFunctionLoader ( ScalarFunctionLoader  loader)
inlineprotected

Copies function deffinition data from the current function DTO to the specified function loader.

Parameters
loaderFunction loader where data is xopied to.

References IG.Lib.ScalarFunctionLoader.GradientDefinitionStrings, IG.Lib.ScalarFunctionLoader.IndependentVariableNames, and IG.Lib.ScalarFunctionLoader.ValueDefinitionString.

virtual ScalarFunctionLoader IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.GetFunctionLoader ( )
inlinevirtual

Returns the loader that can create a scalar function according to the definition from the current DTO.

virtual void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.SetFunctionLoader ( ScalarFunctionLoader  loader)
inlinevirtual

Sets the loader that can create a scalar function according to the definition from the current DTO.

Parameters
loaderFunction loader to be set.
LoadableScalarFunctionBase IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.GetFunction ( )
inline

Returns a scalar function that is created from the funciton definitio on the current function DTO.

References IG.Lib.Function.

Referenced by IG.Script.AppExtBase.FormDemoFunctionTestDevelop().

void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.DataToFunctionLoader ( )
inline

Copies data of the form to function loader.

virtual InputOutputDataDefiniton IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.GetDataDefinitionObject ( bool  setBoundsAndDefaults = false,
IBoundingBox  inputBounds = null,
IBoundingBox  outputBounds = null 
)
inlinevirtual

Creates and returns a data definition object for input parametera and output values of the current function DTO.

Bounds and default values are eventually added to definitions, dependent on parameters.

Definition contains function name and parameter names, and composes meaningful descriptions.

Parameters
setBoundsAndDefaultsWhether output bounds are added to input and output element definitions. Default is false.

If true and bouds are not specified then default bounds (currently 0/1) are specified.

If bounds are specified then default values for function parameters are also set to the mean of the corresponding minimal and maximal value.

Parameters
inputBoundsInput bounds that are added to definitions in the case that setBoundsAndDefaults is true.

If it is null then bounds are replaced by default values.

If it is specified but some bounds are not defined then corresponding bounds are also not specified.

Parameters
outputBoundsOutput bounds that are added to definitions in the case that setBoundsAndDefaults is true.

If it is null then bounds are replaced by default values.

If it is specified but some bounds are not defined then corresponding bounds are also not specified.

References IG.Num.InputOutputDataDefiniton.AddInputElement(), IG.Num.InputOutputDataDefiniton.AddOutputElement(), IG.Num.InputOutputElementDefinition.BoundsDefined, IG.Num.InputElementDefinition.DefaultValue, IG.Num.InputElementDefinition.DefaultValueDefined, IG.Num.InputOutputElementDefinition.Description, IG.Num.InputOutputElementDefinition.MaximalValue, IG.Num.InputOutputElementDefinition.MinimalValue, IG.Num.InputOutputElementDefinition.Name, and IG.Num.InputOutputElementDefinition.Title.

override string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.ToString ( )
inline

Returns human readable string representation of the current object.

Returns
static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.SaveJson ( ScalarFunctionScriptController  functionController,
string  filePath,
InputOutputDataDefiniton  dataDefinition 
)
inlinestatic

Saves (serializes) the specified script-based scalar function controller to the specified JSON file. If the file already exists, contents either overwrites the file or is appended at the end, dependent on the value of the append flag.

File is overwritten if it already exists.

The data definition is also written to the file apart to function data, and can be later restored to a separate object if necessary.

Parameters
functionControllerObject that is saved to a file.
filePathPath to the file in which object is saved.
dataDefinitionOptional object containing the definition of functions's input/output data. If specified, this object is added on the DTO annd is saved to the file together with pure function definitiion.

Referenced by IG.Forms.ScalarFunctionScriptControl.btnSave_Click().

static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.SaveJson ( ScalarFunctionScriptController  functionController,
string  filePath,
bool  append = false,
InputOutputDataDefiniton  dataDefinition = null 
)
inlinestatic

Saves (serializes) the specified script-based scalar function controller to the specified JSON file. If the file already exists, contents either overwrites the file or is appended at the end, dependent on the value of the append flag.

In addition to function data, the data definition is also stored to the output file when specified.

Parameters
functionControllerObject that is saved to a file.
filePathPath to the file in which object is saved.
appendSpecifies whether serialized data is appended at the end of the file in the case that the file already exists.
dataDefinitionOptional object containing the definition of functions's input/output data. If specified, this object is added on the DTO annd is saved to the file together with pure function definitiion.

References IG.Num.ScalarFunctionScriptDtoBase< FunctionControllerType >.ZDataDefinition.

static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.LoadJson ( string  filePath,
ref ScalarFunctionScriptController  controllerRestored 
)
inlinestatic

Restores (deserializes) a script-based scalar function controller from the specified file in JSON format.

Parameters
filePathFile from which object is restored.
controllerRestoredObject that is restored by deserialization.

Referenced by IG.Forms.ScalarFunctionScriptControl.btnLoad_Click(), and IG.Forms.InputOutputDataDefinitionControl.btnLoadFromFunction_Click().

static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.LoadJson ( string  filePath,
ref ScalarFunctionScriptController  controllerRestored,
ref ScalarFunctionScriptDto  dto 
)
inlinestatic

Restores (deserializes) a script-based scalar function controller from the specified file in JSON format.

An intermediate object in the process, the DTO, is also stored, because this kind of DTO also contains some additional data that is not copied to controllerRestored , such as function's input/output data definition.

Parameters
filePathFile from which object is restored.
controllerRestoredObject that is restored by deserialization.
dtoVariable into which the intermediate data transfer object (DTO) is stored in the process. The DTO can in this case include some additional data that is not copied to controllerRestored but may be used in the context where the method is called - for example the function's input/output data definitions.
static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.LoadJson ( string  filePath,
ref ScalarFunctionScriptController  controllerRestored,
ref InputOutputDataDefiniton  dataDef 
)
inlinestatic

Restores (deserializes) a script-based scalar function controller from the specified file in JSON format.

An intermediate object in the process, the DTO, is also stored, because this kind of DTO also contains some additional data that is not copied to controllerRestored , such as function's input/output data definition.

Parameters
filePathFile from which object is restored.
controllerRestoredObject that is restored by deserialization.
dataDefVariable into which the input/output data definition is restored when it is also written in the file (which is possible due to the ability of ScalarFunctionScriptDto to incorporate a data definition object, in addition to pure function data).
static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.SaveCsv ( IVector  vec,
string  filePath 
)
inlinestatic

Saves the specified vector to a CSV file. It the specified file already exists then it is overwritten. Constant UtilCsv.DefaultCsvSeparator is used as separator.

Parameters
vecVector to be stored to a file.
filePathPath of the file to which vector is stored.

References IG.Lib.UtilCsv.DefaultCsvSeparator.

static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.SaveCsv ( IVector  vec,
string  filePath,
string  separator 
)
inlinestatic

Saves the specified vector to a CSV file. It the specified file already exists then it is overwritten.

Parameters
vecVector to be stored to a file.
filePathPath of the file to which vector is stored.
separatorSeparator used in the CSV file.
static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.SaveCsv ( IVector  vec,
string  filePath,
bool  append 
)
inlinestatic

Saves the specified vector to a CSV file. Constant UtilCsv.DefaultCsvSeparator is used as separator in CSV.

Parameters
vecVector to be stored to a file.
filePathPath of the file to which vector is stored.
appendSpecifies whether the data is appended at the end of the file in the case that the ifle already exists.

References IG.Lib.UtilCsv.DefaultCsvSeparator.

static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.SaveCsv ( IVector  vec,
string  filePath,
string  separator,
bool  append 
)
inlinestatic

Saves the specified vector to a CSV file.

Parameters
vecVector to be stored to a file.
filePathPath of the file to which vector is stored.
separatorSeparator used in the CSV file.
appendSpecifies whether the data is appended at the end of the file in the case that the ifle already exists.
static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.LoadCsv ( string  filePath,
ref IVector  vecRestored 
)
inlinestatic

Reads a vector from a CSV file. Constant UtilCsv.DefaultCsvSeparator is used as separator in CSV file. If there are no components then a null vector is returned by this method (no exceptions thrown). If there are more than one rows in the CSV file then vector is read from the first row.

Parameters
filePathPath to the file that contains a vector in CSV format.
vecRestoredVector object where the read-in vector is stored.

References IG.Lib.UtilCsv.DefaultCsvSeparator.

static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.LoadCsv ( string  filePath,
string  separator,
ref IVector  vecRestored 
)
inlinestatic

Reads a vector written in CSV format from a file. If there are no components then a null vector is returned by this method (no exceptions thrown). If there are more than one rows in the CSV file then vector is read from the first row.

Parameters
filePathPath to the file that contains a vector in CSV format.
separatorSeparator that is used to separate values in a row in the CSV file.
vecRestoredVector object where the read-in vector is stored.
static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.LoadCsv ( string  filePath,
int  rowNum,
ref IVector  vecRestored 
)
inlinestatic

Reads a vector from the specified row of a CSV file. Constant UtilCsv.DefaultCsvSeparator is used as CSV separator. If the specified row does not exisist in the file then exception is thrown.

Parameters
filePathPath to the file that contains a vector in CSV format.
rowNumNumber of the row from which the vector is read.
vecRestoredVector object where the read-in vector is stored.

References IG.Lib.UtilCsv.DefaultCsvSeparator.

static void IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.LoadCsv ( string  filePath,
int  rowNum,
string  separator,
ref IVector  vecRestored 
)
inlinestatic

Reads a vector from the specified row of a CSV file. If the specified row does not exisist in the file then exception is thrown.

Parameters
filePathPath to the file that contains a vector in CSV format.
rowNumNumber of the row from which the vector is read.
separatorSeparator that is used to separate values in a row in the CSV file.
vecRestoredVector object where the read-in vector is stored.

Member Data Documentation

int IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._dimension
private
string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._name
protected
string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._description
private
string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._valueString
private
string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._parametersString
protected
string [] IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._parameterNames
private
string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._gradientsSingleString
protected
string [] IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._gradientDefinitionStrings
private
string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._defaultParameterNamesSeparator = ","
staticprivate
string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._defaultFunctionsSeparator = ";"
staticprivate
string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._parameterNamesSeparator = DefaultParameterNamesSeparator
private
string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._functionsSeparator = DefaultFunctionsSeparator
private
bool IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._isLoaderConsistent = false
private
ScalarFunctionLoader IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._functionLoader = null
private
double IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._defaultLowerBound = 0.0
staticprotected
double IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >._defaultUpperBound = 1.0
staticprotected

Property Documentation

virtual int IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.Dimension
getset
virtual string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.Description
getset
virtual bool IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.IsValueDefined
get

Specifies whether value is defined for the funciton represented by the current DTO.

Referenced by IG.Num.ScalarFunctionScriptDtoBase< FunctionControllerType >.CopyFromPlain().

virtual bool IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.IsGradientDefined
get

Specifies whether gradient is defined for the funciton represented by the current DTO.

Referenced by IG.Num.ScalarFunctionScriptDtoBase< FunctionControllerType >.CopyFromPlain(), and IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.ToString().

virtual string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.ValueDefinitonString
getset
virtual string [] IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.ParameterNames
getset
virtual string [] IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.GradientDefinitionStrings
getset

Gradient definition strings (separately for each gradient component).

Referenced by IG.Num.ScalarFunctionScriptDtoBase< FunctionControllerType >.CopyFromPlain(), and IG.Script.AppExtBase.FormDemoFunctionTestDevelop().

string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.DefaultParameterNamesSeparator
staticgetprotected set

Default parameter names separator, separates parametr names when stated in a single string.

string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.DefaultFunctionsSeparator
staticgetprivate setprotected

Default functions separator, separates string definitions of functions when stated in a single string.

string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.ParameterNamesSeparator
getprotected set

Separator string that is used to separate parameter names when stated in a single string.

Usually used for function parameters, but also for other kinds of parameters.

string IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.FunctionsSeparator
getprivate set

Separator string that is used to separate function definitions when stated in a single state.

bool IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.IsLoaderConsistent
getsetprotected

A flag indicateing whether the loader is currently consistent with the function definition contained in the current DTO.

virtual ScalarFunctionLoader IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.FunctionLoader
getsetprotected

Object that is responsible for creation of scalar function objects that correspond to the definitions found on the current scalar function DTO.

LoadableScalarFunctionBase IG.Num.ScalarFunctionScriptControllerBase< ScalarFunctionType >.Function
getprotected

Scalar function (of type IScalarFunction) created on basis of definition in this DTO.


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