Scripting
While most common operations can be executed through the use of commands, scripting is a vital aspect of the program, allowing users to perform problem-specific operations. FLAC3D, PFC, and 3DEC all provide scripting capabilities via both the FISH language, and PFC and FLAC3D provide scripting via the Python language as well. Both are described in this section.
FISH is an embedded programming language specific to Itasca software that has been designed for use by non-programmers. FISH has been augmented through the years, yielding a mature and useful tool for undertaking custom scripting in Itasca software. With FISH, users can access model data at any time during the modeling sequence. FISH has a legacy of being extensively used to perform advanced algorithms in PFC.
The Python programming language has been embedded inside PFC since the release of PFC 5.00.20; its first inclusion with FLAC3D was with FLAC3D 6.00. It is not embedded in the present 3DEC implementation. Python is an open-source, object-oriented, interpreted, and interactive high-level programming language. This program includes a scientific Python distribution that has been extended to allow one to access program model data from Python. In addition, the IPython console has been embedded in the user interface to provide an interactive python console.
Note
Both Python and FISH can be used to interact with PFC, 3DEC, and FLAC3D. The main differences between the two can be summarized as follows:
Unlike FISH, Python uses an object-oriented programming style to interact with model components. For instance, one accesses ball data by calling a function with a ball pointer (e.g.
ball.radius(bp)
where bp is a ball pointer) in FISH. In Python, on the other hand, balls are represented via the Ball class which defines methods for interacting with the balls. For instance, the operation above is undertaken with Python asb.radius()
whereb
is a Ball object (i.e., an instance of the Ball class).Unlike FISH, the global Python namespace is not connected to the model state. When a
model new
,model save
ormodel restore
command is given, the FISH programming state is cleared, saved or restored; the state of the Python namespace is unchanged by these operations, though. Whereas this can be seen as a limitation of Python usage, it provides also the advantages of being able to automate batch processing with sequences of save and restore operations.Python has the advantage of being easy to use, and has substantial functionalities included in the scientific Python environment distributed with this program. Since its inception in the 1980’s, Python has become the most widely used programming language in the world. In addition, Python is extensible via a plethora of modules available from the large worldwide user community.
The FISH and Python languages are described in the sections below.
Was this helpful? ... | Itasca Software © 2024, Itasca | Updated: Dec 03, 2024 |