# FISH Enhancements

## General

• New variable types include:
• Boolean;
• Symmetric Tensor (e.g., stress and strain);
• Matrix (with built-in functions to inverse, multiply, etc.);
• Map (associative array); and
• Structures.
• The FISH foreach construct can now be used for 3DEC objects (blocks, zones, gridpoints), rather than pointers, greatly simplifying FISH scripting.
• FISH functions are now available for all 3DEC objects, including structural elements.
• Many new math, system utility, list, matrix, string, and other intrinsic FISH functions have been added.
• Streamline scripting using assignment operators (=, +=, -=, *=, or /=), where fred += var1 is equivalent to fred = fred + var1.
• The data file text editor has been improved with better highlighting, visible line numbers, and code folding (i.e., collapse and expand segments of code).

The FISH scripting language is now multi-threaded, resulting in much faster execution of functions. To take full advantage of multi-threaded FISH, a new LIST data type, SPLITTING syntax, and OPERATORS have been added.

### FISH Lists

Lists are one-dimensional arrays of general FISH values. They differ from matrices in that each index can hold any valid FISH type (including another list). They differ from arrays in that they are passed by value, and they can only be of one dimension. You can iterate through all the elements of a list using the loop foreach statement. The access operator -> can be applied to lists, which permits the retrieval or assignment of an element and returns another list.

 aa = list.sequence(1,'a',3.1,4,math.pi) Makes a 5 element list. bb = a(3) bb = '3.1' cc(2) = 'c' cc = list.seq(1,'c',3.1,4,'b',math.pi) dd = list.seq( (1,2,3) , (4,5,6) ) Make a 2 element list of vectors. ee = dd -> y The list ee is now a list of only the y-components of the vectors in dd, that is, a list {2,5}. ee -> z / 2 The z-components of the vectors in ee have been cut in half, that is, a list {1, 2.5}.

### Splitting

FISH splitting allows a function, operator, or library call to be executed repeatedly on each element of an aggregate type (a list, an array, a container of objects, etc). Splitting is executed on all available threads. Splitting can be used as an alternative to loop statements to perform actions on many objects in a very clear and concise manner.

In order to make a split call, use the split operator '::' prefix to one or more arguments of the function, operator, or library call. The example below reduces the elastic shear modulus of an elastic model.

### Operators

FISH operators are a special class of function designed to be executed in a multi-threaded environment.

On a repeated function call made using splitting, if the symbol was declared as an operator these separate executions will be distributed on all available threads (see the program threads command). On a typical modern multi-core computer and a large set of data this can result in a very large increase in speed.

One of the most common and important uses of FISH operators—indeed their primary reason for being—is to use during cycling. Otherwise a single threaded FISH function that checks or changes all objects in a model will easily dominate the run time of the system.

## Python Scripting

The Python programming language is embedded inside the most current versions of PFC, FLAC3D, and 3DEC. Python is a popular, general purpose programming language with good support for scientific and numerical programming. Interaction between Python data files and models (e.g., zones, blocks, balls, rigid blocks, etc.) is also possible using the itasca Python module.

• All FISH functions are also available as Python methods
• Use either Python data files or the enhanced interactive IPython console built into 3DEC
• The IPython console provides a powerful set of tools:
• GUI-based script shell
• interactive data visualization
• comprehensive object inspection
• Python script parallel processing
• robust error handling

### Scientific Plotting

Create custom publication quality figures using Matplotlib, a Python 2D plotting library that produces figures in a variety of hardcopy formats and interactive environments across platforms. Plot types include lines, bars, pie, polar, statistical, contours, fields, and a large number of specialty charts.

### Power Computing

Use NumPy for scientific computing with Python for:

• a powerful N-dimensional array object;
• tools for integrating C/C++ and Fortran code;
• useful linear algebra, Fourier transform, and random number capabilities; and
• database integration.

### Science & Engineering

Advanced, customizable calculations are available via SciPy which builds on the NumPy array object. SciPy contains modules for optimization, linear algebra, integration, interpolation, special functions, FFT, signal and image processing, ODE solvers, and other tasks common in science and engineering.

### User Interface Customization

Pyside provides Python bindings for the Qt library that is used by the 3DEC user interface (UI). With PySide, users can modify, manipulate, or extend the 3DEC UI, create and control custom UI panes, including labels, text boxes, pane docking, and command buttons. Streamline modeling of complex problems by creating custom applications with dedicated user dialogs to input parameters and post-process simulation results.

##### Latest News
• ARMA 2022 Student Design Competition Congratulations to the winners of the American Rock Mechanics Association's (ARMA) 2022 Student Design Competition....
• International Slope Stability 2022 Itasca is proud to be a Diamond sponsor of Slope Stability 2022 (October 17-21 |...