IGLib
1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
|
File manager for interfacing simulation casting simulator of Robert Vertnik. More...
Public Member Functions | |
SimCastingRobertFileManager (string rootDirectory, string projectName, string simulationName) | |
Constructs a file manager for interfacing simulation casting simulator of Robert Vertnik. More... | |
void | UpdateRootDirectory () |
Updates the root directory path. More... | |
void | RemoveTemporaryFilesFromExecutableDirpath () |
Removes temporary files from teh executable directory. This is crucial for normal working of the interface (otherwise there are errors saying for some temporary files that they are readonly). 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... | |
virtual void | CalculateVectorResponse (IVector inputParameters, ref IVector outputValues) |
Calculates simulator's response at the specified input parameters. More... | |
override string | ToString () |
Returns a stirng that contains basic information about the current interfacing object, especially various relevant names (such as project name, etc.) and directory and file paths. More... | |
Protected Attributes | |
string | _rootDirectory = null |
string | _projectName |
string | _simulationName |
string | _executableDirname = SimCastingRobertConst.ExecutableDirname |
int | _numInputParameters |
int | _numOutputValues |
Static Protected Attributes | |
static string[] | emptyCommandArguments = new string[0] |
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... | |
int | OutputLevel [get, set] |
Level of information that is output to the console by some methods. More... | |
string | RootDirectory [get, protected set] |
Root directory for accessing casting simulator. More... | |
string | ProjectName [get, protected set] |
Casting simulator project name, specifies names of subdirextories of the main directories, where data actually resides. More... | |
string | SimulationName [get, protected set] |
Casting simulator simulation name, determines e.g. names of the optimization input and output files. More... | |
virtual string | ExecutableDirpath [get, protected set] |
Path of the directory where executable is 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 | InputDirpath [get, protected set] |
Path of the directory where input 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... | |
virtual string | PlotOutputDirpath [get, protected set] |
Path of the directory where plot 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 | MaterialDirpath [get, protected set] |
Path of the directory where material data is 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 | RootDirectoryContainingFilepath [get, protected set] |
File path of the file that contains the path of the directory containing the simulation directory structure. This file is important because it contents must be consistent with the actual location, otherwise simulation executable will not work. Only pure file name can be provided (if the full path is provided then only the file name is extracted, and the related path is calculated when firs needed). If set to null then file path is set to null and will be recalculated when getter is called. More... | |
virtual string | ExecutablePath [get, protected set] |
File path of simulator's executable. Only pure file name can be provided (if the full path is provided then only the file name is extracted, and the related path is calculated when firs needed). If set to null then file path is set to null and will be recalculated when getter is called. More... | |
virtual string | SimulationNamePath [get, protected set] |
Path to the file that contains the simulation name. Data found in this file specifies the names of input and output files. Only pure file name can be provided (if the full path is provided then only the file name is extracted, and the related path is calculated when firs needed). If set to null then file path is set to null and will be recalculated when getter is called. More... | |
virtual string | OptInputJsonPath [get, protected set] |
Path to the file that contains optimization input (usually stored by the caller of simulator). Only pure file name can be provided (if the full path is provided then only the file name is extracted, and the related path is calculated when firs needed). If set to null then file path is set to null and will be recalculated when getter is called. More... | |
virtual string | OptOutputJsonPath [get, protected set] |
Path to the file where optimization output values are stored by simulator. Only pure file name can be provided (if the full path is provided then only the file name is extracted, and the related path is calculated when firs needed). If set to null then file path is set to null and will be recalculated when getter is called. 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... | |
![]() | |
object | Lock [get] |
Private Member Functions | |
SimCastingRobertFileManager () | |
Private Attributes | |
object | _mainLock = new object() |
object | _internalLock = new object() |
int | _outputLevel = Util.OutputLevel |
string | _executableDirpath = null |
string | _inputDirname = SimCastingRobertConst.InputDirname |
string | _inputDirpath = null |
string | _outputDirname = SimCastingRobertConst.OutputDirname |
string | _outputDirpath = null |
string | _plotoutputDirname = SimCastingRobertConst.PlotoutputDirname |
string | _plotoutputDirpath = null |
string | _materialDirname = SimCastingRobertConst.MaterialDirname |
string | _materialDirpath = null |
string | _rootDirectoryContainingFilename = SimCastingRobertConst.RootDirectoryContainingFilename |
string | _rootDirectoryContainingPath = null |
string | _executableFilename = SimCastingRobertConst.ExecutableFilename |
string | _executablePath = null |
string | _simulationNameFilename = SimCastingRobertConst.SimulationNameFilename |
string | _simulationNamePath = null |
string | _simJsonExtension = SimCastingRobertConst.SimJsonExtension |
string | _optInputJsonFilename = null |
string | _optInputJsonPath = null |
string | _optOutputJsonFilename = null |
string | _optOutputJsonPath = null |
File manager for interfacing simulation casting simulator of Robert Vertnik.
$A Igor Jul11;
|
inlineprivate |
|
inline |
Constructs a file manager for interfacing simulation casting simulator of Robert Vertnik.
rootDirectory | Root directory containing all base directories for simulator data. |
projectName | Name of the project, which determines nmes of subdirectories of base directories that contain data for the current project. |
simulationName | Simulation name, which determines e.g. names of optimization input and output files used for data exchange between optimization and simulation. |
|
inline |
Updates the root directory path.
References IG.Lib.UtilSystem.StandardizeDirectoryPath().
|
inline |
Removes temporary files from teh executable directory. This is crucial for normal working of the interface (otherwise there are errors saying for some temporary files that they are readonly).
|
inlinevirtual |
Reads optimization input parameters form the file at a standard location.
inputParameters | Reference to an object where input parameters are stored. |
Reimplemented in IG.Num.ConvectionRobertFileManager.
References IG.Num.VectorBase.LoadJson().
|
inlinevirtual |
Writes optimization input parameters to the standard location.
outputValues | Parameters to be written. |
Reimplemented in IG.Num.ConvectionRobertFileManager, and IG.Num.ConvectionRev1RobertFileManager.
References IG.Num.VectorBase.SaveJson().
|
inlinevirtual |
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).
Reimplemented in IG.Num.ConvectionRobertFileManager.
|
inlinevirtual |
Reads optimization output values form the file at a standard location.
If for some reason the file does not exist or it is corrupted, the vector of output values is set to null.
outputValues | Reference to an object where output parameters will be stored. |
Reimplemented in IG.Num.ConvectionRobertFileManager.
References IG.Num.VectorBase.LoadJson().
|
inlinevirtual |
Writes optimization ouptut values to the standard location.
outputValues | Values to be written. |
Reimplemented in IG.Num.ConvectionRobertFileManager.
References IG.Num.VectorBase.SaveJson().
|
inline |
Runs the simulaor interfaced by the current object. This method only runs the simulator, it does not prepare any input.
|
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.
commandlineArguments | Command-line arguments that are passed to the simulator program. |
References IG.Lib.UtilSystem.ExecuteSystemCommand().
|
inlinevirtual |
Calculates simulator's response at the specified input 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.StopWatch1.Start(), IG.Lib.StopWatch1.Stop(), IG.Lib.StopWatch1.Time, IG.Num.IVector.ToStringMath(), and IG.Lib.StopWatch1.TotalTime.
|
inline |
Returns a stirng that contains basic information about the current interfacing object, especially various relevant names (such as project name, etc.) and directory and file paths.
|
private |
|
private |
|
private |
|
protected |
|
protected |
|
protected |
|
protected |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
protected |
|
protected |
|
staticprotected |
|
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.
|
getprotected |
Used internally for locking access to internal fields.
|
getset |
Level of information that is output to the console by some methods.
|
getprotected set |
Root directory for accessing casting simulator.
|
getprotected set |
Casting simulator project name, specifies names of subdirextories of the main directories, where data actually resides.
|
getprotected set |
Casting simulator simulation name, determines e.g. names of the optimization input and output files.
|
getprotected set |
Path of the directory where executable is 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.
|
getprotected set |
Path of the directory where input 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.
|
getprotected 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.
|
getprotected set |
Path of the directory where plot 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.
|
getprotected set |
Path of the directory where material data is 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.
|
getprotected set |
File path of the file that contains the path of the directory containing the simulation directory structure. This file is important because it contents must be consistent with the actual location, otherwise simulation executable will not work. Only pure file name can be provided (if the full path is provided then only the file name is extracted, and the related path is calculated when firs needed). If set to null then file path is set to null and will be recalculated when getter is called.
|
getprotected set |
File path of simulator's executable. Only pure file name can be provided (if the full path is provided then only the file name is extracted, and the related path is calculated when firs needed). If set to null then file path is set to null and will be recalculated when getter is called.
|
getprotected set |
Path to the file that contains the simulation name. Data found in this file specifies the names of input and output files. Only pure file name can be provided (if the full path is provided then only the file name is extracted, and the related path is calculated when firs needed). If set to null then file path is set to null and will be recalculated when getter is called.
|
getprotected set |
Path to the file that contains optimization input (usually stored by the caller of simulator). Only pure file name can be provided (if the full path is provided then only the file name is extracted, and the related path is calculated when firs needed). If set to null then file path is set to null and will be recalculated when getter is called.
|
getprotected set |
Path to the file where optimization output values are stored by simulator. Only pure file name can be provided (if the full path is provided then only the file name is extracted, and the related path is calculated when firs needed). If set to null then file path is set to null and will be recalculated when getter is called.
|
getset |
Number of input optimization parameters for the simulator.
|
getset |
Number of optimization output values produced by the simulator.