mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-20 11:48:35 -06:00
User Doc : Octave interface ok
This commit is contained in:
parent
5772767f79
commit
fabbb659f3
@ -1,11 +1,35 @@
|
||||
## Script interface to Octave #
|
||||
ResInsight provides a flexible interface to [Octave](http://www.gnu.org/software/octave/ "Octave") for scripts execution. ResInsight can create an external Octave process, and is able to send and receive data from this external process.
|
||||
## Octave Interface
|
||||
|
||||
### Script execution - single case
|
||||
A script can be started by navigating to the script in the **Project Tree**, and selecting **Execute** from the context menu. The currently active case will be manipulated by the Octave script. It is also possible to execute a script from the context menu of a case.
|
||||
ResInsight provides a flexible interface to [Octave](http://www.gnu.org/software/octave/ "Octave").
|
||||
This includes a set of Octave functions that communicates with a running ResInsight session, and set of features in ResInsight that makes it easy to manage and edit Octave scripts, and to execute them using Octave.
|
||||
|
||||
The octave functions are documented in [ Octave Interface Reference](OctaveInterfaceReference.md)
|
||||
|
||||
### Script execution - multiple cases
|
||||
One script can be executed on many cases by first selecting a set of cases, and then activating **Execute script** from the context menu for the case selection.
|
||||
|
||||
### Script management
|
||||
Octave scripts are available in the **Scripts** folder in the **Project Tree**. Multiple script folder locations can be defined in the field _Shared Script Folder(s)_ in **Edit=>Preferences**. These scripts can be edited by a text editor defined in _Script Editor_ in **Edit=>Preferences**.
|
||||
Octave scripts are available in the **Scripts** folder in the **Project Tree**.
|
||||
|
||||

|
||||
|
||||
This folder contains an entry for each of the directories you have added as a **Script Folder**. Each of the folder lists available `*.m` files and sub directories. The tree is continously updated to reflect the file structure on disk.
|
||||
|
||||
#### Adding Script Folders
|
||||
You can add directories by right clicking the **Scripts** item to access the context menu.
|
||||
|
||||
Multiple standard script folder locations can also be defined in the field **Shared Script Folder(s)** in the **Preferences Dialog** (**Edit -> Preferences**).
|
||||
|
||||
#### Editing scripts
|
||||
To enable script editing from ResInsight you need to set up the path to a text editor in the **Script Editor** field in the **Preferences Dialog** (**Edit -> Preferences**)
|
||||
|
||||
When done, scripts can be edited using the context menu command **Edit** on the script item in the tree.
|
||||
|
||||
### Script execution
|
||||
Octave scripts can be executed with or without a selection of cases as context. The [ Octave Interface Reference](OctaveInterfaceReference.md) highlights in more depth how to design your octave scripts to utlize these features.
|
||||
|
||||
#### Without a case selection
|
||||
A script can be started by navigating to the script in the **Project Tree**, and selecting **Execute** from the context menu. The currently active case (The one with the active 3D View) will then be set as ResInsight's *Current Case*.
|
||||
|
||||
#### With a case selection
|
||||
One script can be executed on many cases by first selecting a set of cases, and then activating **Execute script** from the context menu for the case selection. The script is then executed once pr selected case. Each time ResInsight's *Current Case* is updated, making it accessible from the Octave script.
|
||||
|
||||

|
||||
|
@ -5,7 +5,7 @@ To identify a ResInsight case uniquely in the Octave script, an integer Id (Case
|
||||
|
||||
### Single case scripts
|
||||
Single case scripts do not need to address cases explicitly, but works on what ResInsight considers being the "Current Case". When the user selects several cases and executes a script on them, ResInsight loops over all cases in the selection, sets the current case and executes the script. All references to the "Current Case" from the script will then refer to the case currently being processed by ResInsight.
|
||||
The Current Case can be accessed directly using **riGetCurrentCase()**, but the more direct way is to omit the CaseId parameter in the functions, the Current Case is then automatically used.
|
||||
The Current Case can be accessed directly using **riGetCurrentCase()**, but the more direct way is to *omit the CaseId parameter* in the functions, the Current Case is then automatically used.
|
||||
|
||||
### Multi case scripts
|
||||
Scripts can access the selection state in ResInsight, and also retrieve lists of Case Groups and cases including some meta information. This can be used if the scripts need to get values from some cases, and store the results in others, etc.
|
||||
@ -134,7 +134,7 @@ If the case contains coarse-cells, the results are expanded onto the active cell
|
||||
If the CaseId is not defined, ResInsight's Current Case is used.
|
||||
The RequestedTimeSteps must contain a list of indices to the requested timesteps. If not defined, all the timesteps are returned.
|
||||
|
||||
#### Matrix[numI][numJ][numK][numTimestepsRequested] riGetGridProperty([CaseId], GridIndex , PropertyName, [RequestedTimeSteps], [PorosityModel = "Matrix"|"Fracture"])
|
||||
#### Matrix[numI][numJ][numK][numTimestepsRequested] <font style="color:darkblue"> riGetGridProperty</font> ([CaseId], GridIndex , PropertyName, [RequestedTimeSteps], [PorosityModel = "Matrix"|"Fracture"])
|
||||
This function returns a matrix of the requested property data for all the grid cells in the requested grid for each requested timestep.
|
||||
Grids are indexed from 0 (main grid) to max number of LGR's
|
||||
If the CaseId is not defined, ResInsight's Current Case is used.
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
Documentation/UsersGuide/images/OctaveScriptTree.png
Normal file
BIN
Documentation/UsersGuide/images/OctaveScriptTree.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
Loading…
Reference in New Issue
Block a user