Tecplot User S Manual
Tecplot User S Manual
Tecplot 360TM User’s Manual is for use with Tecplot 360TM Version 2011 R2.
Copyright © 1988-2011 Tecplot, Inc. All rights reserved worldwide. Except for personal use, this manual may not be reproduced, transmitted, transcribed, stored in a retrieval system, or translated in any form, in whole or in part, without the express written
permission of Tecplot, Inc., 3535 Factoria Blvd, Ste. 550; Bellevue, WA 98006 U.S.A.
The software discussed in this documentation and the documentation itself are furnished under license for utilization and duplication only according to the license terms. The copyright for the software is held by Tecplot, Inc. Documentation is provided for
information only. It is subject to change without notice. It should not be interpreted as a commitment by Tecplot, Inc. Tecplot, Inc. assumes no liability or responsibility for documentation errors or inaccuracies.
Tecplot, Inc.
Post Office Box 52708
Bellevue, WA 98015-2708 U.S.A.
Tel:1.800.763.7005 (within the U.S. or Canada), 00 1 (425)653-1200 (internationally)
email: sales@tecplot.com, support@tecplot.com
Questions, comments or concerns regarding this document: documentation@tecplot.com
For more information, visit http://www.tecplot.com
LAPACK 1992-2007 LAPACK Copyright © 1992-2007 the University of Tennessee. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistribu-
tions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer listed in this cense in
the documentation and/or other materials provided with the distribution. Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without pecific prior written per-
mission. 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 COPYRIGHT OWNER 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. The University
of Tennessee. All Rights Reserved. SciPy 2001-2009 Enthought. Inc. All Rights Reserved. NumPy 2005 NumPy Developers. All Rights Reserved. VisTools and VdmTools 1992-2009 Visual Kinematics, Inc. All Rights Reserved. NCSA HDF & HDF5 (Hierarchical
Data Format) Software Library and Utilities Contributors: National Center for Supercomputing Applications (NCSA) at the University of Illinois, Fortner Software, Unidata Program Center (netCDF), The Independent JPEG Group (JPEG), Jean-loup Gailly
and Mark Adler (gzip), and Digital Equipment Corporation (DEC). Conditions of Redistribution: 1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form
must reproduce the above copyright notice, this list of conditions, and the following disclaimer in the documentation and/or materials provided with the distribution. 3. In addition, redistributions of modified forms of the source or binary code must carry
prominent notices stating that the original code was changed and the date of the change. 4. All publications or advertising materials mentioning features or use of this software are asked, but not required, to acknowledge that it was developed by The HDF
Group and by the National Center for Supercomputing Applications at the University of Illinois at Urbana-Champaign and credit the contributors. 5. Neither the name of The HDF Group, the name of the University, nor the name of any Contributor may be
used to endorse or promote products derived from this software without specific prior written permission from the University, THG, or the Contributor, respectively. DISCLAIMER: THIS SOFTWARE IS PROVIDED BY THE HDF GROUP (THG) AND THE
CONTRIBUTORS "AS IS" WITH NO WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. In no event shall THG or the Contributors be liable for any damages suffered by the users arising out of the use of this software, even if advised of the pos-
sibility of such damage. Copyright © 1998-2006 The Board of Trustees of the University of Illinois, Copyright © 2006-2008 The HDF Group (THG). All Rights Reserved. PNG Reference Library Copyright © 1995, 1996 Guy Eric Schalnat, Group 42, Inc., Copy-
right © 1996, 1997 Andreas Dilger, Copyright © 1998, 1999 Glenn Randers-Pehrson. All Rights Reserved. Tcl 1989-1994 The Regents of the University of California. Copyright © 1994 The Australian National University. Copyright © 1994-1998 Sun
Microsystems, Inc. Copyright © 1998-1999 Scriptics Corporation. All Rights Reserved. bmptopnm 1992 David W. Sanderson. All Rights Reserved. Netpbm 1988 Jef Poskanzer . All Rights Reserved. Mesa 1999-2003 Brian Paul. All Rights Reserved. W3C IPR
1995-1998 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. Ppmtopict 1990 Ken Yap. All Rights Reserved. JPEG 1991-1998 Thomas
G. Lane. All Rights Reserved. Dirent API for Microsoft Visual Studio (dirent.h) 2006-2006 Copyright © 2006 Toni Ronkko. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so.
Toni Ronkko. All Rights Reserved. ICU 1995-2009 Copyright © 1995-2009 International Business Machines Corporation and others. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished
to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software and that both the above copyright notice(s) and this permission notice appear in supporting documentation. International Business Machines
Corporation and others. All Rights Reserved. QsLog 2010 Copyright © 2010, Razvan Petru. All rights reserved. QsLog Copyright (c) 2010, Razvan Petru. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following onditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. The name of the contributors may not 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 MERCHANTABIL-
ITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUEN-
TIAL 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. Razvan Petru.
All Rights Reserved. VTK 1993-2008 Copyright © 1993-2008 Ken Martin, Will Schroeder, Bill Lorenson. 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 following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the distribution. Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names of any contributors may be used to endorse or promote products derived from this software without spe-
cific 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 AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSE-
QUENTIAL 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 LIABIL-
ITY, 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. Ken Martin,
Will Schroeder, Bill Lorenson. All Rights Reserved.
TRADEMARKS
Tecplot,® Tecplot 360,TM the Tecplot 360 logo, Preplot,TM Enjoy the View,TM Master the View,TM and FramerTM are registered trademarks or trademarks of Tecplot, Inc. in the United States and other countries.
3D Systems is a registered trademark or trademark of 3D Systems Corporation in the U.S. and/or other countries. Macintosh OS is a registered trademark or trademark of Apple, Incorporated in the U.S. and/or other countries. Reflection-X is a registered trade-
mark or trademark of Attachmate Corporation in the U.S. and/or other countries. EnSight is a registered trademark or trademark of Computation Engineering Internation (CEI), Incorporated in the U.S. and/or other countries. EDEM is a registered trademark
or trademark of DEM Solutions Ltd in the U.S. and/or other countries. Exceed 3D, Hummingbird, and Exceed are registered trademarks or trademarks of Hummingbird Limited in the U.S. and/or other countries. Konqueror is a registered trademark or trade-
mark of KDE e.V. in the U.S. and/or other countries. VIP and VDB are registered trademarks or trademarks of Halliburton in the U.S. and/or other countries. ECLIPSE FrontSim is a registered trademark or trademark of Schlumberger Information Solutions
(SIS) in the U.S. and/or other countries. Debian is a registered trademark or trademark of Software in the Public Interest, Incorporated in the U.S. and/or other countries. X3D is a registered trademark or trademark of Web3D Consortium in the U.S. and/or other
countries. X Window System is a registered trademark or trademark of X Consortium, Incorporated in the U.S. and/or other countries. ANSYS, Fluent and any and all ANSYS, Inc. brand, product, service and feature names, logos and slogans are registered
trademarks or trademarks of ANSYS Incorporated or its subsidiaries in the U.S. and/or other countries. PAM-CRASH is a registered trademark or trademark of ESI Group in the U.S. and/or other countries. LS-DYNA is a registered trademark or trademark of
Livermore Software Technology Coroporation in the U.S. and/or other countries. MSC/NASTRAN is a registered trademark or trademark of MSC.Software Corporation in the U.S. and/or other countries. NASTRAN is a registered trademark or trademark of
National Aeronautics Space Administration in the U.S. and/or other countries. 3DSL is a registered trademark or trademark of StreamSim Technologies, Incorporated in the U.S. and/or other countries. SDRC/IDEAS Universal is a registered trademark or trade-
mark of UGS PLM Solutions Incorporated or its subsidiaries in the U.S. and/or other countries. Star-CCM+ is a registered trademark or trademark of CD-adapco in the U.S. and/or other countries. Reprise License Manager is a registered trademark or trade-
mark of Reprise Software, Inc. in the U.S. and/or other countries. Python is a registered trademark or trademark of Python Software Foundation in the U.S. and/or other countries. Abaqus, the 3DS logo, SIMULIA and CATIA are registered trademarks or
trademarks of Dassault Systèmes or its subsidiaries in the U.S. and/or other countries. The Abaqus runtime libraries are a product of Dassault Systèmes Simulia Corp., Providence, RI, USA. © Dassault Systèmes, 2007 FLOW-3D is a registered trademark or
trademark of Flow Science, Incorporated in the U.S. and/or other countries. Adobe, Flash, Flash Player, Premier and PostScript are registered trademarks or trademarks of Adobe Systems, Incorporated in the U.S. and/or other countries. AutoCAD and DXF are
registered trademarks or trademarks of Autodesk, Incorporated in the U.S. and/or other countries. Ubuntu is a registered trademark or trademark of Canonical Limited in the U.S. and/or other countries. HP, LaserJet and PaintJet are registered trademarks or
trademarks of Hewlett-Packard Development Company, Limited Partnership in the U.S. and/or other countries. IBM, RS/6000 and AIX are registered trademarks or trademarks of International Business Machines Corporation in the U.S. and/or other countries.
Helvetica Font Family and Times Font Family are registered trademarks or trademarks of Linotype GmbH in the U.S. and/or other countries. Linux is a registered trademark or trademark of Linus Torvalds in the U.S. and/or other countries. ActiveX, Excel,
Microsoft, Visual C++, Visual Studio, Windows, Windows Metafile, Windows XP, Windows Vista, Windows 2000 and PowerPoint are registered trademarks or trademarks of Microsoft Corporation in the U.S. and/or other countries. Firefox is a registered trade-
mark or trademark of The Mozilla Foundation in the U.S. and/or other countries. Netscape is a registered trademark or trademark of Netscape Communications Corporation in the U.S. and/or other countries. SUSE is a registered trademark or trademark of
Novell, Incorporated in the U.S. and/or other countries. Red Hat is a registered trademark or trademark of Red Hat, Incorporated in the U.S. and/or other countries. SPARC is a registered trademark or trademark of SPARC International, Incorporated in the
U.S. and/or other countries. Products bearing SPARC trademarks are based on an architecture developed by Sun Microsystems, Inc. Solaris, Sun and SunRaster are registered trademarks or trademarks of Sun MicroSystems, Incorporated in the U.S. and/or
other countries. Courier is a registered trademark or trademark of Monotype Imaging Incorporated in the U.S. and/or other countries. UNIX and Motif are registered trademarks or trademarks of The Open Group in the U.S. and/or other countries. Qt is a reg-
istered trademark or trademark of Trolltech in the U.S. and/or other countries. Zlib is a registered trademark or trademark of Jean-loup Gailly and Mark Adler in the U.S. and/or other countries. OpenGL is a registered trademark or trademark of Silicon Graph-
ics, Incorporated in the U.S. and/or other countries. JPEG is a registered trademark or trademark of Thomas G. Lane in the U.S. and/or other countries. SENSOR is a registered trademark or trademark of Coats Engineering in the U.S. and/or other countries.
SENSOR is licensed and distributed only by Coats Engineering and by JOA Oil and Gas, a world-wide authorized reseller. MySQL is a registered trademark or trademark of Oracle in the U.S. and/or other countries. MySQL is a trademark of Oracle Corpora-
tion and/or its affiliates. All other product names mentioned herein are trademarks or registered trademarks of their respective owners.
Use, duplication, or disclosure by the U.S. Government is subject to restrictions as set forth in subparagraphs (a) through (d) of the Commercial Computer-Restricted Rights clause at FAR 52.227-19 when applicable, or in subparagraph (c)(1)(ii) of the Rights in
Technical Data and Computer Software clause at DFARS 252.227-7013, and/or in similar or successor clauses in the DOD or NASA FAR Supplement. Contractor/manufacturer is Tecplot, Inc., 3535 Factoria Blvd, Ste. 550; Bellevue, WA 98006 U.S.A.
11-360-06-2
Rev 4/2011
Table Of Contents
Introduction
1 Introduction .......................................................................... 19
Platform Issues ..................................................................................... 20
Add-ons Created with Previous Versions ................................... 20
Recent Updates .................................................................................... 20
Macros Versus Add-ons .................................................................... 21
3
4 Running Tecplot 360 with Add-ons ..................... 39
Specifying which Add-ons to Load............................................... 39
Add-ons Loaded by All Users............................................................ 39
Specifying a Secondary Add-on Load File......................................... 39
Specifying Add-ons Via the Command Line ..................................... 39
Using the $!LoadAddOn Command ............................................ 40
Specifying Add-ons under Development ................................... 40
Developing Add-ons on Linux or Macintosh platforms ................... 40
Developing Add-ons on a Windows Operating System ................... 41
Data
9 Data Structure .................................................................... 63
Ordered Data ........................................................................................ 63
Face Neighbors for Ordered Data...................................................... 64
Finite Element Data ............................................................................ 65
Indexing Nodal Finite Element Data ................................................ 66
Indexing Cell-centered Finite Element Data..................................... 66
Face Neighbors .................................................................................... 71
4
By Reference (Array) ......................................................................... 75
By Reference (Single Value)............................................................... 76
By Specifying Zone-variable ............................................................. 78
Working with Shared Data............................................................... 78
Branching Shared Data ..................................................................... 78
Querying or Modifying Shared Data ................................................ 79
Allowing Data Sharing ..................................................................... 79
Load-on-demand ................................................................................. 79
5
Surfaces ........................................................................................... 144
Coloring ................................................................................................ 146
Basic Colors ..................................................................................... 147
Multi-color Settings ........................................................................ 147
RGB Multi-coloring ........................................................................ 148
Axes ....................................................................................................... 151
Axis Variable Assignment ............................................................... 151
Axis Range ...................................................................................... 152
Tick Marks ....................................................................................... 152
Axis Lines........................................................................................ 153
Axis Labels ...................................................................................... 153
Axis Grid Area ................................................................................ 153
Annotations ......................................................................................... 153
Text .................................................................................................. 153
Geometries ....................................................................................... 162
Images ............................................................................................. 164
Labels ............................................................................................... 165
Blanking ............................................................................................... 165
Frame Linking .................................................................................... 166
Animation ............................................................................................ 169
Working with Transient Data ........................................................ 170
View Options ...................................................................................... 172
Rotation ........................................................................................... 172
Translation....................................................................................... 173
Zoom................................................................................................ 173
6
18 Sets ........................................................................................... 191
Tecplot Toolbox Set Class ............................................................... 191
TecUtil Functions that Use Sets .................................................... 193
Additional Functionality
19 Augmenting the Macro Language of Tecplot 360 199
Processing Custom Macro Commands ...................................... 199
Error Processing................................................................................. 200
Recording Custom Macro Commands....................................... 201
User Interface
23 GUI Overview ..................................................................... 219
UTF8 Strings ....................................................................................... 219
Types of Dialogs ................................................................................ 219
7
25 Tecplot GUI Builder ....................................................... 225
Using Tecplot GUI Builder ............................................................. 225
How TGB Works ............................................................................. 225
Selecting a Language....................................................................... 226
Adding Dialogs and Sidebars ....................................................... 227
Adding Dialogs ............................................................................... 227
Adding Sidebars .............................................................................. 228
Adding Controls ................................................................................ 228
Common Control Features .............................................................. 229
Bitmap Buttons and Toggles ........................................................... 231
Push Buttons ................................................................................... 232
Scale Controls.................................................................................. 232
Form Controls.................................................................................. 232
Tab Controls..................................................................................... 233
Text Field Spin Controls.................................................................. 234
Option Menus ................................................................................ 234
Adding a Menu Bar to a Dialog...................................................... 235
Specifying Exact Control Width in Dialog Units or Characters .... 236
Building the Source Code ............................................................... 237
Modifying Your Source Code........................................................ 237
Compiling Your Add-on ................................................................. 238
Linux and Macintosh OS X Platforms ........................................... 238
Windows Platforms ......................................................................... 238
Informing Tecplot 360 of Your New Add-on ........................... 238
Running Your New Add-on .......................................................... 238
Common Add-ons
26 Building Data Set Reader Add-ons .................... 245
Converters Versus Loaders ............................................................ 245
How a Data Converter Works ......................................................... 245
How a Data Loader Works .............................................................. 245
8
For Face-based Finite Elements ....................................................... 266
Loading Face Neighbor Data ........................................................ 268
Local one-to-one............................................................................... 269
Global or one-to-many ..................................................................... 269
Transient Data .................................................................................... 269
Appending Data with a Data Loader ......................................... 269
Replacing Data ................................................................................... 270
Overriding Data Loader Instructions ......................................... 270
9
Appendixes
B Migrating Add-ons .......................................................... 331
Migrating Add-ons ........................................................................... 331
Active Frame Manipulation ............................................................ 331
Surface Clipping TecUtil Changes .................................................. 332
Export Format TecUtil Changes...................................................... 332
Load-on-demand for Connectivity Lists and Face Neighbors ......... 332
Migrating Add-ons from Tecplot 360 2006 or Earlier to Tecplot 360 2008 R2 or
Later ....................................................................................................... 332
Polyhedral Support.......................................................................... 333
Shared Grid Files ............................................................................. 334
Python Scripting ............................................................................. 334
New in Tecplot 360 2011 R2: Functions for Active Frame Manipulation334
New in Tecplot 360 2008: TecUtil Functions.................................. 335
Migrating Add-ons From Version 10 to Tecplot 360 2006 ... 336
Data Loaders.................................................................................... 336
Time Aware...................................................................................... 336
Data Functions................................................................................ 336
10
List of Tutorials
Introduction
Hello World! (Linux/Macintosh Platforms) ....................................................26
Data
Accessing Data By Reference (Array) ..............................................................76
11
List of Tutorials
12
Adding Volume Streamtraces .........................................................................139
Activating Iso-surfaces.....................................................................................141
13
List of Tutorials
Using Sets...........................................................................................................193
Additional Functionality
Zone Processing ................................................................................................199
14
Changing Color of Vectors in Pick List..........................................................216
User Interface
Extending Interactive User Interface Capabilities .......................................239
Common Add-ons
Immediate Data Loading without Data Journaling.....................................253
Appendixes
15
List of Tutorials
16
Part 1 Introduction
18
1
Introduction
Tecplot 360 add-ons are executable modules that extend Tecplot 360’s basic functionality in a well-defined,
systematic way. Add-ons are implemented as compiled function libraries, called shared objects, shared
libraries, or dynamic-link libraries (DLLs). Tecplot 360 add-ons can be written in C, C++, or FORTRAN.
The source code (including the interface) can be platform independent.
Using the Tecplot 360 Application Programming Interface (API) described in this manual and the function
syntax, defined in Tecplot 360 Add-on Developer’s Kit Reference Manual, you can create add-ons to
generate plots, manipulate or analyze data, or perform a broad variety of specialized tasks. Because the
add-ons are shared runtime objects, you do not need to link them into Tecplot 360. As such, you are not
limited to using the compilers Tecplot 360 uses, and you do not have to compile (or recompile) large
libraries of Tecplot 360 function calls.
The user documentation for Tecplot 360 is divided into these nine books:
• Add-on Developer’s Kit - User’s Manual (this document) - This manual provides instructions
and examples for creating add-ons for Tecplot 360.
• Getting Started Manual - New Tecplot 360 users are encouraged to work through the tutorials
provided in the Getting Started Manual. These tutorials highlight how to work with key
features in Tecplot 360.
• User’s Manual - This manual provides a complete description of working with Tecplot 360
features.
• Scripting Guide - This guide provides Macro and Python command syntax and information on
working with Macro and Python files and commands.
• Quick Reference Guide - This guide provides syntax for zone header files, macro variables,
keyboard shortcuts, and more.
• Data Format Guide - This guide provides information on outputting simulator data to Tecplot
360 file format.
• Add-on Developer’s Kit - Reference Manual - This manual provides the syntax for the
functions included in the add-on kit.
• Installation Instructions - These instructions give a detailed description of how to install
Tecplot 360 on your machine.
19
• Release Notes - These notes provide information about new and/or updated Tecplot 360
features.
• Tecplot Talk - A user-supported forum discussing Tecplot 360, Tecplot Focus, Python
scripting, Add-on development, TecIO and more. Visit www.tecplottalk.com for details.
In addition to the user documentation and a set of include files and libraries, the Add-on Developer’s Kit
(ADK) includes the following components:
• Tecplot 360 GUI Builder - a platform independent tool for creating the user interface for your
add-on. Refer to Chapter 25: “Tecplot GUI Builder” for additional information.
• Samples directory - a collection of sample add-ons. These add-ons are included in your
Tecplot 360 distribution in $TEC_360_2011R2/adk/samples. A separate collection of sample add-
ons for Visual Studio 2005 are included in $TEC_360_2011R2/adk/vs2005samples.
• Add-ons available on Tecplot Talk - Refer to http://www.tecplottalk.com/addons.php for
additional add-ons available for download. These add-ons are developed by Tecplot 360
customers, as well as Tecplot 360 developers. Please note that these add-ons are not subject to
our Quality Assurance processes and are not covered by any Technical Support agreement.
Please use the forums available on Tecplot Talk for questions and comments.
• Tecplot Toolbox - The Tecplot Toolbox provides an alternate method for communicating with
the Tecplot Engine. It is a convenience library that provides an object-oriented wrapper for
many of the procedural commands housed in the Tecplot Engine, including State Change
commands and style commands. To use the Tecplot Toolbox, you must include tptoolbox.h in
your project. We recommend working with the Toolbox code in lieu of the Classic Code. The
StyleValue and AuxData classes are simpler to use and also require a fraction of the code.
The following classes are included in the Tecplot Toolbox (and are described in their
subsequent sections):
• Argument Lists - Chapter 16: “Argument Lists”
• Auxiliary Data - Chapter 12: “Auxiliary Data”
• State Changes - Chapter 6: “State Changes From an Add-on”
• Sets - Chapter 18: “Sets”
• String Lists - Chapter 17: “String Lists”
• Style Values - Chapter 13: “Setting Plot Style”
20
Macros Versus Add-ons
TecUtilDataNodeGetRef
TecUtilDataFaceNbrArrayAssign
TecUtilDataFaceNbrAssign
TecUtilDataFaceNbrBeginAssign
TecUtilDataFaceNbrBeginAssignX
TecUtilDataFaceNbrEndAssign
TecUtilDataFaceNbrGetByRef
TecUtilDataFaceNbrGetByZone
TecUtilDataFaceNbrGetRawPtr
TecUtilDataFaceNbrGetRef
When upgrading from Tecplot 360 2008 Release 1 or earlier to Tecplot 360 2008 Release 2 or later, the
following items also require consideration:
• InitTecAddOn has been deprecated and replaced with InitTecAddOn113.
• C++ users - InitTecAddOn will automatically convert to InitTecAddOn113 upon recompiling.
• Fortran users - You must manually change instances of InitTecAddOn to InitTecAddOn113 before
recompiling.
• If you update Tecplot 360 on a Windows machine, you must update your non-Tecplot add-ons
to link with libtec.lib (instead of tecplot.lib).
21
22
2
Creating Add-ons on Linux/
Macintosh Platforms
The Tecplot 360 Add-On Developers Kit (ADK) contains include files (.h) along with a libtec.lib file with
which to link add-on source code. To create an add-on for Tecplot 360 with the Add-on Developer’s kit,
you must perform the following steps:
• First, follow the steps in Section 2 - 1 “General Setup for Creating Add-ons” for setting up your
software and environment variables. The steps described in this section only need to be
performed once.
• Second, follow the steps in Section 2 - 2 “Creating a New Add-on” for setting up your
development project. The steps performed in this section are required for each add-on that you
write.
• Third, develop your add-on using the TecUtil function provided in the ADK. The syntax for
these functions is provided in the ADK Reference Manual.
• Fourth, compile your add-on using the instructions provided in Section 2 - 3 “Compiling the
Add-on”.
23
6. [Optional] If you plan to use the Tecplot GUI Builder, add the following line to the tecdev.add
file in your Add-on Development Root Directory:
$!LoadAddon "|TECHOME|/lib/libguibld"
7. Set the environment variable TECADDONDEVDIR to the path of the Add-on Development Root
Directory.
8. Set the environment variable TECADDONDEVPLATFORM to one of the valid platform names. A list of
valid platforms can be obtained by running tec360 -platlist.
9. Set the environment variable TECADDONFILE. to the path of your add-on file(s) (e.g. tecplot.add or
tecdev.add).
Once the preceding steps are completed, you are ready to proceed with Section 2 - 2 “Creating a New
Add-on”.
24
Compiling the Add-on
3. [Optional] Write the GUI Code - The Tecplot 360 Add-on Developers Kit includes a simple
GUI builder called Tecplot GUI Builder (TGB). When you run CreateNewAddOn and choose to
use the TGB, a starter set of TGB files is created for you. Refer to Chapter 25: “Tecplot GUI
Builder” for additional information.
You are not restricted to this GUI builder. You may use a commercial GUI builder such as
Builder Xcessory or X-Designer. When you run CreateNewAddOn and choose to use the TGB, a
starter set of TGB files is created for you.
From this point on, when you want to test the add-ons you are developing, use the -develop flag when
running Tecplot 360. When you have completed coding your add-on, copy the shared object library to the
lib subdirectory below the Tecplot 360 home directory and include the command:
$!LoadAddOn "|$TEC_360_2011R2|/lib/libMyAddOnName"
in the tecplot.add file in the Tecplot 360 home directory.
Refer to “Hello World! (Linux/Macintosh Platforms)” on page 26 for an introductory tutorial on creating a
Tecplot 360 Add-on.
If the Tecplot 360 home directory and your Add-on Development Directory are located in
directories that can be remotely mounted by other UNIX® or Linux® computers, then
you can log on to those computers and use Runmake as described earlier. The resulting
shared library will be stored in the appropriate subdirectory for the computer platform.
25
Example 1:Hello World! (Linux/Macintosh Platforms)
This Hello World example uses source code files created by the CreateNewAddOn script (UNIX). To complete
this example on a Windows platform, use the example files found in
$TEC_360_2011R2\adk\vs2005samples. Our project name will be “hiwrld”, and the add-on name will be
“Hello World.”
26
Debugging Shared Objects
You have now completed Hello World. Recompile and run Tecplot 360.
27
28
3
Creating Add-ons on Windows
Platforms
The Tecplot 360 Add-On Developers Kit (ADK) contains include files (.h) along with a libtec.lib file with
which to link add-on source code. The libtec.lib library will dynamically load libtec.dll at runtime. To create
an add-on for Tecplot 360 with the Add-on Developer’s kit, you must perform the following steps:
1. First, follow the steps in Section 3 - 1 “General Steps for Creating an Add-on” for setting up
your software and environment variables. You need to perform the steps described in this
section only once.
2. Follow the steps in Section 3 - 2 “Creating an Add-on with Visual Studio 2005” or Section 3 - 3
“Creating an Add-on with Intel Visual Fortran” to set up your development project. Each
add-on that you write requires the steps in one of these sections.
3. Develop your add-on using the TecUtil function provided in the ADK. The syntax for these
functions is provided in the ADK Reference Manual.
The Tecplot 360 ADK is supplied with dynamic-link libraries created by Microsoft®. This
is in compliance with the Visual Studio® license agreement. The license agreement,
however, also states that licenses cannot be transferred a second time unless the party
distributing the libraries also has a Visual Studio license agreement. In other words, if
you develop a Tecplot 360 add-on and you plan to distribute it outside of your
organization, you must also have the right to distribute the Microsoft dynamic link
libraries. If you own Microsoft Visual Studio, you have this right to distribution.
29
3-2 Creating an Add-on with Visual Studio 2005
You should be familiar with Microsoft® Visual Studio® 2005, and its concepts, such as DLLs and callback
functions, before reading this section.
To complete any example in the Add-on Developer’s Kit User’s Manual that uses files
generated by the CreateNewAddOn script, use the example files found in
$TEC_360_2011R2\adk\vs2005samples.
30
Creating an Add-on with Visual Studio 2005
MANAGESTATE
6. To test your add-on with Tecplot 360, create your DLL file by building your project (choose
Build Solution from the Build menu). Make sure you know the location of your DLL file.
7. To test your add-on with Tecplot 360, run Tecplot 360 from your DLL project. To do this:
a. Open the Properties dialog from the Project menu.
b. In the navigation pane, choose “Debugging”, underneath the “Configuration
Properties”.
c. Set the “Command” to $TEC_360_2011R2\tec360.exe.
d. Set the “Command Arguments” to -loadaddon [path to project_name.dll].
e. Set the “Working Directory” to “Debug”.
You can now set breakpoints to debug your add-on.
We have provided skeleton code of the basic types of add-ons (General Purpose, Data
Loader, Data Converter and Curve Fit) for add-on developers using Visual Studio 2005,
in $TEC_360_2011R2\adk\vs2005samples. Each sample project contains a readme.txt
describing the project settings and code included in the project.
31
3. Select “Static Text” in the Dialog Editor and add text to read “This is an MFC add-on.” (If the
Dialog Editor is not open, go to View>Toolbox to display it.)
4. Using the dialog’s Properties toolbox, change the dialog’s ID from "IDD_DIALOG1” to
"IDD_ADDONDLG” and the Caption to "Simple MFC Add-On”.
5. In order to use the dialog in the add-on, create a class for it. Double-click on the dialog to
bring up the Class Wizard. Type in the Class name "CSimpDlg.” Select a Base Class of
"CDialog”. (The Dialog ID "IDD_ADDONDLG” will fill in automatically.) Select [Finish] to create the
class and close the Class Wizard.
6. Edit the file SimpMFC.cpp: near the top of the file, immediately after the line "#include
SimpMFC.h”, add the following lines:
#include "TECADDON.h"
#include "SimpDlg.h"
Addon_pa COMMANDPROCESSORID;
Near the bottom of the file, after the line "CSimpMFCApp theApp", add the following lines:
7. In the Properties dialog (open from the Project menu), make the following changes:
a. In the navigation pane, select “Debugging”, underneath the “Configuration
Properties”.
b. Set the “Command” to $TEC_360_2011R2\bin\tec360.exe.
c. Set the “Command Arguments” to “-loadaddon [path to simpmfc.dll]”.
d. Set the “Working Directory” to “Debug”.
e. In the navigation pane, go to Configuration Properties>C/C++>General.
f. On the General page, Add $TEC_360_2011R2\include as one of the “Additional Include
Directories”.
g. Go to “Input” under “Linker” in the navigation pane. On the Input page, add
$TEC_360_2011R2\bin\libtec.lib as one of the “Additional Dependencies”.
8. Build the debug version of your project and run it (by selecting “Build Solution” from the
Build menu). Launch Tecplot 360, go to the Tools menu, and select “Simple MFC Add-on”.
This action will launch your dialog.
32
Creating an Add-on with Visual Studio 2005
#include "TECADDON.h"
AddOn_pa COMMANDPROCESSORID;
static void STDCALL LaunchSimpleDialog(void)
{
TecUtilLockStart(COMMANDPROCESSORID);
TecUtilDialogMessageBox("This is the Simple dialog!",
MessageBox_Information);
TecUtilLockFinish(COMMANDPROCESSORID);
}
EXPORTFROMADDON void STDCALL InitTecAddOn113(void)
{
TecUtilLockOn();
COMMANDPROCESSORID=TecUtilAddOnRegister(110, "Simple non-MFC Test",
"1.0", "My Company");
TecUtilMenuAddOption("Tools",
"Simple non-MFC Test",
'S',
LaunchSimpleDialog);
TecUtilLockOff();
}
3. In the Properties dialog, on the “Debugging” page under “Configuration Properties”, set
“Command” to $TEC_360_2011R2\bin\tec360.exe. Set “Command Arguments” to “-
loadaddon [path to simple.dll]”. Set the “Working Directory” to “Debug”.
4. On the General page, Add $TEC_360_2011R2\include as one of the “Additional Include
Directories”.
5. Go to “Input” under “Linker” in the navigation pane. On the Input page, add
$TEC_360_2011R2\bin\libtec.lib as one of the “Additional Dependencies”.
6. Add the SIMPLE.C file to your project.
Build the debug version of your project and then run it. When Tecplot 360 comes up, go to the
Tools menu and select “Simple non-MFC Test.” Your dialog will launch with the message,
“This is the Simple dialog!”
33
3-3 Creating an Add-on with Intel Visual Fortran
Tecplot 360 supports FORTRAN on Windows operating systems only if you are using Intel
Visual FORTRAN.
This section is for users using Intel Visual FORTRAN 6.0 or later. You should be familiar with its use and
concepts (such as DLLs) before using the information provided in this section.
If you are not familiar with this process, please refer to your Visual FORTRAN documentation and online
help. We recommend you go through several examples of creating DLLs before attempting to create an
Tecplot 360 add-on.
subroutine InitTecAddOn113
!DEC$attributes DLLEXPORT::InitTecAddOn113
.
.
.
end
5. When you are ready to test your add-on with Tecplot 360, create your DLL file by building
your project (“Solution”). Make sure you know the location of your DLL file. When you build
the Debug version of your project, you may get a warning message recommending you use
the "/NODEFAULTLIB" link option. You may ignore this warning. If you wish to eliminate it,
check the "Ignore all default libraries" link option, and explicitly add the additional
FORTRAN and C libraries required (refer to your FORTRAN documentation for a list of
these).
To run your add-on with Tecplot 360, run Tecplot 360 from your DLL project. To do this:
34
Creating an Add-on with Intel Visual Fortran
1. In the navigation pane of the Properties dialog, select “Debugging”, underneath the
“Configuration Properties”.
2. Set the “Command” to $TEC_360_2011R2\bin\tec360.exe.
3. Set the “Command Arguments” to “-loadaddon [path to project_name.dll]”.
4. Set the “Working Directory” to “Debug”.
5. In the navigation pane, go to Configuration Properties>C/C++>General.
6. On the General page, Add $TEC_360_2011R2\include as one of the “Additional Include
Directories”.
7. Go to “Input” under “Linker” in the navigation pane. On the Input page, add
$TEC_360_2011R2\bin\libtec.lib as one of the “Additional Dependencies”.
You can now set a breakpoint anywhere in your code to debug your add-on.
subroutine LaunchSimpforDialog
include "FGLUE.INC"
common /Addon/ COMMANDPROCESSORID
35
pointer (COMMANDPROCESSORID, AddonUnused)
integer i
call TecUtilLockStart(COMMANDPROCESSORID)
i = TecUtilDialogMessageBox(
& "This is the Simpfor dialog!"//char(0),
& MessageBox_Information)
call TecUtilLockFinish(COMMANDPROCESSORID)
return
end
subroutine InitTecAddOn113
!DEC$ attributes DLLEXPORT::InitTecAddOn113
include "FGLUE.INC"
common /Addon/ COMMANDPROCESSORID
pointer (COMMANDPROCESSORID, AddonUnused)
integer i
external LaunchSimpforDialog
call TecUtilLockOn
call TecUtilAddOnRegister(110,
& "Simple FORTRAN Test"//char(0),
& "1.0"//char(0),
& "My Company"//char(0),
& COMMANDPROCESSORID)
i = TecUtilMenuAddOption(
& "Tools"//char(0),
& "Simple FORTRAN Test"//char(0),
& 'S'//char(0),
& LaunchSimpforDialog)
call TecUtilLockOff
return
end
3. On the Debugging page underneath “Configuration Properties” in the Properties dialog:
• Set the “Command” to $TEC_360_2011R2\bin\tec360.exe.
• Set the “Command Arguments” to “-loadaddon [path to project_name.dll]”.
• Set the “Working Directory” to “Debug”.
4. Go to “Input” under “Linker” in the navigation pane. On the Input page, add
$TEC_360_2011R2\bin\libtec.lib and $TEC_360_2011R2\bin\fglue.lib as “Additional
Dependencies”.
5. On the Preprocessor tab under “Fortran”, add $TEC_360_2011R2\include to the “Additional
Include Directories”. (Separate this from any other listed paths by a semi-colon).
6. Build the debug version of your project and run it. When Tecplot 360 launches, go to the Tools
menu and select “Simple FORTRAN Test.” Your dialog will launch with the message, “This is
the Simpfor dialog!”
This Hello World example uses source code files created by the CreateNewAddOn script (UNIX). To complete
this example on a Windows platform, use the example files found in
$TEC_360_2011R2\adk\vs2005samples. Our project name will be “hiwrld”, and the add-on name will be
“Hello World.”
36
Creating an Add-on with Intel Visual Fortran
37
38
4
When Tecplot 360 is started, it goes through various initialization phases, including the processing of the
tecplot.cfg file, the loading of the Tecplot 360 stroke font file (tecplot.fnt), and the initialization of the
graphics. When these steps have been completed, Tecplot 360 looks for add-ons.
#!MC 1120
$!LoadAddOn "myaddon"
39
processed earlier (for graphics and add-on initialization). This ordering allows for a data reader add-on
(discussed later) to be used to load data specified on the command line.
$!LoadAddOn "libname"
where libname is the name of the shared object library file or DLL and must be in quotes.
Special rules govern how libname name is specified. In all cases the filename extension is omitted.
If you assign libname to the basename of the shared object library then Tecplot 360 will do the following:
• UNIX/Linux/Macintosh - The shared library to load will come from the file specified by:
$TEC_360_2011R2/lib/lib+basename+platform-specific-extension
Where platform-specific-extension is .sl for HP platforms and .so for all others.
• Windows - The add-on basename.dll will be searched for in the following order:
• The directory where the Tecplot 360 executable resides.
• The Windows system directories.
• The directories in your PATH environment variable.
If an absolute pathname is used in libname, then in Windows, .dll is appended, and in Linux .so
or .sl is appended.
$!LoadAddOn "|$TECADDONDEVDIR|/libmyaddon"
As in this example, “myaddon” must be the name of the add-on you are developing. To launch Tecplot 360
so that it will load your add-on that is under development, you use:
tec360 -develop
This launches Tecplot 360 in a manner such that the tecdev.add file in your Add-On Development Root
Directory is processed and also sets up the environment variable TECADDONDEVDIR so the specific add-on for
your platform can be found. If you don’t want to load the standard add-ons listed in the main tecplot.add
file (located in the Tecplot 360 home directory), then include the -nostdaddons flag on the command line.
See Chapter 2: “Creating Add-ons on Linux/Macintosh Platforms” for more details about developing add-
ons.
40
Specifying Add-ons under Development
1. The setup instruction assume that the add-on MyAddon is being developed in c:\dev\MyAddon, and that the
$TEC_360_2011R2 environment variable has been set.
41
42
Part 2 General Add-
on Components
44
5
AddOn_pa COMMANDPROCESSORID;
void InitTecAddOn(void)
{
TecUtilLockOn();
COMMANDPROCESSORID = TecUtilAddOnRegister(110,
"My Add-On",
"V1.0-02/10/06",
"Acme, Inc.");
TecUtilLockOff():
}
Note this is the only instance where you must use the TecUtilLockOn and TecUtilLockOff functions.
TecUtilAddOnRegister registers information which is then accessible to the user via Help>About Add-Ons.
It also informs Tecplot 360 of the base version of Tecplot (110) on which your add-on was built.
In addition to TecUtilAddOnRegister, one or more of the following function calls are typically included in
the add-on initialization function:
TecUtilImportAddConverter
TecUtilImportAddLoader
TecUtilMenuAddOption
TecUtilCurveRegisterExtCrvFit
Each of the preceding function calls provides a different method for end-users to access the add-on via the
Tecplot 360 interface.
• TecUtilMenuAddOption will add a menu option.
• TecUtilImportAddConverter and TecUtilImportAddLoader register the add-on as a special type of
add-on that is used to load non-Tecplot format data into Tecplot 360. You can access these
options from a scrolled list of loaders and converters that is launched when the File>Data
File(s) dialog is selected. Refer to Chapter 29: “Creating a Data Converter” or Chapter 27:
“Creating a Data Loader” for additional information.
45
• TecUtilCurveRegisterExtCrvFit registers the add-on as a special type that is used to extend
Tecplot 360’s XY-plot curve fit capability. You can access these curve fits from the Curve Type
option on the Curve page of the Mapping Style dialog. Refer to Chapter 28: “Building
Extended Curve Fit Add-ons” for additional information.
At initialization time, an add-on may also elect to launch one or more dialogs immediately in addition to,
or in place of, adding menu options to the Tecplot 360 interface.
It's best to complete all of your clean up when you get the message
StateChange_QuitTecplot, rather than waiting for object destructors to get called.
Tecplot 360 could be too far along in the shutdown process to use TecUtil functions by
the time the destructor is called. This is particularly true for global and static objects.
46
6
State changes are the method for propagating information when an event occurs. A state change can be
triggered by many events. Examples include: loading a data file, changing the color of a mesh plot,
creating a new zone, or changing the plot type.
In general, your application should listen for state changes if it needs to take an action based on the state of
the Tecplot Engine. For example, if your application displays a dialog which deals with 3D plots, you may
want to drop the dialog if the plot type is changed to XY. Alternatively, you may need to update the dialog
if a new data set is loaded. Most of the TecUtil functions will transmit the necessary state changes
automatically.
There are only certain circumstances under which your application will need to send state changes. Refer
to Section 6 - 3 “Sending State Changes” for a list of these situations.
47
State Change Value Explanation UI Example API Example
Alter variable values in
Values of one or more
StateChange_VarsAltered the Data>Alter>Specify TecUtilDataAlter
variables were altered.
Equations dialog.
StateChange_NodeMaps The node map for one or Cannot do this from the TecUtilDataNodeSetByZo
Altered more zones was altered. interface. ne
StateChange_FrameDelet Frame>Delete
A frame was deleted. TecUtilFrameDeleteTop
ed Current Frame menu.
Explicitly by calling
One or more text elements Adding, removing, or
StateChange_Text TecUtilStateChanged with
have changed. modifying text.
StateChange_Text.
Explicitly by calling
One or more geometry Adding, removing, or
StateChange_Geom TecUtilStateChanged with
elements have changed. modifying geometries.
StateChanged_Geom.
An X-Y mapping
StateChange_LineMapAs definition has been Definitions page of the TecUtilLineMapSetAssign
signment altered (includes zone and Mapping Style dialog. ment
axis information).
48
State Change Values
StateChange_MouseMode A new mouse mode (tool) Select a new mouse mode TecUtilPickSetMouseMod
Update has been selected. (tool) in the sidebar. e
49
State Change Value Explanation UI Example API Example
The dataset attached to
StateChange_DataSetLock Cannot be done via user
the active frame has been TecUtilDataSetLockOn
On interface.
locked.
When running in
interactive mode this state
StateChange_TecplotIsInit change is broadcast when
N/A N/A
ialized initialized. In batch mode
this message is not
broadcast.
50
Listening for State Changes
#include “StateChangeListenerInterface.h”
class ContourDialogSimple :
public tecplot::toolbox::StateChangeListenerInterface
{
public:
void launchDialog();
void dropDialog();
private:
// Update the controls on the dialog
void updateDialog();
// Implementation of StateChangeListenerInterface
// NOTE: tbx is an alias for tecplot::toolbox.
void stateChanged(const tbx::StateChangeEventInterface&
stateChangeEvent,
tbx::StateChangeNotifierInterface& source);
};
void ContourDialogSimple::launchDialog()
{
// Begin listening for state changes when the dialog is launched.
StateChangeEventObservable::getInstance().addListener(this);
void ContourDialogSimple::dropDialog()
{
// Remove the state change listener when the dialog drops
// since we don’t need to listen to state changes anymore
StateChangeEventObservable::getInstance().removeListener(this);
// TODO: add logic to drop the dialog
}
void ContourDialogSimple::updateDialog()
{
// TODO: update controls on the dialog
}
tbx::StateChangeNotifierInterface& source)
{
VERIFY(&source == &StateChangeEventObservable::getInstance());
switch ( stateChangeEvent.getStateChange() )
{
case StateChange_ContourLevels :
51
case StateChange_ContourVar :
updateDialog();
break;
case StateChange_QuitTecplot :
dropDialog();
break;
default:
break;
}
}
getStyleParam(), getStyleParams(),
Style parameters P1, P2, P3, P4, P5,
getOffset1, getOffset2(),
P6 (P2-P6 are optional), Page unique
StateChange_Style getFieldmapSet(), getLinemapSet(),
ID for page commands, Frame
getPageUniqueID(),
unique ID for frame commands
getFrameUniqueID()
52
Listening for State Changes
Var, VarLockMode:ArbParam_t,
StateChange_VariableLockOn LockOwner:Name getName(), getDataSetUniqueID()
Dataset unique ID
Var, LockOwner:Name
StateChange_VariableLockOff getName(), getDataSetUniqueID()
Dataset unique ID
LockOwner:Name
StateChange_DataSetLockOn getName(), getDataSetUniqueID()
Dataset unique ID
LockOwner:Name
StateChange_DataSetLockOff getName(), getDataSetUniqueID()
Dataset unique ID
void ContourDialogSimple::stateChanged(const
tbx::StateChangeEventInterface& stateChangeEvent,
tbx::StateChangeNotifierInterface&
source)
{
StateChange_e stateChange = stateChangeEvent.getStateChange();
if ( stateChange == StateChange_VarsAltered )
{
// If the contour variable was altered, update the dialog
EntIndex_t contourVarNum = TecUtilVarGetNumByAssignment(‘C’);
53
if ( stateChangeEvent.hasVarSet() &&
stateChangeEvent.getVarSet().isMember(contourVarNum) )
{
updateDialog();
}
}
else if ( StateChange_QuitTecplot )
dropDialog();
}
54
Sending State Changes
When an application submits a state change with StateChange_VarsAltered, you may supply the set of
variables altered (required), the set of zones in which those variables were altered, and the index of the
point that was altered (if only one value was altered).
The following example illustrates how to broadcast a state change. The example has altered the 3rd
variable in zones 5 and 6 at offset 10 and needs to broadcast the state change:
NOTE: Error checking has been omitted for clarity.
Set zoneSet;
Set varSet(3);
zoneSet.add(5);
zoneSet.add(6);
StateChangeEventObservable::sendStateChange(StateChange_VarsAltered,
zoneSet,
varSet,
10);
As discussed in the previous sections, the state change listeners can choose to use any or all of the
supplemental information. Listeners must also know how to handle situations where the supplemental
information is not supplied (assume worst case).
NOTE: Only the state change notifications listed in Table 6 - 3 may explicitly originate from your
application.
The following example illustrates how to broadcast a state change. The example modifies an add-on that
alters the 3rd variable in zones 5 and 6 at offset 10. Because the add-on alters data, a state change must be
broadcast:
{
ArgList_pa ArgList;
Set_pa ZoneList;
Set_pa VarList;
ArgList = TecUtilArgListAlloc;
ZoneList = TecUtilSetAlloc(FALSE);
VarList = TecUtilSetAlloc(FALSE);
TecUtilSetAddMember(ZoneList,5,FALSE);
TecUtilSetAddMember(ZoneList,6,FALSE);
55
TecUtilSetAddMember(VarList,3,FALSE);
TecUtilArgListAppendInt(ArgList,SV_STATECHANGE,
(LgIndex_t)StateChange_VarsAltered);
TecUtilArgListAppendSet(ArgList,SV_ZONELIST,ZoneList);
TecUtilArgListAppendSet(ArgList,SV_VARLIST,VarList);
TecUtilArgListAppendInt(ArgList,SV_INDEX,10);
TecUtilStateChangedX(ArgList);
TecUtilSetDealloc(&ZoneList);
TecUtilSetDealloc(&VarList);
TecUtilArgListDealloc(&ArgList);
}
56
7
Most classic function calls (i.e. TecUtilXXX functions) require that the Tecplot Engine be locked. The only
exceptions to this are for the lock functions themselves and for most query type functions, such as
TecUtilFrameGetPlotType.
You should call TecUtilLockStart at the beginning of any function that calls TecUtil functions and call
TecUtilLockFinish at the end. Note that you must pass your add-on ID to these functions.
The following sample code illustrates switching the plot type to 3D Cartesian. Because this
involves a call to a classic TecUtil function, you must also use the lock functions.
void SwitchFrameTo3D(void)
{
TecUtilLockStart();
TecUtilFrameSetPlotType(PlotType_Cartesian3D);
TecUtilLockFinish();
}
57
The following table lists the functions that control or monitor locking and unlocking in the Tecplot Engine:
58
8
Incorporating multi-threading into your add-on or application allows you to take advantage of multiple
processors (when they are present) thereby increasing the efficiency of your application. Threads are
present under any of the following scenarios:
• Receiving a load-on-demand callback. Refer to Section 23 - 5 “Load-on-demand” for
information on working with load-on-demand callbacks.
• Using threading associated with your own add-on or application. Note: You are not required
to use the threading functions provided by the Tecplot Engine; they are provided for your
convenience. You can use your own threading code. However, if you are creating an
application from scratch or a data loader for the Tecplot Engine, you may prefer to use these
functions.
• Adding threading via the Tecplot Engine API. Threading can be incorporated using TecUtil
functions with of the following methods: the thread pool, a mutex, or a condition variable.
Refer to the remainder of this chapter for information regarding the remaining scenarios.
While you are in a thread, you can only call functions that are thread safe. Functions that are thread safe
are labeled as such in the .
59
MAXAVAILABLEPROCESSORS = xxx your tecplot.cfg file. If MAXAVAILABLEPROCESSORS is not set or is set to “0”, the
number of available threads is determined by your system. However, the number cannot be greater than 8
for Tecplot 360 or 1 for Tecplot Focus.
60
Part 3 Data
62
9
Data Structure
There are three primary classes of data structure: Ordered Data, Finite Element Data and Face Neighbors.
63
• Three-dimensional Ordered Data (IJK-ordered)
A three-dimensional array where all IMAX,
JMAX and KMAX are each greater than
one. For nodal ordered data, the number of
nodes is the product of the I-, J-, and K-
dimensions. For nodal data, the number of
stored values is equal to IMAX * JMAX *
KMAX. For cell-centered data, the number
of stored values is (IMAX)(JMAX)(KMAX-
1).
64
Finite Element Data
Figure 9-1. This figure shows finite element data used to model a complex boundary. This plot file,
feexchng.plt, is located in your Tecplot 360 distribution under the examples/2D subdirectory.
Finite element data defines a set of points (nodes) and the connected elements of these points. The
variables may be defined either at the nodes or at the cell (element) center. Finite element data can be
divided into three types:
• Line data is a set of line segments defining a 2D or 3D line. Unlike I-ordered data, a single
finite element line zone may consist of multiple disconnected sections. The values of the
variables at each data point (node) are entered in the data file similarly to I-ordered data,
where the nodes are numbered with the I-index. This data is followed by another set of data
defining connections between nodes. This second section is often referred to as the
connectivity list. All elements are lines consisting of two nodes, specified in the connectivity
list.
• Surface data is a set of triangular, quadrilateral, or polygonal elements defining a 2D field or a
3D surface. When using polygonal elements, the number of sides may vary from element to
element. In finite element surface data, you can choose (by zone) to arrange your data in three
point (triangle), four point (quadrilateral), or variable-point (polygonal) elements. The number
of points per node and their arrangement are determined by the element type of the zone. If a
mixture of quadrilaterals and triangles is necessary, you may repeat a node in the quadrilateral
element type to create a triangle, or you may use polygonal elements.
65
• Volume data is a set of tetrahedral, brick or polyhedral elements defining a 3D volume field.
When using polyhedral elements, the number of sides may vary from element to element.
Finite element volume cells may contain four points (tetrahedron), eight points (brick), or
variable points (polyhedral). The figure below shows the arrangement of the nodes for
tetrahedral and brick elements. The connectivity arrangement for polyhedral data is governed
by the method in which the polyhedral facemap data is supplied.
66
Finite Element Data
• For nodal data, the node numbering is implicitly defined by the order in which the data values
are supplied (i.e. the first value supplied is for node 1, followed by the value for node 2, and so
on). The node numbers must be provided in order, either clockwise or counter-clockwise.
Otherwise, the elements may appear misshapen. For example, given the node numbering for
two elements as defined in the following picture,
• You must provide the same number of nodes as are included in an element. For example, you
must provide eight numbers for BRICK elements and three numbers for TRIANGLE elements.
If you are using repeated nodes, provide the node number of the repeated node multiple times.
67
FaceNodeCounts and FaceNodes
For illustration purposes, consider a zone composed of a single pyramidal element. The pyramid is
composed of five nodes and five faces.
The FaceNodeCounts array is used to specify the number of nodes that compose each face. The values in
the array are arranged as follows:
FaceNodeCounts = [NumNodesInFace1,
NumNodesInFace2,
...
NumNodesInFaceF]
where F is the total number of faces in the zone
In this example, the FaceNodeCounts array is: [3 3 3 3 4]. The first four faces are composed of three nodes
and the last face is composed of four nodes.
The FaceNodes array is used to specify which nodes belong to which face. The array is dimensioned by
the total number of face nodes in the zone. The total number of face nodes is defined as:
NumNodesInFacef
f=1
The first K values in the FaceNodes array are the node numbers for Face 1, where K is the first value in the
FaceNodeCounts array. The next L values are the node numbers for Face 2, where L is the second value in
the FaceNodeCounts array.
When supplying the node numbers for each face, you must supply the numbers in
either a clockwise or counter-clockwise configuration around the face. Otherwise, the
faces will be contorted when the data is plotted.
It is not important to be consistent when choosing between clockwise or counter-
clockwise ordering. The key is to present the numbers consistently within the
numbering scheme. For example, you may present the node numbers for face 1 in a
clockwise order and the node numbers for the remaining faces in counter-clockwise
order.
Consider the preceding pyramid. Using the FaceNodeCounts array we have already defined and the
figure, we can create the FaceNodes array for the pyramid.
68
Finite Element Data
FaceNodes = [1, 2, 3
3, 2, 4,
5, 2, 4,
5, 1, 2,
1, 5, 4, 3]
Face 2 1 0
69
Face Number Right Neighboring Element Left Neighboring Element
Face 3 1 2
Face 4 1 3
Face 5 1 4
Face 6 1 0
Face 7 2 0
Face 8 2 0
Face 9 2 0
Face 10 2 3
Face 11 3 0
Face 12 3 4
Face 13 4 0
Face 14 4 0
Face 15 4 0
The number zero is used to indicate that the face is on the edge of the data (i.e. has “no neighboring
element”).
In this figure, Zone 1 contains a single element (e1) and Zone 2 contains two elements (e1 and e2). The
boundary faces and boundary connections for each zone are as follows:
• Zone 1 - In Zone 1, Face 1 (f1) is the sole connected boundary face. It has two boundary
connections. The first boundary connection is Element 1 in Zone 2. The second boundary
connection is Element 2 in Zone 2.
70
Face Neighbors
• NumConnectedBndryFaces = 1
• TotalNumBndryConnections = 2
• Zone 2 - In Zone 2, both Face 1 and Face 2 are connected boundary faces. There is a total of two
boundary connections. The boundary connection for each boundary face in Zone 2 is Element
1 in Zone 1.
• NumConnectedBndryFaces = 2
• TotalNumBndryConnections = 2
A value of -4 in the FaceLeftElems indicates that the left neighboring element for that face is element four in
zone three.
Face Neighbor Mode Number of Order of Data in the Face Neighbor Connections List
Values
The cell number in the current zone.
Local One-to-one 3 The number of the cell face in the current zone.
1. Refer to “Facemap Data” on page 156 for details on defining connections for finite-element polyhedral data.
71
Face Neighbor Mode Number of Order of Data in the Face Neighbor Connections List
Values
The cell number in the current zone.
Face obscuration flag (zero for face partially obscured, one for face
entirely obscured).
Local One-to-many nza+4
The number of neighboring cells for the “one-to-many” options.
The cell number of the neighbor cell in the current zone, as follows:
cell number 1,cell number 2...cell number n (where n is the number of
cell numbers).
Face obscuration flag (zero for face partially obscured, one for face
entirely obscured)
The cell number in the remote zone of the nth neighboring cell in the
global one-to-many list (c)
The combination of cell and face numbers in the current zone must be unique; multiple entries are not
allowed. The face numbers for cells in the various zone types are defined in Figure 9-4.
f3
f4 f2
f1
A B C
Figure 9-4. A: Example of node and face numbering for an fe-brick cell or IJK-
ordered cell. B: Example of node and face numbering for an IJ-ordered
cell. C: Example of tetrahedron node and face numbering.
72
Face Neighbors
A connection must be specified for two matching cell faces to be effective. For example, for data with a
Face Neighbor Mode of global one-to-one, if cell six, face two in zone nine should be connected to cell one,
face four in zone 10, the connections for zone nine must include the line:
6 2 10 1 (cell#, face#, connecting zone#, connecting cell#)
And the connections for zone 10 must include this line:
1 4 9 6 (cell#, face#, connecting zone#, connecting cell#)
Global face neighbors are useful for telling the Tecplot Engine about the connections between zones. This
could be used, for example, to smooth out the crease in Gouraud surface shading at zone boundaries. For
cell-centered data, they improve the continuity of contours and streamtraces at zone boundaries.
73
74
10
There are several ways to query and set field data. Each method has advantages and disadvantages with
respect to speed and ease-of-use.
When accessing data stored in the Tecplot Engine, be aware that all data access via the TecUtil layer is “1-
based.” For example, the first value in the data set is at an offset of 1. In addition, all data is accessed as a
contiguous array of values using a single LgIndex_t offset regardless of a zone's dimensions.
75
Example 10:Accessing Data By Reference (Array)
LgIndex_t Iteration;
for (Iteration = 0; Iteration < NumIterations; Iteration++)
{
... fetch up to CHUNK_SIZE data from source
if (NumRemainingValues != 0)
{
... fetch the remaining values from source
For brevity, we assumed that the field data was of type double in the previous example. The field
data type can be determined by calling:
76
Data Access Methods
double value;
FieldData_pa FD = TecUtilDataValueGetWritableRef(5,2);
/* Zone 5, Variable 2 */
/* You can now use FD to get/set the data. */
value = TecUtilDataValueGetByRef(FD,1);
value += 1.0;
TecUtilDataValueSetByRef(FD,1,value);
/* No need to free FD. */
Note that in order to modify a value in the field data we fetched a writable field data reference. If
we were only inspecting values then it would be more efficient to acquire a readable reference via,
TecUtilDataValueGetReadableRef:
Set all the interior nodal values for variable V in zone Z to 99.0. Do this only if zone Z is an IJK-
ordered zone and variable V is node located.
77
for (I = 2; I < IMax-1; I++)
{
LgIndex_t FinalOffset = I + JMax*((J-1) + KMax*(K-1));
TecUtilDataValueSetByRef(FinalOffset,99.0);
}
}
}
78
Load-on-demand
State changes can be used to identify the variable (or connectivity information) that was changed. Only
those zones that were altered need to be identified, and the Tecplot Engine will recognize that other zones
may be affected because of sharing.
10 - 3 Load-on-demand
When load-on-demand is active, not all of the variables in your data set are necessarily loaded. As such,
you should always call one of the TecUtil functions listed below before you perform any action that
requires a specific variable to be loaded. NOTE: Depending on both the nature of your data set and the
nature of your request, the variable you are attempting to load may not be loaded as expected. For
example, if you request the nodal values of a given variable (via TecUtilDataValueGetReadableNLRef) and
only the cell-centered values exist in the data file, the cell-centered values will be loaded and interpolated
to nodal values.
Get a read-only handle to the cell centered data for the specified
TecUtilDataValueGetReadableCCRef
zone and variable in the data set attached to the current frame.
Get a read-only handle to the derived data for the specified zone and
TecUtilDataValueGetReadableDerivedRef
variable in the data set attached to the current frame.
Get a read-only handle to the node located data for the specified
TecUtilDataValueGetReadableNLRef
zone and variable in the data set attached to the current frame.
Get a read-only handle to the native data for the specified zone and
TecUtilDataValueGetReadableNativeRef
variable in the data set attached to the current frame.
Get a native read/write handle to the data for the specified zone and
TecUtilDataValueGetWriteableNativeRef
variable in the data set attached to the current frame.
79
Example 13:Equate Add-on
The equate add-on is an example of how to query and set field data in an add-on. It will appear in the
Tools menu as Equate. The add-on is used to multiply each data point of the first variable in the first zone
by a value entered in a dialog.
The source code shown in this example are included in your Tecplot 360 installation under adk/samples/
equate.
80
Load-on-demand
zone by that value. Before beginning, be sure that Tecplot GUI Builder (TGB) is available from Tecplot
360’s Tools menu. If TGB is not available, do the following:
On Windows platforms, in the Tecplot 360 home directory edit the file tecplot.add and add the line:
$!LoadAddOn "guibld"
For Linux or Macintosh platforms, edit the file tecdev.add in your Add-on Development Root Directory and
add the line:
$!LoadAddOn "guibld"
To create the main dialog, perform the following steps:
1. Run Tecplot 360 and load the gui.lay file for your project. Select Tecplot GUI Builder (TGB)
from the Tecplot 360 Tools menu.
2. Resize the frame and edit the layout as follows:
You can edit a control by double-clicking on it and editing as you would text.
Although the text fields and buttons are referred to as controls (since they exist in a
Tecplot 360 layout file), they are represented as text field objects in Tecplot 360.
3. So that TGB will create meaningful variable names for the text field controls, change their
properties in Tecplot 360. Double-click on the text field “TF:,” then select Options.
Do not alter the text string “TF”. Tecplot 360 uses this string to identify this control
as a Text Field.
In the Macro Function text field, set VarName=MulNum. This will be the base name of the
“Multiply By” callback function, which will be named MulNum_TF_D1_CB. TGB takes the
base name and decorates it with the dialog number, control type and CB (for callback).
4. Double-click on the [Compute] button, then select Options. Set VarName=Compute in the “Macro
Function” field. The [Compute] button callback function will be named Compute_BTN_D1_CB.
Double-click on the “Multiply By” label, then select Options. Set VarName=MultiplyBy in the
“Macro Function” field. Callback functions are not generated for labels, but a variable name
will be generated and will be named MultiplyBy_LBL_D1.
5. In TGB, the title of the dialog is specified in the Edit Active Frame dialog (accessed in the
Frame menu). Double-click on the dialog frame and verify that the Frame Name has been set
to “Equate”:
81
ID=1 MODE=MODELESS TITLE="Equate" OKCLOSEBUTTON=T HELPBUTTON=T
6. You can now build the source for this layout. From the TGB dialog, select Go Build. If you
wish to preview your dialog, select Preview Layout from TGB.
7. Rename the file guicb.tmp to be guicb.c, replacing the original guicb.c then compile the source
code.
82
Load-on-demand
83
Compute (double MulNum); Note the function call to Compute in guicb.c. This function is displayed following.
Before calling this function, check that a data set is available. If there is, then it is implied that at least one
zone and one variable exist.
Edit guicb.c as follows:
TecUtilLockStart(AddOnID);
strMulNum = TecGUITextFieldGetString(MulNum_TF_D1);
if (TecUtilDataSetIsAvailable())
{
Compute(atof(strMulNum));
}
else
TecUtilDialogErrMsg(“No data set available.”);
TecUtilStringDealloc(&strMulNum);
TecUtilLockFinish(AddOnID);
}
No error checking is done on the input string. As an exercise, use TecGUITextFieldGetDouble,
TecGUITextFieldSetDouble, and TecGUITextFieldValidateDouble to do error checking for you.
TecUtilLockStart(AddOnID);
if (TecUtilZoneIsEnabled(1) &&
TecUtilVarIsEnabled(1) &&
TecUtilZoneGetType(1) == ZoneType_Ordered &&
TecUtilDataValueGetLocation(1,1) == ValueLocation_Nodal)
{
/* Get the number of data points */
TecUtilZoneGetInfo(1, /* Zone */
&IMax,
&JMax,
&KMax,
NULL, /* XVar */
NULL, /* YVar */
NULL, /* ZVar */
NULL, /* NMap */
84
Load-on-demand
NULL, /* UVar */
NULL, /* VVar */
NULL, /* WVar */
NULL, /* BVar */
NULL, /* CVar */
NULL); /* SVar */
FD = TecUtilDataValueGetWritableRef(1,1);
/* Change it */
Value *= MulNum;
TecUtilLockFinish(AddOnID);
}
Equate is now complete. Recompile and load it into Tecplot 360. Note that this example add-on is only
valid for ordered data as we computed MaxIndex by multiplying the dimensions together.
Step 6 Additional exercises
1. Currently, there is no error checking done on the value entered in the text field. You could
enter “ABCDEFG” and atof would convert it into 0.0. This could be fixed by adding error
checking to the button callback. Use TecGUITextFieldValidateDouble and
TecGUITextFieldGetDouble for better error checking.
2. Add a multi-selection list box which allows you to select one or more zones from a set.
3. Add a multi-selection list box to select one or more variables from a set.
4. This add-on assumes variable 1 and Zone 1 are “Enabled,” which may not be the case. Add
error checking to make sure Zone 1 is enabled (TecUtilZoneIsEnabled) and variable 1 is enabled
(TecUtilVarIsEnabled).
85
86
11
Manipulating Data
Plots created with the Tecplot Engine rely on the datasets attached to each frame. You can modify, create,
transform, interpolate, duplicate, and delete the data in the current dataset. You can also use the data
manipulation capabilities to change the value of some or all of your data parts.
Changes to the dataset do not affect the original data file(s). When you save a layout file, a journal of data
operations is saved and those operations are repeated when the layout file is read at a later time. If the
data in the file has changed, or the data file is overridden with a different file, the operations are applied to
the new data. Alternatively, any datasets that have been modified can be saved to data files. Refer to
Chapter 20: “Implementing Data Journaling” for details on data journaling.
This chapter covers the following sections on data manipulation:
• Calculating Equations
• Data Smoothing
• Coordinate Transformation
• Zone Creation
• Data Extraction from an Existing Zone
• Data Interpolation
• Irregular Data Point Triangulation
11 - 1 Calculating Equations
You can alter the data in existing zones by using equations. Equations allow you to create new variables or
change the values of variables or specific data points. Equations can be specified via the TecUtilDataAlter
function.
The prototype for TecUtilDataAlter is:
Boolean_t TecUtilDataAlter ( const char * Equation,
Set_pa ZoneSet,
LgIndex_t IMin
LgIndex_t IMax
LgIndex_t ISkip
LgIndex_t JMin
87
LgIndex_t JMax
LgIndex_t JSkip
LgIndex_t KMin
LgIndex_t KMax
LgIndex_t KSkip
FieldDataType_e DestDataType
)
Where the parameters are described as:
Refer to Section 11 - 1.1 “Equation Syntax” for a complete description of how to specify equation
Equation
syntax.
ZoneSet Select whether to alter: all zones, all active zones, a range of zones, or no zones.
For these parameters, select the index ranges to alter in the selected zones.
Min, Max, and For Ordered Data, the I-index, J-index, and K-index options correspond to the I, J, and K values
Skip in the dataset. For finite-element data, the I-index corresponds to the range of nodes and the J-
parameters index corresponds to the cell-centered values. The K-index has no bearing on finite-element data.
If you are creating a new variable, the new variable’s value is set to zero at any index value that is
skipped.
You can confirm the number and order of variables in the data file by selecting the [Data
Set Info] button in the Specify Equations dialog and going to the Zones/Var page of
the Data Set Information dialog. The variables in the dataset are listed on the right-
hand side of the page.
88
Calculating Equations
• By its name - To reference a variable by its name, enclose the name with curly braces (“{” and
“}”). For example, to set V3 equal to the value of the variable named R/RFR, you can enter:
V3 = {R/RFR}
Variable names are not case sensitive. Leading and trailing spaces are also not considered.
However, spaces within the variable name are significant.
If two or more variables have the same name, the first variable is used when the variable is
referred to by name. So, if both V5 and V9 are named R/rfr, V5 is used.
The curly braces can also be used on the left-hand side of the equation. In this case, if a variable
with that name does not exist, a new variable is created with that name for all zones.
• By a letter code - Variables and index values may be referenced by the following letter codes:
• I - For I-ordered and finite-element data:
Finite-element Ordered
Nodal I is equal to 1 I is equal to the I-
index number
Cell- I is equal to the I is equal to the I-
centered element number index number
Finite-element Ordered
Finite-element Ordered
• X - The variable assigned to the X-axis. In XY-plots, all active mappings must have the
same X-variable in order for this variable name to be valid.
• Y - The variable assigned to the Y-axis. In XY-plots, all active mappings must have the
same Y-variable in order for this variable name to be valid.
• Z - The variable assigned to the Z-axis (if in 3D Cartesian).
• A - The variable assigned to the Theta-axis for Polar plots. For this variable to be valid,
the plot type must be set to Polar Line. In addition, all active mappings must have the
same Theta-variable.
• R - The variable assigned to the R-axis for Polar plots. The plot type must be Polar Line,
and all active mappings must have the same R-variable for this variable name to be
valid.
• U - The X-component of vectors (if defined).
• V - The Y-component of vectors (if defined).
• W - The Z-component of vectors (if defined).
89
• B - The value-blanking variable for the first active constraint (if applicable).
• C - The contour variable for contour group 1 (if defined in the Contour Details dialog).
• S - The scatter-sizing variable (if defined in the Scatter Size/Font dialog).
• SOLUTIONTIME - The current solution time.
Letter codes may be used anywhere on the right-hand side of the equation. Do not enclose
them in curly braces.
Those letter codes representing variables (all letter codes except I, J, and K) may be used on the
left-hand side of the equation as well.
The variables referenced by the letter codes are for the current frame.
Binary Operators
In an equation, the valid binary operators are as follows:
+ Addition
- Subtraction
* Multiplication
/ Division
** Exponentiation
** Highest precedence
*,/
Functions
The following functions are available (except where noted, all take a single argument):
90
Calculating Equations
MIN(A,B) Minimum of A or B
MAX(A,B) Maximum of A or B
Notes
• LOG and ALOG are equivalent functions, as are LOG10 and ALOG10.
• Variables input into trigonometric functions must be in units of radians.
• To call an intrinsic function, place its argument within parentheses, i.e. to set V4 to the
arctangent of V1, use:
V4 = ATAN(V1)
The complete set of first and second-derivative and difference functions are listed below:
Second Order (cross derivatives) d2d = xy, yz, xz, az, ar, or rz
91
2
2
The derivative function ddx is used to calculate ; d2dx2 calculates ; d2dxy calculates .
x x2 x y
Second-Order
d2d = ij, jk, or ik
(cross derivatives)
Table 11 - 2: Difference Functions
The difference functions ddi, d2di2, and so forth, calculate centered differences of their argument with
respect to the indices I, J, and K based on the indices of the point. For example:
Boundary Values
Boundary values for first-derivative and difference functions (ddx, ddy, ddz, ddi, ddj, and ddk) of ordered
zones are evaluated in one of two methods: simple (default) or complex1.
For simple boundary conditions, the boundary derivative is determined by the one-sided first derivative
at the boundary. This is the same as assuming that the first derivative is constant across the boundary (i.e.
the second derivative equal to zero).
For complex boundary conditions, the boundary derivative is extrapolated linearly from the derivatives at
neighboring interior points. This is the same as assuming that the second derivative is constant across the
boundary (i.e. the first derivative varies linearly across the boundary).
For second-derivatives and differences (d2dx2, d2dy2, d2dz2, d2dxy, d2dyz, d2dxz, d2di2, d2dj2, d2dij,
d2dk2, d2djk, and d2dik), these boundary conditions are ignored. The boundary derivative is set equal to
the derivative one index in from the boundary. This is the same as assuming that the second derivative is
constant across the boundary.
You can create your own derivative boundary conditions by using the index range and
the indices options discussed previously.
1. The $!INTERFACE parameter in the configuration file tecplot.cfg selects the method to use: $!INTERFACE
DATA {DERIVATIVEBOUNDARY=SIMPLE}. Change the parameter SIMPLE to COMPLEX to use the complex
boundary condition. Or you can programmatically set this parameter using the StyleValue class.
92
Calculating Equations
• Derivative functions are calculated using the current frame’s axis assignments. Be careful if
you have multiple frames with different variable assignments for the same dataset.
• Derivatives at the boundary of two zones may differ since only one zone is operated on at a
time while generating derivatives.
Auxiliary Data
You may use auxiliary data containing numerical constants in equations. The syntax for using auxiliary
data in equations is:
AUXZONE[nnz]:Name
AUXDATASET:Name
AUXFRAME:Name
AUXVAR[nnv]:Name
AUXLINEMAP[nnm]:Name
where
nnz = the zone number(s)
For example, a dataset auxiliary data constant called Pref would be referenced using AUXDataSet:Pref.
Equations using this auxiliary data might appear as:
{P} = {P_NonDim} * AUXDataSet:Pref
Refer to Chapter 13: “Auxiliary Data” for more information about auxiliary data and using the
tecplot::toolbox::AuxData class.
If you do not specify a zone, the zone modified by the left-hand side of the equation is
used.
Index Specification
By following a variable reference with parentheses, you can specify indices for ordered data only. Indices
can be absolute or an offset from the current index.
Index offsets are specified by using the appropriate index “i”, “j” or “k” followed by a “+” or “-” and
then an integer constant. Any integer offsets may be used. If the offset moves beyond the end of the zone,
the boundary value is used. For example, V3(i+2) uses the value V3(IMAX) when I=IMax-1 and I=IMax.
V3(I-2) uses the value of V3(1) when I=1 or I=2.
93
Absolute indices are specified by using a positive integer constant only. For example, V3(2) references V3
at index 2, regardless of the current i index.
If the indices are not specified, the current index values are used.
Subsequent alteration of the variables may result in loss of sharing. Refer to Chapter 11:
“Accessing Data” for more information on data sharing.
11 - 2 Data Smoothing
You can smooth the values of a variable of any zone (in either 2D or 3D) to reduce “noise” and lessen
discontinuities in data. Smoothing can also be used after inverse-distance interpolation to reduce the
artificial peaks and plateaus. Each pass of smoothing shifts the value of a variable at a data point towards
an average of the values at its neighboring data points. Data smoothing can be performed with the
TecUtilSmooth function.
The prototype for TecUtilSmooth is:
Boolean_t TecUtilSmooth ( EntIndex_t Zone,
EntIndex_t SmoothVar,
LgIndex_t NumSmoothPasses
double SmoothWeight
BoundaryCondition_e SmoothBndryCond
)
Specify the number of the zone to smooth. The zone must be an ordered zone (not a finite-
Zone
element zone).
Select the number of the variable to smooth. For the XY Line plot type, the variable must be a
SmoothVar
dependent variable for one active mapping for that zone.
Specify the number of smoothing passes to perform. The default is one. A greater number of
NumSmoothPasses
passes results in greater smoothing, but takes more time.
Specify the relaxation factor for each pass of smoothing. Enter a number between zero and
one (exclusively). Large numbers flatten peaks and noise quickly. Small numbers smooth
SmoothWeight
less each pass, rounding out peaks and valleys rather than eliminating them. The normal
default is 0.8.
94
Coordinate Transformation
with XY Line, 2D, or 3D Cartesian plot types. Be careful if you have multiple frames with
different variable assignments for the same dataset.
• Any axis scaling is ignored while smoothing.
• For I-ordered or finite-element line segment zones, the current frame can be in the XY Line, 2D
or 3D Cartesian plot types. In XY Line, the variable must be the dependent variable of one
active mapping for that zone.
• For IJ-ordered, finite-element triangle, or finite-element quadrilateral zones, the current frame
can be a 2D or 3D Cartesian plot type, but you cannot smooth the variables assigned to the X
and Y-axes in 2D Cartesian.
• For IJK-ordered, finite-element tetrahedral, or finite-element brick zones, the plot type must be
3D Cartesian, and you cannot smooth the variables assigned to the X, Y, and Z-axes. The IJK-
mode is ignored. The zone is smoothed with respect to the entire 3D volume.
• Smoothing does not extend across zone boundaries. If you use a boundary condition option
other than Fixed (such that values along the zone boundary change), contour lines can be
discontinuous at the zone boundaries.
• Smoothing is performed on all nodes of a zone, and disregards value-blanking.
11 - 3 Coordinate Transformation
By default, all 2D and 3D plots use a Cartesian coordinate system with X, Y, and Z-axes. If your data is in
polar coordinates or spherical coordinates, you will probably want to compute the corresponding
Cartesian (X,Y and Z) coordinates before visualizing your data. Coordinate transformation can be
performed with the TecUtilTransformCoordinatesX function.
The prototype for TecUtilTransformCoordinatesX is:
Boolean_t TecUtilTransformCoordinatesX ( ArgList_pa ArgList )
Argument list descriptions are:
Specify the source variables for each coordinate. If new variables are not
Source Variables created, these are required destination variable numbers for coordinate
transformations.
Select the type of transformation for changing all points in one or more zones
from one coordinate system to another.
Polar to Rectangular - The current Y-variable represents the radius r, and the
SV_TRANSFORMATION current X-variable represents the angle
Refer to Chapter 23: “Argument Lists” for more information on argument lists.
11 - 4 Zone Creation
You can create a zone programmatically using any of the following techniques:
• 1D Line Creation
• Rectangular Zone Creation
95
• Circular or Cylindrical Zone Creation
• Zone Duplication
• Mirror Zone Creation
• FE Surface Zone Creation (from Polylines)
• Zone Creation by Entering Values
• Sub-zone Extraction
When you create a zone from calculated (i.e. not loaded) data, you are forced to load all
of the zones (regardless of your load-on-demand settings).
FieldDataType Specify the data type for the variables in the new zone.
The points are uniformly distributed along the X-axis between XMin and XMax. Y, and any other
variables, are set to zero.
You can create a 1D line zone as the first step in plotting an analytic function and then
specify an equation that modifies the Y-variable of the new zone using TecUtilDataAlter.
96
Zone Creation
double ZMax
FieldDataType_e FieldDataType
)
Where the parameters are described as:
Coordinates - Enter the start and end points of the physical coordinates (X,Y and Z).
FieldDataType Specify the data type for the variables in the new zone.
• To create an I-ordered zone, enter one for both the J- and K-dimensions.
• To create an IJ-ordered zone, enter one for the K-dimension. The z-axis variable will equal
ZMin throughout the created zone.
• To create an IJK-ordered zone, enter a K-dimension greater than one.
The data points will be uniformly distributed in the I, J and K directions. Any variable not assigned to an
axis is set to zero. You can modify the X, Y, and Z coordinates, and the values of the other variables as well.
97
double ZMin,
double ZMax,
FieldDataType_e FieldDataType
)
Where the parameters are described as:
Select the number of points for the height of the cylinder (K). Set K
KMax
equal to one to create a 2D circular zone.
Coordinates - Enter the start and end points of the physical coordinates (X,Y and Z).
XOrigin Specify the coordinates for the X-origin of the zone center.
YOrigin Specify the coordinates for the Y-origin of the zone center.
FieldDataType Specify the data type for the variables in the new zone.
For 2D (IJ-ordered), a zone in which I-circles are connected by J-radial lines is created, as shown in Figure
11-1 (A). For 3D (K>1), a K-layered cylindrical zone having I-circles connected by J-radial planes is created,
as shown in Figure 11-1 (B). All other variables are set to zero.
A B
After a zone is duplicated, all variables in the newly created zone(s) will be shared with
their corresponding source zone(s).
98
Zone Creation
ZoneUsed Specify the source zone. Must be greater than or equal to one.
ISkip Specify the I skip value. Set to one to duplicate the entire I-direction.
You can only create mirrored zones along one of the standard axes (2D) or the plane
determined by any two axes (3D).
MirrorVar Specify the axis (2D) or axis plane (3D) to mirror about.
99
Each mirror zone has a name of the form “Mirror of zone sourcezone”, where sourcezone is the number of
the zone from which the mirrored zone was created.
The variables in the newly created zone(s) are shared with their corresponding source
zone(s), except for the coordinate and velocity normal to the symmetry plane.
The data must be arranged in non-intersecting polylines, where each polyline can have
any number of points.
Select two or more zones to create your new zone from. The field displays only I-
NumPts
Ordered zones (the polylines).
100
Data Interpolation
11 - 6 Data Interpolation
Interpolation refers to assigning new values for the variables at data points in a zone based on the data
point values in another zone (or set of zones).
For example, you may have a set of data points in an I-ordered zone that are distributed randomly in the
XY-plane. This type of data is sometimes referred to as unordered, ungridded, or random data. In Tecplot
360, it is referred to as irregular data. Using data in this form, you can create mesh plots and scatter plots,
but you cannot create contour plots, light-source shading, or streamtraces.
You can interpolate the irregular I-ordered data onto an IJ-ordered mesh, and then create contour plots
and other types of field plots with the interpolated data. You can also interpolate your 3D, I-ordered
irregular data into an IJK-ordered zone and create 3D volume plots from the IJK-ordered zone. You can
even interpolate to a finite-element zone.
The accuracy of the interpolation will depend on your data, the density of the destination grid, how well
the grid fits the area of your unorganized zone and the settings used for interpolation.
There are three types of interpolation available:
• Linear Interpolation - Interpolate using linear interpolation from a set of finite-element, IJ-
ordered, or IJK-ordered zones to one zone.
• Inverse-distance Interpolation - Interpolate using an inverse-distance weighting from a set of
zones to one zone.
• Kriging Interpolation- Interpolate using kriging interpolation from a set of zones to one zone.
101
Set_pa VarList
double LinearInterpConst
LinearInterpMode_e LinearInterpMode
)
Parameter descriptions are:
SourceZones Specify the set of zones used to obtain the field values for interpolation.
LinearInterpConst Constant value to which all points outside the data field are set.
Select how to treat points that lie outside the source-zone data field.
Specify a zone into which to interpolate. Existing values in the destination zone will be
DestZone
overwritten.
102
Data Interpolation
Specify the minimum distance used for the inverse-distance weighting. Source data
points which are closer to a destination data point than this minimum distance are
InvDistMinRadius
weighted as if they were at the minimum distance. This tends to reduce the peaking and
plateauing of the interpolated data near the source data points.
Specify the method used for determining which source points to consider for each
destination point.
Nearest N - For each point in the destination zone, consider only the closest n points to
the destination point. These n points can come from any of the source zones. This option
may speed up processing if n is significantly smaller than the entire number of source
InterpPtSelection
points.
Octant - Like Nearest N above, except the n points are selected by coordinate-system
octants. The n points are selected so they are distributed as evenly as possible
throughout the eight octants. This reduces the chances of using source points which are
all on one side of the destination point.
All - Consider all points in the source zone(s) for each point in the destination zone.
InterpNPoints Specify the number of source points to consider for each destination data point.
The exponent should be set between 2 and 5. The algorithm is speed-optimized for an
exponent of 4, although in many cases, the interpolation looks better with an exponent
of 3.5.
Inverse-distance interpolation ignores the IJK-mode of IJK-ordered zones. All data points in both the
source and destination zones are used in the interpolation.
The current frame’s axis assignments are used to determine the variables to use for
coordinates in interpolation. However, axis scaling is ignored.
Inverse-Distance Algorithm
The algorithm used for inverse-distance interpolation is simple. The value of a variable at a data point in
the destination zone is calculated as a function of the selected data points in the source zone.
The value at each source zone data point is weighted by the inverse of the distance between the source
data point and the destination data point (raised to a power) as shown below:
ws s
d = ------------------- (summed over the selected points in the source zone)
ws
where d and s are the values of the variables at the destination point and the source point,
respectively, and ws is the weighting function defined as:
103
–E
ws = D
D in the equation above is the distance between the source point and the destination point or
the minimum distance, whichever is greater.
Smoothing may improve the data created by inverse-distance interpolation. Smoothing adjusts the values
at data points toward the average of the values at neighboring data points, removing peaks, plateaus, and
noise from the data.
Kriging and Inverse Distance Interpolation Improvements: For better results with
3D data, try changing the range of your Z-variable to one similar to the X-range the Y-
range. Also, set Zero Value to 0.05.
Specify a zone into which to interpolate. Existing values in the destination zone will be
DestZone
overwritten.
Select the distance beyond which source points become insignificant for the kriging. The
value is stated as the fraction of the length of the diagonal of the box which contains the
data points. A range of zero means that any point not coincident with the destination
KrigRange
point is statistically insignificant. A range of one means that every point in the dataset is
statistically significant for each point. In general, values between 0.2 and 0.5 should be
used.
Select the semi-variance at each source data point on a normalized scale from zero to
one. Semi-variance is the certainty of the value at a data point. Zero is usually a good
number for the zero value, and it causes the interpolated data to fit closely to all the
KrigZeroValue
source data points.Values greater than zero mean the values at the source points have
some uncertainty or noise. Increasing the zero value results in smoother interpolated
values that fit increasingly more to the average of the source data.
104
Irregular Data Point Triangulation
Select the method used for determining which source points to consider for each
destination point.
Nearest N - For each point in the destination zone, consider only the closest n points to
InterpPtSelection the destination point. These n points can come from any of the source zones.
Octant - Like Nearest N above, except the n points are selected by coordinate-system
octants. The n points are selected so they are distributed as evenly as possible
throughout the eight octants. This reduces the chances of using source points which are
all on one side of the destination point.
All - Consider all points in the source zone(s) for each point in the destination zone. In
general, you should not use the All option unless you have very few source points.
InterpNPoints Specify the number of source points to consider for each destination data point.
SourceZones - The current frame’s axis assignments are used to determine the variables
to use for coordinates in kriging. However, any axis scaling is ignored.
KrigDrift - If the Drift is set to Linear or Quadratic, the points selected must be non-
collinear (non-coplanar in 3D). To avoid this limitation, set the Drift to None.
Alternatively, you can eliminate coincident points by Irregular Data Point Triangulation
before you interpolate.
InterpPtSelection - This option is important for kriging, because kriging involves the
computationally expensive inversion and multiplication of matrices. The computational
time and memory requirements increase rapidly as the number of selected source data
points increases.
Kriging Algorithm
For a detailed discussion of the kriging algorithm refer to: Davis, J. C., Statistics and Data Analysis in
Geology, Second Edition, John Wiley & Sons, New York, 1973, 1986.
Kriging and Inverse Distance Interpolation Improvements: For better results with
3D data, try changing the range of your Z-variable to one similar to the X-range the Y-
range. Also, set Zero Value to 0.05.
105
LgIndex_t * NumCoincidentPts
double TriangleKeepFactor
)
Where the parameters are described as:
If TRUE, BoundaryZones must specify one or more I-ordered zones that define the
DoBoundary
boundaries across which no triangles can be created.
Specify a boundary zone for the triangulation. The boundary zones define the
boundaries in the triangulation region. If you do not include boundary zones, the data
BoundaryZones
points are assumed to lie within a convex polygon and that all points in the interior can
be connected.
Set this to TRUE if you also want to include the points in the boundary zones in the
IncludeBoundaryPts triangulated zone.
This factor is used to define “bad” triangles on the outside of the triangulated zone.
At the completion of triangulation, the Tecplot Engine attempts to remove bad triangles
from the outside of the triangulation. The definition of a bad triangle is stored as a
TriangleKeepFactor
number between zero (three colinear points) and 1.0 (an equilateral triangle). Typical
settings are values between 0.1 and 0.3; settings above 0.5 are not allowed. Bad triangles
will not be removed if removing the triangle strands a data point.
After triangulating your data, you can use the resulting finite-element surface zone to create plots.
Generally, you turn off the original zone(s) and plot the new zone only, but you can, for example, plot a
scatter plot of the original zone(s) along with the contours of the new zone.
106
12
Auxiliary Data
107
Example 14:Adding Auxiliary Data to a Data Set
This object, as with TecUtil functions, operates on the current frame in the current page. You may create
an AuxData object and reuse it in any frame on any page provided that the current frame has the data
required for the AuxData object. In the example above, the current frame must have a dataset attached in
order for the set method to succeed. The method AuxData::isValid is provided to confirm that the state of
the current frame is valid for the given AuxData object.
Refer to the ADK Reference Manual for a complete listing of the AuxData class methods.
108
Using Standardized Auxiliary Data
109
Common.GeoMean double Variable
110
13
The Tecplot Engine provides a large number of plotting capabilities, including a full range of Sketch1, XY,
Polar, 2D, and 3D plots. While you are likely familiar with the fundamental concepts of data visualization,
it is important that you understand the nomenclature and concepts behind data visualization as it pertains
to the Tecplot Engine. For background information on any of the plot options described in this chapter,
please refer to the User’s Manual (included in your installation).
Once data has been loaded and associated with a particular plot type, the next step is typically to
customize the style of the plot. The “style” of the plot encompasses the active plot layers and their settings
(such as color, line type, etc.), along with the axis settings, and many display settings. This chapter outlines
many of those style settings available to you, along with example code showing how to set these styles.
Although the example code in this chapter provides a good method to connect the
desired style settings with actual code, we recommend working with the Code Generator
described in Chapter 16: “Code Generator”.
1. A Sketch plot is a plot that contains text, geometries, and/or images, but no dataset.
111
connection to a dataset. However, setting the style for objects that represent the data involves the use of a
linemap (for Line Plots) or a fieldmap (for Field Plots).
Figure 13-1 depicts the relationship between your dataset, fieldmaps, linemaps and your final plot. The
data in a given dataset can map to one or more fieldmaps or linemaps. Each fieldmap and linemap has its
own style settings. A field plot is composed of one or more fieldmaps, and a line plot is composed of one
or more linemaps.
The following table outlines the information that is stored in fieldmaps and linemaps with respect to a
dataset:
Zone Number
Dependent Variable
Notice that fieldmaps do not associate variables with the plot. In field plots, the variables are assigned to
the axes, and the axes assignments are used for all fieldmaps in the current frame. The set of zones
assigned to a fieldmap are dictated by the dataset. In general, for transient data the set of zones
representing a particular region in space for all time is associated with a given fieldmap. For static data,
each static zone is associated with a unique fieldmap.
112
Linemaps and Fieldmaps
• 10 Zones, (all I-ordered, all with an arbitrary number of data points, static data - i.e.
independent of time)
• 4 Variables (named "Time", "Pressure", "Temperature", "Density")
Create a line plot containing three lines as follows:
objectSet.assign(“[1-3]”);
StyleValue sv5(SV_LINEMAP, SV_LINES, SV_LINETHICKNESS);
sv5.set( 0.8, objectSet);
113
Example 16:Setting Style for Multiple Fieldmaps
• 10 Zones, (all IJ-ordered, all with an arbitrary number of data points and static
zones)
• 4 Variables (named "X", "Y", "Temperature", "Density")
Suppose we want to create a field plot showing zones 4, 5 and 9 where:
StyleValue sv2(SV_FIELDLAYERS );
sv2.set( TRUE , SV_SHOWCONTOUR );
sv2.set( FALSE, SV_SHOWEDGE );
sv2.set( TRUE , SV_SHOWSHADE );
StyleValue sv3(SV_GLOBALTHREEDVECTOR);
sv3.set( 1, SV_UVAR );
sv3.set( 2, SV_VVAR );
sv3.set( 3, SV_WVAR );
114
Line Plots
TecUtilResetVectorLength();
sv1.set( TRUE, SV_STREAMTRACELAYERS, SV_SHOW);
StyleValue sv4(SV_FIELDMAP);
Set objectSet(“[2,4-6,8,10-12]”);
sv4.set( FALSE, objectSet, SV_MESH, SV_SHOW);
objectSet.assign(“[1-3,7-10]”);
sv4.set( FALSE, objectSet, SV_CONTOUR, SV_SHOW);
objectSet.assign(“[1,3-7,9-12]”);
sv4.set( FALSE, objectSet, SV_VECTOR, SV_SHOW);
objectSet.assign(“[1,3-7,9-12]”);
sv4.set( FALSE, objectSet, SV_SHADE, SV_SHOW);
objectSet.assign(“[2,8]”);
sv4.set( Yellow_C, objectSet, SV_SHADE, SV_COLOR);
13 - 2 Line Plots
Use the Code Generator to determine the syntax for any of the style settings discussed
in this section.
A line plot is the simplest type of graph produced by the Tecplot Engine. Each line on the line plot
represents one series of data points, where each data point is defined by its independent and dependent
variable values. A series of data points is referred to as a mapping (or map, for short).
115
Line plots are usually created from one-dimensional, I-ordered data1. The data used for line plots must
have at least two variables defined at each data point. The same number of variables must be defined at
each data point.
There are two supported types of line plots: XY plots and Polar Line plots. An example of XY and Polar
Line plots is shown below:
Figure 13-4. A plot of speed versus angle in XY Line (left) and Polar Line (right) plot
• XY Plots - XY plots are plotted on Cartesian coordinates using X and Y as the independent and
dependent variables. XY plots can include line, symbol, bar and/or error bar mapping layers.
• Polar Plots - Polar plots are plotted on polar coordinates using Theta and R values. Polar plots
can include line and/or symbol layers. Polar Line plots have the following three drawing
options:
• Curved Lines (Theta-R Interpolation) - The connection between two points is a curve.
This may slow plotting speed for large datasets.
• Straight Lines (X-Y Interpolation) - The connection between two points is a straight
line.
The difference between the two Polar Line Drawing Modes is shown below:
Figure 13-5. The Polar Drawing Modes: Curved lines are shown
on the left and straight lines are shown on the right.
1. Refer to Chapter 10: “Data Structure” for information on Data Structure, including I,J, and K-ordering of
datasets.
116
Line Plots
For information on limiting the number of points plotted for a given linemap, refer to Section 13 - 4
“Plotting Subsets of Data”.
117
Example 17:Changing the Line Thickness for a Set of Linemaps
To set the line thickness for linemaps 2, 3 and 5, use the following code
Note that this example illustrates a way to use the Set and StyleValue classes which is different
from the code created by the Code Generator.
If you want to change the style for all linemaps, do not supply a Set in the
StyleValue::set method call.
This sample code sets the line color for all linemaps because no linemap set is specified. If a
linemap set were specified, the line color would be set only for that linemap set.
The following sample code creates an XY Line Plot with a blue line and red circles for a single
mapping:
StyleValue sv1;
sv1.set( TRUE, SV_STREAMTRACELAYERS, SV_SHOW);
118
Line Plots
StyleValue sv2(SV_STREAMATTRIBUTES);
sv2.set( TRUE, SV_TERMLINE, SV_ISACTIVE);
The following sample code creates an XY Line Plot with green bars that have a blue outline:
The following sample code creates an XY Line Plot with 3 mappings and 2 y-axes:
TecUtilLineMapCreate();
Set objectSet(2);
StyleValue sv(SV_LINEMAP);
sv.set( “Map 2”, objectSet, SV_NAME);
sv.set( 1 , objectSet, SV_ASSIGN , SV_XAXISVAR);
sv.set( 3 , objectSet, SV_ASSIGN , SV_YAXISVAR);
sv.set( 1 , objectSet, SV_ASSIGN , SV_ZONE);
sv.set( Lines_I, objectSet, SV_INDICES, SV_IJKLINES);
sv.set( 2 , objectSet, SV_ASSIGN , SV_YAXIS);
TecUtilLineMapSetActive(objectSet.getRef(), AssignOp_PlusEquals);
TecUtilLineMapCreate();
119
objectSet = 3;
sv.set( “Map 3”, objectSet, SV_NAME);
sv.set( 1 , objectSet, SV_ASSIGN, SV_XAXISVAR);
sv.set( 2 , objectSet, SV_ASSIGN, SV_YAXISVAR);
sv.set( 1 , objectSet, SV_ASSIGN, SV_ZONE);
sv.set( Lines_I, objectSet, SV_INDICES, SV_IJKLINES);
TecUtilLineMapSetActive( objectSet.getRef(), AssignOp_PlusEquals);
120
Line Plots
Linear Fit, Polynomial Fit, Exponential Fit, and Power Fit are all determined by using a least squares
algorithm. Examples of each curve fit type are shown below:
The following sample code modified linemap 3 in an existing XY Line plot to use a polynomial
curve fit (order=5):
Set objectSet(1);
StyleValue LineMapStyle(SV_LINEMAP, SV_CURVES);
LineMapStyle.set(CurveType_PolynomialFit, objectSet,
SV_CURVETYPE);
LineMapStyle.set(5, objectSet, SV_POLYORDER);
121
• Box Style Specify whether to have no box, a filled box, or an outline.
• Box Line Style If you set the box style to filled or outline, you can customize the box
thickness and line color. Any of the basic color values are available. Refer to Section 13 -
5.1 “Basic Colors” for details.
• Fill Color If you set the box style to filled, specify the fill color using any of the basic
color values. Refer to Section 13 - 5.1 “Basic Colors” for details.
• Margin Use the margin to specify the space between the legend and the legend box. The
margin is available for all box types.
The following sample code illustrates turning on the line legend for an existing line plot:
13 - 3 Field Plots
Use the Code Generator to determine the syntax for any of the style settings discussed
in this section.
There are two types of field plots available: 2D and 3D Cartesian. The axes in field plots are all
independent variables.
You can create a 2D or 3D field plot by using any combination of the following plot properties:
• Fieldmap Layers - By default, 2D and 3D field plots are initially displayed with Mesh and
Edge fieldmap layers.
• Plotting Subsets of Data - Points or surfaces may be selected as the source for your data points.
• Plot Effects - 3D field plots may be enhanced with Lighting effects and Translucency.
• Derived Objects - Field plots may also contain any combination of iso-surfaces, slices, and
streamtraces (which are derived from the values in the dataset).
122
Field Plots
• Contour
• Vector
• Scatter
• Shade
• Edge
Mesh
The Mesh plot layer displays the lines connecting neighboring data points within a fieldmap. For each
fieldmap, you can customize the following mesh settings:
• Show Opt whether to display the mesh for the given set of fieldmaps.
• Mesh Type There are three mesh types available:
• Wire Frame Wire frame meshes are drawn below any other zone layers on the same
zone. In 3D Cartesian plots, no hidden lines are removed. For 3D volume zones (finite-
element volume or IJK-ordered), the full 3D mesh (consisting of all the connecting lines
between data points) is not generally drawn because the sheer number of lines would
make it confusing. The mesh drawn will depend upon your choice of “Surfaces to Plot”.
See Section 13 - 4.2 “Surfaces” for further details. By default, only the mesh on exposed
cell faces is shown.
• Overlay Similar to Wire Frame, mesh lines are drawn over all other zone layers except
for vectors and scatter symbols. In 3D Cartesian plots, the area behind the cells of the
plot is still visible (unless another plot type such as contour flooding prevents this). As
with Wire Frame, the visibility of the mesh is dependent upon your choice of “Surfaces
to Plot”. See Section 13 - 4.2 “Surfaces” for further details.
• Hidden Line Similar to Overlay, except hidden lines are removed from behind the
mesh. In effect, the cells (elements) of the mesh are opaque. Surfaces and lines that are
hidden behind another surface are removed from the plot. For 3D volume zones, using
this plot type obscures everything inside the zone. If you choose this option for 3D
volume zones, then choosing to plot every surface has the same effect as plotting only
exposed cell faces, but is much slower.
The opaque surfaces created by Hidden Line are not affected by the Lighting effect
(there is no light source shading). However, it is affected by translucency.
• Mesh Color Specify the mesh color using any of the coloring options described in Section 13 -
5 “Coloring”.
• Mesh Line You can customize the mesh line pattern and thickness.
123
The following sample code creates a Mesh Plot with dashed blue lines:
Set objectSet(1);
StyleValue FieldMapStyle(SV_FIELDMAP, SV_MESH);
FieldMapStyle.set( LinePattern_Dashed, objectSet, SV_LINEPATTERN);
FieldMapStyle.set( Blue_C, objectSet , SV_COLOR);
The following sample code illustrates how to set the mesh color for fieldmaps 1 and 3:
If you want to change the style for all fieldmaps, do not supply a Set in the
MeshColor.Set method call.
Contour
Contour plots can be used to show the variation of one variable across the data field.
Contour plots can only be plotted with organized data, such as IJ-ordered, IJK-ordered,
or FE-data. Refer to Section 3 - 6 “Working with Unorganized Datasets” in the User’s
Manual for information on organizing your dataset.
There are two levels of control for contour plots: control by contour group number, or control for a given
fieldmap. A contour group is used to link a group of settings such as contour level values and contour
labels to a given contour variable. You can use up to eight different contour groups.
Before activating the contour layer, you should assign a variable to at least contour group 1. If you plan to
work with multiple contour groups, assign a contour variable to those groups, as well.
Fieldmap Settings
The following contour style settings can be set for a given fieldmap or group of fieldmaps:
• Show/Hide You can opt whether or not to display contours for a given fieldmap.
• Contour Type You can create contour plots of five different types (An example of each plot
type is shown below):
• Lines Lines of constant value are drawn for the specified contour variable.
124
Field Plots
• Flood Floods regions between contour lines with colors from the global color map. The
distribution of colors used for contour flooding may be banded or continuous. When
banded distribution is used for flooding, a solid color is used between contour levels. If
continuous color distribution is used, the flood color will vary linearly, as defined by the
colormap.
• Both Lines and Flood Combines the above two options.
• Average Cell Floods cells or finite-elements with colors from the global color map
according to the average value of the contour variable over the data points bounding the
cell.
• Primary Value Floods cells or finite-elements with colors from the global color map
according to the primary value of the contour variable for each cell.
• Flood By Specify a contour group (C1, C2, C3, C4, C5, C6, C7, or C8) or assign variables to the
RGB color map. NOTE: You must assign RGB variables prior to using RGB Coloring. Refer to
Section 13 - 5.3 “RGB Multi-coloring” for details.
• Lines By Specify which contour group identifies the contour lines (applicable only when the
contour type is 'Lines' or both ‘Lines and Flood').
• Line Attributes When the contour type is set to Lines or Lines and Flood, you can customize
the line color, line pattern and the pattern length.
• Use Lighting (3D only) Turn the lighting effects on or off. If lighting is on, the contour
coloring may not match the contour legend because of shading effects.
You can also turn the contour layer on and off for a subset of fieldmaps.
125
Example 26:Changing the Contour Type
The following sample code illustrates setting the contour type to ‘Lines and Flood’ for all
fieldmaps:
The following sample code demonstrates turning off colormap linking and assigning a different
colormap to contour group 3:
StyleValue sv;
//Assign var 1 to Contour Group 3
sv.set(1, 3, SV_GLOBALCONTOUR, SV_VAR);
126
Field Plots
The following sample code adds contour labels to the plot. NOTE: the labels will be automatically
positioned on the plot.
StyleValue sv;
sv.set(TRUE, 1, SV_GLOBALCONTOUR, SV_LABELS, SV_SHOW);
TecUtilFieldLayerSetIsActive( SV_SHOWCONTOUR, TRUE);
Contour Legends
You have the option to add a contour legend to your plot. Contour Legends can be added on a group by
group basis. You can customize the following attributes of your contour legend:
• Show/Hide - You can opt whether or not to display a contour legend for each contour group.
• Labels - You can customize both the header label and number labels in your contour legend.
The following settings are available:
• Header Label - The header label is used to display the contour variable name in the
legend. You can opt whether to display a header label, and also specify its font type
and height.
127
• Label Color - You can set the color for both the header and number labels to any of the
basic color provided by the Tecplot Engine. Refer to Section 13 - 5.1 “Basic Colors” for a
list of available options. NOTE: the same color will be used for both types of labels.
• Level Labels - The Level Labels are used to identify the numerical value of each contour
level. You can customize the font and number format used for the level labels.
• Color Bands - You can opt whether or not to display separators at each contour level. This
setting is available for both continuous and banded coloring.
• Size and Position - You can customize the overall size and position of the contour legend with
the following options:
• Resize Automatically - Set Resize Automatically to TRUE to have the Tecplot Engine
manage the size of your legend based on the number of levels to display.
• Line Spacing - Set the line spacing to specify the distance between level labels. This
does not change the number of entries in the legend, so a large value here creates a large
legend. Use Level Skip to reduce the number of entries in the legend.
• Position (X%/Y%) - Specify the placement of the anchor position as a percentage of
frame height. The location of the anchor or legend origin can be set to top-middle,
bottom-left, middle-right, etc.
• Alignment - You can opt to display either a vertical or horizontal legend.
• Levels to Display - You can customize the contour levels displayed in the legend with the
following settings:
• Level Skip - Specify the number of levels between numbers on the legend. This also
adjusts the number of levels between any contour labels on the plot. Skipping levels on
the contour legend compresses the color bar (if one appears); it does not change the
spacing between text entries on the legend.
• Cutoff Levels - Specify whether or not to display the cutoff level settings in the legend.
• Contour Label Location - Use the Contour Label Location to specify whether to label
the contour at: the contour levels, color map divisions, or a specified increment.
• Legend Box - You can opt to display a box around the contour legend. The contour legend box
can be customized with the following settings:
• Box Style - Specify whether to have no box, a filled box, or an outline.
• Box Line Style - If you set the box style to filled or outline, you can customize the
outline thickness and color. Any of the basic color values are available. Refer to Section
13 - 5.1 “Basic Colors” for details.
• Fill Color - If you set the box style to filled, specify the fill color using any of the basic
color values. Refer to Section 13 - 5.1 “Basic Colors” for details.
• Margin - Use the margin to specify the space between the legend and the legend box.
The margin is available for all box types.
128
Field Plots
The following sample code adds a contour legend to an existing field plot:
StyleValue sv1(SV_GLOBALCONTOUR);
sv1.set( 3 , 1, SV_VAR);
sv1.set( TRUE , 1, SV_LEGEND, SV_SHOW);
sv1.set( FALSE, 1, SV_LEGEND, SV_ISVERTICAL);
sv1.set( FALSE, 1, SV_LEGEND, SV_OVERLAYBARGRID);
Vector
You can create vector plots by activating the Vector layer, and specifying the vector component variables.
You must set the vector variables prior to activating the Vector layer. 2D plots require U
and V variables, while 3D plots require U, V, and W variables.
Some vector settings can be customized on a fieldmap by fieldmap level, while other settings are global to
all vectors in the frame.
Fieldmap Settings
You can control any of the following vector plot attributes on a fieldmap by fieldmap level:
• Show/Hide - Opt whether to display the vector layer for a fieldmap or set of fieldmaps.
• Vector Type - Select from the following arrowhead locations to specify the vector type: tail at
point, head at point, anchor at midpoint, or head only. Figure 13-8 shows examples of each of
the vector plot types.
129
• Hollow - Hollow triangles with apex at the head of the vector.
130
Field Plots
The following sample code illustrates how to create a vector plot with hollow arrows placed at the
point, where the vector variables (U,V, and W) are variables 4, 5 and 6, respectively:
StyleValue sv1(SV_FIELDLAYERS);
sv1.set( TRUE, SV_SHOWVECTOR);
TecUtilResetVectorLength();
Set objectSet(1);
StyleValue sv2( SV_FIELDMAP, SV_VECTOR);
sv2.set( Arrowhead_Hollow , objectSet, SV_ARROWHEADSTYLE);
sv2.set( VectorType_HeadAtPoint, objectSet, SV_VECTORTYPE);
Scatter
Scatter plots are plots of symbols at the data points in a field. The symbols may be sized according to the
values of a specified variable, colored by the values of the contour variable, or uniformly sized or colored.
Unlike contour plots, scatter plots do not require any mesh structure connecting the points. This allows
you to make scatter plots of unorganized data.
The Scatter variable must be set prior to activating the Scatter layer.
You can control some scatter settings on a fieldmap by fieldmap basis, while other settings are global to
the current frame. Refer to the remainder of this section for details.
Fieldmap Settings
You can control any of the following scatter plot attributes on a fieldmap by fieldmap level:
• Show or hide the scatter layer for a given set of fieldmaps.
131
• Symbol shape
• Outline color
• Fill mode and color
• Scatter size
• Line thickness
The following sample code generates a Scatter Plot with purple circles, line thickness of 0.2:
TecUtilFieldLayerSetIsActive(SV_SHOWSCATTER, TRUE);
Set objectSet(1);
TecUtilZoneSetScatterSymbolShape( SV_GEOMSHAPE,
objectSet.getRef(),
GeomShape_Circle);
Global Settings
The following attributes are global to all fieldmaps displaying the scatter layer:
• Scatter Size Variable - If at least one fieldmap is set to “size the scatter symbol according to a
variable”, you can customize and set a scatter variable.
• Reference Scatter Symbol - If you are using a scatter-size variable, it is sometimes useful to
create a reference scatter symbol that shows the size at which a data point of a given
132
Field Plots
magnitude will be represented. Figure 13-12 shows a scatter plot with a reference scatter
symbol.
• Scatter legend - You may opt to turn the scatter legend on or off, and customize its settings
and position.
Shade
Although most commonly used with 3D surfaces, shade plots can also be used to flood 2D plots with solid
colors, or light source shade the exterior of 3D volume plots. In 3D plots, fieldmap effects (translucency
and lighting) cause color variation (shading) throughout the fieldmap(s). Shading can also help you
discern the shape of the plot. See also Section 13 - 3.2 “Plot Effects”.
You can control any of the following shade plot attributes on a fieldmap by fieldmap level:
• Show or hide the shade layer for a given group of fieldmaps.
• Turn lighting zone effect on or off.
• Set Shade color
Edge
An edge plot layer displays the connections of the outer lines (IJ-ordered zones), finite-element surface
zones, or planes (IJK-ordered zones). The Edge layer allows you to display the edges (creases and borders)
of your data. Zone borders exist only for ordered zones, or 2D finite-element zones.
There are two types of edges: creases and borders. An edge border is the boundary of a zone. An edge-
crease appears when the inside angle between two cells is less than a user-defined limit. The inside angle
can range from 0-180 degrees (where 180 degrees indicates coplanar surfaces). You can control the inside
133
angle on a global level. The default inside angle for determining an edge-crease is 135 degrees. Only edge-
borders are displayed, by default.
For 2D plots, only edge-borders are available, and for FE-volume zones, only edge-
creases are available.
The following sample code creates and Edge Plot with an inside angle of 110 degrees, edge color
of green:
Set objectSet(1);
StyleValue FieldMapEdgeLayerStyle( SV_FIELDMAP, SV_EDGELAYER);
FieldMapEdgeLayerStyle.set(1 , objectSet, SV_EDGETYPE);
FieldMapEdgeLayerStyle.set(Green_C, objectSet, SV_COLOR);
FieldMapEdgeLayerStyle.set(0 , objectSet, SV_JBORDER);
StyleValue sv;
sv.set( 110.0, SV_GLOBALEDGE, SV_MINCREASEANGLE);
Lighting
There are two types of lighting effects: Paneled and Gouraud.
• Paneled - Within each cell the color assigned to each area by shading or contour flooding is
tinted by a shade constant across the cell. This shade is based on the orientation of the cell
relative to your 3D light source.
• Gouraud - This plot type offers a more continuous and much smoother shading than Paneled
shading, but it also results in slower plotting and larger print files. Gouraud shading is not
continuous across fieldmap boundaries, unless face neighbors are specified. Gouraud shading
is not available for finite-element volume fieldmaps when blanking is included. A finite-
134
Field Plots
element volume fieldmap set to use Gouraud shading will revert to Paneled shading when
blanking is included.
IJK-ordered data with Surfaces to Plot set to Exposed Cell Faces, faces exposed by
blanking will revert to Paneled shading.
Translucency
When a fieldmap is translucent, you may view objects inside or beyond the fieldmap. All surfaces in 3D
Cartesian plots may be made translucent. A different translucency may be assigned to individual
fieldmaps, and may also be assigned to derived objects such as slices, streamtrace ribbons or rods, and iso-
surfaces.
The following sample code modifies fieldmap 1 to use Gouraud shading and changes the light
source to have 50% intensity:
TecUtilContourSetVariable(4);
Set objectSet(1);
TecUtilFieldLayerSetIsActive( SV_SHOWCONTOUR, TRUE );
StyleValue sv1(SV_FIELDMAP, SV_EFFECTS, SV_LIGHTINGEFFECT);
sv1.set( LightingEffect_Gouraud, objectSet );
Streamtraces
A streamtrace is the path traced by a massless particle placed at an arbitrary location in a steady-state
vector field. Streamtraces may be used to illustrate the nature of the vector field flow in a particular region
135
of the plot. Because streamtraces are dependent upon a vector field, you must define vector components
before creating streamtraces.
While the vector variables must be defined prior to activating streamtraces, it is not
necessary to activate the Vector fieldmap layer to use streamtraces.
You can opt to display streamtraces on a fieldmap by fieldmap basis. There are two main categories of
streamtraces:
• Surface Line Streamtraces (or streamlines) - Surface streamtraces are confined to the surface
on which they are placed. They can only be placed in fieldmaps displayed as a 2D or 3D
surface. When surface streamtraces are placed on a no-slip boundary surface1, they will
propagate according to the flow field very near the surface.
• Volume Streamtraces - Volume streamtraces can be created in 3D volume fieldmaps only (IJK-
ordered or FE-volume fieldmaps). Volume streamtraces are subdivided into three categories:
Volume Lines, Volume Ribbons and Volume Rods.
You can customize the following streamtrace attributes:
• Line Styles - Surface streamtraces or streamlines are confined to the surface on which they are
placed. They can only be placed in zones displayed as a 2D or 3D surface. If you try to place
streamlines in a zone displayed as a 3D volume, no streamlines are drawn.
You cannot customize streamtraces until after the streamtraces have been drawn. Once
streamtraces have been drawn, you can customize the following line settings:
• Show Path - You can opt whether or not to display the streamtrace path or line. Set this
option to FALSE, if you would like only streamtrace markers to be displayed.
• Line Color - You may set the color to any of the coloring options provided by the
Tecplot Engine. NOTE: If you wish to use Multi-coloring and the contour variable is not
currently defined, you will need to define it first. Refer to Section 13 - 5 “Coloring” for
additional details.
• Line Thickness - Specify the thickness of the streamtrace lines.
• Arrows - You can opt whether or not to include arrowheads on your streamtrace lines.
Arrows are not available for volume ribbons or volume rods. You can control the
following attributes of the displayed arrows:
• Arrowhead Size - The arrowhead size is specified as a percentage of the frame
height.
• Arrowhead Spacing - Specify the distance between arrowheads in terms of Y-
frame units. A value of ten percent will space arrowheads approximately ten
percent of the frame height apart from each other along each streamline.
• Rod/Ribbon Styles - If you are using volume ribbons or volume rods, you can customize the
following attributes of your streamtraces:
• Rod/Ribbon Width - Specify the rod or ribbon width in grid units. If you want two sets
of streamtraces with different widths, you must create them individually by first
creating a set of streamtraces with a specific width, and then extracting it as a zone. You
can then configure a new set of streamtraces with the second width.
• Rod Points - Volume rods have a polygonal cross-section. Use this parameter to specify
the number of points in cross-section. (Three is an equilateral triangle, four is a square,
five is a regular pentagon, and so on.) If you want two sets of volume rods with different
cross-sections, you must first create one set and then extract them as zones. You can then
configure a new set of streamtraces with the second cross-section.
1. Refer to the User’s Manual for background information on no-slip boundary surfaces.
136
Field Plots
• Mesh - You can opt to display a mesh on the volume streamtraces. You specify both the
line thickness for the mesh and the mesh color. Refer to Section 13 - 5 “Coloring” for
additional details on the coloring options.
• Contour Flooding - You can opt to display contour flooding on your volume
streamtrace. If you select this option, you will also need to specify which contour group
to use.
• Shade - You can display shading on your volume streamtrace as well. You can
customize the following shading effects:
• Shade Color - Specify a shade color from the basic color palette. Multi-color and
RGB coloring are not available (use contour flooding instead). Refer to Section 13
- 5.1 “Basic Colors” for additional details.
• Lighting Effect - You can opt whether or not to include lighting on the
streamtraces. If you opt to include lighting, select from “Paneled” or “Gouraud”
shading.
• Surface Translucency - Use the Surface Translucency setting to customize the
translucency of the volume streamtraces.
• Stream Markers - Stream markers are symbols plotted along streamtrace paths to identify the
positions of particles at certain times. Figure 13-13 shows a plot with both streamtrace markers
and dashes.
The spacing between stream markers is proportional to the magnitude of the local vector field.
You can adjust the spacing between stream markers by specifying the time interval (or delta)
between stream markers. Increasing the delta time will increase the space between stream
markers and vice versa. The actual spacing is the product of the local vector magnitude and the
specified delta.
You may also specify the shape, size, and color of your stream marker(s).
137
• Termination Line - A streamtrace termination line is a polyline that terminates any
streamtraces that cross it. The termination line is useful for stopping streamtraces before they
spiral or stall. Figure 13-14 shows the cylinder data with some streamtraces terminated by a 2D
streamtrace termination line.
Streamtraces are terminated whenever any of the following occur:
• The maximum number of integration steps is reached.
• Any point where the streamtrace passes outside the available data.
• The streamtrace reaches a point where the velocity magnitude is zero.
• Hits the termination line.
In 2D Cartesian plots, the termination line is drawn in the grid coordinate system and moves
with the data as you zoom and translate. If you rotate a 3D dataset after drawing a streamtrace
termination line, streamtraces previously terminated by the termination line may be
terminated at different places, or not terminated at all if the rotated streamtrace no longer
intersects the termination line.
Figure 13-14 shows a 3D volume plot with streamribbons and a streamtrace termination line,
and how the termination points vary as the plot is rotated. Notice that the termination line
itself remains in place on the screen as the plot is rotated.
138
Field Plots
• Step Size - Specify the initial and maximum step size used while integrating through
the vector field as a decimal fraction of the local cell or element width. A typical value
(and the default) is 0.25, which results in four integration steps through each cell or
element. The value for the Step Size affects the accuracy of the integration. Setting the
Step Size too small can result in round-off errors, while setting it too large can result in
truncation errors and missed cells.
• Max Steps - Specify the maximum number of steps before the streamtrace is
terminated. This prevents streamtraces from spinning forever in a vortex, or from
wandering into a region where the vector components are very small, very
random, or both. If you choose a small Step Size, you should specify a larger
maximum number of steps.
• Minimum Step Size - Specify the smallest step size for the Tecplot Engine to use.
Setting this too small results in integration problems. Setting this greater than or
equal to the Step Size results in a constant step size.
• Obey Source Blanking - When active, streamtraces are generated for non-
blanked regions only. When inactive, streamtraces are generated for blanked and
unblanked regions.
Streamtraces may terminate at a zone boundary even if there is an adjacent zone into which the
streamtraces should proceed. This can happen if there is a small gap between the zones.
Specifying face neighbors in the data file to connect the zones can reduce this issue. Increasing
the minimum integration step size can also eliminate this problem.
The following sample code demonstrates adding Volume Rod Streamtraces with a termination
line to an existing 3D Plot:
StyleValue sv1;
sv1.set( TRUE, SV_STREAMTRACELAYERS, SV_SHOW);
StyleValue sv2(SV_STREAMATTRIBUTES);
sv2.set( TRUE, SV_TERMLINE, SV_ISACTIVE);
139
Example 35:Adding Streamtrace Markers
The following sample code illustrates adding streamtraces with multi-colored spherical markers
to an existing 3D Plot:
StyleValue sv1;
sv1.set( TRUE, SV_STREAMTRACELAYERS, SV_SHOW);
TecUtilStreamtraceAdd( 1, Streamtrace_VolumeLine, StreamDir_Both,
0.7, 0.8, 0.1,
0.59, 0.59, 0.11);
sv1.set( FALSE, SV_STREAMATTRIBUTES, SV_SHOWPATHS);
TecUtilContourSetVariable(7);
StyleValue sv2(SV_STREAMATTRIBUTES, SV_STREAMTIMING);
sv2.set( TRUE, SV_SHOWMARKERS);
Iso-surfaces
An iso-surface is a surface that has a constant value for the contour variable. Iso-surfaces require that your
data contains volume fieldmaps (IJK-ordered, finite-element brick, or finite-element tetrahedral
fieldmaps). You can work with up to eight different iso-surface groups.
You may specify whether to include iso-surfaces on a fieldmap by fieldmap level.
If you opt to include iso-surfaces for a given fieldmap, Tecplot 360 will display all active
iso-surface groups for that fieldmap.
You may specify the following attributes for a given iso-surface group:
• Definition - You may customize the following placement and definition settings for a given
iso-surface group:
• Whether to display the group
• Which contour group to use
• Whether to draw iso-surfaces at one, two or three specified value(s), or at each contour
level. Default values are calculated by the Tecplot Engine.
• Style - You may customize the following style settings for a given iso-surface group:
• Mesh - Whether to draw a mesh along the iso-surface, and customize the settings for
the mesh.
• Contour - Whether to draw contours along the iso-surface, and customize the settings
for the contours.
• Shade - Whether to display shading on the iso-surface, and customize the shade
settings.
140
Field Plots
The following example illustrates turning on iso-surfaces for an existing field plot and plotting
one iso-surface defined at 3.57.
StyleValue sv;
sv.set(TRUE, SV_ISOSURFACELAYERS, SV_SHOW);
sv.set(3.57, 1, SV_ISOSURFACEATTRIBUTES, SV_ISOVALUE1);
Iso-surface Extraction
The code for this functionality is not output by the Code Generator. You will need to use
the code discussed in this section to enable the functionality.
Iso-surfaces are derived from the dataset and do not append the dataset. To extract existing iso-surfaces to
Tecplot 360 zones and retain these surfaces after making changes to the contour variable, use
TecUtilCreateIsoZones.
With this function, one zone is created for each iso-surface value displayed in the iso-surface. All of the
variables in the dataset are interpolated from the 3D volume zones to the data points of the iso-surfaces.
Iso-surface zones are FE-surface quadrilateral element-type zones, regardless of the original 3D volume
zone types. The mesh of the iso-surfaces is derived from the mesh of the original zones so that in regions
where the original mesh was coarse, the iso-surface mesh is coarse, and where the original mesh was fine,
the iso-surface mesh is fine.
After creating the new iso-surface zones, it is often a good idea to turn off or
reconfigure the current settings for iso-surfaces because the new zones will occupy the
same physical space as the original iso-surfaces. The new zones will not maintain the
style, as defined by the derived iso-surfaces.
Slices
There are two types of slices:
• Slices that are derived from the dataset - Slices that are derived from the dataset are defined
by a constant X, Y, or Z location or constant I, J, or K-index for IJK-ordered fieldmaps. This type
of slice is part of the style of your plot and does not add to the dataset unless you extract it to a
fieldmap.
• Slices that are extracted directly to fieldmaps - This option allows you to slice through 3D
surface as well as 3D volume fieldmaps.
141
These operations are separate, and each has unique advantages. The resulting slices are always 3D
surfaces.
You can use the Code Generator to create the code for these operations.
The following example illustrates turning on slices for an existing field plot:
StyleValue sv;
sv.set(TRUE, SV_SLICELAYERS, SV_SHOW);
142
Plotting Subsets of Data
ArgList arglist;
arglist.appendDouble( SV_ORIGINX, 0.3);
arglist.appendDouble( SV_ORIGINY, 0.6);
arglist.appendDouble( SV_ORIGINZ, 0.5);
arglist.appendDouble( SV_NORMALX, 0.2);
arglist.appendDouble( SV_NORMALY, 0.75);
arglist.appendDouble( SV_NORMALZ, 0.3216);
TecUtilCreateSliceZoneFromPlneX(arglist.getRef());
Use the Code Generator to determine the syntax for any of the style settings discussed
in this section.
Once you have loaded your data, you can modify your field plot attributes. You may select the source
(points or surfaces) for the data points used to plot vectors and scatter symbols.
13 - 4.1 Points
The points to plot can be specified for both fieldmaps and linemaps. You may select one of the following
options to specify how the points are plotted:
• Nodes on Surfaces - Draws only the nodes that are on the surface of the fieldmap.
• All Nodes - Draws all nodes in the fieldmap.
• All Connected - Draws all the nodes that are connected by the node map. Nodes without any
connectivity are not drawn.
• Cell Centers Near Surfaces - Draws points at the cell centers that are on or near the surface of
the fieldmap.
• All Cell Centers - Draws points at all cell centers in the fieldmap.
• Index Skip - Specifies the skip intervals for the I, J, and K indices.
143
The following sample code demonstrates an XY Line Plot where data values are restricted to the J-
range of 3-5:
Set objectSet(1);
StyleValue LineMapStyle(SV_LINEMAP);
LineMapStyle.set( 3, objectSet, SV_INDICES, SV_JRANGE, SV_MIN);
LineMapStyle.set( 5, objectSet, SV_INDICES, SV_JRANGE, SV_MAX);
The following sample code demonstrates how to modify an existing 3D Field Plot to show only
nodes on the surfaces:
Set zone_set(1);
TecUtilZoneSetScatterSymbolShape( SV_GEOMSHAPE,
zone_set.getRef(),
GeomShape_Sphere);
StyleValue sv(SV_FIELDMAP);
sv.set( PointsToPlot_SurfaceNodes, zone_set, SV_POINTS,
SV_POINTSTOPLOT);
13 - 4.2 Surfaces
There are many ways to divide volume data for plotting. One way to view volume data is to select surfaces
from part of the data.
The following surface selections are available:
• Boundary Cell Faces - Plots all surfaces on the outside of the volume fieldmap.
• IJK-ordered Data - The minimum and maximum I, J, and K planes are plotted.
• Finite-element Volume Data - All faces that do not have a neighbor cell (according to the
connectivity list) are plotted.
If blanking is turned on, the boundary cells in the blanked region will not be drawn and you
will be able to see the interior of the volume fieldmap.
• Exposed Cell Faces (default) - When value blanking is used, the outer cell faces between
blanked and non-blanked cells and the outer surfaces of the data are drawn.
• Planes Settings (I, J, K, IJ, JK, IK, and IJK-planes) - Plots the appropriate combination of I, J,
and/or K planes. These settings are available only for IJK-ordered data.
• Every Surface (Exhaustive) - This setting will plot every face of every cell in volume data. It is
not recommended for large datasets.
144
Plotting Subsets of Data
The following sample code demonstrates how to modify an existing 3D Field Plot to show
Boundary Cell Faces with blanking activated:
TecUtilContourSetVariable(4);
TecUtilFieldLayerSetIsActive( SV_SHOWCONTOUR, TRUE);
TecUtilFieldLayerSetIsActive( SV_SHOWMESH, FALSE);
Set objectSet(1);
StyleValue sv2(SV_FIELDMAP, SV_SURFACES, SV_SURFACESTOPLOT);
sv2.set( SurfacesToPlot_BoundaryFaces, objectSet);
I, J, and K-planes
A K-plane is the connected surface of all points with a constant K-index value. The I and J indices range
over their entire domains, similarly for an I-plane and a J-plane. Examples of I, J, and K planes are shown
below.
The following sample code illustrates how to display only the seventh J-plane in fieldmap 1:
Set objSet(1);
StyleValue sv( SV_FIELDMAP, SV_SURFACES);
sv.set( SurfacesToPlot_JPlanes, objSet, SV_SURFACESTOPLOT);
sv.set( 7, objSet, SV_IRANGE, SV_MIN);
sv.set( 7, objSet, SV_IRANGE, SV_MAX);
145
A B
C D
I, J, or K planes are not necessarily two-dimensional in physical space. They are called
planes because they exist as planes in logical (IJK) space. In physical (XYZ) space, the
planes may be cones, ellipsoids, or arbitrary surfaces.
13 - 5 Coloring
Use the Code Generator to determine the syntax for any of the style settings discussed
in this section.
Each attribute of your plot can be set to a different color or color type. When assigning a value for
ColorIndex_t, you have three types of color assignments:
• Basic Colors - Use the basic color palette to apply a single, constant color to a plot attribute
(e.g. Blue_C, Red_C, etc.)
146
Coloring
• Multi-color Settings - In many instances, you can assign a given plot attribute to be colored
according by a contour group, and the coloring of the contour group is defined by the Multi-
color Settings. The Contour Variables are typically used for coloring mesh, contour, vector, and
scatter layers.
• RGB Multi-coloring - RGB coloring is used to illustrate the relationship between two or three
variables in your dataset, by setting R, G, and B to each of the variables.
For example, you can create a 3D field plot with a contour layer (with colors defined by a contour
variable), an edge layer (with colors from the basic color palette), and a vector layer (with colors defined
by RGB vectors).
The contour variable must be defined prior to setting a color value to multi-coloring.
The colors used to display contour variables are determined by the global color map. By default, a color
map called Small Rainbow is used, which is a rainbow of colors from blue to cyan to green to yellow to
red. Color maps can also be linked to specific contour groups. Refer to Section 13 - 3.1 “Fieldmap Layers”
for details.
The color map is used by all frames; if you change the color map to modify the look of
one frame, all frames with contour flooding or any form of multi-coloring are modified
as well.
To change the base color map, call TecUtilColorMapSetBase. You may select one of the following color maps:
• Small Rainbow - Five point color spectrum from blue to cyan to green to yellow to red.
• Large Rainbow - Seven point color spectrum from blue to cyan to green to yellow to red to
purple to white.
• Modern - Seven point color spectrum; colors change in intensity from dark to light within each
color band.
• Gray Scale - Color spectrum from black to white.
• Wild - Random color spectrum. Wild is different each time you select it.
147
• Two-color - A two-color spectrum.
• User-defined - A version of one of the first four options above that can be customized by the
user. You can add or delete control points, as well as change RGB values for each control point.
• Raw User-defined - A version of one of the first four options above that can be customized by
the user. NOTE: You can have only one raw user-defined color map at a time.
You can color an attribute using a given contour group (and therefore color map), by replacing
ColorIndex_t from your Code Generator output with MultiColor_C or MultiColorn_C, where n can be 2 - 8.
Refer to Section “Contour” on page 124 for additional information on working with contour groups.
The following sample code demonstrates changing global colormap number 1 to use the
“modern” colormap:
TecUtilFieldLayerSetIsActive(SV_SHOWCONTOUR, TRUE);
StyleValue sv;
sv.set(ColorMap_Modern, 1, SV_GLOBALCOLORMAP, SV_CONTOURCOLORMAP);
RGB Coloring is set by using the value RGBColor_C where ColorIndex_t is specified in your Code Generator
output. NOTE: The RGB variables must be assigned before any object is set to be colored with RGB
Coloring.
148
Coloring
• RGB Mode - You can either specify all three variables or specify two of the three variables and
calculate the third. The third variable is calculated using the following formula
f(R)+f(G)+f(B)=1.0 (assuming f() is a function that maps R,G,B values into [0,1.0]).
• Channel Variables - Assign the variables that supply the values for the color components, as
specified in the RGB Mode.
• Channel Variable Range - By default, it is assumed that the minimum value for any of the
Channel Variables is zero, the maximum is one, and the sum of the three variables is one at
every point. If the sum is not normalized, you can set a new minimum and maximum. For
example, if your variables sum to 100 at every point, you can specify 100 for Value at
Maximum Intensity.
The following sample code demonstrates a vector plot with RGB coloring. NOTE: This example
assumes a 2D field plot has already been created.
StyleValue sv1(SV_GLOBALTWODVECTOR);
sv1.set( TecUtilVarGetNumByName(“U”), SV_UVAR);
sv1.set( TecUtilVarGetNumByName(“V”), SV_VVAR);
StyleValue sv2(SV_GLOBALRGB);
sv2.set(TecUtilVarGetNumByName(“R”), SV_REDCHANNELVAR);
149
sv2.set(TecUtilVarGetNumByName(“G”), SV_GREENCHANNELVAR);
sv2.set(TecUtilVarGetNumByName(“B”), SV_BLUECHANNELVAR);
Set zoneSet(1);
StyleValue sv3(SV_FIELDMAP, SV_VECTOR);
sv3.set( RGBColor_C, zoneSet, SV_COLOR);
RGB Legend
You can also include an RGB coloring legend in your plot. RGB legends have the following options:
• Size and Position - Specify the position of the anchor point as percentages of the frame width
and height. (You can also move the legend interactively.) Specify the height of the legend in
frame units.
• Orientation - Specify the order of the coloring channels (i.e. RGB, GBR, BGR etc.). The first
channel listed is shown on the lower left corner, the second on the lower right, and the third at
the top.
• Text Labels - You can opt to include text labels in your legend. If included, you can also
customize the color and font of the text.
• Red, Green, and Blue Label - Each channel can be labeled by the name of the assigned
variable, or by text you enter. When a channel has been calculated (no variable assigned), no
label is shown.
• Legend Box - Specify which kind of box you want drawn around the legend (No Box, Filled, or
Plain). If you choose Filled or Plain, format the box using the following controls:
• Line Thickness - Specify the line thickness as a percentage of the frame height.
• Box Color - Choose a color for the legend box outline.
• Fill Color (Filled only) - Choose a color for the legend box fill.
• Margin - Specify the margin between the legend text and legend box as a percentage of
the text height.
The following example code illustrates how to incorporate an RGB Legend in an existing field
plot:
StyleValue sv1;
sv1.set( 3, 1, SV_GLOBALCONTOUR, SV_VAR);
sv1.set( TRUE, SV_FIELDLAYERS, SV_SHOWCONTOUR);
StyleValue sv2(SV_GLOBALRGB);
sv2.set( 1, SV_REDCHANNELVAR);
sv2.set( 2, SV_GREENCHANNELVAR);
150
Axes
sv2.set( 3, SV_BLUECHANNELVAR);
sv2.set( TRUE, SV_LEGEND, SV_SHOW);
Set objectSet(1);
sv1.set( ContourColoring_RGB, objectSet, SV_FIELDMAP,
SV_CONTOUR, SV_FLOODCOLORING);
13 - 6 Axes
Use the Code Generator to determine the syntax for any of the style settings discussed
in this section.
The axes for 3D, 2D, XY, and Polar plot types are automatically enabled. When generating the axes, axis
labels and position, spacing, and labels for tick marks are also created.
The Tecplot Engine maintains five distinct sets of axes, one for each plot type. Each plot type has its own
axis settings. This way you may set different axis styles for each plot type. The Code Generator can
produce all the code required for changing axis styles. To change an axis style, you must be in the
appropriate plot type for that axis, e.g. you must be in the XY Line plot type to make changes to the XY
Line axis styles.
It is also important to note that the XY Line axis can support up to five X-axes and five Y-axes. When
setting styles for an XY Line axis, you must supply an offset1 parameter when using the StyleValue class.
This offset tells the Tecplot Engine which X or Y axis should be changed. By default, all linemaps use the
first X-axis and the first Y-axis.
The following example code illustrates setting the x-axis to use variable 5 and the y-axis to use
variable 9 for the second linemap:
Set objectSet(2);
StyleValue sv(SV_LINEMAP);
sv.set( “Map 2”, objectSet, SV_NAME);
sv.set( 1 , objectSet, SV_ASSIGN, SV_XAXISVAR);
sv.set( 2 , objectSet, SV_ASSIGN, SV_YAXISVAR);
NOTE: you may omit the objectSet parameter to change the value for all linemaps.
151
13 - 6.2 Axis Range
When changing Axis Ranges, it is important to understand that certain axis settings can affect the axis
range. Settings such as “Preserve Length when Changing Range” and “Dependency” can alter the
behavior when changing the axis range. Please keep the following in mind:
• Dependent Axes - When changing one axis, the range of the other axis (or axes) may be
changed automatically to conform to the dependency setting.
• Aspect Ratio - When changing the aspect ratio of the frame (Sketch, XY, and 2D), the axis
ranges will be adjusted such that they obey the Viewport Position settings.
• X- and/or Y-axis Range Frame Linking - Adjusting the range (or frame aspect ratio) in one
frame will affect all other linked frames.
• Preserve Length when Changing Range - If this option is turned off, the Viewport Position is
changed when adjusting the axis range.
• Changing Axis Variables - The range for an axis fits the value of the first variable assigned to
that axis. If you deactivate the current layer and activate another, it may be necessary to reset
the axis range.
The following example code illustrates changing the minimum and maximum values to display
on the first X-axis in a line plot:
152
Annotations
13 - 7 Annotations
You can enhance any plot or create a drawing from scratch using the text and drawing tools. Tecplot 360
provides tools for creating polylines, circles, ellipses, squares, rectangles, and text. You can also insert
BMP, JPEG, or PNG images to enhance your plot. You can further annotate your plots using labels and
legends.
13 - 7.1 Text
The Text options provided by the Tecplot Engine are not accessible via the Code
Generator and the StyleValue class. You will need to use the along with the following
section to enable Text annotations.
In order to add text to the current frame, you must first call TecUtilTextCreate or TecUtilText3DCreate. This
will allow you to specify the position, height and text string. Both functions return Text_ID, which is used
to customize the text (i.e. set font, color, text box properties, etc.) You can change the value of the text
string later with the TecUtilTextSetString function.
You can customize the following attributes of the text string:
• Color - Use TecUtilTextSetColor to set the color value for your text string. Refer to Section 13 -
5 “Coloring” for details on the various color options.
• Font - You can customize the text font style by either setting the font for the entire string with
TecUtilTextSetFont, or you can embed text formatting tags in your text string to set the font
style for a portion of your text string.
• Text Formatting Tags - The text formatting tags and their effects are as follows (format tags are
not case sensitive and may be either upper or lower case):
1. Tecplot 360 does not currently support Mac Excel "1904" format.
153
• Font Weight - Use the bold or italics tags to customize the weight of your text string.
• <b>...</b> - Bold
• <i>...</i> - Italics
• Verbatim - Use the verbatim tag, <verbatim>...</verbatim>, to display a portion of your
text string “as-is”, without any formatting.
• Font Override - Use any of the following tags to override the font settings set with
TecUtilTextSetFont for part of the text string.
• <greek>...</greek> - Greek Font
• <math>...</math> - Math Font
• <userdef>...</userdef> - User-defined Font
• <helvetica>...</helvetica> - Helvetica Font
• <times>...</times> - Times Font
• <courier>...</courier> - Courier Font
The text formatting tags are not available when the font for the string is set to Greek,
Math, or User-defined.
154
Annotations
• Origin - Use TecUtilTextSetAnchorPos to specify the X- and Y-coordinates of the text anchor.
The text anchor sets the justification of the text within the text box. The text is anchored using
the coordinate system specified in TecUtilTextSetCoordSysAndUnits. The anchor point of the text
box is set with TecUtilTextBoxSetAnchor.
• Clipping - Clipping refers to displaying only that portion of an object that falls within a
specified clipping region of the plot. If you have specified your text position in the
CoordSys_Frame coordinate system, the text will be clipped to the frame. If you have specified
the CoordSys_Grid coordinate system, you can choose to clip your text to the frame or the
viewport by calling TecUtilTextSetClipping. The size of the viewport depends on the plot type
as follows:
• 3D Cartesian - The viewport is the same as the frame, so viewport clipping is the same
as frame clipping.
• 2D Cartesian/XY Line - The viewport is defined by the extents of the X and Y axes.
• Polar Line/Sketch - By default, the viewport is the same as the frame.
• Line Spacing - Call TeUtilTextSetLineSpacing to set the line spacing for the text. The units used
are specified with TecUtilTextSetCoordSysAndUnits.
• Margin - Specify the space between the text and box surrounding the text object as a
percentage of the text character height via TecUtilTextBoxSetMargin.
• Text Box - The text string is housed within a text box (which you choose whether or not to
display). Use TecUtilTextBoxSetType to set the style of the box around the text. Select from the
following types:
• TextBox_None -Specify that no box is drawn around the text.
• TextBox_Filled -Use a filled box around the text. NOTE: A filled box is opaque; if you
place it over another object, the underlying object cannot be seen.
• TextBox_Plain - Use a plain box around the text.
If you select TextBox_Plain or TextBox_Filled, you can set the Line Thickness and line color
with TecUtilTextBoxSetLineThickness and TecUtilTextBoxSetColor, respectively. If you select
TextBox_Filled, you can set the box outline fill color with TecUtilTextBoxSetFillColor. Refer to
Section 13 - 5 “Coloring” for information regarding the possible color values.
• Text Box Anchor Location - Specify the anchor point, or fixed point, for the text box with
TecUtilTextBoxSetAnchor. As the text box grows or shrinks, the anchor location is fixed, while
the rest of the box adjusts to accommodate the new size. There are nine possible anchor points,
corresponding to the left, right, and center positions on the headline, midline, and baseline of
the text box.
The following sample code generates a text label with Courier font and a centered anchor point:
Text_ID tid;
tid = TecUtilTextCreate( CoordSys_Grid, 0.0, 0.5, Units_Frame,
2.4, “Data Point 1”);
TecUtilTextSetFont( tid, Font_Courier);
TecUtilTextSetAnchor( tid, TextAnchor_MidCenter);
155
Special Characters
Tecplot 360 supports the ISO-Latin one-character encodings. Characters in the ASCII ordinal range from
160-255 are available. Table 13 - 1 shows the characters supported by the Tecplot 360. Note that the two
right-hand columns represent the extended European characters. Text formatting tags for Greek, Math, or
User-defined characters work only with characters in the range 32-126 and are not available for the
extended European characters.
If your keyboard is configured to produce European characters, then the European characters should
appear and print automatically with no additional setup.
If your keyboard is not configured to produce a specific European character, you can generate it by
including the sequence \nnn in your text where nnn is from the character index table found in Table 13 - 1.
For example, if your keyboard will not generate the é and you want to show the word “latté,” use:
latt\233
In order to use the custom characters, you can either set the font type for the entire text string to Greek,
Math, or User-defined (by using TecUtilTextSetFont), or use the appropriate text formatting tags around
the desired characters.
156
Annotations
Similarly, if you are the using Greek, Math, or User-defined font type, you can use one of the “English”
formatting tags around the subset of characters to display the English characters.
Dynamic Text
You can add dynamic text strings to your text using the syntax below. When dynamic text strings are used,
the displayed text is updated as the data changes.
Variables Notes
&(AUXDATASET:name) The value of the named auxiliary data attached to the dataset.
&(AUXFRAME:name) The value of the named auxiliary data attached to the frame.
&(AUXPAGE:name) The value of the named auxiliary data attached to the page.
&(AUXVAR[nnn]:name) The value of the named auxiliary data attached to variable nnn.
157
Variables Notes
The value of the named auxiliary data attached to linemap Q, where Q = either nnn
or ACTIVEOFFSET = nnn and nnn = linemap number. If ACTIVEOFFSET= is used,
&(AUXLINEMAP[Q]:name)
the integer value indicates the first linemap associated with the nnnth active
fieldmap.
The value of the named auxiliary data attached to Q, where Q = either nnn or
&(AUXZONE[Q]:name) ACTIVEOFFSET = nnn and nnn = zone number. If ACTIVEOFFSET= is used, the
integer value indicates the first zone associated with the nnnth active fieldmap.
&(AXISMAXn) Maximum value of the current n-axis range, where n is one of: Aa, R, X, Y, or Z.
&(AXISMINn) Minimum value of the current n-axis range, where n is one of: Aa, R, X, Y, or Z.
Filename of the nnnth file associated with the current dataset. If nnn is omitted,
&(DATASETFNAME[nnn])
then all dataset filenames are shown, separated by new lines.
&(ENDSLICEPOS[<slice
The position of the ending slice plane.
grouporactiveoffset>])
&(ISDATASETAVAILABLE) Returns a value of 1 if a dataset exists for the current frame, 0 if nonexistent.
&(ISOSURFACELEVEL[<iso
surfacegrouporactiveoffset>] The value of the contour variable on the nnnth iso-surface.
[nnn])
&(MACROFILEPATH) Path to the folder containing the most recently opened macro file.
Maximum value of the blanking variable for the first active constraint. For 2D or
&(MAXB) 3D Cartesian plots, the value is calculated from the active zones. For line plots, the
value is calculated from the zone assigned to the first active linemap.
[I, J, K]-dimension of the first active zone for 2D and 3D Cartesian plot types. For
finite-element data, I represents the number of nodes in the first active zone, J
&(MAXI), &(MAXJ),
represents the number of elements in the first active zone, and K represents the
&(MAXK)
number of nodes per element (cell-based) or total number of faces (face-based) in
the first active zone.
158
Annotations
Variables Notes
&(MAXS) Maximum value of the scatter sizing variable of the active zones.
&(MAXU), &(MAXV), Maximum value of the variable assigned to the [X, Y, Z]-vector component of the
&(MAXW) active zones.
Minimum value of the blanking variable of the first active blanking constraint. For
&(MINB) 2D or 3D Cartesian plots, the value is calculated from all active zones. For line
plots, the value is calculated from the zone assigned to the first active linemap.
&(MINS) Minimum value of the scatter sizing variable for the active zones.
&(MINU), &(MINV), Minimum value of the variable assigned to the [X, Y, Z]-vector component for the
&(MINW) active zones.
Number of processors used. This may be different than the total number on the
&(NUMPROCESSORS machine because of the $!Limits MaxAvailableProcessors configuration file
USED) command, or because of a product limitation. Tecplot Focus is limited to one
processor, while Tecplot 360 is limited to eight.
Plot type of the current frame: 0 for Sketch, 1 for XY Line, 2 for Cartesian 2D, 3 for
&(PLOTTYPE)
Cartesian 3D, and 4 for Polar Line.
&(PRIMARYSLICEPOS
The primary slice position.
[<slicegrouporactiveoffset>])
&(SLICEPLANETYPE[<slice
The type of the slice plane (X, Y, Z, I, J or K-planes).
grouporactiveoffset>])
159
Variables Notes
Solution time of Q, where Q = either nnn or ACTIVEOFFSET = nnn and nnn = zone
number. If ACTIVEOFFSET= is used, the integer value indicates the fist zone
&(SOLUTIONTIME[Q]) associated with the nnnth active fieldmap. &(SOLUTIONTIME[5]) displays the
solution time of the 5th zone. &(SOLUTIONTIME[ACTIVEOFFSET=3]) displays the
solution time of the first zone in the 3rd active fieldmap.
&(STARTSLICEPOS[<slice
The position of the starting slice plane.
grouporactiveoffset>])
&(STREAMSTARTPOS
Starting position (X, Y, Z) of the nnnth streamtrace.
[nnn])
Type (Surface Line, Volume Line, Volume Ribbon, Volume Rod) of the nnnth
&(STREAMTYPE[nnn])
streamtrace.
Color of the mesh for Q, where Q = either nnn or ACTIVEOFFSET = nnn and nnn =
zone number. If ACTIVEOFFSET= is used, the integer value indicates the nnnth
&(ZONEMESHCOLOR[Q])
active zone for field plots or the zone associated with the nnnth active linemap for
line plots.
The zone name of Q, where Q = either nnn or ACTIVEOFFSET = nnn and nnn = zone
number. If ACTIVEOFFSET= is used, the integer value indicates the nnnth active
&(ZONENAME[Q])
zone for field plots or the zone associated with the nnnth active linemap for line
plots.
a. where A represents the theta (or angle) axis variable in Polar Line plots.
The placeholders must be typed exactly as shown, except that the nnn in the zone name and variable name
placeholders should be replaced by the actual number of the zone or variable, such as &(ZONENAME[3]) or
&(VARNAME[2]).
You can, of course, embed the dynamic text strings in text records in a Tecplot-format data file, as in the
following example:
160
Annotations
The following example code illustrates including a text label that displays the date in your plot:
System environment variables can be accessed directly from the Tecplot 360 by using the following:
&($string), where string is the name of your environment variable. Using environment variables within
Tecplot 360 can add another degree of flexibility by taking advantage of your customized environment. If
an environment variable is missing, the environment variable name itself will appear on the screen.
161
13 - 7.2 Geometries
Geometries in the Tecplot Engine are simply line drawings. Geometries include polylines (a set of line
segments), circles, ellipses, rectangles, and squares.
The Geometry options provided by the Tecplot Engine are not accessible via the Code
Generator and the StyleValue class. You will need to use the along with the following
section to enable Geometries.
• Line - There are number of different types of lines that you can create with the Tecplot Engine.
You can create single line segments (i.e. a single line with two defined sets of coordinates),
polylines (i.e. a single line with multiple coordinate pairs), or multi polylines (i.e. multiple
lines, each with multiple coordinate pairs).
• Line Segments - A line segment has two defined endpoints. Call
TecUtilGeom2DLineSegmentCreate or TecUtilGeom3DLineSegmentCreate to add a line segment
to your plot.
• Polylines - A polyline is a line created by a group of line segments. You can add a
polyline to your plot with TecUtilGeom2DPolylineCreate or TecUtilGeom3DPolylineCreate.
• Multiple Polylines - You can create multiple polylines simultaneously by calling
TecUtilGeom2DMPolyCreate or TecUtilGeom3DMPolyCreate. After calling the appropriate
create function, you will also need to call TecUtilGeom2DMPolySetPolyline or
TecUtilGeom3DMPolySetPolyline to define the coordinates of the points in each polyline.
Once the line(s) have been created, you can customize the arrowheads of the line using any of
following options:
• Attachment - Use TecUtilGeomArrowheadSetAttach to specify whether the arrowheads
should be attached at: the beginning of the segment, the end of the segment, both ends,
or not at all.
• Size(%) - Use TecUtilGeomArrowheadSetSize to specify the size of the arrowhead, as a
percentage of frame height.
• Style - Use TecUtilGeomArrowheadSetStyle to specify the style for your arrowhead. The
following styles are available:
Geometry Style
When you create a given geometry with the Tecplot Engine, the create function returns Geom_ID. You can
then use Geom_ID to customize the style and display attributes of that geometry.
162
Annotations
You can place text and geometries in any order you like. The Tecplot Engine draws all
geometries first, in the order in which they were placed, then all text. Use the
TecUtilFramePopXXX and TecUtilFramePushXXX commands to reorder objects in the
viewstack.
163
Example 50:Adding a Square Geometry to your Plot
The following sample code creates a green square with a black outline:
13 - 7.3 Images
The Image options provided by the Tecplot Engine are not accessible via the Code
Generator and the StyleValue class. You will need to use the along with the following
section to enable Images.
You can import images from JPEG, BMP, and PNG files by calling TecUtilGeomImageCreate. These images
can be used as logos or as a backdrop to your plot. Images cannot be included in data files. When you save
a data file, even if you specify to include geometries, any images in the plot are not saved.
In layout and style sheet files, the image is referenced from its original location. This reference can be a
relative reference or an absolute (as with data files).
After you have imported the image, you can customize the following attributes:
• Height and Width - Call TecUtilGeomImageSetHeight or TecUtilGeomImageSetWidth to set the
height or width of the image, respectively. The image will be resized to fit the dimension
specified. As such, the size of a geometry when it is displayed in a frame is not necessarily the
size of the image in the file.
• Resize Filter - The Resize Filter determines how the image is resized to fit the screen. The
following filters are available:
• Fast (textures) - default- OpenGL textures are used to resize the image. This is the fastest
option (given sufficient graphics space). However, the accuracy of the image may suffer,
especially when reducing an image to a size much smaller than it was before.
• Pixelated - Choose this option when the image is much larger than its original size and
you want to see the individual pixels. This option is slower than the Fast (textures) filter
for increasing the size of images.
164
Blanking
• Smooth - There are seven smoothing options, all producing slightly different effects.
These options are slower than the Fast (textures) filter, but produce better effects for
highly reduced images. In general, use the Smooth (Lanczos2) option unless you have
specific image processing needs.
The resize filter has no effect on vector-based output, only on the screen and for
exported images.
13 - 7.4 Labels
You can label all or some of the data points or nodes in your field plots with either the index value(s) of the
data point or the value of some specified variable at each point. You can also label each cell or element of
the data with its index (which for finite-element data is its element number).
You can label all or some of the data points or nodes in your line plots with either the index of the data
point, the value of the dependent variable at the point, or both the values (X & Y or Theta & R) for the data
point.
Use the Code Generator to determine the syntax for including labels in your plots.
13 - 8 Blanking
Use the Code Generator to determine the syntax for any of the style settings discussed
in this section.
Blanking allows you to exclude specific portions of fieldmaps from being plotted (in other words,
selectively display certain cells or data points). In 3D, the result is analogous to a cutaway view. In general,
all types of blanking affect all field layers, fieldmaps, and all other plot attributes with the following
exceptions:
Plot attributes not affected by blanking:
165
• Value Blanking - Cells (or portions of cells) of selected fieldmaps or line plot mappings are
excluded based on the value of the value-blanking variable at the data point of each cell or at
the point where each cell intersects with a constraint boundary.
• IJK Blanking - Cells of one IJK-ordered fieldmap are included or excluded based on the index
values. (IJK-ordered fieldmaps only)
• Depth-Blanking - Cells in a 3D plot are visually excluded based on their distance from the
viewer plane. (3D fieldmaps only)
All types of blanking may be used in a single plot. They are cumulative: cells blanked from any of the
options do not appear. Value Blanking and Depth Blanking affect selected fieldmaps of all types, while
IJK-blanking affects a single IJK-ordered fieldmap.
13 - 9 Frame Linking
Use the Code Generator to determine the syntax for any of the style settings discussed
in this section.
The frame linking feature allows you to link specific style attributes either between frames or within a
frame. Linking between frames allows you to quickly make changes in one frame and propagate them
through a number of other frames. Linking within frames links attributes between similar objects within a
frame. Refer to Section 2 - 3 “Frames” for background information on frames.
166
Frame Linking
• XY-axis Position (For XY Line and 2D plots) - Links the positioning of the X- and Y-axes
between frames, including the method used for positioning the axes, such as aligning
with an opposing axis value.
• Polar Plot View - Link views for frames using the Polar Line plot type.
• 3D Plot View - Link the 3D axes and 3D view.
• Slice Positions - Link slice positions and slice planes for active slices (but not slice
style).
• Iso-Surface Locations (for 3D Plots) - Link iso-surface values (but not iso-surface plot
style).
• Contour Levels - Link the values and number of contour levels for 2D and 3D plots.
• Value Blanking Constraints - Link all value blanking attributes.
Use the Code Generator to determine the syntax for frame linking with the StyleValue class.
After you specify the frame linking settings and group number for each frame, any changes you make in a
linked frame will be propagated to the other members of that group. NOTE: Every member of a given
group does not have to link the same attributes. For example, if frames 3, 4 and 5 are all members of group
2, but only frames 3 and 5 have the 3D View linked, the 3D View will change in frame 5 only when the
view is shifted in frame 3 (and visa versa).
The following example code illustrates linking the 3D View between frames. This example
assumes you have two frames established, both showing a 3D plot:
TecUtilFrameLightweightPopStart();
TecUtilFrameLightweightPopNext();
StyleValue sv1( SV_LINKING, SV_BETWEENFRAMES, SV_LINK3DVIEW);
sv1.set( TRUE );
TecUtilFrameLightweightPopNext();
TecUtilFrameLightweightPopEnd();
sv1.set( TRUE);
167
using the StyleValue class. New frames added to a group take on the characteristics of previous members
of the group.
You can apply the above settings to multiple frames simultaneously by selecting the
group of frames. Refer to Chapter 21: “Working with Picked Objects” for instructions for
identifying the selected frame(s).
The following example illustrates linking axis style between two existing frames:
TecUtilFrameLightweightPopStart();
TecUtilFrameLightweightPopNext();
StyleValue sv(SV_LINKING, SV_BETWEENFRAMES);
sv.set(TRUE, SV_LINKXAXISRANGE);
168
Animation
sv.set(TRUE, SV_LINKYAXISRANGE);
sv.set(TRUE, SV_LINKAXISPOSITION);
TecUtilFrameLightweightPopNext();
TecUtilFrameLightweightPopEnd();
sv.set(TRUE, SV_LINKXAXISRANGE);
sv.set(TRUE, SV_LINKYAXISRANGE);
sv.set(TRUE, SV_LINKAXISPOSITION);
13 - 10 Animation
While the Code Generator will output code for animation, it is more efficient to use the
TecUtil functions for animation.
You can create Flash, Raster Metafile, and AVI animation files using the following types of animation
plots:
• IJK-plane Animation - You can display all or a specified subset of the IJK-planes in your
dataset, one at a time using TecUtilAnimateIJKPlanesX. You can choose to animate either the I, J,
or K-planes.
• IJK-blanking Animation - Animate a sequence of renderings starting with an initial set of
blanked IJK indices and proceeding in a series of interpolated steps to a final set of blanked IJK
indices using TecUtilAnimateIJKBlankingX. Before you can animate IJK-blanking, you must first
activate IJK-blanking. Refer to Section 13 - 8 “Blanking” for details.
• Iso-surfaces Animation - Animate iso-surfaces either on screen or to a file. You must specify a
starting value, an ending value, and the number of steps using TecUtilAnimateIsoSurfaces. If
you specify a start level with a higher number than the end level, the Tecplot Engine cycles
backward from the start to the end.
• Mapping Animation - Display all or a specified subset of the XY or Polar Line mappings
defined in the current frame, one at a time using TecUtilAnimateLineMapsX.
• Slice Animation - Animate slices either on screen or to a file using TecUtilAnimateSlicesX. You
must specify a starting value, an ending value, and the number of steps. If you specify a start
level with a higher number than the end level, the Tecplot Engine cycles backward from the
start to the end.
• Streamtrace Animation - Animate slices either on screen or to a file using
TecUtilAnimateStreamX. You must specify the number of steps per cycle and the number of
cycles.
• Zone Animation - Animate zones/fieldmaps either on screen or to a file using
TecUtilAnimateZonesX. This option is not available for transient datasets.
• Time Animation - Animate transient data using TecUtilAnimateTimeX. See also Section 13 - 11
“Working with Transient Data”.
Use the Code Generator to determine the syntax for any of the above animation styles.
169
The following sample code illustrates how to animate iso-surfaces in an existing 3D Plot
containing volume data:
ArgList arglist;
arglist.appendDouble( SV_STARTVALUE , -0.95);
arglist.appendDouble( SV_ENDVALUE , 1.95);
arglist.appendInt( SV_NUMSTEPS , 25);
arglist.appendInt( SV_LIMITSCREENSPEED, TRUE);
arglist.appendDouble( SV_MAXSCREENSPEED , 10.6);
TecUtilAnimateIsoSurfacesX( arglist.getRef() );
• Transient zones - Zones associated with time. The transient zone(s) displayed in the current
frame are dependent upon the current solution time. Zones 2-13 in Table 13 - 3 are transient
zones.
• Static zones - Zones not associated with time. They are displayed regardless of the current
solution time. Zones 1 and 14 from Table 13 - 3 are static.
• Current Solution Time - The value that determines which transient zones are displayed in the
current frame.
• Strand - A series of transient zones that represent the same part of a dataset at different times.
Zones 2, 5, 8, and 11 in Table 13 - 3 all have the same StrandID and, therefore, are part of the
same strand.
• StrandID - An integer value defined for each transient zone. The StrandID of a given zone is
determined by the data loader.
170
Working with Transient Data
• Relevant Zone - Only “relevant zones” are plotted at a given solution time. A relevant zone is
defined as a zone for a given strand used for a certain solution time. If the strand exists at
solution time n, the relevant zone is either the transient zone on that strand defined explicitly
at solution time n, or the zone defined immediately prior to solution time n. If the strand does
not exist at solution time n, there are no relevant zones for that strand at that time. Static zones
are always considered relevant zones. Figure 13-18 below illustrates how relevant zones are
determined.
Figure 13-18. An illustration of how relevant zones are determined (based on the data
in Table 13 - 3). For a given solution time, ONLY the relevant zones are
displayed in the plot. NOTE: static zones are always considered relevant
zones.
t = .2s - The red-colored transient zones and both static zones are plotted. NOTE:
no zones from the first strand are represented because the strand is not defined at
that time.
t = .4s - The green-colored transient zones and both static zones are plotted.
t = .6s - The blue-colored transient zones and both static zones are plotted. NOTE:
ArgList_pa ArgList;
ArgList = TecUtilArgListAlloc();
TecUtilArgListAppendInt(ArgList,SV_CREATEMOVIEFILE,TRUE);
TecUtilArgListAppendInt(ArgList,SV_EXPORTFORMAT,ExportFormat_AVI);
TecUtilArgListAppendString(ArgList, SV_FNAME , “Time.avi”);
TecUtilArgListAppendDouble(ArgList, SV_STARTTIME, 0.000000);
TecUtilArgListAppendDouble(ArgList, SV_ENDTIME , 0.002419);
TecUtilAnimateTimeX(ArgList);
TecUtilArgListDealloc(&ArgList);
171
13 - 12 View Options
The View options provided by the Tecplot Engine are not accessible via the Code
Generator and the StyleValue class. You will need to use the along with the following
section to enable view control.
You can adjust the view in the current frame using the following options:
• Rotation
• Translation
• Zoom
13 - 12.1 Rotation
You may rotate your field plots using either 2D Rotation or 3D Rotation.
2D Rotation
Two-dimensional field data can be rotated about a user specified XY-origin. Two-dimensional data
rotation can be performed with the TecUtilDataRotate2D function.
The prototype for TecUtilDataRotate2D is:
Boolean_t TecUtilDataRotate2D ( Set_pa ZoneSet,
double RotateAmountInDegrees,
double XOrigin,
double YOrigin
)
RotateAmountInDegree
Specify the angle of rotation, in degrees.
s
3D Rotation
Use TecUtilViewRotate3D to work with three-dimensional rotation. You can perform three-dimensional
rotation about any of the following rotation axes:
• X, Y, or Z-Axis - Rotation about one of the three axes: X, Y, or Z.
• Psi, Theta or Alpha-Axis - Spherical rotation about the Psi, Theta or Alpha axis.
• Horizontal or Vertical RollerBall - Rotation like a roller ball, that is horizontal movements, are
right and left from the current position; vertical movements rotate up or down from the
current position; and twist is about the current screen Eye/Origin ray.
• Vector - Specify a vector to rotate about.
172
View Options
• Center of Rotation - Use this option to set the center of rotation to be the Center of Data (the
center of the bounding box of the data) or Center of View (the point hit by a probe at frame
coordinates 50%, 50%).
Center of View can result in an error if there is no data in the center of the frame. If this
is the case, the center of rotation will not move.
The following sample code illustrates how to rotate the plot by 65% about the Z-axis translated to
the currently defined origin:
TecUtilViewRotate3D( RotateAxis_Z,
0.65*360,
0, 0, 0,
RotateOriginLocation_DefinedOrigin);
The following sample code illustrates how to change the center of rotation to 1,1,1:
13 - 12.2 Translation
You can translate your display in the following ways:
• Plot - Use TecUtilViewTranslate to shift the plot in the X and/or Y direction.
• WorkView - Use TecUtilWorkViewTranslate to shift the view of the workspace.
13 - 12.3 Zoom
Similar to translation, you can zoom into either the plot or the workspace using TecUtilViewZoom or
TecUtilWorkViewZoom, respectively. Use TecUtilViewSetMagnification to set the magnification factor.
173
Example 58:Adjusting the Magnification Factor
The following sample code illustrates how to change the Magnification Factor to 0.85:
TecUtilViewSetMagnification(0.85);
174
14
Code Generator
In order to set or get a Tecplot 360 style value, you must know the hierarchy of the value in which you are
interested, as well as the available style values. The hierarchy of the value can be determined using the
Code Generator add-on. The values available for a given parameter can be determined using the Code
Generator, coupled with the ADK Reference Manual.
The variety of style option available are discussed in detail in Chapter 13: “Setting Plot Style”.
14 - 1 Style Hierarchy
The Tecplot Engine uses an extensive style hierarchy to isolate each plot attribute, with attributes such as
fieldmap, linemap, interface, global paper and sketch axis at the top level of the hierarchy. Items such as
plot type, plot layer, and derived object (i.e. iso-surface, slice or streamtrace) are immediately below the
top level, followed by a characteristic of the secondary item.
For example, the contour style or type is a secondary characteristic of the contour plot layer (which is an
attribute of a fieldmap). As such, the data hierarchy for ContourType (e.g. lines or flood) is:
FIELDMAP, CONTOUR, CONTOURTYPE
The following list shows the hierarchy for the style values for the main "Axis Line" for the Y-Axis in 2D
plots1:
$!TwoDAxis YDetail {AxisLine {Show = (Boolean_t)}}
$!TwoDAxis YDetail {AxisLine {ShowPerpendicular = (Boolean_t)}}
$!TwoDAxis YDetail {AxisLine {ShowBothDirections = (Boolean_t)}}
$!TwoDAxis YDetail {AxisLine {ShowOppositeEdge = (Boolean_t)}}
$!TwoDAxis YDetail {AxisLine {Color = (ColorIndex_t)}}
$!TwoDAxis YDetail {AxisLine {LineThickness = (double)}}
$!TwoDAxis YDetail {AxisLine {Alignment = [AxisAlignment_e]}}
$!TwoDAxis YDetail {AxisLine {OpposingAxisValue = (double)}}
$!TwoDAxis YDetail {AxisLine {Position = (double)}}
$!TwoDAxis YDetail {AxisLine {Angle = (double)}}
$!TwoDAxis YDetail {AxisLine {Offset = (double)}}
$!TwoDAxis YDetail {AxisLine {Edge = (SmInteger_t)}}
1. An exhaustive list of the style hierarchy can be viewed by examining the comlist file supplied with your dis-
tribution. This file lists the hierarchy in the form of the corresponding native macro command syntax includ-
ing the assignment type for each entry. The comlist file is located in the home directory.
175
In general, a style command contains the following information:
primary offset (if applicable) Offset needed to access the nth item.
ItemSet (if applicable) Set of items to apply the style to (e.g. set of linemaps)
new value New value to apply (e.g. color, line thickness value, etc.)
The Code Generator add-on is provided to help you determine the style hierarchy for a plot attribute you
wish to expose. The overview of the Tecplot Engine style hierarchy in this section is provided for your
convenience.
The StyleValue command needed to change the line thickness of the Y-Axis in a 2D plot to 1.5 is:
StyleValue styleValue;
styleValue.set(1.5, SV_TWODAXIS, SV_XDETAIL,
SV_AXISLINE,SV_LINETHICKNESS);
The "SV" constants mimic the macro command navigation options with a "SV_" prefix.
In some cases a set or offset (or two offsets) are also needed to identify the exact entity to modify.
For example, in line plots there can be multiple X- or Y-Axes. Use the following code to set the line
thickness for the third Y-Axis in a line plot:
styleValue.set(2,3,SV_XYLINEAXIS,SV_XDETAIL,SV_AXISLINE,
SV_LINETHICKNESS);
176
Code Generator
Most of the time you will be applying style to just one entity. In some cases the style can be
applied to a set of entities with one command. This is true for fieldmaps and linemaps. For
example, use the following code to change the mesh color for the first three fieldmaps to Green.
Set objectSet("[1-3]");
styleValue.set(Green_C, objectSet, SV_FIELDMAP, SV_MESH, SV_COLOR);
14 - 2 Code Generator
The Code Generator is an add-on that displays the style value code corresponding to any plot style
changes you have made. You have the option to display the code using either the Tecplot Toolbox
StyleValue class, Python, or classic code (which uses a series of TecUtil function calls). We highly
recommend that you use the Tecplot Toolbox StyleValue class, as it is much easier to use than the classic
code. Not only does the StyleValue class handle memory management issues, it also requires a fraction of
the code. If you are an add-on developer working with the Tecplot 360, you may be more comfortable with
the classic TecUtil code. However, you will probably find the StyleValue class to be much easier to use.
The Code Generator will not produce code for interactive style changes, such as using
the mouse to rotate or translate, or manipulating data, etc. To perform these actions,
you must search through the ADK Reference Manual for the TecUtil function(s) that
meet your needs.
objectSet.assign("[1]");
styleValue.set((ContourType_e)2, objectSet, SV_FIELDMAP, SV_CONTOUR,
SV_CONTOURTYPE);
1. When working with the Code Generator, it is imperative that Tecplot 360 be in the state your end users will
be in before you generate the code. Otherwise, the results may not be as expected. For details on creating
and customizing plots in Tecplot 360, please refer to the Tecplot 360 User’s Manual (included in with your
Tecplot 360 distribution).
177
To set the “ContourType” parameter to ContourType_Flood, the code is:
Set objectSet("[3]");
styleValue.set((ColorIndex_t)3, objectSet, SV_FIELDMAP, SV_MESH,
SV_COLOR);
You will need to make accommodations for the object set and color to be determined via user
input. See also Chapter 24: “Sets”.
• Offsets - Some style items are part of an array (or two-dimensioned array) of settings. For
example, iso-surface settings are assigned to a particular iso-surface group. In order to modify
iso-surface style, you must provide the group number as the offset.
For example,with the Code Generator running, activate iso-surfaces for group 3 and then elect
to display the mesh on the iso-surfaces. The Code Generator will output:
StyleValue styleValue;
styleValue.set((Boolean_t)1, 3, SV_ISOSURFACEATTRIBUTES,
SV_SHOWGROUP);
styleValue.set((Boolean_t)1, 3, SV_ISOSURFACEATTRIBUTES, SV_MESH,
SV_SHOW);
To use this in your code change "(Boolean_t)1" to "TRUE":
StyleValue styleValue;
styleValue.set(TRUE, 3, SV_ISOSURFACEATTRIBUTES, SV_SHOWGROUP);
styleValue.set(TRUE, 3, SV_ISOSURFACEATTRIBUTES, SV_MESH, SV_SHOW);
178
Code Generator
The Code Generator will not produce code for interactive style changes, such as using the mouse to rotate
or translate, or manipulating data, etc. To perform these actions, you must search through the ADK
Reference Manual for the TecUtil function(s) that meet your needs.
179
180
15
Porting Add-ons
Ideally, the process of transferring an add-on between operating systems begins when you write the first
version of your add-on. The cross-platform strategy revolves around creating the original add-on with
cross-platform-compatible ingredients. For many users, this means writing the add-on in C, since many
Linux machines have C compilers readily available.
If your add-on has a graphical user interface, we recommend you use the Tecplot GUI Builder (TGB), or
another code library which is portable between platforms. If your add-on uses MFC, then you must isolate
the MFC code as much as possible and include separate code for Motif®.
181
1. Follow the directions in Chapter 3: “Creating Add-ons on Windows Platforms” for creating a
non-MFC DLL in Visual Studio. It is important that you select "Win32 Project" as the project
template, and “DLL” as the Application Type in the Application Wizard.
2. Move all of the *.c, *.cpp, and *.h files and gui.lay from your Linux project directory to the new
project directory on your Windows machine.
3. In Visual Studio, select “Add Existing Item” from the Project menu, and add all of the *.c and
*.h files. Right-click on the guibld.c file in the Solution Explorer window, and open the
Properties dialog. On the General page of the Configuration Properties, set the toggle
“Excluded file from Build” to “Yes”. Select [OK].
4. Link with wingui.lib.
5. Select Build>Build Solution to build your add-on.
182
Part 4 Lists and
Sets
184
16
Argument Lists
Several TecUtil functions require a flexible, or extended, argument list. The ArgList class in the Tecplot
Toolbox is provided to handle these TecUtil functions. ArgLists provide a method to supply a variable set
of name-value pairs when calling a function. Most of these values are optional.
When an extended function is created or as new capabilities are added to an existing extended function,
reasonable default values are assigned whenever appropriate. The defaults also provide backward
compatibility for written and compiled with prior versions of Tecplot.
All TecUtil functions that use extended argument lists end with the capital letter X, distinguishing them
from standard argument list functions. Where appropriate, a standard argument list function is provided
along with the extended version so that common uses of the function are not burdened with the additional
instructions required for the extended version.
ArgList argList;
argList.appendString(SV_NAME, "New Zone");
argList.appendInt(SV_ZONETYPE, ZoneType_Ordered);
argList.appendInt(SV_IMAX, 10);
TecUtilDataSetAddZoneX(argList.getRef());
185
16 - 2 TecUtil Functions that Use Argument Lists
Currently, argument lists are used in the following TecUtil functions:
TecUtilSaveLayoutX
TecUtilReset3DOriginX
TecUtilAnimateZonesX
TecUtilAnimateContourLevelsX
TecUtilAnimateIJKPlanesX
TecUtilAnimateIJKBlankingX
TecUtilAnimateStreamX
TecUtilAnimateSlicesX
TecUtilImageBitmapCreateX
TecUtilDataSetAddZoneX
TecUtilAnimateLineMapsX
TecUtilStateChangedX
TecUtilTransformCoordinatesX
TecUtilZoneCopyX
TecUtilCreateSliceZoneFromPlneX
186
17
String Lists
A string list is simply a list or collection of strings. The StringList_pa type is simply a handle to a string list
maintained by the Tecplot Engine. There are several TecUtil functions provided to handle the
StringList_pa type, and a number of TecUtil functions require the StringList_pa type as a parameter. For
example, string lists are used when loading data - the list of data files to load is contained in a string list.
The Tecplot Toolbox provides a class, tecplot::toolbox::StringList, which deals with the StringList_pa
type. The StringList class manages the StringList_pa type in such a way that the client generally does not
have to worry about memory management issues as you would when using the legacy TecUtilStringList
family of functions. To use the Tecplot Toolbox, you must include tptoolbox.h in your project.
A notable exception is when the StringList_pa type is an output parameter or return value of a TecUtil
function, then the StringList_pa must be deallocated using TecUtilStringListDealloc.
187
Example 65:Working with StringList_pa as an Output Parameter
char *loaderName;
StringList_pa tmpInstructions;
TecUtilImportGetLoaderInstr(&loaderName,
&tmpInstructions);
// Assign tmpInstructions to loaderInstructions
tecplot::toolbox::StringList loaderInstructions(tmpInstructions);
TecUtilStringDealloc(&loaderName);
TecUtilStringListDealloc(&tmpInstructions);
... do something with loaderInstructions ...
int i = 0;
int count = 0;
char *file_name = NULL;
Boolean_t selected = FALSE;
StringList_pa selected_file_names = NULL;
StringList_pa default_file_names = NULL;
.
.
.
/* Set up the default file name list. */
default_file_names = TecUtilStringListAlloc;
TecUtilStringListAppendString(default_file_names, "a.dat");
TecUtilStringListAppendString(default_file_names, "b.dat");
188
Tecplot Toolbox StringList Examples
189
190
18
Sets
A set is a group or collection of zones, variables, or line-mappings. The set is a convenient way of dealing
with groups of numbers. Each number that exists in a set is referred to as a member of the set. The Set
class in the Tecplot Toolbox is provided to deal with this type.
A set will not accept a value that already exists within it. In other words, if the set already contains a value
of 2, adding another 2 does not change the list of values or the count of total values. This ensures a
compact set without duplicates. Sets are also sorted and are limited to values of greater than or equal to
one.
In many cases where a set is used, you may pass NULL to indicate all values. For example,
TecUtilReadDataSet takes a parameter which is the set of zones you want to read. If you pass NULL for this
parameter, all zones are loaded. To determine whether you can use NULL in this manner, refer to the . When
using the tecplot::toolbox::Set class provided by the Tecplot Toolbox, you must explicitly pass NULL
rather than using the Set::getRef method, since the Set class always maintains a non-NULL Set_pa handle.
191
Example 67:Getting the Set of Enabled Zones
Set_pa zoneSet;
TecUtilZoneGetEnabled(&zoneSet);
Set enabledZones(zoneSet);
TecUtilSetDealloc(&zoneSet);
if ( enabledZones.isMember(3) )
{
// Do something to zone 3
}
192
TecUtil Functions that Use Sets
zone = zoneSet.getNext(zone);
}
193
The following example shows uses of all of the TecUtilSetxxx functions:
/*
* Create two sets, A and B. A will have 1,2,3 for its
* members, and B will have 4 and 9.
*/
Set_pa A;
Set_pa B;
A = TecUtilSetAlloc(TRUE);
B = TecUtilSetAlloc(TRUE);
if (A && B)
{
SetIndex_t Position, Member;
/*
* Add the members to the sets.
*/
TecUtilSetAddMember(A,1,TRUE);
TecUtilSetAddMember(A,2,TRUE);
TecUtilSetAddMember(A,3,TRUE);
TecUtilSetAddMember(B,4,TRUE);
TecUtilSetAddMember(B,9,TRUE);
/*
* Check to see if the sets are equal.
*/
if (TecUtilSetIsEqual(A,B))
TecUtilDialogErrMsg("Something is wrong here");
/*
* Clear out set A.
*/
TecUtilSetClear(A);
/*
* Make A a copy of B.
*/
TecUtilSetCopy(A,B,TRUE);
/*
* Get the position of the member '9' of set B
* (the result is '2').
*/
Position = TecUtilSetGetPosition(B,9);
/*
* Get the member located at position '2' of set A
* (the result is '4').
*/
Member = TecUtilSetGetMember(A,Position);
/*
* Get the member located after the member '4' of
* set A (the result is '9').
*/
Member = TecUtilSetGetNextMember(A,Member);
/*
* Remove the first valid member from B.
*/
if (TecUtilSetGetMemberCount(B) > 0)
{
int I = 1;
while (!TecUtilSetIsMember(B,I))
I++;
TecUtilSetRemoveMember(B,I);
194
TecUtil Functions that Use Sets
/*
* Show a warning dialog if B is now empty.
*/
if (TecUtilSetIsEmpty(B))
TecUtilDialogMessageBox("B is empty", MessageBox_Warning);
/*
* Finally, deallocate the sets.
*/
TecUtilSetDealloc(&A);
TecUtilSetDealloc(&B);
}
195
196
Part 5 Additional
Functionality
19
Augmenting the Macro Language of
Tecplot 360
Tecplot 360’s macro language allows you to automate tasks that are performed repeatedly. Macro
functions can be assigned to buttons in the Quick Macro Panel, or used to load and process data retrieved
from a large number of files. You can augment Tecplot 360’s macro language with your add-on’s own
macro functions, allowing your add-on’s tasks to be automated as well.
199
This example uses an add-on that sums the areas (or volumes) of all cells in a specified list of zones. You
want to create a macro command that can tell your add-on which zones to process.
The first task is to create a function in your add-on that can handle these instructions. This function will
look something like:
19 - 2 Error Processing
If your macro command callback function detects an error during processing or in the command string, it
is required to do the following:
1. Allocate enough space for an error message by calling TecUtilStringAlloc. The ErrMsg
parameter to the callback function must be assigned to this space.
2. Generate an appropriate error message and place it into the space created in Step 1.
3. Return with a value of FALSE.
For example, if the function ProcessSumCellsCommand in the previous section detects that a zone specified in
the command does not exist (and this is determined to be an error condition). The coding for
ProcessSumCellsCommand may then look like:
200
Recording Custom Macro Commands
double SumTotal = 0;
/*
* Scan CommandString and pull out zones to sum. The function
* GetNextZone pulls out the next zone number and advances CPtr.
* SumNextZone attempts to calculate a sum in the next zone and
* returns FALSE if the zone requested is invalid.
*/
Now we will examine code that allows Equate’s compute function to be run from a macro command. All of
the examples of the source code shown in this manual are included in the Tecplot 360 distribution in:
201
$TEC_360_2011R2 /ADK/Samples/Equate. Refer to “Equate Add-on” on page 80 for the introductory steps
for this add-on.
The first step is to decide what information is required by the add-on. In this case, Equate only requires
that the value is sent to the Compute function. To write out the macro command, we will use the
TecUtilMacroRecordExtCommand function. All TecUtil functions are defined in the ADK Reference Manual.
Note the Compute_BTN_D1_CB function in guicb.c:
TecUtilLockStart(AddOnID);
strMulNum = TecGUITextFieldGetString(MulNum_TF_D1);
if (TecUtilDataSetIsAvailable())
{
Compute(atof(strMulNum));
if (TecUtilMacroIsRecordingActive())
TecUtilMacroRecordExtCommand(“equate”, strMulNum);
}
else
TecUtilDialogErrMsg(“No data set available.”);
TecUtilStringDealloc(&strMulNum);
TecUtilLockFinish(AddOnID);
}
We check to see if a macro is being recorded before we write out the macro command. When
TecUtilMacroRecordExtCommand is called, it will add the following lines to the macro file:
$!EXTENDEDCOMMAND
COMMANDPROCESSORID=’equate’
COMMAND=’2’
COMMANDPROCESSORID tells Tecplot 360 which add-on to send the command to, and COMMAND is the value in the
text field of Equate’s dialog. Now that a macro command is being written out, write a function to decode it.
When a macro is running, Tecplot 360 will send the information following COMMAND to the add-on. In this
case, the only item that COMMAND contains is a number. Tecplot 360 sends all the information following
COMMAND as a string.
Examine the following function in main.c:
202
Recording Custom Macro Commands
In order to process macros, you must register a callback function. The callback must follow the signature
TecUtilLockStart(AddOnID);
IsOk = TecUtilDataSetIsAvailable();
if (IsOk)
{
Compute(atof(CommandString));
}
else
{
*ErrMsg = TecUtilStringAlloc(2000, “Error message”);
strcpy(*ErrMsg, “No data set available.”);
}
TecUtilLockFinish(AddOnID);
return IsOk;
}
used as shown in the ProcessEquateCommand. This function is similar to the Compute_BTN_D1_CB function in
guicb.c. There is no error checking of the value of CommandString. This is left as an exercise.
In main.c note the registration of the ProcessEquateCommand macro command callback from within the add-
on initialization code:
AddOnID = TecUtilAddOnRegister(
100,
ADDON_NAME,
“V”ADDON_VERSION”(“TecVersionId”) “ADDON_DATE,
“Joe Coder”);
TecUtilMenuAddOption(“Tools”,
“Equate”,
‘E’,
MenuCB);
TecUtilMacroAddCommandCallback(“equate”, ProcessEquateCommand);
}
TecUtilLockOff();
}
203
Equate is now complete. Compile and run your add-on. Try recording and playing back various macros to
verify that the new functions you have added work properly.
204
20
The initial loading of a data set and most changes made to a data set after loading are actions that can be
journaled. In face, mot built-in data modification actions in the Tecplot Engine will automatically journal
for you. However, custom data modifications performed directly by your application or add-on, must be
journaled by hand. Executing the data journal recreates the data by loading data files and performing
modifications. The figure below shows how the data journal plays an important role in the lifecycle of a
layout file.
Figure 20-1. The life cycle of a layout file. Data journaling occurs in
Step 6, when the data loader has finished loading and
the load instructions have been registered.
When a layout is saved, rather than saving a new data file, the Tecplot Engine can reference the original
data file and store only the modifications to the data within the layout file. This eliminates duplication of
data and saves disk space.
205
20 - 1 Data Journaling Prerequisites
In order to journal a custom data modification, the following conditions must be met:
• There must be a data set attached to the current frame.
• The data set must have a valid journal.
• The data modification must involve only one data set.
• The data modification must not rely on style settings.
The first two prerequisites are easily verified with TecUtil functions calls. The third prerequisite arises
from the fact that frames and their data sets can appear in layout files in any order. You cannot be certain
that one data set will be created prior to another data set. As such, data journaling cannot rely on the order
in which data sets are created. If your creates or modifies one data set based on values in a different data
set, this criterion is violated, and the operation cannot be journaled.
The final prerequisite arises from the fact that data journals in layout files are executed prior to any style
commands. Style settings include axis, contour and other variable assignments. So if your performs a
custom data modification that uses the identity of the axis variables, then you need to include the axis
variable assignments in your journal command, because your will not be able to query the Tecplot Engine
for that information when the journal is executed.
The below code verifies there is a current data set. If so, it suspends data set marking and
performs an action that modifies the data set. It then verifies that the data journal is valid, and
records an $!EXTENDEDCOMMAND macro command to the data journal. Finally, it reactivates data set
marking. Note that it stores the identity of the X-axis variable, which the will need to use when
the journal is executed:
if (TecUtilDataSetIsAvailable())
{
EntIndex_t XAxisVar;
char Command[256];
/* Suspend dataset marking. */
TecUtilDataSetSuspendMarking(TRUE);
/* Modify the dataset. */
ModifyDataSet();
XAxisVar = TecUtilVarGetNumByAssignment(X);
sprintf( Command,
“DoStuff XAxisVar=%d”,
(int)XAxisVar);
if (TecUtilDataSetJournalIsValid())
206
Inhibiting Marking of the Data Set
{
TecUtilDataSetAddJournalCommand(COMMANDPROCESSORID,
Command,
NULL); /* RawData */
}
TecUtilDataSetSuspendMarking(FALSE);
}
207
208
21
Once your add-on is complete, you may find that there are many details and instructions you would like
to make available to users. Online Help is an effective way to include necessary details and instructions. It
is an effective way of ensuring that needed information can easily be accessed from your add-on.
The Tecplot GUI Builder (TGB) provides an easy way for you to add on-line help to your add-on. Each
modal and modeless dialog created with TGB has a [Help] button and associated callback. You are free to
do any processing or use any help system you wish in the callback. Refer to Chapter 25: “Tecplot GUI
Builder” for additional information.
The Tecplot 360 ADK API has also provided a function, TecUtilHelp which can display any HTML file
when the user selects the [Help] button. This chapter will explain how to use TecUtilHelp to add on-line
help to your add-on.
209
TecUtilLockFinish(COMMANDPROCESSORID);
}
Change this to:
We strongly recommend you install your help files in Tecplot 360's help directory.
210
Using the Tecutilhelp Function
To add help to the Equate add-on, create a simple HTML document to serve as your help file, naming it
equate.html.
Refer to “Equate Add-on” on page 80 and “Adding Macro Commands to the Equate Add-
on” on page 201 for the preliminary steps to this tutorial.
211
212
22
An object in the Tecplot Engine is any item that appears in the workspace that can be selected and can have
actions performed on it. Geometries, axes, frames, legends, streamtraces, zones, and XY mappings are all
examples of objects that can be picked.
There are a number of ways to select, or pick, objects. You can use TecUtilMouseSetMode to modify which
actions are allowed after a pick has occurred. To programmatically pick objects, you can use
TecUtilPickAddAllInRect to select objects within a confined rectangle, or TecUtilPickAddAll to select all
objects of a specific type (e.g., all geometries or all zones). When an object is picked, selection handles are
drawn (graphics that indicate that the object is selected and can be manipulated) or boxes around the
object.
, picked objects are handled through the pick list. The pick list is an indexed list of objects that are currently
selected. The objects in the list are typically sorted in the same order in which they were picked.
22 - 1 Object Types
Object types are used in many of the functions related to picked objects. An object type is specified with
the PickObjects_e enumerated type. You may pick the following types of objects:
PickObject_Frame
PickObject_Axis
PickObject_3DOrientationAxis
PickObject_Geom
PickObject_Text
PickObject_ContourLegend
PickObject_ContourLabel
PickObject_ScatterLegend
PickObject_LineLegend
PickObject_ReferenceVector
PickObject_ReferenceScatterSymbol
PickObject_StreamtracePosition
PickObject_StreamtraceTermLine
PickObject_Paper
PickObject_Zone
PickObject_LineMapping
PickObject_StreamTraceCOB
PickObject_SliceCOB
PickObject_RGBLegend
PickObject_IsoSurfaceCOB
213
22 - 2 Picking Objects
To pick objects, you can use the TecUtilSetMouseMode function to set the mouse mode tool to be either the
Selector or Adjustor. This will also clear out the pick list (i.e., unpick all picked objects).
The following functions are used to pick objects (i.e., to add objects to the pick list):
• TecUtilPickAtPosition - Pick an object at a specified (X,Y) location.
• TecUtilPickAddAll - Add all objects of a specified type to the pick list.
• TecUtilPickAddAllInRect - Add all objects of a specified type and within a specified region to
the pick list.
The TecUtilPickAtPosition function can either replace or add to what is already in the pick list. The
TecUtilPickAddAll and TecUtilPickAddAllInRect functions always add to what is already in the pick list.
This makes it easy, for example, to pick all text and all geometries with the following two commands:
TecUtilPickAddAll(PickObject_Geom);
TecUtilPickAddAll(PickObject_Text);
The functions TecUtilPickGeom and TecUtilPickText are also available to add a specific text or geometry to
the pick list. The function that is used to unpick all objects or to clear out the pick list is
TecUtilPickDeselectAll.
214
Pick List
The following code will add all geometries to the pick list and change their color, line pattern, position,
and size:
TecUtilPickSetMouseMode(Mouse_Select);
TecUtilPickAddAll(PickObject_Geom);
TecUtilPickEdit(“Color = Blue”);
TecUtilPickEdit(“LinePattern = Dashed”);
TecUtilPickShift(1.2, 1.2, PointerStyle_AllDirections);
TecUtilPickMagnify(1.5);
22 - 4 Pick List
The pick list is accessed through index values starting at one. The procedure for enumerating the pick list
begins with a call to TecUtilPickListGetCount to determine the number of objects that are currently in the
pick list. This number can be used as a boundary condition as you loop through the pick list. For each
object in the pick list, call TecUtilPickListGetType. This will return the type of object in the pick list at the
specified index. Once you have the object type, you can call appropriate functions to get more information:
215
The following piece of code will change the color of all text and geometries in the pick list to purple:
int Index;
int Count = TecUtilPickListGetCount;
for (Index = 1; Index <= Count; Index++)
{
PickObjects_e ObjectType = TecUtilPickListGetType(Index);
/* We are only interested in text and geometries in the pick
list.*/
switch (ObjectType)
{
case PickObject_Text :
{
Text_ID TextObject =
TecUtilPickListGetText(Index);
TecUtilTextSetColor(TextObject, Purple_C);
} break;
case PickObject_Geom :
{
Geom_ID GeomObject =
TecUtilPickListGetGeom(Index);
TecUtilGeomSetColor(GeomObject, Purple_C);
} break;
}
}
The following piece of code will change the color of all vectors in the pick list to purple:
If instead we wanted to change the color of all objects in the pick list to purple, we could have used the
following code:
TecUtilPickEdit("COLOR = PURPLE");
216
Part 6 User
Interface
23
GUI Overview
You can incorporate a platform independent GUI into your add-on using the Tecplot GUI Builder (TGB).
When you run CreateNewAddon (UNIX/Linux/Mac), you can choose to use the TGB during your add-on
development. Windows users can create Windows-only dialogs by hand. Refer to Chapter 25: “Tecplot
GUI Builder” and Chapter 24: “Dialogs on Windows Platforms” for detailed information.
23 - 1 UTF8 Strings
On Windows platforms, all TecGUI functions which take data types of const char* require valid UTF8
strings. If you pass a non-English UTF8 string to a TecGUI function (such as a Japanese UTF8 string),
Tecplot 360 will display the string correctly (as long the proper language pack(s) have been installed on
the your machine from the Windows XP® Installation CD).
Note: a valid UTF8 string is also a valid 7-bit ASCII string. As such, no changes are necessary if your
existing add-on uses 7-bit ASCII strings exclusively (i.e., your strings use only ASCII characters in the
range 0x00 - 0x7F).
IMPORTANT: If your add-on is currently using strings with ASCII characters in the range 0x80-0xFF to
display accented European characters, the string will not display correctly in Tecplot 360 2011 R2. ASCII
characters in this range are not standardized and are not valid UTF8, so you must convert your string to
UTF8 (or to 7-bit ASCII) in order for it to display correctly.
23 - 2 Types of Dialogs
Tecplot 360 uses two primary types of dialogs - “modal” and “modeless.” Modal dialogs lock out the rest of
Tecplot 360 from being used. Modeless dialogs do not. File dialogs, error messages, and the Print dialog are
examples of modal dialogs. You must select [OK] or [Cancel] before interacting with the rest of Tecplot
360. The Quick Edit dialog, the Rotate dialog, and the Zone Style/Mapping Style dialogs are all examples
of modeless dialogs. You may interact with the rest of Tecplot 360 while these dialogs are open.
A sidebar is a special subset of a modeless dialogs. Designing a sidebar is similar to designing a dialog,
although a few different principles apply. Notably, sidebar dialogs can only be created using the Tecplot
GUI Builder and you may only have one active sidebar at a time in Tecplot 360. Refer to Section 25 - 2.2
“Adding Sidebars” for additional information.
219
Tecplot 360’s modal/modeless dialog paradigm does not exactly match that used on Windows operating
systems, so add-ons must inform Tecplot 360 when a modal dialog is launched and dismissed. This allows
Tecplot 360 (and other add-ons) to disable its interface. Add-ons with modeless dialogs must keep track of
when to enable and disable their modeless dialogs. This is easily done by using Tecplot 360's state change
mechanism (see Chapter 6: “State Changes From an Add-on”). Modal dialogs must inform Tecplot 360
(and other add-ons) of their launch/dismissal with TecUtilStateChanged.
This is done for you automatically if you are using TGB for your interface. The
BuildDialogn function will call TecGUIDialogCreateModal.
220
24
This section is necessary only if you did not use the Tecplot GUI Builder while creating
your add-on.
Tecplot 360 uses two types of dialogs - “modal” and “modeless.” Modal dialogs lock out the rest of Tecplot
360 from being used. Modeless dialogs do not. Examples of modal dialogs are file dialogs, error messages,
and the Print dialog. All of these dialogs require you to select [OK] or [Cancel] before doing anything else
inside Tecplot 360. Examples of modeless dialogs are the Quick Edit dialog, the Rotate dialog, and the
Zone Style/Mapping Style dialogs. You may have these dialogs up and still interact with the rest of
Tecplot 360.
This modal/modeless dialog paradigm does not exactly match that used by Windows operating systems,
so add-ons must inform Tecplot 360 when a modal dialog is launched and dismissed so that Tecplot 360
(and other add-ons) can disable its interface. Add-ons with modeless dialogs must keep track of when to
enable and disable their modeless dialogs. This is easily done by using Tecplot 360's state change
mechanism. Modal dialogs must inform Tecplot 360 (and other add-ons) of their launch/dismissal with
TecUtilStateChanged. Add-ons with modeless dialogs must monitor Tecplot 360's state with
TecUtilStateChangeAddCallback and disable the modeless dialogs at the appropriate times.
This is done for you automatically if you are using TGB for your interface. The
BuildDialogn function will call TecGUIDialogCreateModal.
24 - 1 Modal Dialogs
Whenever a modal dialog is launched, the add-on must inform Tecplot 360 of the launch by calling:
TecUtilStateChanged(StateChange_ModalDialogLaunch, NULL);
when processing WM_INITDIALOG or (in MFC) in the dialog's OnInitDialog.
Whenever a modal dialog is closed, the add-on must inform Tecplot 360 by calling:
221
TecUtilStateChanged(StateChange_ModalDialogDismiss, NULL);
when processing WM_NCDESTROY or (in MFC) in the dialog's PostNcDestroy.
That is all that is needed for modal dialogs. If you do not call these functions, Tecplot 360 may appear to
work, but other add-ons may fail to work with your add-on.
Dialogs created by Tecplot 360 (e.g. error messages, file dialogs) or any function starting with
“TecUtilDialog” already process the state change.
24 - 2 Modeless Dialogs
The following section applies only if you are NOT using TGB for your interface.
If your add-on uses modeless dialogs like Tecplot 360 does, you have a little more work to do. First, you
must monitor Tecplot 360's state changes. You do this by creating a state change callback function (see
Chapter 6: “State Changes From an Add-on”). Within the state change callback, you must put the
following:
{
/* When using MFC, the following line is always required on callbacks.
*/
/* Do not include this line if you are not using MFC. */
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
if (StateChange == StateChange_ModalDialogLaunch)
{
nDisabledCount++;
if (nDisabledCount > 0)
{
/* Disable all modeless dialogs, e.g., in Win32 SDK. */
if (hwndModelessDialog)
EnableWindow(hwndModelessDialog, FALSE);
/* Or, under MFC. */
if (modeless_dlg)
modeless_dlg->EnableWindow(FALSE);
}
else if (StateChange == StateChange_ModalDialogDismiss)
{
nDisabledCount--;
if (nDisabledCount <= 0)
{
nDisabledCount = 0;
/* Enable all modeless dialogs, e.g. in Win32 SDK.
*/
if (hwndModelessDialog)
EnableWindow(hwndModelessDialog, TRUE);
/* Or, under MFC. */
if (modeless_dlg)
modeless_dlg->EnableWindow(TRUE);
222
PreTranslateMessage Function for Modeless Dialogs
}
}
}
Each modeless dialog must be individually enabled or disabled. If you have several modeless dialogs, you
should write a function to enable or disable all modeless dialogs.
If you do not monitor Tecplot 360's state, your add-on’s modeless dialogs will not disable themselves at the
appropriate times, and the user may be able to access your add-on at an unexpected time.
This could cause any number of serious problems, including a crash of Tecplot 360.
If you use both modal and modeless dialogs in your add-on, monitoring state changes for the modeless
dialogs, and informing Tecplot 360 of the launch/dismiss of the modal dialogs, will automatically make
your add-on’s modeless dialogs disable themselves when the add-on itself brings up a modal dialog.
If you use the Tecplot GUI Builder for your interface, then the TecGUI function calls with
enable or disable your Add-on dialogs.
223
The TecUtil function to inform Tecplot 360 of your PreTranslateMessage function is
TecUtilInterfaceWinAddPreMsgFn. You will usually call this function in your InitTecAddon function:
TecUtilLockOn();
COMMANDPROCESSORID = TecUtilAddOnRegister(110,
"MyAddon",
"1.0",
"Acme, Inc.");
TecUtilLockOff();
}
224
25
The Tecplot GUI Builder (TGB) is an add-on tool and library for building a platform-independent
graphical user interface for a Tecplot 360 add-on. Using TGB will allow you to quickly generate platform-
independent user-interface code in C, C++, or FORTRAN. However, it is not necessary to use TGB—you
can use other commercial graphical layout tools, such as MFC.
When you run CreateNewAddOn (Linux/Macintosh OS® X) to begin your add-on development, a default set
of TGB files are created. (See Chapter 2: “Creating Add-ons on Linux/Macintosh Platforms” for more
details on using this utility.) This default code will generate a Tecplot 360 layout file called gui.lay. By
default, gui.lay includes a blank dialog, which you can edit directly in Tecplot 360 using the GUI Builder
dialog. The GUI Builder dialog is accessible from the Tools menu when you have included the TGB add-
on in your tecplot.add1 file. Visual Studio is not involved in editing or maintaining GUI Builder dialog
layouts.
1. To run Tecplot 360 with the TGB add-on, add $!LoadAddon "guibld" to your tecplot.add file. See
also: Chapter 4: “Running Tecplot 360 with Add-ons”.
225
1
Tecplot
Layout
2 File
TG B
3
Tecplot
S ource code
for your addon
4
Your Addon
C ompile and link
1. Create or open an existing layout file that stores the information needed to define dialogs and
the controls that go into the dialogs. If you used CreateNewAddon, a dialog template (gui.lay) will
be included in your add-on development directory.
2. Open the GUI Builder dialog (accessed via Tecplot 360’s Tools menu).
3. Using the GUI Builder dialog, add dialogs and controls to the layout file. Each dialog will be
housed in a separate Tecplot 360 frame. Complete details of each of the available controls are
included in the remainder of this chapter.
4. Once your dialog(s) are complete, select the button from the GUI Builder dialog. This
will overwrite guicb.tmp in your add-on development directory.
5. Copy the new code from guicb.tmp to guicb.c. Refer to Section 25 - 5 “Modifying Your Source
Code” for additional information.
226
Adding Dialogs and Sidebars
Internally, the files are identical with the C files. In the remainder of this document, reference to .c/.cpp
files are interchangeable.
The following sections describe how to create and add controls to the dialogs. Before
you add dialogs or controls to your GUI, you must first start Tecplot 360 and open the
layout file that defines your GUI.
Each dialog, sidebar, tab and form will be represented as a separate frame.
In addition to the keywords, the frame title may also begin with a comment enclosed in square brackets.
This is useful if you have a lot of dialogs and want to quickly identify and pop them using Tecplot 360’s
frame ordering function. For example, the frame title could be:
[This is the main dialog] ID=1 TITLE="Main Dialog" MODE=MODAL
227
25 - 2.2 Adding Sidebars
The sidebartest example add-on illustrates the TGB sidebar API described following.
Your add-on can use its own sidebar dialog in lieu of the standard Tecplot 360 sidebar. The sidebar may
contain any controls available in the TGB, with the exception of menus. All controls in a sidebar receive
the same callbacks that are used for a modal or modeless dialog.
An add-on may create several sidebar dialogs and switch between them using TecGUISidebarActivate. The
Tecplot 360 sidebar may also be restored by calling TecGUISidebarActivate with the special ID value of
TECGUITECPLOTSIDEBAR.
Add-ons may create sidebars which are wider or narrower than the Tecplot 360 sidebar. The handling of
different sized sidebars may be changed with the following macro command:
$!Interface SidebarSizing = {Dynamic | MaxOfAll}
If SidebarSizing is set to MaxOfAll (default), the sidebar size will be set to the maximum width of all
registered sidebars, including Tecplot 360. If SidebarSizing is set to Dynamic, the sidebar size will be
adjusted each time a new sidebar is displayed.
Creating sidebars
Designing a sidebar in the TGB is the same as designing a dialog. To create a sidebar in TGB, select the
Sidebar button in the GUI Builder dialog. A dialog will be created in the TGB with the approximate
width and height of the Tecplot 360 sidebar. The frame title will have the keyword SIDEBAR=TRUE.
After you have created the sidebar in the TGB, you may add controls just as you would a modal or
modeless dialog. TGB will generate the code to create the sidebar and add controls to it in a function
BuildSidebarNN, located in guibld.c. This function is automatically called when you call the generated
BuildDialogN function.
25 - 3 Adding Controls
Controls are added to dialogs and sidebars via the controls buttons in TGB. The TGB allows you to add the
following types of controls to your sidebar or dialog:
• Bitmap Buttons and Toggles
• Push Buttons
228
Adding Controls
• Scale Controls
• Form Controls
• Tab Controls
• Text Field Spin Controls
• Option Menus
• Adding a Menu Bar to a Dialog
Variable names
Controls which generate events must have a unique variable name. The variable name is specified in the
"Macro Command" text field of the Text Options dialog using the VARNAME= keyword. To change the "Macro
command" text field, select the [Options] button in the Text Details dialog.
For example, to assign the variable name "banana" to a toggle, in the "Macro Command" field, change the
default VarName = TGL to varname=banana.
Because variable names may not contain spaces, double quotes are not used.
Control keywords
If a name is not assigned as the Macro Function Command, TGB assigns a name by looking at the text
used for the control. Some controls must begin with a keyword identifying the control type. Table 25 - 1
lists the controls, the keyword, and text style that TGB uses to identify the control type:
Multi-selection list
Multi-selection list MLST: Filled text box
box
229
Control Control Keyword Tecplot text style
(X Motif) (Windows)
Push button Push button None Filled text box
Multi-line read
Read only multi-line text field TRO: Filled text box
only
Text field with spin Text field with spin TFS: Filled text box
These keywords are created automatically when you use the GUI Builder dialog to
create the control.
For example, if you have a toggle with the text <math>7</math> Include Banana, TGB will name the control
“Include Banana.” Note that <math>7</math> signifies toggles and the radio box because it resembles a check
box when it is displayed on the screen. For labels, TGB uses the label text. By default, variable names are
limited to 30 characters. To remove this limitation, select Layout>Options in the GUI Builder dialog and
deselect the “Limit variable name length to 30 characters” toggle. Note that if you deselect this option on
an existing add-on project, you may have to edit your guicb.c file before compiling your add-on, since the
variable names may change with the longer length limit.
You cannot generate variable names with more than thirty characters in FORTRAN.
ToolTips
You can add a tool tip to any control by using the Tool Tip keyword in the "Macro Command" field. For
example, to add a tool tip to the "banana" variable, type the following:
varname=banana tooltip="This is the banana toggle"
230
Adding Controls
Note that since a tool tip is a string, double quotes are required. You may add a tool tip to any type of TGB
control. Alternatively, you can add a tooltip by calling TecGUISetToolTip with the ID of the control.
IMPORTANT:In previous versions of TGB, you could specify a variable name by typing it
into the "Macro Command" text field. This syntax is still supported. However, if you
want to use a tool tip, you must use the VARNAME= identifier. This allows the TGB to
differentiate between the variable name and the tool tip text.
Alignment options
To align controls using the alignment options, select 2 or more controls and press the appropriate
alignment button. Note that, when appropriate, the first control selected controls the alignment. For
example, selecting the Align Left button will align all of the controls based on the left margin of the first
selected control.
Previewing dialogs
You may preview a dialog by selecting the dialog and selecting the Preview button from the GUI
Builder dialog. Previewing is useful for checking the layout of a dialog before generating the source code.
Only one dialog may be previewed at a time. Use the [Close], [OK] or [Cancel] button in the previewed
dialog to exit preview mode.
(Linux Only) Each time you preview a dialog, that dialog's resources are created from
scratch. Since dialog resources are not released until you exit Tecplot 360, excessive
previewing during the same Tecplot 360 session will gradually reduce the available
resources. When designing a dialog in TGB, we recommend that you periodically close
and restart Tecplot 360 if you are frequently previewing dialogs.
231
Note that the bitmap is never resized to fit onto the control. If the bitmap is too large, then it will be clipped to
the size of the control. If it is too small, then there will be additional empty space on the control.
When you add a bitmap control in TGB, TGB will create an image geometry of the appropriate size for the
bitmap dimensions. Resizing the control is not recommend. You may resize this button, but note that the
original bitmap size does not change and will be centered on the button, or clipped if it is too large.
You create bitmap buttons or bitmap toggles in TGB by selecting bitmap button or bitmap toggle
, respectively. After you select one of the bitmap control buttons, you will be prompted to specify the
bitmap file name. Note that this file is not needed when you run your add-on. It is only needed when TGB
generates source code for the add-on. TGB will generate a static array of bytes in the guicb.c file which
represent the bitmap. The bitmap is generated in true color (24bit RGB) format.
After you have specified the bitmap file name, the Insert Bitmap Image dialog will be launched. Specify
the following options on the dialog:
• Tool tip text - We recommend that you add Tool tip text to your bitmap controls, since it is not
always clear to users what a bitmap button does. The text you enter in the "tool tip" field will
be added to "Macro Command" text field of the Image Geometry Details dialog in the form:
Tooltip = "Tool Tip Text"
You may edit the tool tip at any time.
• Button Type - Select a bitmap button or bitmap toggle
• Use transparent color - Most bitmaps have a transparent color. Check this toggle to enable the
bitmap to have a transparent color. The transparent color will be replaced by the button
background color when you run your add-on.
• Transparent color - Enter the transparent color in as RGB in 6 digit hexidecimal format
(similar to HTML). Examples: Red: FF0000 Black: 000000, White: FFFFFF, Blue: 0000FF
Push button controls are sized to their label text, by default. If you plan to add multiple
push buttons to your dialog and would like them to be the same size, follow these
steps:
1. Use the same text in all of your push buttons while constructing your dialog/sidebar.
2. Once you have built the GUI, use TecGUIButtonSetText during dialog initialization to
set the desired text labels in guicb.c.
232
Adding Controls
The primary difference between child form pages and regular dialogs is that the size of a form page dialog
is restricted to the size of its parent form control. You may add any number of form pages to a form
control. Controls are added to form pages and built by TGB exactly like dialogs.
An add-on can have no more than twenty form or tab controls. This is because forms
and tabs make use of frame-linking, which is limited to twenty distinct linking groups.
Each form or tab may have an unlimited number of pages, however.
To create a new form in a GUI Builder dialog, select the Parent Form button . This will add a new
control to the dialog with the type FM:Group=NN, where NN is an automatically generated link group number.
Do not edit this text or the group number! It is needed by TGB to identify the control as a form and to identify
the form pages associated with this control. When you add a new form to a dialog it is initially empty. In
order to create sets of controls, you must add child form pages.
To add a form page, select the Form Page button . The button is active only if you have selected a form
control. This will create a new dialog in TGB which is actually a form page. This new dialog (a Tecplot 360
frame) will have the same link group number as the Group=NN text in its parent form control. It will also be
exactly the same size as the form control it is linked to. Do not edit or remove the group linking from this frame,
or it will not be recognized by TGB as a form page. In the frame name will be an additional keyword,
FORMPAGE=T, which identifies this dialog as a form page. See Section 25 - 3 “Adding Controls” for a complete
list of keywords for form and tab pages.
In your source code, TGB will generate a variable representing each form page using the parent form. This
variable is similar to the DialogNManager variable that TGB creates for each dialog.
To set the controls for a form control to this set, call:
TecGUIFormSetCurrentPage(FormN_GManager)
Where G is the group number associated with the form and N is the form page number.
See also: Section “Resizing parent form or tabs” on page 234.
233
Keyword Default Description
If this dialog is a form page, the NN is its position, with NN=1 at
POS=n None
the left
For a sample TGB Add-on which uses forms, tabs and spin controls, see the sample
code for Tabtest. The ADK sample directory is included in your installation. It is placed in
%$TEC_360_2011R2%\Adk\Samples.
Using C/C++
When generating interface code in C, TGB creates a static string in the guicb.tmp file that is used to store
the options for the option menu. For example, if you have an option menu control with the name “Fruit”
then guicb.tmp will contain the declaration:
static char *Fruit_OPT_D1_List = "Option 1,Option 2,Option 3";
After transferring this to guicb.c you can edit the string and put the items you want to appear in the option
menu in the static string. Separate items with a comma. For example, the resulting declaration in guicb.c
may appear as:
static char *Fruit_OPT_D1_List = "apple,banana,orange";
Using FORTRAN
Option menu coding in FORTRAN is different than C, because TGB does not give you any hints as to what
to add. The procedure is the following:
• Find the spelling of the character string created to hold the option menu items. It will be
located in the file GUIDEFS.INC. For example, if an option menu to assign colors is named
234
Adding Controls
coloropt and is in the first dialog, then you will find the variable coloropt_OPT_D1_List in
GUIDEFS.INC. It is of type character*100 by default.
• Put all assignments for the character strings that define the option menus into the
InitTecAddon113 function. It is critical that this assignment is made at the very beginning. If the
color choices are “red,” “blue,” and “green,” then the statement to add to the initialization
function is as follows:
Subroutine IntTecAddOn113
.
.
.
Call TecUtilLockOn
coloropt_OPT_D1_List = "Red,Blue,Green"
Also note that TecGUIMenuAdd can be used to create walking menus by using another
menu as the parent instead of the menu bar.
The menu creation code must only be executed once and should be done so immediately after the creation
of the dialog. The best place to put the code is immediately after the call to BuildDialog for the dialog. The
following example demonstrates how to do this in a way that guarantees the menu bar code will only be
executed once.
Create a menu bar that has the following menu structure:
235
NewProject_MN1_D1_CB);
OpenProject_item = TecGUIMenuAddItem(FileMenu,"Open Project",
OpenProject_MN1_D1_CB);
SaveProject_item = TecGUIMenuAddItem(FileMenu,"Save Project",
SaveProject_MN1_D1_CB)
SetupMenu = TecGUIMenuAdd(MenuBar,"Setup");
SolverSetup_item = TecGUIMenuAddItem(SetupMenu,
"Solver Setup",
SolverSetup_MN2_D1_CB);
ReferenceVal_item = TecGUIMenuAddItem(SetupMenu,
"Reference Values",
ReferenceVal_MN2_D1_CB);
DefineOutput_menu = TecGUIMenuAdd(SetupMenu,"Define Output");
PrintOutput_item =TecGUIMenuAddItem(DefineOutput_menu,
"Print",
PrintOutput_MN2_D1_CB);
IntegrationO_item = TecGUIMenuAddItem(DefineOutput_menu,
"Integration",
IntegrationO_MN2_D1_CB);
HistoryPlotO_item = TecGUIMenuAddItem(DefineOutput_menu,
"History Plot",
HistoryPlotO_MN2_D1_CB);
SolutionPlot_item =TecGUIMenuAddItem(DefineOutput_menu,
"Solution Plot",
SolutionPlot_MN2_D1_CB);
}
...
236
Building the Source Code
Description Filename
C C++ FORTRAN
Template for the callback module, contains code for each
guicb.tmp
control in your dialog
guib.inc
include file naming all of the callback functions N/A N/A
The file guicb.tmp is the template for the guicb.c (or guicb.f) module you will be editing to customize all of
the callbacks generated by your interface. A callback is a function that is called when the user interacts
with one of the controls in your dialogs. The first time you run TGB, simply rename guicb.tmp to guicb.c (or
guicb.f). If you change and rebuild your layout later, you will need to cut and paste the corresponding code
from guicb.tmp to guicb.c/guicb.f. Refer to Section 25 - 5 “Modifying Your Source Code” for additional
information.
You should never edit the files guibld.c, guibld.f, guidefs.c or the include files,
GUIDEFS.h (C language), GUIDEFS.INC and GUICB.INC (FORTRAN language). If you
ever modify any of these files, be aware that they will be overwritten the next time you
run Tecplot GUI Builder
237
If you remove a control from a dialog, it is not necessary to edit guicb.c or guicb.F. However, if you do not,
you will end up with a callback function that is never called.
If you rename a control, you should look at guicb.tmp and see how TGB has now named things, then edit
guicb.c or guicb.F. Change the name of the callback function to match.
Always use the -debug flag when developing add-ons. Only when you are ready to make
a release version use the -release flag. Using -debug puts the resulting shared library in
the appropriate location so that Tecplot 360 will know where to get it when using the
-develop flag.
238
Running Your New Add-on
Windows platforms
In Visual Studio, select [Go] or press F5.
The SumProbe add-on illustrates how to sum the probed values of a selected variable. It will appear in
Tecplot 360’s Tools menu as “Sum Probed Values”. When selected, a dialog will appear allowing you to
specify which variable you wish to sum.
SumProbe uses source code files created by the CreateNewAddOn script (Linux/Macintosh). All of the
examples of the source code shown in this manual are included in the Tecplot 360 distribution in the adk/
samples/sumprobe below the Tecplot 360 home directory.
239
add-on. This callback function is specified in the TecUtilMenuAddOption function is passed to Tecplot 360 in
InitTecAddOn.
The TecUtilDialogGetVariables function has a built-in dialog which allows you to select the variable to be
summed. Then the newly-created dialog appears. As points are probed, the summed total is displayed on
the dialog.
Before adding the following code, create a label on the dialog which will be set to the total as the plots are
probed. (See the Chapter 25: “Tecplot GUI Builder” for more information on adding a label to a GUI
Builder dialog.) Set the variable name of this label to VarName=Totalis00. Set the text string of the label to
read “The total is 0.0”
The new or modified source code is displayed in bulleted lines. If you are working along, add or edit
bulleted lines only.
Note the MenuCallback function in main.c:
if (IsNearestPoint)
{
double ProbeValue = TecUtilProbeFieldGetValue(Variable);
char Msg[100];
240
Running Your New Add-on
TecGUILabelSetText(Thetotalis00_LBL_D1, Msg);
}
else
TecUtilDialogErrMsg(“You must hold down the Ctrl key when probing”);
TecUtilLockFinish(AddOnID);
}
Each time a point is probed, the callback checks to see if it was probed while holding down Ctrl. If it was,
it gets the value of the variable, adds it to the running total, and changes the text displayed on the dialog to
reflect this.
SumProbe is complete. Recompile and load it into Tecplot 360.
Step 4 Exercises
1. Enhance SumProbe to allow for interpolated values while probing.
2. Add a Clear button to the dialog to zero out the summed values.
241
242
Part 7 Common
Add-ons
26
A data set reader add-on allows you to load non-Tecplot format data into Tecplot 360. Once registered
with Tecplot 360, the data reader can then be accessed with the Load Data File(s) dialog and referenced
with the $!ReadDataSet macro command. This then enables layout files generated by Tecplot 360 to
reference your data set reader add-on.
Data set readers are divided into two different types: “data set converters” and “data set loaders.” When
either of these is created using an add-on script as described in Chapter 2: “Creating Add-ons on Linux/
Macintosh Platforms”, the script will create the skeleton code you need.
CGNS. Data loaders appear under “Load Data File(s)” in the File menu. Data loaders sometimes have
custom dialogs for collecting loading parameters.
245
An add-on informs Tecplot 360 that it is a data loader by:
• Registering as a data loader by calling the TecUtilImportAddLoader function. This is called from
the InitTecAddOn function in main.c.
• Exporting an interface callback function, named LoaderSelectedCallback, called by Tecplot 360
when you select the Load Data File(s) option from the File menu. This usually displays a
dialog to collect loading parameters. After collecting the parameters the add-on will call the
loader function to load the data.
• Exporting a loading callback function, LoaderCallback, which is called by Tecplot 360 to load
the data. This is used whenever a file is loaded by macro or by selecting “Load Data File(s)”
from the File menu.
After it’s been registered, the loader add-on waits for:
• The user to select it from the Load Data File(s) option. Then Tecplot 360 calls the registered
interface callback.
- or -
• Tecplot 360 to process the $!READDATASET macro command. Then Tecplot 360 calls the loader
callback. (In this case, the add-on will not display a dialog.)
Refer to Chapter 27: “Creating a Data Loader” for additional information, as well as a tutorial example.
246
27
Before creating a plot with , you must first connect your data. Your data may be stored as one or more
files on the hard disk, or local storage in your application. It may even be calculated from another data
source via a formula. Once your data is connected, the primary steps for loading your data are
independent of your data source.
Code used to load data can be found in a Tecplot add-on (which is often referred to as a "data loader add-
on"). This chapter discusses the overall approach to loading data. We recommend that you isolate the
actual data loading functionality in its own module. The remainder of this chapter refers to this module as
the “core loader function”.
247
27 - 1 Data Hierarchy
In the Tecplot Engine, your data is divided into subsections called “zones”. Zones are simply a way of
partitioning a large amount of data into smaller pieces and are often used to represent a given solution at
specific times and/or solutions clustered in different spatial locations (or both).
0 0
...
Y
Y
-0.5 -0.5 -0.5
-1 -1 -1
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1
X X X
248
Data Hierarchy
A Tecplot Zone is composed of a set of variables (n) with each variable holding a set of data point values
(p). Each zone may have any number of data points. A value must be supplied for every data point in
every variable.
Point V1 V2
... Vn
1 P1V1 P1V2
Zone 1
... P1Vn
2 P2V1 P2V2
... P2Vn Each zone can have a
different number of data
points.
Point V1 V2
... Vn
1 P1V1 P1V2 Zone 2
... P1Vn
2 P2V1 P2V2
... P2Vn
.
.
.
Cells are formed by connecting the data points. The method used to form cells identifies the zone "Type".
Points are logically connected based on the node ordering. An I-ordered zone is a logical 1D
Ordered array of points. IJ-ordered Zones are a 2D array of points and IJK-ordered 3D. J, K, JK, IK-
ordered Zones are also possible.
FE Line Pairs of points are connected to each other. Not all of the points have to be connected and not all
Segment connections have to be contiguous (i.e. there can be many clusters of cells).
Zones are grouped together to form datasets. A dataset manages your data in the Tecplot Engine.
249
27 - 2 Primary Data Load Steps
Figure 27-4. The six Data Load Steps. Steps 2, 3, and 4 are required and steps
1, 5 and 6 are optional.
Figure 27-4 illustrates the primary steps for loading data into the Tecplot Engine. Data Load Steps 2
through 4 are required and steps 1, 5 and 6 are optional. Data Load Step 3 is the most complex step. It is
where the data is loaded or attached, and also where you have the option to specify whether to use
immediate loading or load-on-demand.
Detailed descriptions of each Data Load Step are provided in the remainder of this section. Detailed
examples of each type of loading are provided in Section 27 - 4 “Immediate Loading” and Section 27 - 5
“Load-on-demand”.
250
Recommended Code Layering
As a general rule we do NOT recommend that a data loader set the plot style. This
exception might help if the data loader can determine the ideal plot type for the data.
Figure 27-5. Interaction between the core components of a data loader and the Tecplot Engine.
(LOD is the acronym for load-on-demand.)
251
The previous figure shows how the core components of a data loader interact with the Tecplot Engine.
The bold items represent the required Data Load Steps. Items in gray represent components necessary to
implement the optional Data Load Steps 1, 5 and 6.
27 - 4 Immediate Loading
Immediate loading creates pre-allocated zones and copies your application data directly into variables
within those zones.
252
Immediate Loading
This is the simplest method for loading data into the Tecplot Engine. Using this method will
provide data for plotting. However, it will not allow you to save a layout that can reference the
original dataset.
Your Tecplot product installation includes the complete source code for this example in
the adk/loadimmed folder of your installation.
Only the required Data Load Steps 2, 3 and 4 are necessary. Since journaling is not supported, the
loader does not have to be registered.
The following code shows how to load data using the immediate loading method. The actual data
values supplied to the dataset could come from any source, including: a data file, network sockets,
or a formula. Here we will create a dataset containing a basic 10x10 zone where only X and Y are
defined (determined by a simple formula). This code assumes that your application (or add-on)
has already been initialized.
253
Example 80:Immediate Data Loading with Data Journaling
The immediate data loading method builds on the previous method and fills in the loader
responsibilities to support data journaling (i.e. adds Data Load Steps 1 and 5). With data
journaling a layout can make use of your custom data loader to re-read the data at a future time.
Your Tecplot product installation includes the complete source code for this example in
the adkloadjrnl folder of your Tecplot product installation.
To support data journaling, we will need to do all six Data Load Steps. For Data Load Step 3, we
will repeat what we did in the previous method, i.e. create a dataset containing a simple IJ-
Ordered zone.
The following code should be placed in a separate module reserved for your data loader.
254
Load-on-demand
To connect everything, we must register our loader with the Tecplot Engine using
TecUtilImportAddLoader, which in turn uses MyLoaderCallback to isolate the parsing of load
instructions from the core data load code.
27 - 5 Load-on-demand
Use Load-on-demand when:
• You are working with very large data.
• You plan to plot a subset of the data at a time.
255
Figure 27-9 shows two common scenarios where using Load-on-demand is preferred.
Unlike Immediate Loading, Load-on-demand does not force the Tecplot Engine to allocate space for
variables as soon as zones are "defined". Instead each variable is initialized as a "passive" variable. Passive
variables take up an insignificant amount of space and return a value of zero for all data locations until
they are converted to active variables. Once a variable has been created (regardless of how it was created),
it can be converted to use Load-on-demand. Load-on-demand then establishes a set of callbacks to
manage loading.
To use Load-on-demand, perform the following steps:
1. Create zones using TecUtilDataSetAddZoneX (with SV_DEFERVARCREATION set to TRUE). At this
point, all of the variables in the zone are passive.
2. Call either TecUtilDataValueAutoLOD or TecUtilDataValueCustomLOD to associate each variable
with a set of Load-on-demand callbacks.
3. Write Load-on-demand callback functions as needed.
There are three types of Load-on-demand:
256
Load-on-demand
An example for each type of load-on-demand is provided in the remainder of this section.
Auto-load variable-on-demand requires that you implement all six Data Load Steps from Figure 27-5. In
Data Load Step 3, we will register to use auto-load variable-on-demand.
With auto-load variable-on-demand, the Tecplot Engine controls all loading and unloading of variables.
Your application or add-on only needs to supply the name of the data file and how to locate the data
within the file. This is done with the TecUtilDataValueAutoLOD function.
The prototype for TecUtilDataValueAutoLOD is:
Boolean_t TecUtilDataValueAutoLOD(
257
EntIndex_tZone,
EntIndex_tVar,
DataValueStructure_eDataValueStructure,
const char*FileName,
FileOffset_tOffset,
EntIndex_tStride,
Boolean_tIsDataNativeByteOrder
)
Parameter descriptions are:
Offset The position in the file of the first value for the variable.
The distance between values for the variable in the file: 1 for Block data; Number of
Stride
variables for Point dataa.
Indicates if the byte ordering of the data in the file matches the machine’s native byte
ordering. One common way to determine this up front is to place a known value (like
IsDataNativeByteOrder
“1”) in the first four bytes of a file, and then read that value with one byte ordering. If it
does not return “1”, then try another byte ordering.
a. In order to use point format, the data must be nodal.
Once a variable is registered using TecUtilDataValueAutoLOD, all loading, unloading and managing of the
variable if altered is handled by the Tecplot Engine. For Block format files, if memory mapping is enabled,
the variable is auto memory mapped.
The following sample code assumes that the byte order is “Native”. For this exercise, assume the
Data Value Structure is ClassicPlus.
The code below shows the main components but is not complete. Your Tecplot product
installation includes the complete source code in the adk/loadauto folder of its
installation.
To support data journaling, we will need to do all six Data Load Steps. Unlike the immediate
load methods, Data Load Step 3 will first add a zone (with DeferVarCreation set to TRUE) and
then register auto load information with the Tecplot Engine.
The following code must be placed in your application or add-on where initialization is
performed.
TecUtilImportAddLoader(LoaderCallback,
LoaderName.c_str(),
LoaderSelectedCallback,
NULL);
258
Load-on-demand
This code should be placed in a separate module reserved for your data loader. Include members
as necessary. At a minimum you should have a member for a filename or list of filenames.
For each zone to be loaded, add the zone to the Tecplot Engine with deferred variable loading set
to TRUE.
Other calls set dimensions, zone name, etc. This information is either hard coded or obtained by
opening the data files and reading header information.
Inform the Tecplot Engine that adding zones is finished. You will need to create a ZoneSet set and
populate with all zone numbers being loaded.
This is the function called by the Tecplot Engine when data is to be loaded. It performs the
following steps:
The Tecplot Engine will do the rest. When the engine needs a variable and that variable is not
currently loaded into memory it will open the file, seek to the offset where the variable resides and
load or memory map the variable.
259
27 - 5.2 Load Variable-on-Demand
Load Variable-on-demand is ideal for large data files if your application or add-on needs to be informed,
or to control when the Tecplot Engine loads and unloads variables. Load Variable-on-demand allows your
application or add-on to control the loading and unloading of variables with TecUtilDataValueCustomLOD.
Load variable-on-demand requires that you implement all six Data Load Steps from Figure 27-5. In Data
Load Step 3, we will register to use load variable-on-demand. Load variable-on-demand is orchestrated by
calling TecUtilDataValueCustomLOD for each variable in each zone of your dataset.
Initialization and loader callback registration itself are the same for load variable-on-demand and load
value-on-demand as they are for auto-load variable-on-demand
The prototype for TecUtilDataValueCustomLOD is:
Boolean_t TecUtilDataValueCustomLOD (
EntIndex_t Zone,
EntIndex_tVar,
LoadOnDemandVarLoad_pf VariableLoad,
LoadOnDemandVarUnload_pfVariableUnload,
LoadOnDemandVarCleanup_pfVariableCleanup,
FieldValueGetFunction_pfGetValueFunction,
FieldValueSetFunction_pfSetValueFunction,
ArbParam_t ClientData)
Parameter descriptions include the following:
Your function that reads the values for a variable and loads them into the Tecplot
VariableLoad
Engine.
Your function that unloads a variable. Returning FALSE for this function will prevent
unloading of the variable. Set this to NULL, in order to have the Tecplot Engine take
VariableUnload
responsibility for unloading. Refer to Section 27 - 5.3 “Load Value-on-demand” for
additional information.
260
Load-on-demand
A pointer to an allocated item, containing all the information needed to load, unload or
cleanup the variable when requested by the Tecplot Engine. The structure should
include the file name, the offset to the first value for the current variable, and the
ClientData
number of points. It should also include settings such as the data type and the byte
order. If data is in point format, the structure must also include the offset between
values for a variable or the stride.
The ClientData and a field data pointer are stored for each variable, and passed by the Tecplot Engine to
the appropriate function (Load, Unload, Cleanup) each time the Tecplot Engine needs to load or unload a
variable. In the simple and most common case that a staging area does not need to be allocated, the Load/
Unload/Cleanup functions are optional and only serve to provide notification of the Tecplot Engine’s
intent.
This section concentrates on the core loader function. Source code for a complete
sample using load variable-on-demand can be found in adk/loadvar below the
distribution root directory.
For load variable-on-demand, you must place necessary information into the structure
ClientDataValues. The structure provides information about the original file and how to load the
data requested by the Tecplot Engine. This structure must be defined in a header file:
261
We recommend that you add error checking each time you send and receive parameters for a
function. To further improve your coding, perform the following steps:
Load value-on-demand requires that you implement all six Data Load Steps from Figure 27-5. In Data
Load Step 3, we will register to use load-value-on-demand. Load value-on-demand is orchestrated by
calling TecUtilDataValueCustomLOD for each variable in each zone of your dataset. Unlike load variable-on-
demand, you need to register valid callbacks to set and get individual values.
Initialization and loader callback registration itself are the same for load value-on-demand and load
variable-on-demand, as they are for auto-load variable-on-demand.
This section will concentrate on the core loader function. Source code for a complete
sample using load value-on-demand can be found in adk/loadvalue below the
distribution root directory.
262
Journaling Data Load Instructions
EntIndex_t Var,
LoadOnDemandVarLoad_pf VariableLoad,
LoadOnDemandVarUnload_pf VariableUnload,
LoadOnDemandVarCleanup_pf VariableCleanup,
FieldValueGetFunction_pf GetValueFunction,
FieldValueSetFunction_pf SetValueFunction,
ArbParam_t ClientData
)
Parameter descriptions are:
Your function that allocates the space for a staging area for data, reads the file and stores
VariableLoad
the values into the staging area. It does not place these values into the dataset.
Your function that frees the space allocated for the staging area. Returning FALSE for
VariableUnload this function will prevent unloading of the variable. Most s should set this to NULL,
causing the Tecplot Engine to take responsibility for unloading the variable.
VariableCleanup Your functions that frees the space allocated for the staging area and the ClientData.
Called when the Tecplot Engine needs to retrieve a value from the staging area. It will
retrieve the appropriate value from the staging area for that variable and return it to the
GetValueFunction
Tecplot Engine. You may register a unique GetValueFunction for different variables if
desired.
Submit a value to field data. It is responsible for storing any changes to field data until
SetValueFunction the variable is cleaned up. Most s will set this to NULL, allowing the Tecplot Engine to
take responsibility for storing changes.
A pointer to an allocated structure defined by the writer, containing all the information
ClientData
needed to load, unload or cleanup the variable when requested by the Tecplot Engine.
The ClientData and a field data pointer are stored for each variable, and passed by the Tecplot Engine to
the appropriate function (Load, Unload, Cleanup, GetValue or SetValue) each time the Tecplot Engine
needs to load or unload a variable. Both the VariableLoad and VariableUnload functions need to lock the
Tecplot Engine at their beginning and unlock before they return.
The process is as follows:
1. A request is made to load a dataset.
2. LoaderCallback is called with loading instructions.
3. Call TecUtilDataSetCreate.
4. For each zone, call TecUtilDataSetAddZoneX with SV_DEFERVARCREATION=True.
5. For each variable, call TecUtilDataValueCustomLOD with Load/Unload/Cleanup functions, one or
more Get and Set functions and ClientData.
263
these instructions and then pass the instructions to the Tecplot Engine after the data has been loaded by
calling TecUtilImportSetLoaderInstr.
The loading instructions can be in any format you want. However, we recommend that you follow the
standard syntax. Standard loader instructions are specified as tag/value string pairs in the instruction
string list. That is, the “tag” and “value” strings must be consecutive strings in the string list. Except for
the standard syntax identifier tag (which must be the first string in the string list), tag/value pairs may
appear at any ordinal location in the string list and may be interspersed with custom instructions (which
are ignored by the Tecplot Engine). Note that each custom instruction must be in the Tag/Value form.
Newline delimited strings should not be used to pair multiple values with one name. Instead, use tag/
value pairs with the same name for each value.
The standard syntax tags are summarized as follows:
[N]
FILELIST_[file_list_ide [FileName1,
ntifier] FileName2,.Fil
NO If your loader uses a list of file names, use this tag.a
eNameN]
a. FILELIST_ is the only exception to the STANDARDSYNTAX name/value pair rule by being in the form
"FILELIST_identifier" "N#files" "file1" "file2" "..." "fileN".
You may use any additional name/value pairs that you want. However, keep in mind that these
instructions will appear in layout and macro files. As such, they should be easier for the end-user to
interpret.
For example, if your loader only needs to know the name of a file and a skip. Your loader
instructions could have the following three name/value pair commands:
264
Loading the Connectivity List
They would be added to the instructions string list by appending strings, as shown below:
StringList_pa Instructions;
Instructions = TecUtilStringListAlloc();
TecUtilStringListAppendString(Instructions,"STANDARDSYNTAX");
TecUtilStringListAppendString(Instructions,"1.0");
TecUtilStringListAppendString(Instructions,"FILENAME_TOLOAD");
TecUtilStringListAppendString(Instructions,"MyFile.txt");
TecUtilStringListAppendString(Instructions,"SKIP");
TecUtilStringListAppendString(Instructions,"3");
Result = LoaderCallback(Instructions);
TecUtilStringListDealloc(&Instructions);
The Tecplot Engine would save the following command in a layout or macro:
One advantage of using standard syntax is that it allows the Tecplot Engine to save loader instructions
with relative or absolute path names. If a user saves a layout and elects to use relative path names, the
Tecplot Engine will scan through the loader instructions for all file and directory names identified via the
above mechanism, and replace them with paths relative to the layout file path.
265
5. Use the Unload callback from the LOD function to unload the facemap. This is handled by
the Tecplot Engine if unload is set to NULL.
6. Use the cleanup callback from the LOD function to cleanup the client data.
Be sure to issue a StateChange_NodeMapsAltered state change after the LOD callbacks are registered.
For example, the configuration below has the following connectivity list:
/*
Client data needed by facemap load-on-demand callback (in *.h)
(This is an example; your loader may need different client data)
*/
typedef struct
{
char *FileName;
LgIndex_t ZoneUniqueID;
LgIndex_t VarUniqueID;
LgIndex_t NumFaces;
LgIndex_t NumBoundaryFaces;
FileOffset_t FaceDataOffset;
/* etc. */
} FaceMapClientData_t;
266
Loading the Connectivity List
FaceMapClientData = (FaceMapClientData_t*)
malloc(sizeof(FaceMapClientData_t))
if (FaceMapClientData != NULL)
{
/* initialize client data */
}
TecUtilDataFaceMapCustomLOD(CurrentZone,
NumFaces, /* 0 to generate */
NumFaceNodes, /* 0 to generate */
NumFaceBndryFaces,
NumFaceBndryConns
LoadFaces,
NULL, /* Have Tecplot unload */
CleanupFaces,
(ArbParam_t)FaceMapClientData);
2. In the LOD callbacks, retrieve the ClientData by calling TecUtilDataFaceMapGetClientData.
ClientData = (FaceMapClientData_t *)
TecUtilDataFaceMapGetClientData(FaceMap);
}
3. The reference to the face map is generated by the Tecplot Engine and passed to the LOD
callback. It is not necessary to call TecUtilDataFaceMapBeginAssign or
TecUtilDataFaceMapEndAssign in a load on demand scenario.
4. Specify the face map using one of the two options detailed below, depending on whether the
data file contains connectivity information.
5. Use the Unload callback from the LOD function to unload the face map. This is handled by
the Tecplot Engine if Unload is set to NULL as it is in our example. If you provide an Unload
callback, however, it must unload the facemap.
6. Use the cleanup callback from the LOD function to release any resources used by the face map
loading process. Usually this will be just the client data. If the client data includes any Tecplot
strings or other allocated objects, deallocate these first.
TecUtilLockStart(AddOnID);
if (ClientData->FileName)
TecUtilStringDealloc(&ClientData->FileName);
free(ClientData);
ClientData = NULL;
}
When specifying the face map (step 4 above), choose one of these two options.
Option 1. If connectivity information is readily available, follow these steps to load it.
267
a. Use TecUtilDataFaceMapAssignNodes to assign the face nodes to the face map. Specify
how many nodes are in each face using the NumFaceNodes array and specify the the face
nodes themselves in the FaceNodes array. You can use multiple calls to
TecUtilDataFaceMapAssignNodes if this is more convenient.
b. Define the right and left neighboring elements for each face using
TecUtilDataFaceMapAssignElems. Again, you may use multiple calls to
TecUtilDataFaceMapAssignElems for convenience, and may even intermingle these calls
with calls to TecUtilDataFaceMapAssignNodes. The only requirement is that the
information about the faces be delivered in the same order.
c. If any of the boundary connections in your data are global or one-to-many, you will
need to define boundary connections using TecUtilDataFaceMapAssignBConns. This
includes faces that are partially obscured, have more than one neighboring element on
a side, or have a neighboring element in a different zone.
TecUtilDataFaceMapAssignNodes(FaceMap,
ClientData->NumFaces,
NumFaceNodes,
FaceNodes);
TecUtilDataFaceMapAssignElems(FaceMap,
ClientData->NumFaces,
LeftElements,
RightElements);
if (ClientData->NumBoundaryFaces > 0)
TecUtilDataFaceMapAssignBConns(FaceMap,
ClientData->NumBoundaryFaces,
BoundaryElemCounts,
BoundaryElems,
BoundaryZones);
Option 2. If connectivity information is not available in the data, simply call
TecUtilDataFaceMapAssignElemToNodeMap to have the Tecplot Engine generate the face map. You will need to
provide the number of elements for the zone, arrays for the number of faces per element and nodes per
face, and the actual nodes for each element, all of which you should already have from loading the nodes.
TecUtilLockStart(AddOnID);
TecUtilDataFaceMapAssignElemToNodeMap(FaceMap,
TotalCells,
FacesPerElem,
NodesPerFace,
ElemToNodeMap);
TecUtilLockFinish(AddOnID);
For polygonal zones, the ElemToNodeMap array should contain the index of all the nodes in each element.
NodesPerFace should be NULL, since each polygonal face always has two nodes.
For polyhedral zones, the ElemToNodeMap array should contain the index of all the nodes for each face of
each element. A brick-like polyhedron, for example, would be specified using twenty-four entries: four
nodes for each of six faces (not just eight entries).
268
Transient Data
27 - 9 Transient Data
The examples provided in Section 27 - 4 “Immediate Loading” and Section 27 - 5 “Load-on-demand” are
written using static data. Transient datasets are created in a similar manner to static datasets (i.e. using
TecUtilDataSetAddZoneX). When adding transient zones, simply include the SV_STRANDID and
SV_SOLUTIONTIME arguments in the ArgList for TecUtilDataSetAddZoneX. Refer to Section 15 - 11 “Working
with Transient Data” for additional information regarding transient data, including strandID and
solution time.
269
6. [Optional] As with normal loading, call TecUtilImportSetLoaderInstr to register the
instructions needed for the append.
Performing steps two, five and six will cause the Tecplot Engine to journal this new command along with
any other existing data creation/loading commands. These steps prevent the data journal in the Tecplot
Engine from being invalidated with the activity of adding variables or zones. Refer to Chapter 14: “Data
Journaling” for additional information.
27 - 11 Replacing Data
Once you have loaded data into the Tecplot Engine, you may wish to replace some or all of the data values
to modify your plot. The method you use depends both on your data and your goals. Use the following
table coupled with the ADK Reference Manual to replace data in the Tecplot Engine:
Replace an entire
If the data is in Tecplot file format, you may
dataset while TecUtilReadDataSet (with the
replace the data by calling this function. Refer to
maintaining style ResetStyle parameter set to
the Data Format Guide for instructions for
settings (Tecplot file FALSE)
creating Tecplot data format files.
format ONLY).
270
Overriding Data Loader Instructions
Adding this capability to your data loader is optional. To omit this capability supply NULL for the data
loader override function parameter in the TecUtilImportAddLoader function.
If you only need your loader to allow override of the filenames, simply use the standard
instruction syntax (see Section “Data Load Journal Instructions”).
271
272
28
An extended curve fit add-on allows you to extend Tecplot 360’s XY-plot curve fitting capability. Once
registered with Tecplot 360, the extended curve fit can be activated from the Curves page of the Mapping
Style dialog by: selecting the maps to which it will apply, selecting Curve Type>Extended, and choosing
the curve fit from the list in the Choose Extended Curve Fit dialog. If the extended curve fit has settings
which may be modified (optional), the dialog for modifying the settings may be accessed by selecting the
[Curve Settings] button with the appropriate mapping(s) selected.
The extended curve fit consists of an initialization routine and one or more callback functions, which are
called by Tecplot 360. These callback functions will call functions to compute the curve fit from the raw
data. They may also call functions to launch dialogs for entry of user configurable settings and output of
the curve fit coefficients.
Refer to Example: Polynomial Integer Add-on and Example: Simple Average Add-on for tutorials on
creating curve-fit add-ons, as well as the sample add-on crvrunavg.
Boolean_t TecUtilCurveRegisterExtCrvFit(
const char *CurveFitName,
GetXYDataPointsCallback_pf XYDataPointsCallback,
GetProbeValueCallback_pf ProbeValueCallback,
GetCurveInfoStringCallback_pf CurveInfoStringCallback,
GetCurveSettingsCallback_pf CurveSettingsCallback,
GetAbbreviatedSettingsStringCallback_pf
AbbreviatedSettingsStringCallback);
which returns TRUE if the extended curve fit was added successfully.
• CurveFitName - the unique name given to the extended curve fit. This name is used in the list
of extended curve fits in the Choose Extended Curve Fit dialog, launched from Extended
option on the Curves page of the Mapping Style dialog.
• XYDataPointsCallback - the function that calculates the curve fit. This is the only function that
required to create an extended curve fit add-on.
273
• ProbeValueCallback - the name of the function that will return the dependent value when the
extended curve fit is probed at a given independent value. If ProbeValueCallback is set to NULL,
Tecplot 360 will perform a linear interpolation based on the values returned by the
XYDataPointsCallback function.
• CurveInfoStringCallback - the function that will create a string to be presented in the Curve
Information dialog (accessed via the Data menu). CurveInfoStringCallback may be set to NULL
if you do not wish to present a string to the Curve Information dialog.
• CurveSettingsCallback - the function that is called when the [Curve Settings] button on the
Curves page of the Mapping Style dialog is selected (and the Curve Type is set to extended
curve fit). CurveSettingsCallback may be set to NULL, if there are no configurable settings for
the extended curve fit. If settings are changed, it is the responsibility of the add-on writer to
inform Tecplot 360 of the change by calling the function TecUtilCurveSetExtendedSettings. This
function is usually called when the [OK] button is selected on the add-on dialog.
• AbbreviatedSettingsStringCallback - the function that returns a short version of your curve
settings string. This string will be presented in the Curve Settings text field on the Curves page
of the Mapping Style dialog. AbbreveatedSettingsStringCallback may be set to NULL if you do
not wish to assign anything to this string. Even if you do not assign anything to the
CurveSettings string, you may define this function and return any string you wish. The Curve
Settings text field on the Curves page of the Mapping Style dialog is roughly 50 characters
wide, so strings longer than roughly 50 characters will be truncated.
Because extended curve fit add-ons aren’t compatible with Tecplot 360 versions earlier than 10, it is
important to check the Tecplot 360 version number before registering the curve fit. The version number
may be obtained using the TecUtilGetTecplotVersion function. If this function returns a value less that 10,
display an error message and don’t call TecUtilCurveRegisterExtCrvFit.
It you are creating your add-on using the Tecplot GUI builder, and have created templates by running the
CreateNewAddOn script (Linux/Macintosh):
• the add-on registration code (including the Tecplot 360 version test) will be found in the
module main.c
• the callback functions listed previously will be found in the module engine.c
• Curve Settings dialog callback functions will be found in guicb.c (if configurable settings were
requested).
Typically, you will not need to modify main.c.
274
Calculating the Curve Fit
FieldData_pa RawDepV,
CoordScale_eIndVCoordScale,
CoordScale_eDepVCoordScale,
LgIndex_t NumRawPts,
LgIndex_tNumCurvePts,
EntIndex_tXYMapNum,
char*CurveSettings,
double*IndCurveValues,
double*DepCurveValues);
Where:
• XYDataPointsCallback - the function that calculates the curve fit.
• RawIndV - the handle to the raw field data of the independent variable.
• RawDepV - the handle to the raw field data of the dependent variable.
• IndVCoordScale- an enumerated variable specifying whether the independent variable axis
has a linear or log scale.
• DepVCoordScal - an enumerated variable specifying whether the dependent variable axis has
a linear or log scale.
• NumRawPts - the number of raw field data values.
• NumCurvePts - the number of points that will construct the curve fit.
• XYMapNum - the map number that is currently being operated on.
• CurveSettings - the curve settings string for the current Line-map.
• IndCurveValues - a pre-allocated array of size NumCurvePts which the add-on will populate
with the independent values for the curve fit.
• DepCurveValues - a pre-allocated array of size NumCurvePts which the add-on will populate
with the dependent values for the curve fit.
The arrays, IndCurveValues and DepCurveValues are the main result of this function call.
Generally speaking, the XYDataPointCallback consists of two parts. The first part computes the curve fit
coefficients, and the second populates the curve values arrays. The process for computing the curve fit
coefficients is beyond the scope of this manual. For common techniques such as linear least squares and
splines, there are several good books you can refer to for theory (see the Numerical Recipes series,
published by the Cambridge University Press, for examples) and various libraries are available on the
internet and elsewhere.
Regardless of what method you use to compute the curve fit parameters, you will need to extract data
from the raw data arrays. This may be done with the TecUtilDataValueGetByRef utility. For example, with:
int I;
DepVar = TecUtilDataValueGetByRef(RawDepV, I)
DepVar will contain the ith element of the raw dependent variable array.
Populating the dependent variable arrays is relatively simple. Determine the spacing of the independent
curve variable with the following code:
275
DepCurveValues[ii] = CurveFunction(IndCurveValues[ii], Parameters);
}
If you use the CreateNewAddOn script (Linux/Macintosh), most of the code for populating the curve variable
arrays is created for you. You will only need to modify the line that computes DepCurveValues[ii] (the
default code sets this to the mean value of the raw dependent variable).
There are three items in the XYDataPointCallback parameter list that are not required for every case:
• The CurveSettings string is needed only if the curve fit has user configurable curve settings.
• IndVCoordScale and DepVCoordScale are needed only if the nature of the curve fit depends upon
the axis scale used (log or linear). Generally this is not the case. Tecplot 360’s standard curve
fits, for example, are not dependent upon the axis scale.
276
Providing Curve Fit Information
277
CurveSettingsCallback is the name of the function that is called when the [Curve Settings] button on the
Curves page of the Mapping Style dialog is selected while the extended curve fit is set as the Curve Type.
If CurveSettingsCallback is set to NULL in the call to TecUtilCurveRegisterExterCrvFit, there are no
configurable settings for the extended curve fit. The syntax for this function is:
void STDCALL CurveSettingsCallback(Set_pa LineMapSet, StringList_pa SelectedXYMapSettings);
Where:
• CurveSettingsCallback - the name of your function that launches your extended curve
settings dialog. CurveSettingsCallback usually sets any global variables and launches the curve
settings dialog.
• LineMapSet - the set of Line-maps that are selected in the Mapping Style dialog.
• SelectedXYMapSettings - a string list of the curve settings for the Line-maps that are selected
on the Mapping Style dialog.
You must provide one or more dialogs to prompt the user for the curve fit settings. We strongly
recommend that this be a modal dialog to minimize the complexity of monitoring for changes while the
dialog is up. When the [OK] button is selected in the Curve Settings dialog, update the curve settings
string and inform Tecplot 360 by calling TecUtilCurveSetExtendedSettings or TecUtilXYMapSetCurve (with
the first parameter being “EXTENDEDSETTINGS”). Remember that the settings must be modified for all
Line-maps that were selected when the dialog was launched. These map numbers are provided by Tecplot
360 in LineMapSet. If TecUtilCurveSetExtendedSettings is used, you must loop through the maps in
LineMapSet and set each one. In contrast, TecUtilXYMapCurve only needs to be called once, with LineMapSet
as an argument.
It you are creating your add-on using Tecplot GUI Builder, and have created templates by running the
CreateNewAddOn script (Linux/Macintosh) (with configurable settings requested), the CurveSettingsCallback
function will be found in the module engine.c. This function, which saves XYMapSet and XYMapSettings in
global variables and launches the Curve Settings dialog, will probably not need to be modified. The curve
settings dialog callback functions will be found in guicb.c.
278
Creating the Curve Settings Text Field
• AbbreviatedSettings - the short form of the CurveSettings that are passed into your function
by Tecplot 360. The AbbreviatedSettings string must be allocated inside the
AbbreviatedSettingsStringCallback function using TecUtilStringAlloc as follows:
*AbbreviatedSettings = TecUtilStringAlloc(Size, "AbbreviatedSetting");
The string may then be written to using sprintf.
The Tecplot 360 add-on you will build in this tutorial is an example of an extended curve-fit add-on that
does not have any settings which may be configured. This add-on, called PolyInt, will add an option to the
single selection list that is launched by the Curve Type>Extended option on the Curves page of the
Mapping Style dialog. The code in this example is platform-independent.
This add-on will perform three operations:
• Calculate the curve-fit of discrete XY-data. This is the only option that is required.
• Supply Tecplot 360 with a dependent value when the plot is probed
• Present a string to the Curve Information dialog
All of the example of source code shown in this manual is included in the Tecplot 360 distribution and are
found in the adk/samples/polyint subdirectory below the Tecplot 360 home directory.
Before proceeding with this tutorial, please read Chapter 2: “Creating Add-ons on
Linux/Macintosh Platforms” and/or Chapter 3: “Creating Add-ons on Windows
Platforms”.
279
At this point, you should verify that you can compile your add-on and load it into Tecplot 360. If you are
unable to compile or load your add-on, we recommend that you refer to Chapter 2: “Creating Add-ons on
Linux/Macintosh Platforms” or Chapter 3: “Creating Add-ons on Windows Platforms” before proceeding.
1. main.c - This file contains the add-on registration routine. If you open the file, you will see a
call to TecUtilCurveRegisterExtCrvFit. This function registers the extended curve-fit add-on
with Tecplot 360. In main.c, the call to TecUtilCurveRegisterExtCrvFit will appear as follows:
Notice that parameters five and six are NULL. This is because this add-on has no settings
TecUtilCurveRegisterExtCrvFit(ADDON_NAME,
XYDataPointsCallback,
ProbeValueCallback,
CurveInfoStringCallback,
NULL, /* CurveSettingsCallback */
NULL); /*
AbbreviatedSettingsStringCallback */
which may be configured.
2. ENGINE.h - Open ENGINE.h and verify that the following lines exist:
Each of these functions are defined in engine.c.
280
Creating the Curve Settings Text Field
In engine.c we will define the three callbacks that are listed previously. First we will deal with
the function that actually performs the curve-fit. The function is called PolyInt. It is based on a
method given in the Stineman article from Creative Computing (July, 1980)1. Much of this
tutorial will focus on manipulating the data into a form that the PolyInt function can use. A
description of the algorithm is beyond the scope of this tutorial.
The PolyInt function takes an array called Data and some information about the contents of
the array. The Data array is separated into four separate blocks.
• Block 1: Raw independent data values.
• Block 2: Raw dependent data values.
• Block 3: Calculated independent values (based on the number of points on the
calculated curve).
• Block 4: Calculated dependent values (to be filled in by PolyInt function).
We will also pass the indices of the start of each block, the number of raw data points, and the
number of points on the calculated curve to the PolyInt function.
Note the following code in engine.c immediately following the last #include statement:
/**
* Interpolate y=f(x) using the method given in Stineman article from
* Creative Computing (July 1980). At least 3 points are required for
* interpolation. If fewer than three points are supplied, then use
* linear interpolation.
*
* Data is treated as a 1 based array, while lx,ly,lxn,lyn are treated
as 0
* base.
*
* @param npts
* number of original data points
* @param lx
* location of x data points
* @param ly
* location of y data points
* @param nptn
* number of points on the fitted curve
* @param lxn
* location of fitted x points
* @param lyn
* location of fitted y points
* @param data
* working array
*/
void PolyInt(int npts,
int lx,
int ly,
int nptn,
int lxn,
int lyn,
double *data)
{
int j,j1,i,ix,jx,kx,ixx,jxx;
double xv,yv,dydx,dydx1,s,y0,dyj,dyj1;
j = 1;
j1 = j+1;
1. Stineman, R. W. A consistently well-behaved method of interpolation. Creative Computing (July 1980): 54-
57.
281
/* Isolate the data(lx+j) and the data(lx+j+1) that bracket xv... */
for (i=1; i<=nptn; i++)
{
xv = data[lxn+i];
while (xv > data[lx+j1])
{
j++;
j1 = j+1;
}
if (npts == 1)
yv = data[ly+j];
if (npts == 2)
yv = data[ly+2]-(data[lx+j1]-xv)*(data[ly+j1]-data[ly+j])/
(data[lx+j1]-data[lx+j]);
if (npts >= 3)
{
/*
* Calculate the slope at the jth point (from fitting a circle
thru
* 3 points and getting slope of circle).
*/
ix = 1;
jx = 2;
kx = 3;
if (j != 1)
{
ix = j-1;
jx = j;
kx = j+1;
}
dydx = (((data[ly+jx]-data[ly+ix])*
(pow(data[lx+kx]-data[lx+jx],2)+
pow(data[ly+kx]-data[ly+jx],2))+
(data[ly+kx]-data[ly+jx])*
(pow(data[lx+jx]-data[lx+ix],2)+
pow(data[ly+jx]-data[ly+ix],2)))/
((data[lx+jx]-data[lx+ix])*
(pow(data[lx+kx]-data[lx+jx],2)+
pow(data[ly+kx]-data[ly+jx],2))+
(data[lx+kx]-data[lx+jx])*
(pow(data[lx+jx]-data[lx+ix],2)+
pow(data[ly+jx]-data[ly+ix],2))));
if (j == 1)
{
ixx = ix;
jxx = jx;
s = (data[ly+jxx]-data[ly+ixx])/(data[lx+jxx]-
data[lx+ixx]);
if (s != 0.0)
{
if (!((s >= 0.0 && s > dydx) || (s <= 0.0 && s < dydx)))
dydx = s+(fabs(s)*(s-dydx))/(fabs(s)+fabs(s-dydx));
else
dydx = 2.0*s-dydx;
}
}
282
Creating the Curve Settings Text Field
kx = nptn;
if (j1 != nptn)
{
ix = j1-1;
jx = j1;
kx = j1+1;
}
dydx1 = (((data[ly+jx]-data[ly+ix])*
(pow(data[lx+kx]-data[lx+jx],2.)+
pow(data[ly+kx]-data[ly+jx],2.))+
(data[ly+kx]-data[ly+jx])*
(pow(data[lx+jx]-data[lx+ix],2.)+
pow(data[ly+jx]-data[ly+ix],2.)))/
((data[lx+jx]-data[lx+ix])*
(pow(data[lx+kx]-data[lx+jx],2.)+
pow(data[ly+kx]-data[ly+jx],2.))+
(data[lx+kx]-data[lx+jx])*
(pow(data[lx+jx]-data[lx+ix],2.)+
pow(data[ly+jx]-data[ly+ix],2.))));
if (j1 == nptn)
{
ixx = jx;
jxx = kx;
s = (data[ly+jxx]-data[ly+ixx])/
(data[lx+jxx]-data[lx+ixx]);
if (s != 0.0)
{
if (!((s >= 0.0 && s > dydx1) ||
(s <= 0.0 && s < dydx1)))
dydx1 = s+(fabs(s)*(s-dydx1))/(fabs(s)+fabs(s-
dydx1));
else
dydx1 = 2.0*s-dydx1;
}
}
/*
* Calculate s=slope between j and j+1 points
* y0 = y-value if linear interp used
* dyj = delta-y at the j-th point
* dyj1 = delta-y at the j+1 point
*/
s = (data[ly+j1]-data[ly+j])/(data[lx+j1]-data[lx+j]);
y0 = data[ly+j]+s*(xv-data[lx+j]);
dyj = data[ly+j]+dydx*(xv-data[lx+j])-y0;
dyj1 = data[ly+j1]+dydx1*(xv-data[lx+j1])-y0;
/* Calculate y... */
if (dyj*dyj1 == 0.0)
yv = y0;
if (dyj*dyj1 > 0.0)
yv = y0+(dyj*dyj1)/(dyj+dyj1);
if (dyj*dyj1 < 0.0)
yv = y0+((dyj*dyj1*(xv-data[lx+j]+xv-data[lx+j1]))/
((dyj-dyj1)*(data[lx+j1]-data[lx+j])));
}
data[lyn+i] = yv;
}
}
283
Step 2 The XYDataPointsCallback function
Knowing that the PolyInt function uses a single array containing all the raw and calculated independent
values, we must prepare this array in the XYDataPointsCallback function and pass it on to the PolyInt
function. Once the array is passed on to PolyInt, it will be returned with the calculated points. At that time,
we must extract those points from the working array and place them into the array that Tecplot 360 passed
to the XYDataPointsCallback function.
The XYDataPointsCallback has the following structure:
1. Allocate and initialize the working array, called Data.
2. Fill the working array with the raw data and the calculated independent values.
3. Pass the working array to the PolyInt function. This will fill in the calculated dependent
values.
4. Extract the data from the working array and place into the arrays that Tecplot 360 passed in.
5. Free the working array.
Use the following code for XYDataPointsCallback:
Notice that in this function, the CurveSettings and XYMapNum variables are never referenced.
TecUtilLockStart(AddOnID);
/*
* Data will contain all the data points and is 1 base:
* RawIndpts
* RawDepPts
* IndCurveValues
* DepCurveValues
* Therefore, the array must be large enough to
* contain all these points: 2*(NumRawPts+NumCurvePts).
*/
TotalNumDataPts = 2*(NumRawPts+NumCurvePts);
Data = malloc((TotalNumDataPts+1)*sizeof(double));
if (Data != NULL)
{
/* Initialize Data to contain all zero. */
for (ii = 0; ii < TotalNumDataPts+1; ii++)
Data[ii] = 0;
}
else
IsOk = FALSE;
if (IsOk)
{
int lx;
284
Creating the Curve Settings Text Field
int ly;
int lxn;
int lyn;
/* Extract the values from Data that were placed there by the
curve fit. */
ExtractCurveValuesFromWorkingArray(NumCurvePts,
lxn,
lyn,
Data,
IndCurveValues,
DepCurveValues);
free(Data);
}
TecUtilLockFinish(AddOnID);
return IsOk;
}
This is because there are no settings which may be configured for this curve-fit. Tecplot 360 requires only a
return value (TRUE or FALSE), and that the Ind CurveValues and DepCurveValues arrays are filled.
Tecplot 360 will plot any values that are placed in these arrays. If the values do not make sense, the
resulting plot will not make sense. The burden is on the add-on writer to make sure that the values placed
in these arrays are correct.
Also, notice that there are two functions we have referenced that must still be written. These functions take
care of steps 2 and 4 as outlined in the preceding function structure.
Step 3 The PrepareWorkingArray function
This function will fill the working array, Data, with the raw data and the calculated independent curve
points. It will also return the indices within the Data array to the different blocks of data. As stated
previously:
• lx - Start of the raw independent data.
• ly - Start of the raw dependent data.
• lxn - Start of the calculated independent data.
• lyn - Start of the calculated dependent data.
Note the following function above the XYDataPointsCallback function.
285
LgIndex_t NumRawPts,
LgIndex_t NumCurvePts,
int *lx,
int *ly,
int *lxn,
int *lyn,
double *Data)
{
double FirstValidPoint;
double LastValidPoint;
double StepSize;
int ii;
/*
* The followint are indices to start points of
* the data blocks in the 1 based arrray, Data
* lx - Start of the raw Independent data.
* ly - Start of the raw Dependent data.
* lxn - Start of the calculated independent data.
* lyn - Start of the calculated dependent data.
*
* The PolyInt function treats lx,ly,lxn,lyn as 0 base
* indices, but treats Data as a 1 base array.
*/
*lx = 0;
*ly = NumRawPts;
*lxn = 2*NumRawPts;
*lyn = 2*NumRawPts+NumCurvePts;
/* Fill the first blocks of the Data array with the Raw Data Values.
*/
for (ii = 1; ii <= NumRawPts; ii++)
{
Data[*lx+ii] = TecUtilDataValueGetByRef(RawIndV, ii);
Data[*ly+ii] = TecUtilDataValueGetByRef(RawDepV, ii);
}
/*
* Calculate the size of steps to take while stepping
* along the independent variable range.
*/
TecUtilDataValueGetMinMaxByRef(RawIndV,
&FirstValidPoint,
&LastValidPoint);
StepSize = (LastValidPoint-FirstValidPoint)/(NumCurvePts-1);
/*
* Fill the third block of the Data array with the
* calculated independent values.
*/
for (ii = 1; ii <= NumCurvePts; ii++)
{
double IndV = FirstValidPoint + (ii-1)*StepSize;
if (IndV > LastValidPoint)
IndV = LastValidPoint;
Data[*lxn+ii] = IndV;
}
}
Step 4 The ExtractCurveValuesFromWorkingArray function
This function will extract the calculated data from the working array, Data, and place it in the arrays that
were passed to the XYDataPointsCallback function by Tecplot 360. Tecplot 360 will then use these values to
plot the curve.
286
Creating the Curve Settings Text Field
/**
* This functions follows a similar process as the
XYDataPointsCallback,
* except it manually inserts ProbeIndValue in the list of the
* independent curve points. It stores the index in the Data array for
* that value and uses that relative location to find the calculated
287
* ProbeDepValue.
*/
Boolean_t STDCALL ProbeValueCallback(FieldData_pa RawIndV,
FieldData_pa RawDepV,
CoordScale_e IndVCoordScale,
CoordScale_e DepVCoordScale,
LgIndex_t NumRawPts,
LgIndex_t NumCurvePts,
EntIndex_t XYMapNum,
char *CurveSettings,
double ProbeIndValue,
double *ProbeDepValue)
{
Boolean_t IsOk = TRUE;
int ii;
double FirstValidPoint;
double LastValidPoint;
double *Data = NULL;
int TotalNumDataPts;
TecUtilLockStart(AddOnID);
if (IsOk)
{
/*
* If the Curve has too few points, crank the number of points
* on the curve up, so we get a good approximation of the curve.
*/
NumCurvePts = MAX(NUMPTSFORPROBING, NumCurvePts);
TotalNumDataPts = 2*(NumRawPts+NumCurvePts);
Data = malloc((TotalNumDataPts+1)*sizeof(double));
if (Data != NULL)
{
/* Initialize Data to contain all zero. */
for (ii = 0; ii < TotalNumDataPts+1; ii++)
Data[ii] = 0;
}
else
IsOk = FALSE;
}
if (IsOk)
{
int lx,ly,lxn,lyn;
int ProbeValueIndex = -1;
PrepareWorkingArray(RawIndV,
RawDepV,
NumRawPts,
NumCurvePts,
&lx,
&ly,
&lxn,
&lyn,
Data);
IsOk = InsertProbeValueInWorkingArray(ProbeIndValue,
288
Creating the Curve Settings Text Field
NumCurvePts,
lxn,
&ProbeValueIndex,
Data);
if (IsOk && ProbeValueIndex != -1)
{
/* Perform the curve fit. */
PolyInt(NumRawPts,
lx,
ly,
NumCurvePts,
lxn,
lyn,
Data);
/* The dependent value is in the same relative location. */
/* as the probed independent value. */
*ProbeDepValue = Data[lyn+ProbeValueIndex];
}
}
if (Data != NULL)
free(Data);
TecUtilLockFinish(AddOnID);
return IsOk;
}
Step 6 The InsertProbeValueInWorkingArray function
This function inserts the probed independent value into the working array so that the curve-fit will be
performed exactly at the probed value. This is done by marching through the calculated independent
values, and when two values that surround the probed value are found, the probed value replaces the
lesser of the two surrounding values in the working array. Also, the relative location of the probed value is
saved, so that the calculated dependent value can be extracted from the working array.
Note the following code above the ProbeValueCallback in engine.c:
289
Step 7 The CurveInfoStringCallback function
The CurveInfoStringCallback function will pass a string to the XY-Plot Curve Information dialog. This
string can be any information you wish to present to the dialog. Typical information in this dialogs are the
curve coefficients. Since it is beyond the scope of this tutorial to calculate the coefficients of the curve, we
will simply present a string to the dialog.
Examine the following code in engine.c:
This tutorial is an example of an extended curve-fit add-on that uses curve settings. The setting that we
will be configuring in this add-on, called SimpAvg, is the independent variable range. This curve-fit add-
on will compute the average of the data within the specified independent variable range. The code in this
tutorial is platform-independent.
1. rainfall.plt is included in the $TEC_360_2011R2/Demo/XY directory on your Tecplot 360 installation, where
$TEC_360_2011R2 is your installation directory. For Windows users, this is typically C:\Program Files\Tec-
plot\Tec360 2011R2.
290
Creating the Curve Settings Text Field
The process described in this manual is the preferred process for creating curve-fit add-
ons with configurable settings. Whenever creating an add-on of this type, you should
refer to this example as a template.
SimpAvg will use the following source code files. Each one will be automatically created by the
CreateNewAddOn script (Linux/Macintosh). The project and add-on names will both be SimpAvg.
When running CreateNewAddOn answer the questions as follows:
• Project Name (Base name) - SimpAvg
• Add-on Name - SimpAvg
• Company Name - [Your company name]
• Type of Add-on - Extended Curve-Fit
• Language - C
• Allow Configurable Settings - Yes
• Create Callback Function for More Accurate Probing - No
After running the CreateNewAddOn script, you should have the following files:
engine.c main.c guibld.cguicb.c
guidefs.c ADDGLBL.hENGINE.hGUIDEFS.h
You will also have other files specific to your platform, but the files listed are the only ones we will be
dealing with. The purpose of each file will be explained in detail as we proceed through the tutorial.
At this point, you should verify that you can compile your add-on and load it into Tecplot 360.
If you are unable to compile or load your add-on, we recommend that you refer to Chapter 2: “Creating
Add-ons on Linux/Macintosh Platforms” or Chapter 3: “Creating Add-ons on Windows Platforms” before
proceeding.
Step 2 Designing the add-on
Since this curve-fit will have settings which may be configured, we will need to make some decisions
before writing the add-on.
1. What are the settings going to be?
• Use an Independent Variable Range.
• What is the IndVarMin?
• What is the IndVarMax?
2. What are the default settings?
• UseIndVarRange - FALSE.
• IndVarMin - -LARGEDOUBLE (-1E+150).
• IndVarMax - LARGEDOUBLE (1E+150).
3. What is the syntax for the CurveSettings string?
• Newline delimited (spaces delimiting the ‘=’ are required).
• Example:
UseIndVarRange = TRUE\n
IndVarMin = 2\n
IndVarMax = 7\n
4. How to maintain the values of the settings?
291
• The settings string will be maintained by Tecplot 360; however, we will create a struct as
follows to hold the values that are contained in the settings string.
typedef struct
{
Boolean_t UseIndVarRange;
double IndVarMin;
double IndVarMax;
} CurveParams_s;
• This structure will be placed in ADDGLBL.h.
Step 3 Handling the CurveSettings string
The first thing we will do is lay the groundwork for how to handle the CurveSettings string. Because, this
string is maintained by Tecplot 360 and is updated by the add-on, our add-on must be able to parse the
string.
We will start with the function that creates the string. This function will make use of the CurveParams_s
structure. If you have not done so already, add the CurveParams_s structure, as defined previously, to
ADDGLBL.h.
Now that the CurveParams_s structure is in place, we will create a function in engine.c called
CreateCurveSettingsString. This function will take one parameter, the CurveParams_s structure, and return a
string based on the values of the structure. The function is written as follows:
Add this prototype to ENGINE.h:
char *CreateCurveSettingsString(CurveParams_s CurveParams);
The following code is in engine.c:
/**
* Creates a CurveSettings string based on the values
* in the CurveParams structure that is passed in.
*/
char *CreateCurveSettingsString(CurveParams_s CurveParams)
{
char S[1000];
char *CurveSettings;
if (CurveParams.UseIndVarRange)
strcpy(S,”UseIndVarRange = TRUE\n”);
else
strcpy(S,”UseIndVarRange = FALSE\n”);
S[strlen(S)] = ‘\0’;
CurveSettings = TecUtilStringAlloc(strlen(S), “CurveSettings”);
strcpy(CurveSettings, S);
return CurveSettings;
}
Notice that this function calls TecUtilStringAlloc. The calling function is responsible for de-allocating the
string returned by CreateCurveSettingsString. Also notice that the string is newline delimited, as discussed
previously.
Now that we have a function that creates the CurveSettings string, create a function that will parse the
newline delimited string and populate the CurveParams_s structure. The function that we will be writing
will use several convenient functions that are defined in adkutil.h. Simply, add the line:
#include "ADKUTIL.h"
292
Creating the Curve Settings Text Field
/**
* This function makes use of functions found in the
* adkutil.c module to parse the CurveSettings string.
*/
void GetValuesFromCurveSettings(EntIndex_t XYMapNum,
char *CurveSettings,
CurveParams_s *CurveParams)
{
Boolean_t IsOk = TRUE;
# define MAXCHARS 50
char Command[MAXCHARS+1];
char ValueString[MAXCHARS+1];
char *CPtr;
char *ErrMsg = NULL;
293
double Max;
IsOk = Macro_GetDoubleArg(Command,
ValueString,
-LARGEDOUBLE,
LARGEDOUBLE,
&Max,
&ErrMsg);
if (IsOk)
CurveParams->IndVarMax = Max;
}
else
{
ErrMsg = TecUtilStringAlloc((strlen(Command)+100),
“error message”);
sprintf(ErrMsg, “Unknown argument: %s.”, Command);
IsOk = FALSE;
}
}
else /* GetArgPair Failed. */
IsOk = FALSE;
}
}
else /* CurveSettings is an invalid string. */
IsOk = FALSE;
if (NewCurveSettings != NULL)
{
TecUtilCurveSetExtendedSettings(XYMapNum,NewCurveSettings);
TecUtilStringDealloc(&NewCurveSettings);
}
if (ErrMsg != NULL)
{
TecUtilDialogErrMsg(ErrMsg);
TecUtilStringDealloc(&ErrMsg);
}
}
}
Notice at the bottom of this function we repair the CurveSettings string if it was invalid. It could be that the
syntax was wrong, or that the string had not yet been initialized. Either way, we call the function
InitializeCurveParams in which we setup the CurveParams_s structure with default values. Then, we create a
new CurveSettings string, which is constructed with the default values. Finally, we set the CurveSettings
string for the current XY-map, XYMapNum, by calling TecUtilCurveSetExtendedSettings.
Step 4 The InitializeCurveParams function
Examine the following code in engine.c:
294
Creating the Curve Settings Text Field
TecUtilCurveRegisterExtCrvFit(ADDON_NAME,
XYDataPointsCallback,
NULL, /* ProbeValueCallback */
CurveInfoStringCallback,
CurveSettingsCallback,
AbbreviatedSettingsStringCallback);
If Tecplot GUI Builder is not available from the Tools menu in Tecplot 360, refer to
Section 25 - 1 “Using Tecplot GUI Builder” for instructions are running Tecplot 360 with
the GUI Builder.
3. There will be callbacks associated with each of the text fields, and the toggle button. By
default, the TGB adds generic variable names for these controls. Change these variable names
by double-clicking on the control and selecting the [Options] button in the resulting Text
Details dialog. The variable name can be changed in the Macro Function field of the Text
Options dialog.
a. Double-click on the Use Independent Variable Range toggle and select Options. In the
Macro Function field, type VarName=UseIndVarRange. This will give the callback a
meaningful name.
b. Appropriate names for the text fields are IndVarMin and IndVarMax. Although we
will not be performing any operations in the text field callbacks, giving them
meaningful names is recommended. Set the label names to "VarName=Min" and
"VarName=Max".
4. Now, double-click on the dialog frame and verify that the frame name is as follows:
ID=1 MODE=MODAL TITLE="Simple Average"
295
5. You can now build the source for this layout. Select Go Build from the GUI Builder dialog.
6. Now that TGB has created new stub files, be sure to copy the toggle and text field callbacks
from guicb.tmp into guicb.c.
Step 3 Launching and Initializing the Dialog
The add-on dialog is launched by the CurveSettingsCallback function in engine.c. The parameter XYMapSet is
the set of XY-maps that were selected in the Mapping Style dialog at the time Curve Settings was selected.
The parameter XYMapSettings is a string list containing the CurveSettings strings of all the XY-maps in the
set, XYMapSet.
When the [Curve Settings] is selected, the function CurveSettingsCallback is called by Tecplot 360. In this
function we will save the XYMapSet and XYMapSettings so we can use them later in the guicb.c module. These
variables are needed in guicb.c in order to properly initialize the dialog fields.
In engine.c verify that CurveSettingsCallback is as follows:
TecUtilLockStart(AddOnID);
/*
* Save off XYMapSettings and SelectedXYMaps for use
* in the functions in guicb.c
*/
GlobalCurve.XYMapSet = XYMapSet;
GlobalCurve.XYMapSettings = XYMapSettings;
TecUtilLockFinish(AddOnID);
}
GlobalCurve is a global structure that maintains the curve settings when the dialog is launched. This
structure must be declared in ENGINE.h as follows:
typedef struct
{
StringList_pa XYMapSettings;
Set_pa XYMapSet;
} GlobalCurve_s;
Now declare the variable GlobalCurve in engine.c. Immediately below the #include statements in engine.c
and guicb.c, type the following:
GlobalCurve_s GlobalCurve;
Finally, make sure the line:
#include "ENGINE.h"
exists in guicb.c.
Step 4 Initializing the Dialog
Initialization of the dialog is taken care of in guicb.c in the function Dialog1Init_CB. When initializing the
dialog, we must place the correct values into each field, and we must also set the sensitivities of each field.
In the case of this dialog the sensitivities are as follows:
• UseIndVarRange - Toggle, always active.
• IndVarMin - Text field, active when UseIndVarRange is checked.
296
Creating the Curve Settings Text Field
(EntIndex_t)TecUtilSetGetNextMember(GlobalCurve.XYMapSet,TECUTILSETNOT
MEMBER),
CurveSettings,
&OrigCurveParams);
if (CurveSettings != NULL)
TecUtilStringDealloc(&CurveSettings);
NumMembers = TecUtilStringListGetCount(GlobalCurve.XYMapSettings);
/*
* Compare the value of the first mapping with all the other mappings.
* This loop will not be done if there is only one mapping selected.
*/
297
for (ii = 2; ii <= NumMembers; ii++)
{
CurveParams_s TmpParams;
CurveSettings =
TecUtilStringListGetString(GlobalCurve.XYMapSettings, ii);
GetValuesFromCurveSettings(
(EntIndex_t)TecUtilSetGetNextMember(GlobalCurve.XYMapSet, ii),
CurveSettings,
&TmpParams);
if (UseIndVarRangeIsSame)
UseIndVarRangeIsSame = (TmpParams.UseIndVarRange ==
OrigCurveParams.UseIndVarRange);
if (IndVarMinIsSame)
IndVarMinIsSame = (TmpParams.IndVarMin ==
OrigCurveParams.IndVarMin);
if (IndVarMaxIsSame)
IndVarMaxIsSame = (TmpParams.IndVarMax ==
OrigCurveParams.IndVarMax);
if (CurveSettings != NULL)
TecUtilStringDealloc(&CurveSettings);
}
/*
* Initialize the CurveParamsPtr to the default values.
* If all mappings have the same value for a particular parameter,
* use that value instead.
*/
InitializeCurveParams(CurveParamsPtr);
if (UseIndVarRangeIsSame)
CurveParamsPtr->UseIndVarRange = OrigCurveParams.UseIndVarRange;
if (IndVarMinIsSame)
CurveParamsPtr->IndVarMin = OrigCurveParams.IndVarMin;
if (IndVarMaxIsSame)
CurveParamsPtr->IndVarMax = OrigCurveParams.IndVarMax;
}
Finally we will add a function to initialize the dialog fields, which will be called from the Dialog1Init_CB
function, as described following. This function also calls InitializeGUICurveParams, which was previously
defined.
The following function is in guicb.c below the UpdateMainDialogSensitivities and below the
InitializeGUICurveParams function:
Compile and run your add-on to make sure that the fields and sensitivities are initialized correctly. The
298
Creating the Curve Settings Text Field
299
At this point, the dialog should be fully functional. The dialog will be initialized with the correct values
/* Create the Curve Settings string from the new curve parameters. */
CurveSettings = CreateCurveSettingsString(CurveParams);
if (CurveSettings != NULL)
{
EntIndex_t Map;
TecUtilSetForEachMember(Map, GlobalCurve.XYMapSet)
{
TecUtilCurveSetExtendedSettings(Map, CurveSettings);
}
TecUtilStringDealloc(&CurveSettings);
}
TecGUIDialogDrop(Dialog1Manager);
TecUtilLockFinish(AddOnID);
}
and sensitivities. The sensitivities will be updated correctly, and Tecplot 360 will be informed when the
CurveSettings string is changed.
Step 5 Updating the Mapping/Zone Style Dialog
To update the Mapping Style dialog, we move back to the engine.c module. The CurveSettings field of the
Mapping/Zone Style dialog will be filled with the string returned by the
AbbreviatedSettingsStringCallback function. If this function is undefined, or returns a value of NULL, the
CurveSettings string that Tecplot 360 stores will be used in the Mapping Style dialog.
To create this string, we will evaluate the CurveSettings string and create a legible output string. The string
we will produce will look like:
• If using the Independent Variable Range, IndVarMin = 2 and IndVarMax = 7:
"IndVarRange: Min = 2; Max = 7"
• If not using the Independent Variable Range:
"No IndVarRange"
TecUtilLockStart(AddOnID);
GetValuesFromCurveSettings(XYMapNum,
CurveSettings,
&CurveParams);
300
Creating the Curve Settings Text Field
if (CurveParams.UseIndVarRange)
{
sprintf(S,
“IndVar Range: Min = %G; Max = %G”,
CurveParams.IndVarMin,
CurveParams.IndVarMax);
*AbbreviatedSettings = S;
}
else
{
strcpy(S, “No IndVarRange”);
*AbbreviatedSettings = S;
}
TecUtilLockFinish(AddOnID);
}
Compile the add-on and verify that you can change the settings via your dialog, and that settings are
displayed on the Mapping Style dialog.
Step 6 The XYDataPointsCallback
We will need to alter the XYDataPointsCallback to determine the proper independent variable range. This
range is the range limited by the extents of the data and the values specified in the Curve-Fit dialog. Alter
the XYDataPointsCallback as follows:
int ii;
double Average;
double Delta = 0.0;
double IndVarMin,
IndVarMax;
CurveParams_s CurveParams;
TecUtilLockStart(AddOnID);
if (CurveParams.UseIndVarRange)
{
/*
* Adjust the independent variable range to fall either within
* the range of data or the range specified by the
301
* CurveParams structure.
*/
IndVarMin = MAX(IndVarMin, CurveParams.IndVarMin);
IndVarMax = MIN(IndVarMax, CurveParams.IndVarMax);
}
Delta = (IndVarMax-IndVarMin)/(NumCurvePts-1);
/*
* Find the average value of the raw dependent variable for the
* default curve fir (straight line at average).
*/
Average = SimpleAverage(RawDepV,
RawIndV,
NumRawPts,
IndVarMin,
IndVarMax);
/*
* Step through all the points along the curve and set the
* DepCurveValues to the Average at each IntCurveValue.
*/
TecUtilLockFinish(AddOnID);
return IsOk;
}
Notice that the SimpleAverage function has also been changed. We are now passing more information to the
SimpleAverage function so it can make the decision about what points to include in the average value
calculation. Alter the SimpleAverage function as follows:
/**
* Function to compute the average of the raw dependent variable for the
* default fit (straight line at average).
*
* REMOVE THIS FUNCTION FOR OTHER FITS.
*/
double SimpleAverage(FieldData_pa RawDepV,
FieldData_pa RawIndV,
LgIndex_t NumRawPts,
double IndVarMin,
double IndVarMax)
{
int ii;
int Count = 0;
double Sum = 0;
/*
* Only compute the average on values that fall in the
* specified range of the independent variable.
*/
if ( IndV >= IndVarMin && IndV <= IndVarMax)
{
Sum += TecUtilDataValueGetByRef(RawDepV, ii+1);
302
Creating the Curve Settings Text Field
Count++;
}
}
return (Sum/Count);
}
The SimpleAverage function is also used in the CurveInfoStringCallback so we will have to alter that
function as well. You will notice that the process in CurveInfoStringCallback is very similar to the process
used in XYDataPointsCallback. The CurveInfoStringCallback function looks as follows:
TecUtilLockStart(AddOnID);
/*
* If this function is not registered with Tecplot, no curve
* information will be displayed in the XY-Curve Info dialog.
*/
*CurveInfoString = TecUtilStringAlloc(30, “CurveInfoString”);
if (CurveParams.UseIndVarRange)
{
/*
* Adjust the Independent variable range to fall either within
* the range of the data or the range specified by the
* CurveParams structure.
*/
IndVarMin = CurveParams.IndVarMin; /* initialize these values */
IndVarMax = CurveParams.IndVarMax;
IndVarMin = MAX(IndVarMin, CurveParams.IndVarMin);
IndVarMax = MIN(IndVarMax, CurveParams.IndVarMax);
}
Average = SimpleAverage(RawDepV,
RawIndV,
NumRawPts,
IndVarMin,
IndVarMax);
TecUtilLockFinish(AddOnID);
return IsOk;
}
303
The add-on is now complete. You should compile the add-on at this time and verify that it works as
expected.
As a further exercise, add error-checking to the dialog so that the minimum value is
greater than the maximum value.
304
29
A data set converter is the easier of the two data reader types to write. The primary component of a data
set converter is a function that reads in a non-Tecplot 360 data format and writes out a binary Tecplot 360
data file. The ADK provides functions that make it easy to write out a Tecplot 360 binary data file once you
have read in your own data. A data set converter does not require graphical user interface. The standard
Tecplot 360 file dialogs are used and Tecplot 360 manages the reading in of multiple files, partial reads,
and so on. Data set converters are registered with Tecplot 360 by making the following call in
InitTecAddon:
TecUtilImportAddConverter(ConverterCallBack,
"MyConverterName",
"FNameExtension");
• ConverterCallback is the function that converts the data. It is in engine.c, and has these
parameters:
Boolean_t ConverterCallback(char *DataFName,
char *TempBinFName,
char **MessageString);
ConverterCallback reads from the file DataFName, writes to the file TempBinFName, and if
and only if there are any errors, places the error messages in the string MessageString.
MessageString must be allocated inside ConverterCallback using TecUtilStringAlloc as
follows:
*MessageString = TecUtilStringAlloc(Size,"Error message");
You can use strcpy to assign an error string. For example:
strcpy(*MessageString, "My Error");
return FALSE;
• MyConverterName is a unique name assigned to your data set converter. It must be less than 32
characters long. This is also used as the text in the Load Data File(s) dialog in the Tecplot 360
interface.
• FNameExtension is the extension you want as the default for the file dialog when it is displayed
by Tecplot 360.
A data set converter should use only the following functions to write out the binary Tecplot 360 data file:
TecUtilTecAux
TecUtilTecDat
TecUtilTecEnd
305
TecUtilTecFace
TecUtilTecFil
TecUtilTecForeign
TecUtilTecGeo
TecUtilTecGeoX
TecUtilTecIni
TecUtilTecLab
TecUtilTecNod
TecUtilTecTxt
TecUtilTecTxtX
TecUtilTecUsr
TecUtilTecVAux
TecUtilTecZAux
TecUtilTecZne
TecUtilTecZneX
These functions duplicate the capabilities of the TECIO functions described in Section 3 - 7 “Binary Data File
Function Reference” in the Data Format Guide.
This tutorial illustrates how to create an add-on, called Converter. The Converter add-on is an example of
how to load a comma- or space-delimited list of values into Tecplot 360. When you run Tecplot 360 after
you have completed this tutorial, Converter will appear under the Load Data File(s) option of Tecplot 360’s
File menu.
All of the examples of the source code shown in this tutorial are included in the Tecplot 360 distribution in
$TEC_360_2011R2/adk/samples/cnvss.
306
the add-on and state that it is a converter. The InitTecAddOn function is called by Tecplot 360
exactly when the add-on is first loaded, and is not called again.
• ADDGLBL.h - contains information specific to the add-on, such as its name, version number,
and date
There will be other files specific to your platform, however, we will only be dealing with those listed.
Verify that the add-on will compile and that it can be loaded into Tecplot 360. If any problems are
encountered, refer to Chapter 2: “Creating Add-ons on Linux/Macintosh Platforms”.
Step 2 Modifying the ConverterCallback function
When Converter is loaded by Tecplot 360, an option called Simple Spreadsheet Converter will appear in the
Load Data File(s) dialog accessed from Tecplot 360’s File menu. When Converter is launched, Tecplot 360
will ask for a file to convert. Converter passes this file name to the ConverterCallback function. Tecplot 360
will also create a unique temporary file name and pass that to ConverterCallback as well.
In ConverterCallback we are required to:
• Open the file DataFName.
• Convert the data and create a Tecplot 360 binary data file.
• Close the file DataFName.
• Inform Tecplot 360 if there were any errors.
Note how the ConverterCallback function satisfies these requirements:
char *TempBinFName,
char **MessageString)
{
Boolean_t IsOk = TRUE;
FILE *f;
TecUtilLockStart(COMMANDPROCESSORID);
/* If there is no error, remember to free MessageString. */
*MessageString = TecUtilStringAlloc(1000, "MessageString for CNVSS");
/* Try to open the file. */
f = fopen(DataFName, "rb");
TecUtilLockFinish(COMMANDPROCESSORID);
return IsOk;
}
This function does the following:
• Creates an error message - * MessageString is allocated here because the DoConversion function
(which will be explained later) may alter the error message that is reported.
307
• Attempts to open the file - If the file cannot be opened, it sets IsOk to FALSE, and resets the
*MessageString to reflect the fact that the file could not be opened.
• If the file was opened, it converts it - The task of conversion is handed off to the DoConversion
function.
• Some clean up is performed, such as closing the file, de-allocating *MessageString if there were
no errors, and returning IsOk. If IsOk is FALSE at the end of the function, there was an error.
Tecplot 360 will use the string in *MessageString to display an error message.
Step 3 Writing the DoConversion Function
Now that the file is open, we want to perform the conversion. In ConverterCallback the job of performing
the conversion is passed to the DoConversion function. DoConversion is responsible for parsing the file to be
converted and sending specific information to the TecUtil1 functions. In writing the DoConversion function,
we are going to make the following assumptions about the format of the incoming file:
• the variables are at the top of the file, contained in quotes, and separated by commas or spaces
• the data follows the variables and is separated by commas or spaces
An example of such a file would be:
"Var 1" "Var 2" "Var 3"
1.23, 4.4, 3.24
2.45, 3.56, 5.2
3.2, 2.15, 7.56
The basic form of a conversion function is:
• Get variable names from the file into a comma-separated string.
• Call TecUtilTecIni to initialize the temporary file.
• Call TecUtilTecZne to add a zone.
• Get data points into an array.
• Call TecUtilTecDat to add the data points to the temporary file.
• Call TecUtilTecEnd to close the temporary file.
Our converter will perform other function, in addition to the minimum requirements listed here. There are
two functions used for parsing the income file. These are GetVars and get_token. GetVars takes two
parameters: a FILE* and a StringList_pa. Be sure that you understand the StringList_pa data type before
continuing. For a discussion of StringList_pa see the Chapter 17: “String Lists”. GetVars will parse the text
file for the variable names and place them in the string list. get_token takes a FILE* and will parse a text file
for items which are separated by commas or spaces. There is no checking to make sure that the item is a
valid number. get_token will update a global variable called _token, which is used in DoConversion:
308
/* Make sure there is at least one variable. */
if (IsOk && TecUtilStringListGetCount(VarList) < 1)
{
strcpy(*MessageString,”No variables defined.”);
IsOk = FALSE;
}
if (IsOk)
{
/* Debug and VIsDouble are flags used by TecUtilTecIni(). */
int Debug = 0;
int VIsDouble = 1;
int JMax=1,KMax=1;
char VarNames[5000];
char *s;
NumValues = 0;
/*
* Get_token() changed where the file pointer is pointing, so
* we must rewind to the start of the data.
*/
fsetpos(f,&_DataStartPos);
/*
* Use the TecUtilTecIni() function to initialize the TempFName
* file and fill it with the data set title and the variable name.
*/
if (TecUtilTecIni(“ConvertedDataset”, VarNames,
TempFName,”.”,&Debug,&VIsDouble) != 0)
{
strcpy(*MessageString,”Could not create data set.”);
IsOk = FALSE;
}
/*
* Use TecUtilTecZne to add the first zone.
309
* In this case, it is the only zone.
*/
if (IsOk && TecUtilTecZne(“Zone 1”,
&IMax,&JMax,&KMax,
“POINT”,NULL) != 0)
{
strcpy(*MessageString,”Could not add zone.”);
IsOk = FALSE;
}
/*
* Use the function TecUtilTecDat() to fill the
* temporary file with the values stored in the LineValues.
*/
if (TecUtilTecDat(&NumValues,(void*)LineValues,&VIsDouble) !=
0)
{
strcpy(*MessageString,”Error loading data.”);
IsOk = FALSE;
}
TecUtilStringListDealloc(&VarList);
return IsOk;
}
Step 4 Parsing the code
A discussion of the parsing of the incoming file is not in the scope of this tutorial. However, the parsing
code has been included for completeness in the following sections.
Step 5 The Get_Token function
The get_token parses the file fetching basic tokens. Here is the function from engine.c:
310
The GetVars function
/**
*/
#define MAX_TOKEN_LEN 5000
static char _token[MAX_TOKEN_LEN]; /* Global buffer for tokens. */
/**
* Get the next token.
*
* @param f
* Open file handle. The file must be open for binary reading.
* @return
* TRUE if more a token was fetched, FALSE otherwise.
*/
static Boolean_t get_token(FILE *f)
{
int index = 0;
char c;
Boolean_t StopRightQuote;
if (!feof(f))
{
/* Now we’re sitting on a non-white space character. */
StopRightQuote = (c == ‘”’);
if (StopRightQuote)
{
_token[index++] = c;
fread(&c,sizeof(char),1,f);
}
do
{
if (index == MAX_TOKEN_LEN-1)
break; /* Lines shouldn’t be longer than 5,000 characters. */
if (feof(f))
break;
if (StopRightQuote)
{
if (c == ‘”’)
{
_token[index++] = c;
break;
}
}
else
{
/* Note that a space or comma may terminate the token. */
if (c == ‘ ‘ || c == ‘,’ || c == ‘\t’ || c == ‘\n’ || c ==
‘\r’)
break;
}
_token[index++] = c;
fread(&c,sizeof(char),1,f);
311
} while(1);
}
_token[index] = ‘\0’;
/**
*/
static fpos_t _DataStartPos;
/**
* Reads a line of comman or space separated variables from the
* top of the file to be imported. The variables may optionally
* be enclosed in double quotes.
*
* @param f
* Open file handle. The file must be open for binary reading.
* @return
* TRUE if more a token was fetched, FALSE otherwise.
*/
static void GetVars(FILE *f,
StringList_pa sl)
{
char c;
char buffer[5000];
char *Line = buffer;
char Var[100];
int Index = 0;
char Delimiter = ‘ ‘;
buffer[Index] = ‘\0’;
312
/* Read to the next delimiter. */
while (*Line && *Line != Delimiter)
Var[Index++] = *Line++;
}
Var[Index] = ‘\0’;
TecUtilStringListAppendString(sl,Var);
fgetpos(f,&_DataStartPos);
313
314
30
Animating
The add-on you will create in this chapter animates the I-planes of a selected set of zones. It will appear in
Tecplot 360’s Tools menu as “Animate I Planes”. AnimIPlanes will verify that the data is IJK-ordered,
change the Volume mode to I-planes, and cycle through the I-planes.
The code in this tutorial is platform-independent. All of the example source code shown in this manual is
included in the Tecplot 360 distribution and is found in the adk/samples/animplanes subdirectory below the
Tecplot 360 home directory.
30 - 1 Getting Started
AnimIPlanes uses source code files created by the CreateNewAddOn script (Linux/Macintosh). Our project
name will be “AnimIPlanes” and the add-on name will be “Animate I Planes”. When running
CreateNewAddOn, answer the questions as follows:
• Project Name (Base name) - AnimIPlanes
• Add-on name - Animate I Planes
• Company name - [Your company name]
• Type of add-on - General Purpose
• Language - C
• Use TGB to create a platform-independent GUI? - Yes
• Add a menu call back to the Tecplot “Tools” menu? - Yes
• Menu text - Animate I Planes
• Menu callback option - Launch a modeless dialog
• Dialog title - Animate I Planes
After running the CreateNewAddOn script, you should have the following files:
guibld.c guicb.c guidefs.cmain.c
315
ADDGLBL.h GUIDEFS.hgui.lay
You will also have other files specific to your platform, but we will only modify these listed files. The
purpose of each file will be explained in detail as we proceed.
If Tecplot GUI Builder is not available from the Tools menu in Tecplot 360, refer to
Section 25 - 1 “Using Tecplot GUI Builder” for instructions are running Tecplot 360 with
the GUI Builder.
You can edit a control by double-clicking on it and making the desired changes via the Text
Details dialog.
3. There will be callbacks associated with each of the text fields, and the toggle button. By
default, the TGB adds generic variable names for these controls. Change these variable names
by double-clicking on the control and selecting the [Options] button in the resulting Text
Details dialog. The variable name can be changed in the Macro Function field of the resulting
Text Options dialog.
316
Creating the Dialog
a. Double-click on the MLST: multi-selection list and select the [Options] button. In the
Macro Function field on the Text Options dialog, set VarName=ZoneList. This will be the
base name of the callback associated with the multi-selection list.
b. Change the Macro Function for the TF: text field to VarName=Skip.
c. Change the Macro Function for the Animate I Planes button to VarName=AnimPlanes.
4. The dialog title is specified in the Edit Active Frame dialog. Double-click on the dialog frame
and verify that the frame is:
ID=1 MODE=MODELESS TITLE="Animate I Planes"
5. You can now build the source for this layout. Select Go Build from the GUI Builder dialog.
6. Now that TGB has created new stub files, be sure to copy the toggle and text field callbacks
from guicb.tmp into guicb.c.
317
30 - 3 Setting Up State Variables/Initializing Dialog Fields
When the dialog is launched we need to make sure that the Skip and ZoneList text fields are filled in
properly. To initialize Skip we will define the skip to be a reasonable default value and set it every time the
dialog is launched. This initialization will take place in the Dialog1Init_CB function. This function is called
every time the dialog is launched.
Note the following line in guicb.c, immediately below the #include statements:
and the following code used as the dialog initialization callback:
TecUtilLockFinish(AddOnID);
}
To initialize ZoneList we will write a separate function, then call that function from the Dialog1Init_CB
function. This function will be called elsewhere in this exercise.
The following code is above the InitTecAddOn function:
void FillZoneList(void)
{
if (TecUtilDataSetIsAvailable())
{
EntIndex_t NumZones, i;
FillZoneList();
318
The Animate I Planes Button
TecUtilLockFinish(AddOnID);
}
Since the function body of FillZoneList is in main.c, add the following line to ADDGLBL.h:
TecUtilArrayDealloc((void **)&Selection);
}
/* Deallocate the ZoneSet and strSkip string when we are done with
them */
if (ZoneSet != NULL)
TecUtilSetDealloc(&ZoneSet);
if (strSkip != NULL)
TecUtilStringDealloc(&strSkip);
}
else
TecUtilDialogErrMsg(“No data set available.”);
TecUtilLockFinish(AddOnID);
}
319
We collect the information from the dialog and then pass that information off to AnimatePlanes to carry out
the animation. Because ZoneSet is initialized to NULL, we can tell if there were any selections. If there were
not, we display an error message reading “No zones have been picked.”
if (TecUtilMacroIsRecordingActive() &&
(NumberOfZonesInSet >= 1))
{
strMacroCommand = TecUtilStringAlloc(2000, “Macro Command”);
strcpy(strMacroCommand, “ZONESET=”);
}
/*
* Create a subset of ZoneSet that includes only
* IJK Ordered Zones. Do this by looping through
* all the zones in ZoneSet, check to see if the zone
* is IJK Ordered. Then add the zone to IJKZoneSet
*/
for (Index = 1; Index <= NumberOfZonesInSet; Index++)
{
/* Get the current zone */
CurZone = (EntIndex_t)TecUtilSetGetMember(ZoneSet, Index);
if (TecUtilMacroIsRecordingActive())
{
sprintf(&strMacroCommand[strlen(strMacroCommand)], “%d”,
CurZone);
if (Index != NumberOfZonesInSet)
strcat(strMacroCommand, “,”);
}
}
}
320
Writing the AnimatePlanes Function
321
TecUtilSetDealloc(&IJKZoneSet);
}
Note the use of double buffering when we do the animation. If we do not double buffer, there will be a
significant amount of flickering during animation. This is due to the time it takes to draw the other zones.
There are a few functions called in the previous example that have not yet been defined; they check to see
if the zone passed is IJK-ordered.
Note the following functions above the AnimatePlanes function:
TecUtilZoneGetInfo(ZoneNum,
&IMax,
&JMax,
&KMax,
NULL, /* XVar */
NULL, /* YVar */
NULL, /* ZVar */
NULL, /* NMap */
NULL, /* UVar */
NULL, /* VVar */
NULL, /* WVar */
NULL, /* BVar */
NULL, /* CVar */
NULL); /* SVar */
IsOk = (IMax > 1 && JMax > 1 && KMax > 1);
return IsOk;
}
This function is added for convenience, so as to not clutter AnimatePlanes.
322
Exercises
allow it to listen for these messages. This is called a State Change Callback function. Refer to Chapter 6:
“State Changes From an Add-on” for detailed information on state changes.
During the setup of this add-on we requested to have state change monitoring code included in the initial
build. This code was added to main.c. Now locate the function AnimIPlanesStateChangeCallback in main.c.
Notice that it already contains a switch statement with all the state changes you can monitor. The cases
that the add-on is concerned about are grouped together in the state change callback:
case StateChange_NewTopFrame :
case StateChange_ZonesAdded :
case StateChange_ZonesDeleted :
case StateChange_FrameDeleted :
case StateChange_ZoneName :
case StateChange_DataSetReset :
A call to FillZoneList must be performed when these state changes are detected. The resulting code
should look as follows:
case StateChange_NewTopFrame :
case StateChange_ZonesAdded :
case StateChange_ZonesDeleted :
case StateChange_FrameDeleted :
case StateChange_ZoneName :
case StateChange_DataSetReset :
{
/*
* State changes may come in here while the dialog
* is down. We only want to fill the zone list
* while the dialog is up.
*/
if (TecGUIDialogIsUp(Dialog1Manager))
FillZoneList();
} break;
default: break;
}
TecUtilLockFinish(AddOnID);
}
AnimIPlanes is now complete. Recompile and load into Tecplot 360.
30 - 7 Exercises
1. Currently there is nothing to inform users they have entered an invalid number for the skip,
such as a negative number or zero. Add error checking in the text field callback to check for a
valid positive integer.
2. Check that the integer in the text field is less than or equal to the maximum I-Max for the
selected zones.
3. Allow the animation of J- and K-planes. Adding an option menu to the interface with the
types of planes as options would be a good place to start.
323
4. Add code to make the add-on remember the last skip value entered, such that when the dialog
is closed and reopened the last skip value is the default in the text field.
5. Allow input of start and end planes. This would allow animation from a larger plane index to
a smaller index, and allow a specific range of planes to animate.
324
A
To use FORTRAN on Windows machines, you must use Intel Visual FORTRAN. For the most part, only
the standard FORTRAN compilers supplied with Linux platforms are supported. Other FORTRAN
compilers will probably work, but you may have to customize the settings/build scripts.
SUBROUTINE MYSUB
INCLUDE 'ADDGLBL.INC
INCLUDE 'FGLUE.INC'
INCLUDE 'GUIDEFS.INC'
INCLUDE 'GUI.INC'
RETURN
END
325
A-3 Language Calling Conventions
The FORTRAN function signatures of many TecUtil functions vary little from their C counterparts.
However, due to language differences, some argument changes require additional explanation. Those
differences are illustrated in this section.
I = TecUtilDialogMessageBox('Hi Mom'//char(0),
& MESSAGEBOX_INFORMATION)
INTEGER*4 IErr
INTEGER*4 NameLen
CHARACTER*80 UserName
IErr = TecUtilDialogGetSimpleText('Enter your name'//char(0),
& 'Joe Blow'//char(0),
& UserName
& NameLen)
Write(*,*) 'Name = ',UserName(1:NameLen),'<-'
In the preceding example, the variable UserName is filled in with the text of the users name. NameLen then is
used to tell you how many of the 80 characters available in UserName were used. The resulting write
statement will have the '<-' placed after the users name.
SUBROUTINE WriteMyData(FileName),
CHARACTER*(*) FileName
INCLUDE 'FGLUE.INC'
POINTER (ZoneSetPtr, ZoneSet)
POINTER (VarSetPtr, VarSet)
CHARACTER*256 FileNameZ
326
Special Parameter Values
c
c...allocate and populate the zone set: [5]
c
TecUtilSetAlloc(ZoneSetPtr, TRUE)
TecUtilSetAddMember(ZoneSetPtr, 5, TRUE)
c
c...allocate and populate the variable set: [1,3]
c
TecUtilSetAlloc(TRUE, VarSetPtr)
TecUtilSetAddMember(VarSetPtr, 1, TRUE)
TecUtilSetAddMember(VarSetPtr, 3, TRUE)
c
c...be sure to pass a zero terminated string to TecUtil layer
c
FileNameZ = TRIM(FileName)//char(0)
c
c...write the dataset to the specified file name
c
IsOk = TecUtilWriteDataSet(FileNameZ, TRUE, TRUE, TRUE, TRUE,
& ZoneSetPtr, VarSetPtr, TRUE, TRUE, TRUE)
c
c...cleanup allocations
c
TecUtilSetDealloc(ZoneSetPtr)
TecUtilSetDealloc(VarSetPtr)
END
The POINTER variables, ZoneSetPtr and VarSetPtr, are the handles used to access the respective sets and are
passed to the TecUtilWriteDataSet function while the POINTEE variables, ZoneSet and VarSet, are dummy
variables and should not be used.
Two exceptions to this rule are TecUtilDataNodeGetRawPtr and TecUtilDataValueGetRawPtr, where the
POINTEE variables are arrays to Tecplot 360's internal data arrays and may be manipulated directly.
INTEGER*4 MESSAGEBOX_INFORMATION
PARAMETER(MESSAGEBOX_INFORMATION = 2)
It is best to always use the PARAMETER name instead of the number. It makes your code more readable,
prevents errors, and makes it easier to upgrade later if the underlying value changes. In the ADK
Reference Manual, you can see what the possible values for a parameter are by looking at the C equivalent
of the TecUtil function. In C, these PARAMETER values are defined as “enumerated types” and are listed with
the description of the parameter. In C you must use the correct case when typing in the parameter name,
but this is not necessary in FORTRAN.
327
where filelist is one or more FORTRAN source files (*.F).
subroutine ShowConsole
USE DFWIN
logical status
C Get a console window of the currently set size:
status = AllocConsole!
return
end
subroutine HideConsole
USE DFWIN
logical status
status = FreeConsole
return
end
Call ShowConsole from your InitTecAddOn113 routine. HideConsole is probably optional, but can be called
from StateChangeCallback for the state change StateChange_QuitTecplot.
Alternatives to console output include writing to a file instead, or calling TecUtilDialogMessageBox or
TecUtilDialogErrMsg to report information to the user.
328
Part 8 Appendixes
330
B
Migrating Add-ons
331
Refer to the Tecplot 360 Scripting Guide and the ADK Reference Manual for details on working with the
new frame activation capabilities.
332
Migrating Add-ons from Tecplot 360 2006 or Earlier to Tecplot 360 2008 R2 or Later
333
B - 2.2 Shared Grid Files
Grids that do not change in structure can be shared across files by using Tecplot 360's shared grid format.
Any data that will be shared across files can be specified in the "grid" file, while any data that changes over
time is specified in a "solution" file for each time step. Shared grids can also be used for moving meshes, if
the connectivity is static. Shared grid files are only read by Tecplot 360 and not written out. For more
information on Tecplot's shared grid format, see the Data Format Guide.
B - 2.4 New in Tecplot 360 2011 R2: Functions for Active Frame
Manipulation
Because Tecplot 360 2011 R2 allows the user to manipulate a frame without popping that active frame to
the top, additional TecUtil functions and state changes were added.
TecUtil Functions
The following TecUtil functions were added for frame management support:
• TecUtilFrameActivateTop - Activates the top frame in the drawing order
• TecUtilFrameActivateByName - Activates a frame by name
• TecUtilFrameActivateByNumber - Activates a frame by number
• TecUtilFrameActivateByUniqueID - Activates a frame by unique ID
• TecUtilFrameActivateAtPosition - Activates a frame by position
• TecUtilFrameDeleteActive - Deletes the active frame
• TecUtilFrameLightweightLoopStart - Begins a loop through all frames without changing frame
drawing order. Progresses from bottom to top of frame draw order
• TecUtilFrameLightweightLoopNext - Loops to the next frame without changing frame drawing
order. Progresses from bottom to top of frame draw order
• TecUtilFrameLightweightLoopEnd - Ends loop through all framees without changing frame
drawing order
• TecUtilFrameMoveToTopByName - Moves frame specified by name to top of frame draw order
(front)
• TecUtilFrameMoveToTopByNumber - Moves frame specified by number to front
• TecUtilFrameMoveToTopByUniqueID - Moves frame specified by unique ID to front
• TecUtilFrameMoveToBottomByName - Moves frame specified by name to bottom of draw order
(back)
• TecUtilFrameMoveToBottomByNumber - Moves frame specified by number to back
• TecUtilFrameMoveToBottomByUniqueID - Moves frame specified by unique ID to back
• TecUtilPickAddAtPosition - Allows the user to select a frame to add, and allows user to specify
ConsiderStyle parameter
State Changes
The following state changes were added:
• StateChange_NewActiveFrame - Which frame is the active frame has changed
334
Migrating Add-ons from Tecplot 360 2006 or Earlier to Tecplot 360 2008 R2 or Later
335
B - 3 Migrating Add-ons From Version 10 to Tecplot 360
2006
B - 3.1 Data Loaders
As technology advances, datasets and zones get larger and larger. With the introduction of Load-On-
Demand, data loaders can now take advantage of substantial performance increases, especially with large
data. The uses of Load-On-Demand are discussed in detail in Section 27 - 5 “Load-on-demand”. We highly
recommend that your data loaders be updated to use this powerful new feature.
TecUtilDataValueGetReadableRef or
TecUtilDataValueGetRef
TecUtilDataValueGetWritableRef
TecUtilDataValueSetMinMaxByZoneVar
336
Migrating Add-ons From Version 10 to Tecplot 360 2006
TecUtilDialogGetFileNamesX
In the 'Filter Types' parameter, you can now supply a list of types in a single string, where each type is
separated with a vertical bar.
The list is ended with two vertical bars.
Example:
TecUtilImportGetLoaderInstrCount
You can now query the loader instructions for the nth loader. Use TecUtilImportGetLoaderInstrCount to find
the number of loader instructions available
TecUtilImportGetLoaderInstrByNum
You can now query the loader instructions for the nth loader. Use TecUtilImportGetLoaderInstrByNum to
query the loader instructions for the nth loader.
TecUtilToolbarActivate
If your add-on activates or deactivates the sidebar and/or Tecplot 360 menus, you will probably want to
deactivate/activate the toolbar also. Use this function to do it.
TecUtilAnimateTimeX
Use this function instead of TecUtilAnimateZones when dealing with time aware data.
337
338
Index images 164
labels 165
text 153–155
ASCII characters 219
Symbols Auxiliary Data 93, 107–108
$!ADDONCOMMAND command 199 Axes 151–153
$!LoadAddOn command 40 grid area 153
line plot 119
A lines 153
AbbreviatedSettingsStringCallback function 300 range 152
ADDGLBL.h 80 tick marks 152
in SimpAvg 292
Adding a dialog 31 B
Adding dialogs or controls 227 Bars Layer 117
Add-On Development Root Directory 23 Blanking 165
Add-on initialization and mopup 45 Boundary connection 70
-addonfile command 39 Boundary face 70
ADDONGLB.h 26, 37 Building Add-Ons with FORTRAN 325
Add-ons Building data set reader add-ons 245, 331
$!LoadAddOn command 40 Building the source code 237
accessing field data 75 BuildSidebarNN 228
Animate I Planes button 319
assigning to Quick Macro buttons 199 C
Compute function writing 84 C compiler directive 328
Converter 306 Calling conventions
creating 24 __cdecl 328
curve-fit add-on design 291 __stdcall 328
data converters 245 __cdecl
data loaders 245 calling convention 328
dialog field initialization 83 Code
dialog initialization 296 examples 20, 80, 239, 279, 306, 315
dialog launch 296 Code Generator 175–179
dialogs 316 incorporating output 177
Equate 80 launching 177
Equate dialog creation 80 style hierarchy 175
exercises 85, 241, 304, 323 undisplayed commands 178
Help 209 Coloring 146–150
isolating during development 40 basic colors 147
MenuCallback modification 26, 37 multi-color 147
mopup 46 rgb coloring 148
online help 209 Colormap 147
register in Tecplot 295 Command string 200
running 39 Compiler directives 328
specifying on command line 39 C 328
specifying which to load 39 DLLEXPORT 328
state change callbacks 323 Compiling
state changes 322 -debug 25
state variable set up 83 -release 25
SumProbe 239 using Runmake 25
testing 40 Compiling the add-on 25
Add-ons loaded by all users 39 Compiling your add-on
Advanced topics UNIX or Windows 238
Equate exercises 85 Compute
AFX_MANAGE_STATE 31 writing 84
Animate I Planes add-on Compute function 83
creating dialogs 316 Connected boundary face 70
AnimatePlanes function 319, 320, 322 Connectivity List 63–73
AnimatePlanes_BTN_D1_CB function 319 face neighbor 71
Animation 169 finite-element 65
double buffering 322 nodal data 66
AnimIPlanes add-on loading 265
Animate I Planes button 319 classic finite-element 265
exercises 323 face-based finite-element 266
Annotations 153–165 ordered data 63
geometry 162
339
INDEX
340
ordered data 63 style hierarchy 175
face neighbors 64 text 153–155
DataaFName transient data 170
in Converter 307 view options 172
Debug 27 rotation 172
-debug flag 25 translation 173
Default files zoom 173
created by TGB 237 DLL 29
DepCurveValues array 285 DLLEXPORT
Developer Studio compiler directive 328
used with TGB 225 DoConversion function 307
Developing add-ons writing 308
isolating and testing 40 Double buffering
Developing Add-Ons in UNIX 40 in animation 322
Developing Add-Ons in Windows 41 Dynamically linked libraries
Dialog loading add-ons 40
adding 31 Dynamic-link libraries 19
Dialog1HelpButton function 211
Dialog1Init_CB function 83, 298, 318 E
Dialogs Edge Layer 133
adding or creating 227 Engine.c
creating 80 description 306
creation 316 in Converter 306, 310
Curve Information 279 engine.c
Curve-Fit 301 in PolyInt 281, 287, 290
fields 83 in SimpAvg 292, 296, 300
in SimpAvg 299 Engine.h
XY-Plot Curve Info 290 in SimpAvg 293, 294
Zone Style 295, 300 Environment variables
Dialogs in Windows TECADDONDEVDIR 24
modal and modeless 221 TECADDONDEVPLATFORM 24
Directives, compiler 328 Equate
Display adding help 211
animation 169 creating dialogs 80
axes 151–153 writing Compute function 84
blanking 165 Equate add-on 80
code generator 175–179 Exercises 85
incorporating output 177 equate.html 211
launching 177 Equation, calculate 87–94
undisplayed commands 178 auxiliary data 93
coloring 146–150 derivative functions 91
basic colors 147 share variable 94
multi-color 147 syntax 88
rgb coloring 148 Error Bars Layer 117
field plot 122–143 Error messages in command callbacks 200
derived objects 135 Errors
fieldmap layers 122–143 callback function processing 200
fieldmap 111 Example add-on
example 114 MFC DLL 31
styles 115 non-MCF DLL 33, 35
geometry 162 Examples
images 164 code 20, 80, 239, 279, 306, 315
labels 165 creating Equate dialog 80
line plot 115–122 Equate add-on 80
curve types 120 files 20, 80, 239, 279, 306, 315
line legends 121 source code 20, 80, 239, 279, 306, 315
mapping layers 117, 119 string lists 188
linemap 111 using sets 193
example 112 Excercises 85
styles 115 Exercises
plot style 111–174 AnimIPlanes add-on 323
plotting data subset 143 Equate add-on 85
points 143 extending SimpAvg add-on 304
surfaces 144 extending SumProbe add-on 241
341
INDEX
342
description 83 axes 119
guicb.tmp curve types 120
in SimpAvg 296, 317 legends 121
Guidefs.c 80 mapping layers 117
description 82 Linemap 111–115
in Equate 82 Link, Frames 166
GUIDEFS.h 80 Loading add-ons
description 82 $!LoadAddOn command 40
in Equate 82 add-ons loaded by all users 39
GUI_TextFieldSetString function 83 specifying a secondary add-on load file 39
specifying add-ons on the command line 39
H specifying which add-ons to load 39
Help 209 tecplot.add 39
adding to Equate Add-on 211 Load-on-demand 255–263
equate.html 211 auto-load variable-on-demand 257
callbacks 263
I load value-on-demand 262
Images 164 load variable-on-demand 260
Immediate Loading 252–255 threads 263
data journaling 254 Localization 219
no data journaling 253
Include files M
FORTRAN 325 Macro
IndCurveValues array 285 recording with an addon 201
Initialization Macro language
of add-ons 45 accessing field data 75
InitializeCurveParams function 294 augmenting with add-ons 199
InitializeGUICurveParams 298 Main.c 80
InitTecAddOn function 26, 37, 240, 246, 306, 318 in AnimIPlanes 323
InitTecAddOn113 21, 34, 35, 235 in Equate 84
InsertProbeValueInWorkingArray function 289 in SumProbe 240
Interface main.c 26, 37
sidebar in PolyInt 280
size 228 in SimpAvg 295
Interpolate Data 101–106 Mapping Layers 117
inverse-distance interpolation 102 MenuCallback function 26, 37, 239
kriging 104 Menus
linear interpolation 101 coding for 234
Mesh Layer 123
J MessageString
Journal in Converter 307
data loading 263 Metadata, see Auxiliary Data
deactivate 206 MFC DLL example 31
example code 206 Microsoft DLLs 29
immediate data load 254 Modal dialogs
instructions 263 in Windows 221
override loading 270 Modeless dialogs
prerequisites 206 in Windows 222
PreTranslateMessage function 223
K Mopup
Keywords of add-ons 46
for GUI controls 229 MulNum
Kriging Interpolation 104 about 83
Multi-threading 59–60
L condition variables 60
Labels 165 mutex 60
Libraries thread pool 59
libtec 24 Multithreading
linked libraries 19 thread poolb 59
shared libraries 19 Mutex 60
libtec 24 MyProbeCallback function 240
Lighting effect 123
Line Legends 121 N
Line Plot 115–122 Node List 265
343
INDEX
344
R derivative functions 91
-release flag 25 difference functions 91
Replace Data 270 share variable 94
Right-hand rule
face neighbors 69 T
Rotate Data 172 TECADDONDEVDIR 24
Runmake 25 TECADDONDEVPLATFORM 24
Running your add-on 238 TECADDONFILE 24, 39
tecdev.add 40
S TecGUISidebarActivate 228
Scatter Layer 131 TECGUITECPLOTSIDEBAR 228
Sets TecIO function 245
example 193 Tecplot
191 register add-ons 295
Shared Data 78 running with add-ons 39
Shared libraries 19 Tecplot GUI Builder
Shared library source code 82
loading add-ons 40 using 29
Shared objects 19 Tecplot GUI Builder (TGB) 25
Sidebar Tecplot.add 29
sizing 228 tecplot.add 39
SidebarSizing 228 tecplot.cfg 39
SimpAvg add-on tecplot.fnt 39
configuration 291 TecUtil function 239
Curve-Fit dialog 301 TecUtil functions 308
dialog initialization 296 TecUtilCurveRegisterExtCrvFit function 280
dialog launch 296 TecUtilCurveSetExtendedSettings function 294
dialog work 299 TecUtilDialogGetVariables function 240
register in Tecplot 295 TecUtilImportAddLoader function 246
SimpAvgadd-on TecUtilMenuAddOption function 26, 37, 240
exercises 304 TecUtilProbInstallCallback function 240
SimpleAverage function 280, 302, 303 TecUtilStringAlloc function 292
Skip parameter TecUtilTecDat function 308
in AnimIPlanes 319 TecUtilTecEnd function 308
Skip text field 318 TecUtilTecIni function 308
Smooth Data 94 TecUtilTecZne function 308
limitations 94 TecUtilVarIsEnabled function 85
Source code TecUtilZoneIsEnabled function 85
building using TGB 237 Text 153–155
examples 20, 80, 239, 279, 306, 315 TGB
GUI source code 82 building source code building 237
Specifying a secondary add-on load file 39 used with Developer Studio 225
State change callbacks TGB control options 229
in add-ons 323 TGB created files 237
State changes Thread mutex 60
description 322 Thread pool 59
in add-ons 322 Threading 59–60
monitoring 322 condition variables 60
State variables 83 mutex 60
StateChangeCallback function 323 thread pool 59
__stdcall _token variable 308
calling convention 328 Transform Coordinates 95
String lists Transient Data 170
example 188 display 170
StringList_pa loading 269
about 308 Translation, view options 173
Strings Triangulation, irregular data point 105
UTF8 219 Troubleshooting add-ons 31, 35
SumProbe add-on Types of controls and keywords 229
description 239
exercises 241 U
Surfaces to plot 123 UNIX
Syntax, Equation porting add-ons to Windows 181
auxiliary data 93 UpdateMainDialogSensitivities function 298
345
INDEX
W
Windows
how to build add-ons 29
porting add-ons to UNIX 181
Write statements
to console 328
X
XYDataPointsCallback function 284, 285, 287, 301
XYMapNum parameter 293
XYMapNum variable 284
XY-Plot Curve Info dialog 290
Z
Zone
see Fieldmap
346