FISH Scripting

FISH Introduction

FISH is an embedded programming language that enables the user to interact with and manipulate PFC models, defining new variables and functions as needed. These functions may be used to extend PFC’s usefulness or add user-defined features. For example, new variables may be plotted or printed, special particle generators may be implemented, servo controls may be applied to perform a numerical test, unusual distributions of properties may be specified, and parametric studies may be automated.

FISH was developed in response to users who wanted to do things with Itasca software that were either difficult or impossible with existing program structures. Rather than incorporate many new and specialized features into PFC, FISH was provided so that users could write functions to perform custom analyses. It is possible for someone without programming experience to write simple FISH functions. The following section contains an introductory tutorial for non-programmers. However, FISH programs can also become very complicated.

As with all programming tasks, FISH functions should be constructed in an incremental fashion, checking operations at each level before moving on to more complicated code. FISH does less error-checking than most compilers, so all functions should be tested on simple data sets before they are used for real applications.

FISH programs are simply embedded in a normal PFC data file. Lines following the word c define are processed as a FISH function; the function terminates when the word c end is encountered. Functions may invoke other functions, which may invoke others, and so on. The order in which functions are defined does not matter, as long as they are all defined before they are used (e.g., invoked by a PFC command). Since the compiled form of a FISH function is stored in PFC’s memory space, the model save command saves the function and the current values of associated variables.