GiD_Event_SelectGIDBatFile: must be used to switch the default batch file for special cases.
This procedure must return as a value the alternative pathname of the batch file. For example it is used as a trick to select a different analysis from a list of batch calculation files.
in fact can return a list with the batch_name and some extra parameters that will be added to the arguments of the call to run the calculation
proc GiD_Event_SelectGIDBatFile { dir basename } { ...body... set value ... return $value }
example:
The default GiD bat arguments are the 4 provided, but are not compulsory, can provide others
here add a 5th extra argument with the number of threads specified by the user in the preferences windows
proc GiD_Event_SelectGIDBatFile { project_name basename } { set problemtype [GiD_Info Project ProblemType] set problemtype_directory [GidUtils::GiveProblemTypeFullname $problemtype].gid set filename_bat [file join $problemtype_directory $problemtype.win.bat] if { $::tcl_platform(platform) != "windows" } { set filename_bat [file join $problemtype_directory $problemtype.unix.bat] } set gid_exe [info nameofexecutable] set result [list $filename_bat $basename $project_name $problemtype_directory $gid_exe] set cpus [GiD_Set GID_OMP_NUM_THREADS] lappend $result $ncpus return $result }
GiD_Event_BeforeCalculate: will be called a little earlier than GiD_Event_BeforeRunCalculation, e.g. to allow renumber the mesh before write the calculation file and calculate
remote is 0 in case of local calculation, 1 in case or remote (sending to procserverd)
proc GiD_Event_BeforeCalculate { remote } { ...body... set value ... return $value }
GiD_Event_BeforeRunCalculation: will be called before running the analysis. It receives several arguments:
- batfilename: the name of the batch file to be run
- basename: the short name model
- dir: the full path to the model directory
- problemtypedir: the full path to the Problem Types directory
- gidexe: the full path to gid
- args: an optional list with other arguments
If it returns -cancel- then the calculation is not started.
proc GiD_Event_BeforeRunCalculation { batfilename basename dir problemtypedir gidexe args } { ...body... set value ... return $value }
GiD_Event_AfterRunCalculation: will be called just after the analysis finishes.
If it returns -cancel-as a value then the window that inform about the finished process will not be opened.
It receives as arguments:
basename: the short name model;
dir: the full path to the model directory;
problemtypedir: the full path to the Problem Types directory;
where: must be local or remote (remote if it was run in a server machine, using ProcServer);
error: returns 1 if an calculation error was detected;
errorfilename: an error filename with some error explanation, or nothing if everything was ok.
proc GiD_Event_AfterRunCalculation { basename dir problemtypedir where error errorfilename } { ...body... set value ... return $value }