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.Lib.LoadableScriptShellBase Class Reference

Loadable script base class for the shell application that includes tols for definition of optiimization problems, definition of vector response functions, a couple of interfaces with simulation programs, etc. AGREEMENTS: The first argument to initialization and executable method is working directory where data between different applications is exchanged. If overrigding the InitializeThis(...) method, call the base class' method first, and keep the agreement that the first argument must be the working directory. When implementing the executable (RunThis(...)) method, its first argument should also be the working directory (the same as for initialization). This is to enable use of the class in scenarios where initialization and execution arguments must be the same. More...

+ Inheritance diagram for IG.Lib.LoadableScriptShellBase:
+ Collaboration diagram for IG.Lib.LoadableScriptShellBase:

Classes

class  StoredScriptSettings
 In methods of this class you will find all the settings that apply to this script. More...
 

Public Member Functions

 LoadableScriptShellBase ()
 Constructor. More...
 
virtual bool RepairSimulationParameters (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 SimulatorCalculateResponse (IResponseEvaluatorVectorSimple simulator, IVector inputParameters, ref IVector outputValues)
 Calculates vector response by the specified simulator, and stores output values to the specified vector variable. More...
 
void SimulatorCalculateResponse (IVector parameters, ref IVector outputValues)
 Calculates vector response by the main simulator of the script, and stores output values to the specified vector variable. More...
 
- Public Member Functions inherited from IG.Lib.LoadableScriptOptShellBaseControllable
 LoadableScriptOptShellBaseControllable ()
 Creates a LoadableScriptOptBase object. More...
 
- Public Member Functions inherited from IG.Lib.LoadableScriptOptBase
 LoadableScriptOptBase ()
 Creates the LoadableScriptOptBase object. More...
 
abstract void Analyse (IAnalysisResults anRes)
 Performs direct analysis for optimization problems. This method must be overridden in derived classes where one wants to have direct analysis defined. More...
 
- Public Member Functions inherited from IG.Lib.LoadableScriptBase
 LoadableScriptBase ()
 Argument-less constructor. If argument-less constructor is called then initialization is not performed and will be performed later. More...
 
string Run (string[] arguments)
 Performs the action of this object. Override this in derived classes! More...
 
void Initialize (string[] arguments)
 Initializes the object. If not called explicitly, this method is automatically called at the first call to the Run method. More...
 
virtual string Script_DefaultInitialize (string[] arguments)
 Default initialization method for scripts. More...
 
virtual string Script_DefaultRun (string[] arguments)
 Default run method for the script. Can be used when only installed commands are run by hte script. More...
 
virtual
ICommandLineApplicationInterpreter 
Script_CreateInterpreterWithoutCommands ()
 Creates and returns an interpreter that can be used as script's internal interpreter for running script's commands. More...
 
virtual void Script_AddCommands (ICommandLineApplicationInterpreter interpreter, SortedList< string, string > helpStrings)
 Add wscript's internal commands to the specified interpreter. More...
 
delegate string Script_CommandDelegate (string[] args)
 Delegate for commands that are installed on script's internal interpreter (property Script_Interpreter). More...
 
void Script_AddCommand (string commandName, Script_CommandDelegate command, string helpString)
 Adds a new internal script command under specified name to the internal interpreter of the current script object. More...
 
virtual void Script_AddCommand (ICommandLineApplicationInterpreter interpreter, SortedList< string, string > helpStrings, string commandName, Script_CommandDelegate command, string helpString)
 Adds a new internal script command under specified name to the internal interpreter of the current script object. More...
 
string Script_GetHelpString (string scriptCommandName)
 Returns help string for internal script command with specified name, or null if help string is not installed for such a command. More...
 
void Script_PrintCommandsHelp ()
 Prits help for the installed internal commands of the script. More...
 
virtual bool Script_ContainsCommand (string commandName)
 Returns true if the internal script's interpreter contains a command with specified name, false otherwise. More...
 
virtual bool Script_ContainsScriptCommand (string commandName)
 Returns true if the specified command is script command (i.e. its first argument is command-name and it is run through the Script_CommandAdapter object). More...
 
virtual void Script_RemoveCommand (string commandName)
 Removes the specified internal script command from the internal interpreter of the current scripting object. More...
 
virtual void Script_RemoveAllCommands ()
 Removes ALL internal script commands from the internal interpreter of the current scripting object. More...
 
string Script_Run (string[] arguments)
 Runs internal script command. More...
 
string Script_Run (string commandName, params string[] otherArguments)
 Runs internal script command. More...
 
virtual void Script_PrintArguments (string messageString, string[] arguments)
 Prints the specified array of string arguments (usually passed as command-line arguments). More...
 

Protected Member Functions

override void InitializeThis (string[] arguments)
 Inializes the current script object. More...
 
virtual void CreateNewSimulator (string simulatorPath, ref IResponseEvaluatorVectorSimple simulator)
 Creates a new simulator that uses the specified simulator directory, and stores it to the specified variable. More...
 
- Protected Member Functions inherited from IG.Lib.LoadableScriptBase
delegate string CommandMethod (string commandName, string[] args)
 Delegate for internal command methods. More...
 
abstract string RunThis (string[] arguments)
 Performs the action of this object. Override this in derived classes! More...
 
ICommandLineApplicationInterpreter Script_CreateInterpreter ()
 Creates and returns an interpreter that can be used as script's internal interpreter for running script's commands. More...
 
virtual string Script_CommandHelp (string[] arguments)
 Prints help. More...
 
virtual string Script_CommandTestScript (string[] arguments)
 Prints help. More...
 

Protected Attributes

IResponseEvaluatorVectorSimple _simulator
 
string _projectName
 
string _simulationName
 
- Protected Attributes inherited from IG.Lib.LoadableScriptOptBase
StopWatch1 _timer = null
 
bool _checkOptimizationDirectoryExistence = true
 Whether to check existence of optimization directory when set. Also applies to working directory. More...
 
- Protected Attributes inherited from IG.Lib.LoadableScriptBase
string _embeddedCommandName = null
 
int _outputLevel = DefaultOutputLevel
 
ICommandLineApplicationInterpreter _script_interpreter
 

Properties

abstract
IResponseEvaluatorVectorSimple 
Simulator [get, protected set]
 Simulator that is used to calculate vector response. More...
 
virtual bool SimulatorSuppressOutput [get, set]
 A flag indicating whether simulators should suppress output or not, default is false. More...
 
virtual string ProjectName [get, protected set]
 Name of the current project, used in some simulation and other interfaces. More...
 
virtual string SimulationName [get, protected set]
 Name of the current simulation, used in some simulation and other interfaces. More...
 
- Properties inherited from IG.Lib.LoadableScriptOptShellBaseControllable
bool IsLoadable [get, set]
 Either or not the script can be dynamically loaded. More...
 
bool IsRunnable [get, set]
 Either or not the script can be run (some scripts only support other tasks). More...
 
- Properties inherited from IG.Lib.LoadableScriptOptBase
StopWatch1 Timer [get]
 
virtual IRandomGenerator Random [get, protected set]
 Random generator used by the current object. More...
 
virtual string OptimizationDirectory [get, set]
 Optimization directory. This directory is a base directory for data used optimization and neural network - based approximation servers and for other directories that contain data for specific tasks. More...
 
virtual string WorkingDirectory [get, set]
 Working directory. This directory is a base directory for data used by the script. It is usually obtained as parent directory of the optimization directory. More...
 
virtual IAnalysis Analysis [get, protected set]
 Direct analysis object used in optimization. Initialized when first accessed with the embedded class, whose analysis function calls Analyse(...). More...
 
- Properties inherited from IG.Lib.LoadableScriptBase
string EmbeddedCommandName [get, set]
 Command that was used to launch the current embedded application script. More...
 
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...
 
string[] InitializationArguments [get, set]
 Arguments used by the initialization method. WARNING: arguments can only be set before initialization is performed. Initialization is performed either implicitly at the first call to the Run method or explicitly by calling the Initialize method. More...
 
virtual bool IsInitialized [get, protected set]
 Whether the object has been initialized or not. More...
 
static int DefaultOutputLevel [get, set]
 
int OutputLevel [get, set]
 Level of output to console produced by some operations of the current object. More...
 
virtual
ICommandLineApplicationInterpreter 
Script_Interpreter [get, protected set]
 Script's internal interpreter that takes care for execution of installed internal commands. More...
 
SortedList< string, string > Script_CommandHelpStrings [get]
 Contains help strings associated with script commands installed on interpreter. More...
 
- Properties inherited from IG.Lib.ILoadableScript
string EmbeddedCommandName [get, set]
 Command that was used to launch the current embedded application script. More...
 
string[] InitializationArguments [get, set]
 Arguments used by the initialization method. More...
 
bool IsInitialized [get]
 Whether the object has been initialized or not. More...
 
- Properties inherited from IG.Lib.ILockable
object Lock [get]
 
- Properties inherited from IG.Lib.ILoadableScriptC
bool IsLoadable [get, set]
 Either or not the script can be dynamically loaded. More...
 
bool IsRunnable [get, set]
 Either or not the script can be run (some scripts only support other tasks). More...
 

Private Attributes

bool _simulatorSuppressOutput = false
 

Additional Inherited Members

- Public Attributes inherited from IG.Lib.LoadableScriptBase
const string ConstDefaultHelp = "Help"
 Default command name for help. More...
 
const string ConstHelpDefaultUniversal = "?"
 Universal name of the help command. More...
 
const string ConstDefaultTestScrip = "TestScript"
 Default command name for test method. More...
 

Detailed Description

Loadable script base class for the shell application that includes tols for definition of optiimization problems, definition of vector response functions, a couple of interfaces with simulation programs, etc. AGREEMENTS: The first argument to initialization and executable method is working directory where data between different applications is exchanged. If overrigding the InitializeThis(...) method, call the base class' method first, and keep the agreement that the first argument must be the working directory. When implementing the executable (RunThis(...)) method, its first argument should also be the working directory (the same as for initialization). This is to enable use of the class in scenarios where initialization and execution arguments must be the same.

$A Igor Aug11;

Constructor & Destructor Documentation

IG.Lib.LoadableScriptShellBase.LoadableScriptShellBase ( )
inline

Constructor.

Member Function Documentation

override void IG.Lib.LoadableScriptShellBase.InitializeThis ( string[]  arguments)
inlineprotectedvirtual

Inializes the current script object.

Parameters
argumentsInitialization arguments. The first argument must be the working directory path.

Reimplemented from IG.Lib.LoadableScriptOptShellBaseControllable.

Reimplemented in IG.Script.LoadableScriptShellNeural, and IG.Script.LoadableScriptShellNeuralBase.

virtual void IG.Lib.LoadableScriptShellBase.CreateNewSimulator ( string  simulatorPath,
ref IResponseEvaluatorVectorSimple  simulator 
)
inlineprotectedvirtual

Creates a new simulator that uses the specified simulator directory, and stores it to the specified variable.

This method always creates simulator anew, regardless of whether the variable to hold it is already assigned.

Parameters
simulatorPathPath to the simulator directory.
simuatorVariable where the created simulator is stored.

In many scripts, it is this method that sould be overridden in order to sort out everything with respect to simulator creation.

virtual bool IG.Lib.LoadableScriptShellBase.RepairSimulationParameters ( IVector  parameters)
inlinevirtual

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

Parameters
parametersVector of parameters to be repaired. Repaired values are stored in the same vector.
Returns
true if parameters were corrected, false otherwise.

This method should be overridden in the derived classes, in the case that reparation can actual take place. The base class method does nothing (it only returns false).

virtual void IG.Lib.LoadableScriptShellBase.SimulatorCalculateResponse ( IResponseEvaluatorVectorSimple  simulator,
IVector  inputParameters,
ref IVector  outputValues 
)
inlinevirtual

Calculates vector response by the specified simulator, and stores output values to the specified vector variable.

Parameters
simulatorSimulator used to calculate the response.
inputParametersVector of input parameters.<paramparam name="outputValues">Variable where the calculated response (output values) is stored.</paramparam>

This method is seldom overridden in derived classes because it does everything it is expected to do. The method calls the RepairSimulationParameters method, which is often overridden in derived classes. Warning message is written to console if vectr of input parameters had to be repaired.

References IG.Num.IResponseEvaluatorVectorSimple.CalculateVectorResponse().

void IG.Lib.LoadableScriptShellBase.SimulatorCalculateResponse ( IVector  parameters,
ref IVector  outputValues 
)
inline

Calculates vector response by the main simulator of the script, and stores output values to the specified vector variable.

Parameters
inputParametersVector of input parameters.<paramparam name="outputValues">Variable where the calculated response (output values) is stored.</paramparam>

This method can not be overridden in derived classes, but its overload where simulator is an argument, can be overridden.

Member Data Documentation

IResponseEvaluatorVectorSimple IG.Lib.LoadableScriptShellBase._simulator
protected
bool IG.Lib.LoadableScriptShellBase._simulatorSuppressOutput = false
private
string IG.Lib.LoadableScriptShellBase._projectName
protected
string IG.Lib.LoadableScriptShellBase._simulationName
protected

Property Documentation

abstract IResponseEvaluatorVectorSimple IG.Lib.LoadableScriptShellBase.Simulator
getprotected set

Simulator that is used to calculate vector response.

virtual bool IG.Lib.LoadableScriptShellBase.SimulatorSuppressOutput
getset

A flag indicating whether simulators should suppress output or not, default is false.

Current value of this flag affects newly created simulators (usually this is implemented in the CreateNewSimulator method).

Not all simulator interfaces support suppressing output, therefore for some simulator this flag has no effect.

virtual string IG.Lib.LoadableScriptShellBase.ProjectName
getprotected set

Name of the current project, used in some simulation and other interfaces.

virtual string IG.Lib.LoadableScriptShellBase.SimulationName
getprotected set

Name of the current simulation, used in some simulation and other interfaces.


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