![]() |
![]() |
![]() |
Yorick: An Interpreted Language
This file documents Yorick, an interpreted language specialized for numerical analysis. Yorick can prepare input to or process output from another physics simulation code. New simulation codes can also be constructed as a part of the Yorick interpreted environment.
BSD License
Copyright © 2005, The Regents of the University of California. Produced at the Lawrence Livermore National Laboratory. Written by David H. Munro <dhmunro at users.sourceforge.net>. UCRL-CODE-155996 All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the disclaimer below.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the disclaimer (as noted below) in the documentation and/or other materials provided with the distribution.
- Neither the name of the UC/LLNL nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Additional BSD Notice
- This notice is required to be provided under our contract with the U.S. Department of Energy (DOE). This work was produced at the University of California, Lawrence Livermore National Laboratory under Contract No. W-7405-ENG-48 with the DOE.
- Neither the United States Government nor the University of California nor any of their employees, makes any warranty, express or implied, or assumes any liability or responsibility for the accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately-owned rights.
- Also, reference herein to any specific commercial products, process, or services by trade name, trademark, manufacturer or otherwise does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or the University of California. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or the University of California, and shall not be used for advertising or product endorsement purposes.
1. Basic Ideas | A tutorial-like introductory chapter. | |
2. Using Array Syntax | Using array syntax. | |
3. Graphics | How to plot things. | |
4. Embedding Compiled Routines Inside Yorick | Embedding compiled code in a custom Yorick. | |
Concept Index | ||
--- The Detailed Node Listing --- Basic Ideas | ||
---|---|---|
1.1 Simple Statements | ||
1.2 Flow Control Statements | Defining functions, conditionals, and loops. | |
1.3 The Interpreted Environment | How to use Yorick's interpreted environment. | |
Simple Statements | ||
1.1.1 Defining a variable | ||
1.1.2 Invoking a procedure | ||
1.1.3 Printing an expression | ||
Flow Control Statements | ||
1.2.1 Defining a function | ||
1.2.2 Defining Procedures | ||
1.2.3 Conditional Execution | Conditionally executing statements. | |
1.2.4 Loops | Repeatedly executing statements. | |
1.2.5 Variable scope | Local and external variables. | |
Conditional Execution | ||
1.2.3.1 General if and else constructs | ||
1.2.3.2 Combining conditions with && and || | ||
Loops | ||
1.2.4.1 The while and do while statements | ||
1.2.4.2 The for statement | ||
1.2.4.3 Using break, continue, and goto | How to break, continue, and goto from a loop body. | |
Variable scope | ||
1.2.5.1 extern statements | ||
1.2.5.2 local statements | ||
The Interpreted Environment | ||
1.3.1 Starting, stopping, and interrupting Yorick | ||
1.3.2 Include files | How to read Yorick statements from a file. | |
1.3.3 The help function | Using the help command. | |
1.3.4 The info function | Getting information about a variable. | |
1.3.5 Prompts | What Yorick prompts mean. | |
1.3.6 Shell commands, removing and renaming files | Issuing shell commands from within Yorick. | |
1.3.7 Error Messages | What to do when Yorick detects an error. | |
Include files | ||
1.3.2.1 A sample include file | ||
1.3.2.2 Comments | ||
1.3.2.3 DOCUMENT comments | The help command recognizes special comments. | |
1.3.2.4 Where Yorick looks for include files | Directories Yorick searches for include files. | |
1.3.2.5 The `custom.i' file and `i-start/' directory | How to execute Yorick statements at startup. | |
Error Messages | ||
1.3.7.1 Runtime errors | ||
1.3.7.2 How to respond to a runtime error | ||
Using Array Syntax | ||
2.1 Creating Arrays | How to originate arrays. | |
2.2 Interpolating | Interpolation functions. | |
2.3 Indexing | How to reference array elements. | |
2.4 Sorting | How to sort an array. | |
2.5 Transposing | How to change the order of array dimensions. | |
2.6 Broadcasting and conformability | Making arrays conformable. | |
2.7 Dimension Lists | ||
Indexing | ||
2.3.1 Scalar indices and array order | ||
2.3.2 Selecting a range of indices | ||
2.3.3 Nil index refers to an entire dimension | ||
2.3.4 Selecting an arbitrary list of indices | ||
2.3.5 Creating a pseudo-index | ||
2.3.6 Numbering a dimension from its last element | ||
2.3.7 Using a rubber index | ||
2.3.8 Marking an index for matrix multiplication | ||
2.3.9 Rank reducing (statistical) range functions | ||
2.3.10 Rank preserving (finite difference) range functions | ||
Graphics | ||
3.1 Primitive plotting functions | The basic drawing functions. | |
3.2 Plot limits and relatives | Setting plot limits, log scaling, etc. | |
3.3 Managing a display list | The display list model. | |
3.4 Getting hardcopy | How to get it. | |
3.5 Graphics style | How to change it. | |
3.6 Queries, edits, and legends | Seeing legends and making minor changes. | |
3.7 Defaults for keywords | Setting (non-default) defaults. | |
3.8 Writing new plotting functions | Combining the plotting primitives. | |
3.9 Animation | Spielberg look out. | |
3.10 3D graphics interfaces | An experimental interface. | |
Primitive plotting functions | ||
3.1.1 plg | Plot graph. | |
3.1.2 pldj | Plot disjoint lines. | |
3.1.3 plm | Plot quadrilateral mesh. | |
3.1.4 plc and plfc | Plot contours. | |
3.1.5 plf | Plot filled quadrilateral mesh. | |
3.1.6 pli | Plot image. | |
3.1.7 plfp | Plot filled polygons. | |
3.1.8 plv | Plot vectors. | |
3.1.9 plt | Plot text. | |
Plot limits and relatives | ||
3.2.1 limits | Set plot limits. | |
3.2.2 logxy | Set log axis scaling. | |
3.2.3 gridxy | Set grid lines. | |
3.2.4 palette | Set color palette. | |
3.2.5 Color model | More about color. | |
limits | ||
3.2.1.1 Zooming with the mouse | How to zoom by mouse clicks. | |
3.2.1.2 Saving plot limits | Save and restore plot limits. | |
3.2.1.3 Forcing square limits | Assure that circles are not ellipses. | |
Managing a display list | ||
3.3.1 fma and redraw | Frame advance (begin next picture). | |
3.3.2 Multiple graphics windows | How to get them. | |
Getting hardcopy | ||
3.4.1 Color hardcopy | Dumping palettes into hardcopy files. | |
3.4.2 Binary CGM caveats | Caveats about binary CGM format. | |
3.4.3 Encapsulated PostScript | Encapsulated PostScript output. | |
Graphics style | ||
3.5.1 Style keyword | Accessing predefined graphics styles. | |
3.5.2 `style.i' functions | Bypassing predefined graphics styles. | |
3.5.3 Coordinate systems | Multiple coordinate systems. | |
3.5.4 Ticks and labels | How to change them. | |
Queries, edits, and legends | ||
3.6.1 Legends | Setting plot legends. | |
3.6.2 plq and pledit | The plot query and edit functions. | |
3D graphics interfaces | ||
3.10.1 Coordinate mapping | Changing your viewpoint. | |
3.10.2 Lighting | The 3D lighting model. | |
3.10.3 gnomon | Gnomon indicates axis orientation. | |
3.10.4 plwf interface | The plot wire frame interface. | |
3.10.5 slice3 interface | The slice and isosurface interface. | |
Embedding | ||
4.1 Mechanics of embedding | How to use the make utility. | |
4.2 API for embedding | Using the yapi.h interface. | |
4.3 Embedding example | Three ways to implement a function. | |
Embedding example | ||
4.3.1 Using PROTOTYPE | Example of PROTOTYPE comment. | |
4.3.2 Using `yapi.h' | Example of `yapi.h' API. |
![]() |
![]() |
![]() |