diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Allwmake b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Allwmake new file mode 100755 index 0000000000000000000000000000000000000000..935e8e3993a65f7b1e55d49fc929f166372fe807 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Allwmake @@ -0,0 +1,14 @@ +#!/bin/sh +# +# Build optional components (eg, may depend on third-party libraries) +# ----------------------------------------------------------------------------- +cd ${0%/*} || exit 1 # run from this directory +set -x + +# build tecio +wmake libso tecio/tecsrc + +# build converter +wmake + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Make/options b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Make/options index 97a2251f7bb9bf8d90bb23bd4ddbccf3c74a04a9..4776ad7d6489cf454920225a179ab1e304ebefff 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Make/options +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Make/options @@ -1,5 +1,5 @@ EXE_INC = \ - -I$(WM_THIRD_PARTY_DIR)/tecio/tecsrc/lnInclude \ + -Itecio/tecsrc/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude @@ -10,4 +10,4 @@ EXE_LIBS = \ -lfiniteVolume \ -lgenericPatchFields \ -lmeshTools \ - -L$(FOAM_EXT_LIBBIN) -ltecio + -ltecio diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/Runmake b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/Runmake new file mode 100755 index 0000000000000000000000000000000000000000..a22d0c0a86288ab89b2d61fa5da55e25ce42ced7 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/Runmake @@ -0,0 +1,277 @@ +#!/bin/sh + +MAKEWHAT= +EXTRAFLAGS= +STRIPFLAG=-s +isrelease=n +skipcompile=n +if test $# -ge 1 ; then + Platname=$1 + shift + while test $# -ge 1 + do + if test "$1" = "-release" ; then + isrelease=y + elif test "$1" = "-skipcompile" ; then + skipcompile=y + elif test "$1" = "-tecio" ; then + MAKEWHAT=tecio.a + else + EXTRAFLAGS="$EXTRAFLAGS $1" + fi + shift + done +else + echo "Choose platform:" + echo " " + echo " macux.104" + echo " macix64.105" + echo " sgix.62" + echo " sgix3.62" + echo " sgix.65" + echo " sgix64.65" + echo " sgix2.65" + echo " sun4.57" + echo " sun464.57" + echo " sun86.54" + echo " ibmx.43" + echo " ibmx64.43" + echo " ibmx.51" + echo " ibmx64.51" + echo " ibmx64.53" + echo " decalpha.32" + echo " compaq.51" + echo " hp7xx.11" + echo " hp7xx64.11" + echo " hpi64.11" + echo " linux.24" + echo " linuxi64.24" + echo " linux.22" + echo " linuxa.22" + echo " linuxg248x64.26" + echo " linuxg27x64.26" + echo " crayc90" + echo "->\c" + read Platname + + echo "Choose:" + echo " 1. Make tecio.a only" + echo " 2. Make tecio.a and pltview" + + read choice + + if test $choice -eq 1 ;then + MAKEWHAT=tecio.a + fi +fi + +MAKECMD=make +LINKFLAGS= +LINKLIBS= +AR=ar +ARFLAGS=qv +DISTSUBDIR2= + +case $Platname in + mac*) CCOMP=g++ + FINALCFLAGS="-arch ppc -arch i386 -arch ppc64 -arch x86_64 -DDARWIN -DLONGIS64 -I/usr/X11R6/include" + STRIPFLAG=-Wl,-x + LINKFLAGS="-arch ppc -arch i386 -arch ppc64 -arch x86_64" + ;; + sgix.65-64) CCOMP=CC + FINALCFLAGS="-DIRISX -DLONGIS64 -mips4 -64" + LINKFLAGS="-mips4 -64" + ;; + sgix64.65) CCOMP=CC + FINALCFLAGS="-DIRISX -DLONGIS64 -mips4 -64" + LINKFLAGS="-mips4 -64" + ;; + sgix.65) CCOMP=CC + FINALCFLAGS="-DIRISX -mips4 -n32" + LINKFLAGS="-mips4 -n32" + ;; + sgix2.65) CCOMP=CC + FINALCFLAGS="-DIRISX -o32" + LINKFLAGS="-o32" + ;; + sgix.62-64) CCOMP=CC + FINALCFLAGS="-DIRISX -DIRIX62 -DLONGIS64 -mips4 -64" + LINKFLAGS="-mips4 -64" + ;; + sgix.62) CCOMP=CC + FINALCFLAGS="-DIRISX -DIRIX62 -mips4 -n32" + LINKFLAGS="-mips4 -n32" + ;; + sgix1.62) CCOMP=CC + FINALCFLAGS="-DIRISX -DIRIX62 -mips1 -32" + LINKFLAGS="-mips1 -32" + ;; + sgix3.62) CCOMP=CC + FINALCFLAGS="-DIRISX -DIRIX62 -mips3 -n32" + LINKFLAGS="-mips3 -n32" + ;; + ibmx.*) CCOMP=xlC + FINALCFLAGS=-DIBMRS6000X + ;; + ibmx64.*) CCOMP=xlC + FINALCFLAGS="-DIBMRS6000X -DLONGIS64 -q64" + ARFLAGS="-X64 qv" + ;; + compaq.51) CCOMP=cxx + FINALCFLAGS="-DCOMPAQX -I/usr/include -ieee_with_inexact" + ;; + decalpha.32)CCOMP=cc + FINALCFLAGS="-DDECALPHAX -I/usr/include -ieee_with_inexact" + ;; + hp7xx.*-64) CCOMP=aCC + FINALCFLAGS="+DD64 +DS2.0 -AA -DHPX -DLONGIS64 -I/usr/include/X11R6 -I/usr/include/Motif2.1" + LINKFLAGS="+DA2.0W +DD64 +DS2.0W" + ;; + hp7xx64.11) CCOMP=aCC + FINALCFLAGS="+DA2.0W +DD64 +DS2.0W -AA -DHPX -DLONGIS64 -I/usr/include/X11R6 -I/usr/include/Motif2.1" + LINKFLAGS="+DA2.0W +DD64 +DS2.0W" + ;; + hpi64.11) CCOMP=aCC + FINALCFLAGS="+DD64 -AA -DHPX -DLONGIS64 -I/usr/include/X11R6 -I/usr/include/Motif2.1" + LINKFLAGS="+DD64" + ;; + hp7xx.11) CCOMP=aCC + FINALCFLAGS="+DAportable -AA -DHPX -I/usr/include/X11R6 -I/usr/include/Motif2.1" + LINKFLAGS="+DAportable" + ;; + crayc90) CCOMP=cc + FINALCFLAGS="-DCRAY -DUNIXX" + ;; + linux*i64.*)CCOMP=g++ + FINALCFLAGS="-fPIC -DLINUX -DLINUXI64" + ;; + linux*64.*) CCOMP=g++ + FINALCFLAGS="-fPIC -DLINUX -DLINUX64" + ;; + linux*) CCOMP=g++ + FINALCFLAGS="-fPIC -DLINUX" + ;; + sun4.54) CCOMP=/opt/SUNWspro/bin/CC + FINALCFLAGS="-DSUN -DSUNSOLARISX -I/usr/openwin/include -I/usr/dt/include -library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg -xO1" + LINKFLAGS="-library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg" + MAKECMD=/usr/ccs/bin/make + AR=/opt/SUNWspro/bin/CC + ARFLAGS="-xar -o" + ;; + sun4.55) CCOMP=/opt/SUNWspro/bin/CC + FINALCFLAGS="-DSUN -DSUNSOLARISX -I/usr/openwin/include -I/usr/dt/include -library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg -xO1" + LINKFLAGS="-library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg" + MAKECMD=/usr/ccs/bin/make + AR=/opt/SUNWspro/bin/CC + ARFLAGS="-xar -o" + ;; + sun4.57) CCOMP=/opt/SUNWspro/bin/CC + FINALCFLAGS="-DSUNSOLARISX -I/usr/openwin/include -I/usr/dt/include -library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg -xO1" + LINKFLAGS="-library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg" + MAKECMD=/usr/ccs/bin/make + AR=/opt/SUNWspro/bin/CC + ARFLAGS="-xar -o" + ;; + sun4.57-64) CCOMP=/opt/SUNWspro/bin/CC + FINALCFLAGS="-DSUNSOLARISX -DLONGIS64 -KPIC -xarch=v9 -I/usr/openwin/include -I/usr/dt/include -library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg -xO1" + LINKFLAGS="-KPIC -xarch=v9 -library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg" + MAKECMD=/usr/ccs/bin/make + AR=/opt/SUNWspro/bin/CC + ARFLAGS="-xar -o" + ;; + sun464.57) CCOMP=/opt/SUNWspro/bin/CC + FINALCFLAGS="-DSUNSOLARISX -DLONGIS64 -KPIC -xarch=v9 -I/usr/openwin/include -I/usr/dt/include -library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg -xO1" + LINKFLAGS="-KPIC -xarch=v9 -library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg" + MAKECMD=/usr/ccs/bin/make + AR=/opt/SUNWspro/bin/CC + ARFLAGS="-xar -o" + ;; + sun464.59) CCOMP=/opt/SUNWspro/bin/CC + FINALCFLAGS="-DSUNSOLARISX -DLONGIS64 -KPIC -m64 -xarch=generic -I/usr/openwin/include -I/usr/dt/include -library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg -xO1" + LINKFLAGS="-KPIC -m64 -xarch=generic -library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg" + MAKECMD=/usr/ccs/bin/make + AR=/opt/SUNWspro/bin/CC + ARFLAGS="-xar -o" + ;; + sun86.54) CCOMP=/opt/SUNWspro/bin/CC + FINALCFLAGS="-DSUN -DSUNSOLARISX -I/usr/openwin/include -I/usr/dt/include" + MAKECMD=/usr/ccs/bin/make + AR=/opt/SUNWspro/bin/CC + ARFLAGS="-xar -o" + ;; + *) echo "Err: Invalid platform" + exit + ;; +esac + +if test "$isrelease" = "y" ; then + EXTRAFLAGS="$EXTRAFLAGS -DNO_ASSERTS" +else + STRIPFLAG= +fi + +if test "$skipcompile" = "n" ; then + rm -f *.o */*.o *.a > /dev/null 2>&1 +fi + +rm -f *.a > /dev/null 2>&1 + + + +FINALCFLAGS="$FINALCFLAGS $EXTRAFLAGS -DUSEENUM -DTHREED" +# +# NOTE: Used to use make here but had problems with using remsh to run +# make multiple times to get 64 bit and 32 bit versions of libraries.... +# +# $MAKECMD $MAKEWHAT AR=$AR CC=$CCOMP LINKFLAGS="$LINKFLAGS" STRIPFLAG=$STRIPFLAG CFLAGS="$EXTRAFLAGS -DUSEENUM -DTHREED $FINALCFLAGS" +# +# +# + +cd tecsrc + +BASELIST=`/bin/ls -1 *.cpp` + +OBJLIST= +for file in $BASELIST +do + OBJNAME=`echo $file | sed 's/\.cpp/.o/'` + OBJLIST="$OBJLIST tecsrc/$OBJNAME" +done + + + +if test "$skipcompile" = "n" ; then + for file in $BASELIST + do + case $file in + tecxxx.cpp) ARCHIVEFLAG=-DMAKEARCHIVE;; + arrlist.cpp) ARCHIVEFLAG=-DMAKEARCHIVE;; + datautil.cpp) ARCHIVEFLAG=-DMAKEARCHIVE;; + *) ARCHIVEFLAG= ;; + esac + echo "$CCOMP $FINALCFLAGS $ARCHIVEFLAG -c $file" + $CCOMP $FINALCFLAGS $ARCHIVEFLAG -c $file + done +fi + +cd .. + +pwd + + +echo "$AR $ARFLAGS tecio.a $OBJLIST" +$AR $ARFLAGS tecio.a $OBJLIST +if test -f /bin/ranlib ; then + /bin/ranlib tecio.a; +elif test -f /usr/bin/ranlib ; then + /usr/bin/ranlib tecio.a; +elif test -f /usr/ucb/ranlib ; then + /usr/ucb/ranlib tecio.a; +fi + +echo "$CCOMP -I./tecsrc -DMAKEARCHIVE $FINALCFLAGS -c pltview.cpp" +$CCOMP -I./tecsrc -DMAKEARCHIVE $FINALCFLAGS -c pltview.cpp + +echo "$CCOMP $FINALCFLAGS pltview.o tecio.a $LINKFLAGS $LINKLIBS $STRIPFLAG -lm -o pltview" +$CCOMP $FINALCFLAGS pltview.o tecio.a $LINKFLAGS $LINKLIBS $STRIPFLAG -lm -o pltview diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/Arrow.plt b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/Arrow.plt new file mode 100644 index 0000000000000000000000000000000000000000..ee207b04df6aaba46a2454f97f3ce51226b5c642 Binary files /dev/null and b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/Arrow.plt differ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..3fa4b11f3f00acbc7f1421864d34acb54a09bcaa --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/Makefile @@ -0,0 +1,11 @@ +# Set to appropriate C++ compiler +CPP=g++ +CPPFLAGS=-I../../tecsrc ../../tecio.a +EXECUTABLE=arrow +FILES=$(EXECUTABLE).cpp + +build: + $(CPP) $(FILES) $(CPPFLAGS) -o $(EXECUTABLE) + +clean: + rm -f $(EXECUTABLE) \ No newline at end of file diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/arrow.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/arrow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..432022be519670677b74d0458f74ece1b5001650 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/arrow.cpp @@ -0,0 +1,530 @@ +/* This example creates two simple polyhedral zones in the shape + * of a three-dimensional arrow. Obscured boundary faces are used. + */ + +#include <stdio.h> +#include "TECIO.h" + +int main() +{ + /* DOCSTART:arrow_tecini.txt*/ + INTEGER4 Debug = 1; + INTEGER4 VIsDouble = 1; + INTEGER4 FileType = 0; + INTEGER4 I; + + /* Open the file and write the Tecplot datafile + * header information + */ + I = TECINI112((char*)"Multiple polyhedral zones", /* Name of the entire + * dataset. + */ + (char*)"X Y Z P", /* Defines the variables for the data + * file. Each zone must contain each of + * the variables listed here. The order + * of the variables in the list is used + * to define the variable number (e.g. + * X is Var 1). + */ + (char*)"Arrow.plt", + (char*)".", /* Scratch Directory */ + &FileType, + &Debug, + &VIsDouble); + + /* DOCEND */ + + + /* After TECINI is called, call TECZNE to create one or more + * zones for your data file. In this example, Zone 1 contains a + * single rectangular solid created as a face-based finite-element + * (i.e. polyhedral zone). The zone has eight points (or nodes), + * six faces and one element. + */ + /* DOCSTART:arrow_teczne_rect.txt*/ + /* TECZNE Parameters */ + INTEGER4 ZoneType = 7; /* sets the zone type + * to polyhedral */ + INTEGER4 NumPts_Rect = 8; + INTEGER4 NumElems_Rect = 1; + INTEGER4 NumFaces_Rect = 6; + INTEGER4 ICellMax = 0; /* not used */ + INTEGER4 JCellMax = 0; /* not used */ + INTEGER4 KCellMax = 0; /* not used */ + double SolutionTime = 0.0; + INTEGER4 StrandID = 0; + INTEGER4 ParentZone = 0; + INTEGER4 IsBlock = 1; + INTEGER4 NumFaceConnections = 0; /* not used */ + INTEGER4 FaceNeighborMode = 1; /* not used */ + INTEGER4 SharConn = 0; + + /* In a rectangular solid, each face is composed of four nodes. + * As such, the total number of face nodes is twenty-four (four + * nodes for each of the six faces). + */ + INTEGER4 TotalNumFaceNodes_Rect = 24; + + /* There is one connected boundary face in this zone (the face on + * the rectangle adjacent to the arrowhead). Refer to the Data + * Format Guide for additional information. */ + INTEGER4 NumConnBndryFaces_Rect = 1; + + /* The connected boundary face has one connection, the face on + * the bottom of the arrowhead. A connection is an element-zone + * tuple that indicates a neighboring element (and its zone) when + * the neighboring element is in a different zone. Generally, + * there will be one boundary connection for each boundary face. + */ + INTEGER4 TotalNumBndryConns_Rect = 1; + + /* For illustrative purposes, the grid variables (X, Y, and Z) + * are nodal variables (i.e. ValueLocation = 1), and the pressure + * variable (P) is a cell-centered variable (i.e. + * ValueLocation = 0). + */ + INTEGER4 ValueLocation[4] = { 1, 1, 1, 0 }; + + I = TECZNE112((char*)"Zone 1: Rectangular Solid", + &ZoneType, + &NumPts_Rect, + &NumElems_Rect, + &NumFaces_Rect, + &ICellMax, + &JCellMax, + &KCellMax, + &SolutionTime, + &StrandID, + &ParentZone, + &IsBlock, + &NumFaceConnections, + &FaceNeighborMode, + &TotalNumFaceNodes_Rect, + &NumConnBndryFaces_Rect, + &TotalNumBndryConns_Rect, + NULL, + ValueLocation, + NULL, + &SharConn); + + /* DOCEND */ + + /* DOCSTART:arrow_tecdat_rect.txt*/ + //set variable values (X_Rect, Y_Rect, Z_Rect & P_Rect) + double *X_Rect = new double[NumPts_Rect]; + double *Y_Rect = new double[NumPts_Rect]; + double *Z_Rect = new double[NumPts_Rect]; + double *P_Rect = new double[NumElems_Rect]; + + for (INTEGER4 ii = 0; ii <= NumPts_Rect / 2; ii += 4) + { + X_Rect[ii] = 0; + X_Rect[ii+1] = 3; + X_Rect[ii+2] = 3; + X_Rect[ii+3] = 0; + + Y_Rect[ii] = 3; + Y_Rect[ii+1] = 3; + Y_Rect[ii+2] = 1; + Y_Rect[ii+3] = 1; + } + + for (INTEGER4 ii = 0; ii < 4; ii++) + Z_Rect[ii] = 0; + + for (INTEGER4 ii = 4; ii < NumPts_Rect; ii++) + Z_Rect[ii] = -2; + + P_Rect[0] = 10; + + + INTEGER4 IsDouble = 1; + I = TECDAT112(&NumPts_Rect, X_Rect, &IsDouble); + I = TECDAT112(&NumPts_Rect, Y_Rect, &IsDouble); + I = TECDAT112(&NumPts_Rect, Z_Rect, &IsDouble); + I = TECDAT112(&NumElems_Rect, P_Rect, &IsDouble); + /* DOCEND */ + + /* DOCSTART:arrow_facenodes_rect.txt*/ + + /* The FaceNodeCounts array is used to describe the number of + * nodes in each face of the zone. The first value in the array + * is the number of nodes in Face 1, the second value is the + * number of nodes in Face 2 and so forth. In this example, each + * face of the zone has four nodes. + */ + + INTEGER4 *FaceNodeCounts_Rect = new INTEGER4[NumFaces_Rect]; + //For this particular zone, each face has the 4 nodes + for (INTEGER4 ii = 0; ii < NumFaces_Rect; ii++) + FaceNodeCounts_Rect[ii] = 4; + + /* The FaceNodes array is used to specify the nodes that compose + * each face. For each face (n of N), the number of nodes used + * to define the face is specified by the nth value in the + * FaceNodeCounts array. For example, if the first value in the + * FaceNodeCounts array is 4 (indicating Face 1 is composed of + * four nodes), the first four values in the FaceNodes array are + * the node numbers of the nodes in Face 1. + * + * ------------ + * WARNING + * When providing the node numbers for each face, you must + * provide the node numbers in a consistent order (either + * clockwise or counter-clockwise. Providing the node numbers + * out of order results in contorted faces. + * ------------ + */ + + INTEGER4 *FaceNodes_Rect = new INTEGER4[TotalNumFaceNodes_Rect]; + + //Nodes for Face 1 + FaceNodes_Rect[0] = 1; + FaceNodes_Rect[1] = 2; + FaceNodes_Rect[2] = 3; + FaceNodes_Rect[3] = 4; + + //Nodes for Face 2 + FaceNodes_Rect[4] = 1; + FaceNodes_Rect[5] = 4; + FaceNodes_Rect[6] = 8; + FaceNodes_Rect[7] = 5; + + //Nodes for Face 3 + FaceNodes_Rect[8] = 5; + FaceNodes_Rect[9] = 8; + FaceNodes_Rect[10] = 7; + FaceNodes_Rect[11] = 6; + + //Nodes for Face 4 + FaceNodes_Rect[12] = 2; + FaceNodes_Rect[13] = 6; + FaceNodes_Rect[14] = 7; + FaceNodes_Rect[15] = 3; + +//Nodes for Face 5 + FaceNodes_Rect[16] = 6; + FaceNodes_Rect[17] = 2; + FaceNodes_Rect[18] = 1; + FaceNodes_Rect[19] = 5; + + //Nodes for Face 6 + FaceNodes_Rect[20] = 3; + FaceNodes_Rect[21] = 7; + FaceNodes_Rect[22] = 8; + FaceNodes_Rect[23] = 4; + /* DOCEND */ + + /* DOCSTART:arrow_neighbors_rect.txt*/ + INTEGER4 *FaceLeftElems_Rect = new INTEGER4[NumFaces_Rect]; + INTEGER4 *FaceRightElems_Rect = new INTEGER4[NumFaces_Rect]; + + /* Since this zone has just one element, all leftelems are + * NoNeighboring Element and all right elems are itself + */ + for (INTEGER4 ii = 0; ii < NumFaces_Rect; ii++) + { + FaceRightElems_Rect[ii] = 1; + FaceLeftElems_Rect[ii] = 0; + } + + /* The negative value in the FaceLeftElems array indicates that + * the face is connected to an element in another zone. In this + * case, Face 4 is connected to a face in Zone 2 (to be defined + * later in the example). The FaceBoundaryConnectionElems array + * lists all of the element numbers in other zones that the + * current zone shares boundary connections with. Similarly, the + * FaceBoundaryConnectionZones array lists all of the zone numbers + * with which the current zone shares boundaries. A negative + * value in the FaceLeftElems or FaceRightElems array indicates + * the position within these arrays that defines the neighboring + * element and zone for a face. + * + * For example, if the FaceBoundaryConnectionElems array is: + * [1 8 2] and the FaceBoundaryConnectionZones array is: [2 5 3], + * a FaceLeftElems or FaceRightElems value of -2 indicates that + * the face in question has a boundary connection with Element 8 + * in Zone 5. + */ + FaceLeftElems_Rect[3] = -1; + /* DOCEND */ + + /* DOCSTART:arrow_tecpoly_rect.txt*/ + /* The FaceBndryConnectionCounts array is used to define the + * number of boundary connections for each face that has a + * boundary connection. For example, if a zone has three boundary + * connections in total (NumConnectedBoundaryFaces), two of those + * boundary connections are in one face, and the remaining + * boundary connection is in a second face, the + * FaceBndryConnectionCounts array would be: [2 1]. + * In this example, the total number of connected boundary faces + * (specified via TECZNE) is equal to one, so the + * FaceBoundaryConnectionCounts array contains a single value (1). + */ + INTEGER4 *FaceBndryConnCounts_Rect = new INTEGER4[NumConnBndryFaces_Rect]; + FaceBndryConnCounts_Rect[0] = 1; + + /* The value(s) in the FaceBndryConnectionElems and + * FaceBndryConnectionZones arrays specify the element number and + * zone number, respectively, that a given boundary connection is + * connected to. In this case, the boundary connection face is + * connected to Element 1 in Zone 2. + */ + INTEGER4 *FaceBndryConnElems_Rect = new INTEGER4[TotalNumBndryConns_Rect]; + INTEGER4 *FaceBndryConnZones_Rect = new INTEGER4[TotalNumBndryConns_Rect]; + + FaceBndryConnElems_Rect[0] = 1; + FaceBndryConnZones_Rect[0] = 2; + + I = TECPOLY112(FaceNodeCounts_Rect, + FaceNodes_Rect, + FaceLeftElems_Rect, + FaceRightElems_Rect, + FaceBndryConnCounts_Rect, + FaceBndryConnElems_Rect, + FaceBndryConnZones_Rect); + + /* cleanup */ + delete X_Rect; + delete Y_Rect; + delete Z_Rect; + delete P_Rect; + delete FaceNodeCounts_Rect; + delete FaceNodes_Rect; + delete FaceLeftElems_Rect; + delete FaceRightElems_Rect; + delete FaceBndryConnCounts_Rect; + delete FaceBndryConnElems_Rect; + delete FaceBndryConnZones_Rect; + /* DOCEND */ + + /* The data for Zone 1 has been written to the data file, so we + * are ready to create Zone 2. For simplicity, we will reuse many + * of the variables created for the rectangular zone that are not + * relevant to this tutorial. */ + + /* Zone 2 (the arrowhead or prism) has a single element composed + * of six nodes and five faces. + */ + + /* DOCSTART:arrow_teczne_prism.txt*/ + //TECZNE Parameters + INTEGER4 NumPts_Prism = 6; + INTEGER4 NumElems_Prism = 1; + INTEGER4 NumFaces_Prism = 5; + + /* The prism is composed of two triangular faces and three + * rectangular faces. The total number of face nodes is the sum + * of the nodes in each triangular face (2 times 3) and the nodes + * in each rectangular face (3 times 4). + */ + INTEGER4 TotalNumFaceNodes_Prism = 18; + + /* As with Zone 1, Zone 2 has one connected boundary face, the + * face that is connected to Zone 1. + */ + INTEGER4 NumConnBndryFaces_Prism = 1; + + /* In this case, we have set the total number of boundary + * connections for the connected face to two. The first boundary + * connection is the connection to Zone 1. The second boundary + * connection is used to indicate that the face is only partially + * obscured by the face from Zone 1. If we omitted the second + * boundary connection, the connected face of the prism would + * disappear if the rectangular zone was deactivated. + */ + INTEGER4 TotalNumBndryConns_Prism = 2; + + I = TECZNE112((char*)"Zone 2: Prism", + &ZoneType, + &NumPts_Prism, + &NumElems_Prism, + &NumFaces_Prism, + &ICellMax, + &JCellMax, + &KCellMax, + &SolutionTime, + &StrandID, + &ParentZone, + &IsBlock, + &NumFaceConnections, + &FaceNeighborMode, + &TotalNumFaceNodes_Prism, + &NumConnBndryFaces_Prism, + &TotalNumBndryConns_Prism, + NULL, + ValueLocation, + NULL, + &SharConn); + /* DOCEND */ + + /* DOCSTART:arrow_tecdat_prism.txt*/ + + + double *X_Prism = new double[NumPts_Prism]; + double *Y_Prism = new double[NumPts_Prism]; + double *Z_Prism = new double[NumPts_Prism]; + + + /* Set the X and Y variable values, one z-plane at a time */ + double ZVal = 0; + for (INTEGER4 ii = 0; ii < 2; ii++) + { + // triangle in Z=ZVal plane + X_Prism[3*ii] = 3; + Y_Prism[3*ii] = 4; + Z_Prism[3*ii] = ZVal; + + X_Prism[3*ii+1] = 7; + Y_Prism[3*ii+1] = 2; + Z_Prism[3*ii+1] = ZVal; + + X_Prism[3*ii+2] = 3; + Y_Prism[3*ii+2] = 0; + Z_Prism[3*ii+2] = ZVal; + + ZVal = ZVal - 2; + } + + /* When we called TecZne, we specified that the variable 4 + * (pressure) is cell-centered. As such, only NumElements number + * of values needs to be written to the data file for the pressure + * variable. + */ + double *P_Prism = new double[NumElems_Prism]; + P_Prism[0] = 20; + + I = TECDAT112(&NumPts_Prism, X_Prism, &IsDouble); + I = TECDAT112(&NumPts_Prism, Y_Prism, &IsDouble); + I = TECDAT112(&NumPts_Prism, Z_Prism, &IsDouble); + I = TECDAT112(&NumElems_Prism, P_Prism, &IsDouble); + /* DOCEND */ + + /* DOCSTART:arrow_facemap_prism.txt*/ + INTEGER4 *FaceNodeCounts_Prism = new INTEGER4[NumFaces_Prism]; + INTEGER4 *FaceNodes_Prism = new INTEGER4[TotalNumFaceNodes_Prism]; + + /* Because of the way we chose to number our faces, the first + * three faces are rectangular and the last two are triangular. + * The numbering of the faces is arbitrary, but the faces must + * be referred to consistently. + */ + for (INTEGER4 ii = 0; ii < 3; ii++) + FaceNodeCounts_Prism[ii] = 4; + + for (INTEGER4 ii = 3; ii < NumFaces_Prism; ii++) + FaceNodeCounts_Prism[ii] = 3; + + //Nodes for Face 1 + FaceNodes_Prism[0] = 1; + FaceNodes_Prism[1] = 3; + FaceNodes_Prism[2] = 6; + FaceNodes_Prism[3] = 4; + + //Nodes for Face 2 + FaceNodes_Prism[4] = 1; + FaceNodes_Prism[5] = 4; + FaceNodes_Prism[6] = 5; + FaceNodes_Prism[7] = 2; + + //Nodes for Face 3 + FaceNodes_Prism[8] = 3; + FaceNodes_Prism[9] = 2; + FaceNodes_Prism[10] = 5; + FaceNodes_Prism[11] = 6; + + //Nodes for Face 4 + FaceNodes_Prism[12] = 5; + FaceNodes_Prism[13] = 4; + FaceNodes_Prism[14] = 6; + +//Nodes for Face 5 + FaceNodes_Prism[15] = 1; + FaceNodes_Prism[16] = 2; + FaceNodes_Prism[17] = 3; + /* DOCEND */ + + /* DOCSTART:arrow_neighbors_prism.txt*/ + /* Since this zone has just one element, all leftelems are + * NoNeighboring Element and all right elems are itself. + */ + INTEGER4 *FaceLeftElems_Prism = new INTEGER4[NumFaces_Prism]; + INTEGER4 *FaceRightElems_Prism = new INTEGER4[NumFaces_Prism]; + + for (INTEGER4 ii = 0; ii < NumFaces_Prism; ii++) + { + FaceRightElems_Prism[ii] = 1; + FaceLeftElems_Prism[ii] = 0; + } + + /* The negative value in the FaceLeftElems array indicates that + * the face is connected to an element in another zone. In this + * case, Face 1 is connected to a face in Zone 1 (as indicated in + * Line 6). The FaceBoundaryConnectionElems array lists all of + * the element numbers in other zones that the current zone shares + * boundary connections with. Similarly, the + * FaceBoundaryConnectionZones array lists all of the zone numbers + * with which the current zone shares boundaries. A negative + * value in the FaceLeftElems or FaceRightElems array indicates + * the position within these arrays that defines the neighboring + * element and zone for a face. + */ + FaceLeftElems_Prism[0] = -1; + /* DOCEND */ + + /* DOCSTART:arrow_tecpoly_prism.txt*/ + + INTEGER4 *FaceBndryConnCounts_Prism = new INTEGER4[NumConnBndryFaces_Prism]; + FaceBndryConnCounts_Prism[0] = 2; + + INTEGER4 *FaceBndryConnElems_Prism = new INTEGER4[TotalNumBndryConns_Prism]; + INTEGER4 *FaceBndryConnZones_Prism = new INTEGER4[TotalNumBndryConns_Prism]; + + /* As previously mentioned, a connected boundary face is a face + * that has either multiple neighboring faces or neighbor(s) that + * belong to another zone. Those cases are sufficient when the + * combination of all of the face’s neighbors completely cover the + * face. However, there are some cases (such as the bottom of the + * arrowhead) where the face is not completely covered by its + * neighbors. In those cases the face is referred to as “partially + * obscured”. A partially obscured face is indicated by + * incrementing the value in TotalNumConnectedBoundaryFaces and + * entering a value of 0 in both the FaceBndryConnectionElems and + * FaceBoundaryConnectionZones arrays for the boundary connection + * for the partially obscured face. + */ + FaceBndryConnElems_Prism[0] = 0; + FaceBndryConnZones_Prism[0] = 0; + + /* Indicates that Face 1 is connected to Element 1 in Zone 1. */ + FaceBndryConnElems_Prism[1] = 1; + FaceBndryConnZones_Prism[1] = 1; + + I = TECPOLY112(FaceNodeCounts_Prism, + FaceNodes_Prism, + FaceLeftElems_Prism, + FaceRightElems_Prism, + FaceBndryConnCounts_Prism, + FaceBndryConnElems_Prism, + FaceBndryConnZones_Prism); + + /* cleanup */ + delete X_Prism; + delete Y_Prism; + delete Z_Prism; + delete P_Prism; + delete FaceNodeCounts_Prism; + delete FaceNodes_Prism; + delete FaceLeftElems_Prism; + delete FaceRightElems_Prism; + delete FaceBndryConnCounts_Prism; + delete FaceBndryConnElems_Prism; + delete FaceBndryConnZones_Prism; + /* DOCEND */ + + /* DOCSTART:arrow_tecend.txt*/ + I = TECEND112(); + /* DOCEND */ + + return 0; +} diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/arrow.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/arrow.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..31f69eedf107bd4df7d4630066ad847566097de9 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/arrow.vcproj @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="arrow" + ProjectGUID="{3C1105D7-5690-48E0-9402-111CBDC84B42}" + RootNamespace="arrow" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + RuntimeLibrary="2" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\arrow.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..2c6009b07305b63ddd8787e3fcbe020e820719df --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/Makefile @@ -0,0 +1,11 @@ +# Set to appropriate C++ compiler +CPP=g++ +CPPFLAGS=-I../../tecsrc ../../tecio.a +EXECUTABLE=comtest +FILES=$(EXECUTABLE).c + +build: + $(CPP) $(FILES) $(CPPFLAGS) -o $(EXECUTABLE) + +clean: + rm -f $(EXECUTABLE) diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.c b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.c new file mode 100644 index 0000000000000000000000000000000000000000..c290dcef40e3a73694bb3c2c15d0b8616274b275 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.c @@ -0,0 +1,492 @@ +/* + * Complex example C program to write a + * binary data file for Tecplot. This example + * does the following: + * + * 1. Open a data file called "field.plt." + * 2. Open a data file called "line.plt." + * 3. Assign values for X, Y and P. These will be used + * in both the ordered and finite-element data files. + * 4. Write out an ordered zone dimensioned 4 x 5 to "field.plt." + * 5. Assign values for XL and YL arrays. + * 6. Write out data for line plot to "line.plt." Make the data + * use double precision. + * 7. Write out a finite-element zone to "field.plt." + * 8. Write out a text record to "field.plt." + * 9. Write out a geometry (circle) record to "field.plt." + * 10. Close file 1. + * 11. Close file 2. + */ + +#include <stdio.h> +#include <math.h> +#include "TECIO.h" + +int main(void) +{ + float X[5][4], Y[5][4], P[5][4]; + double XL[50], YL[50]; + double SolTime; + INTEGER4 Debug, I, J, K, L, III, NPts, NElm, DIsDouble, VIsDouble, IMax, JMax, KMax; + INTEGER4 ICellMax, JCellMax, KCellMax, ZoneType, Clipping; + INTEGER4 StrandID, ParentZn, FieldFileType, LineFileType; + INTEGER4 SharingZone[3] = {0, 0, 0}; + INTEGER4 IsBlock, NumFaceConnections, FaceNeighborMode, ShareConnectivityFromZone; + INTEGER4 NM[12][4]; + double XP, YP, ZP, FH, LineSpacing, PatternLength; + double BoxMargin, BoxLineThickness, TextAngle; + INTEGER4 AttachToZone, Zone, Scope, PositionCoordSys, FontType, HeightUnits; + INTEGER4 IsFilled, GeomType, LinePattern, NumEllipsePts; + INTEGER4 Anchor, BoxType, BoxColor, BoxFillColor, TextColor, Color, FillColor; + INTEGER4 ArrowheadStyle, ArrowheadAttachment, NumSegments, NumSegPts[1]; + double LineThickness, ArrowheadSize, ArrowheadAngle; + float XGeomData[1], YGeomData[1], ZGeomData[1]; + enum FileType { FULL = 0, GRID = 1, SOLUTION = 2 }; + + Debug = 2; + VIsDouble = 0; + DIsDouble = 0; + FieldFileType = FULL; + LineFileType = FULL; + /* + * Open order.plt and write the header information. + */ + I = TECINI112((char*)"DATASET WITH ONE ORDERED ZONE AND ONE FE-QUAD ZONE OVER 2 TIME STEPS", + (char*)"X Y P", + (char*)"field.plt", + (char*)".", + &FieldFileType, + &Debug, + &VIsDouble); + /* + * Open line.plt and write the header information. + */ + VIsDouble = 1; + I = TECINI112((char*)"DATASET WITH ONE I-ORDERED ZONE", + (char*)"X Y", + (char*)"line.plt", + (char*)".", + &LineFileType, + &Debug, + &VIsDouble); + + /* + * Calculate values for the field variables. + */ + for (J = 0; J < 5; J++) + for (I = 0; I < 4; I++) + { + X[J][I] = (float)(I + 1); + Y[J][I] = (float)(J + 1); + P[J][I] = (float)((I + 1) * (J + 1)); + } + + /* + * Make sure writing to file #1. + */ + III = 1; + I = TECFIL112(&III); + + /* + * Write the zone header information for the ordered zone. + */ + IMax = 4; + JMax = 5; + KMax = 1; + ICellMax = 0; + JCellMax = 0; + KCellMax = 0; + ZoneType = 0; + SolTime = 10.0; + StrandID = 1; + ParentZn = 0; + IsBlock = 1; + NumFaceConnections = 0; + FaceNeighborMode = 0; + ShareConnectivityFromZone = 0; + I = TECZNE112((char*)"Ordered Zone 1", + &ZoneType, + &IMax, + &JMax, + &KMax, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZn, + &IsBlock, + &NumFaceConnections, + &FaceNeighborMode, + NULL, /* PassiveVarList */ + NULL, /* ValueLocation */ + NULL, /* ShareVarFromZone */ + 0, /* TotalNumFaceNodes */ + 0, /* NumConnectedBoundaryFaces */ + 0, /* TotalNumBoundaryConnections */ + &ShareConnectivityFromZone); + /* + * Write out the field data for the ordered zone. + */ + III = IMax * JMax; + I = TECDAT112(&III, &X[0][0], &DIsDouble); + I = TECDAT112(&III, &Y[0][0], &DIsDouble); + I = TECDAT112(&III, &P[0][0], &DIsDouble); + + /* + * Calculate values for the I-ordered zone. + */ + + for (I = 0; I < 50; I++) + { + XL[I] = I + 1; + YL[I] = sin((double)(I + 1) / 20.0); + } + /* + * Switch to the "line.plt" file (file number 2) + * and write out the line plot data. + */ + + III = 2; + I = TECFIL112(&III); + + /* + * Write the zone header information for the XY-data. + */ + IMax = 50; + JMax = 1; + KMax = 1; + SolTime = 0.0; + StrandID = 0; /* StaticZone */ + I = TECZNE112((char*)"XY Line plot", + &ZoneType, + &IMax, + &JMax, + &KMax, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZn, + &IsBlock, + &NumFaceConnections, + &FaceNeighborMode, + 0, /* TotalNumFaceNodes */ + 0, /* NumConnectedBoundaryFaces */ + 0, /* TotalNumBoundaryConnections */ + NULL, /* PassiveVarList */ + NULL, /* ValueLocation */ + NULL, /* ShareVarFromZone */ + &ShareConnectivityFromZone); + /* + * Write out the line plot. + */ + DIsDouble = 1; + III = IMax; + I = TECDAT112(&III, (float *) & XL[0], &DIsDouble); + I = TECDAT112(&III, (float *) & YL[0], &DIsDouble); + + /* + * Switch back to the field plot file and write out + * the finite-element zone. + */ + III = 1; + I = TECFIL112(&III); + + /* + * Move the coordinates so this zone's not on top of the other + */ + for (J = 0; J < 5; J++) + for (I = 0; I < 4; I++) + { + X[J][I] = (float)(I + 6); + Y[J][I] = (float)(J + 1); + P[J][I] = (float)((I + 1) * (J + 1)); + } + + /* + * Write the zone header information for the finite-element zone. + */ + ZoneType = 3; /* FEQuad */ + NPts = 20; /* Number of points */ + NElm = 12; /* Number of elements */ + KMax = 0; /* Unused */ + SolTime = 10.0; + StrandID = 2; + I = TECZNE112((char*)"Finite Zone 1", + &ZoneType, + &NPts, + &NElm, + &KMax, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZn, + &IsBlock, + &NumFaceConnections, + &FaceNeighborMode, + 0, /* TotalNumFaceNodes */ + 0, /* NumConnectedBoundaryFaces */ + 0, /* TotalNumBoundaryConnections */ + NULL, /* PassiveVarList */ + NULL, /* ValueLocation */ + NULL, /* ShareVarFromZone */ + &ShareConnectivityFromZone); + /* + * Write out the field data for the finite-element zone. + */ + IMax = 4; + JMax = 5; + III = IMax * JMax; + DIsDouble = 0; + I = TECDAT112(&III, &X[0][0], &DIsDouble); + I = TECDAT112(&III, &Y[0][0], &DIsDouble); + I = TECDAT112(&III, &P[0][0], &DIsDouble); + + /* + * Calculate and then write out the connectivity list. + * Note: The NM array references cells starting with + * offset of 1. + */ + + for (I = 1; I < IMax; I++) + for (J = 1; J < JMax; J++) + { + K = I + (J - 1) * (IMax - 1); + L = I + (J - 1) * IMax; + NM[K-1][0] = L; + NM[K-1][1] = L + 1; + NM[K-1][2] = L + IMax + 1; + NM[K-1][3] = L + IMax; + } + + I = TECNOD112((INTEGER4 *)NM); + + /* + * Calculate values for the new solution variable. + */ + for (J = 0; J < 5; J++) + for (I = 0; I < 4; I++) + { + P[J][I] = (float)(2.0 * (I + 1) * (J + 1)); + } + + /* + * Write the zone header information for time step 2 + */ + ZoneType = 0; + IMax = 4; + JMax = 5; + KMax = 1; + SolTime = 20.0; + StrandID = 1; + SharingZone[0] = 1; + SharingZone[1] = 1; + SharingZone[2] = 0; /* solution variable is not shared */ + ShareConnectivityFromZone = 0; + + I = TECZNE112((char*)"Ordered Zone 2", + &ZoneType, + &IMax, + &JMax, + &KMax, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZn, + &IsBlock, + &NumFaceConnections, + &FaceNeighborMode, + 0, /* TotalNumFaceNodes */ + 0, /* NumConnectedBoundaryFaces */ + 0, /* TotalNumBoundaryConnections */ + NULL, + NULL, + SharingZone, + &ShareConnectivityFromZone); + + /* + * Write out the solution variable the grid variables are shared. + */ + IMax = 4; + JMax = 5; + III = IMax * JMax; + DIsDouble = 0; + I = TECDAT112(&III, &P[0][0], &DIsDouble); + + /* + * Calculate values for the new solution variable. + */ + for (J = 0; J < 5; J++) + for (I = 0; I < 4; I++) + { + P[J][I] = (float)(3.0 * (I + 1) * (J + 1)); + } + + /* + * Write another time step for the FEZone and share from the first + */ + ZoneType = 3; + SolTime = 20.0; + StrandID = 2; + KMax = 0; + SharingZone[0] = 2; + SharingZone[1] = 2; + SharingZone[2] = 0; /* solution variable is not shared */ + ShareConnectivityFromZone = 2; + I = TECZNE112((char*)"Finite Zone 2", + &ZoneType, + &NPts, + &NElm, + &KMax, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZn, + &IsBlock, + &NumFaceConnections, + &FaceNeighborMode, + 0, /* TotalNumFaceNodes */ + 0, /* NumConnectedBoundaryFaces */ + 0, /* TotalNumBoundaryConnections */ + NULL, /* PassiveVarList */ + NULL, /* ValueLocation */ + SharingZone, + &ShareConnectivityFromZone); + + /* + * Write out the solution variable the grid variables are shared. + */ + IMax = 4; + JMax = 5; + III = IMax * JMax; + DIsDouble = 0; + I = TECDAT112(&III, &P[0][0], &DIsDouble); + + /* + * Prepare to write out text record. Text is positioned + * at 0.5, 0.5 in frame units and has a height + * of 0.05 frame units. + */ + XP = 50.0; + YP = 50.0; + ZP = 0.0; + FH = 5.0; + Scope = 1; /* Local */ + Clipping = 1; /* Clip to frame */ + PositionCoordSys = 1; /* Frame */ + FontType = 1; /* Helv Bold */ + HeightUnits = 1; /* Frame */ + AttachToZone = 0; + Zone = 0; + BoxType = 0; /* None */ + BoxMargin = 5.0; + BoxLineThickness = 0.5; + BoxColor = 3; + BoxFillColor = 7; + TextAngle = 0.0; + Anchor = 0; /* Left */ + LineSpacing = 1.0; + TextColor = 0; /* Black */ + + III = TECTXT112(&XP, + &YP, + &ZP, + &PositionCoordSys, + &AttachToZone, + &Zone, + &FontType, + &HeightUnits, + &FH, + &BoxType, + &BoxMargin, + &BoxLineThickness, + &BoxColor, + &BoxFillColor, + &TextAngle, + &Anchor, + &LineSpacing, + &TextColor, + &Scope, + &Clipping, + (char*)"Hi Mom", + (char*)""); + + /* + * Prepare to write out geometry record (circle). Circle is + * positioned at 25, 25 (in frame units) and has a radius of + * 20 percent. Circle is drawn using a dashed line. + */ + + + XP = 25.0; + YP = 25.0; + ZP = 0.0; + IsFilled = 0; + Color = 0; + FillColor = 7; + GeomType = 3; /* Circle */ + LinePattern = 1; /* Dashed */ + LineThickness = 0.3; + PatternLength = 1.5; + NumEllipsePts = 72; + ArrowheadStyle = 0; + ArrowheadAttachment = 0; + ArrowheadSize = 0.1; + ArrowheadAngle = 15.0; + NumSegments = 1; + NumSegPts[0] = 1; + + XGeomData[0] = 20.0; + YGeomData[0] = 0.0; + ZGeomData[0] = 0.0; + + + III = TECGEO112(&XP, + &YP, + &ZP, + &PositionCoordSys, + &AttachToZone, + &Zone, + &Color, + &FillColor, + &IsFilled, + &GeomType, + &LinePattern, + &PatternLength, + &LineThickness, + &NumEllipsePts, + &ArrowheadStyle, + &ArrowheadAttachment, + &ArrowheadSize, + &ArrowheadAngle, + &Scope, + &Clipping, + &NumSegments, + NumSegPts, + &XGeomData[0], + &YGeomData[0], + &ZGeomData[0], + (char*)""); + + /* + * Close out file 1. + */ + I = TECEND112(); + + /* + * Close out file 2. + */ + III = 2; + I = TECFIL112(&III); + I = TECEND112(); + + return 0; +} diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.f b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.f new file mode 100644 index 0000000000000000000000000000000000000000..c8d6e2ce5aab81b4297ea3d85a4c3e6c46629390 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.f @@ -0,0 +1,467 @@ +C +C Complex example FORTRAN program to write a +C binary data file for Tecplot. This example +C does the following: +C +C 1. Open a data file called "field.plt." +C 2. Open a data file called "line.plt." +C 3. Assign values for X, Y and P. These will be used +C in both the ordered and FE data files. +C 4. Write out an ordered zone dimensioned 4 x 5 to "field.plt." +C 5. Assign values for XL and YL arrays. +C 6. Write out data for line plot to "line.plt." Make the data +C use double precision. +C 7. Write out a finite element zone to "field.plt." +C 8. Write out a text record to "field.plt." +C 9. Write out a geometry (circle) record to "field.plt." +C 10. Close file 1. +C 11. Close file 2. +C + Program ComplexTest + + Include "tecio.inc" + + REAL*4 X(4,5), Y(4,5), P(4,5) + REAL*8 XL(50), YL(50) + REAL*4 XLDummy(1), YLDummy(1) + EQUIVALENCE (XLDummy(1), XL(1)) + EQUIVALENCE (YLDummy(1), YL(1)) + REAL*8 SolTime + INTEGER*4 Debug,I,J,K,L,III,NPts,NElm,DIsDouble,VIsDouble + INTEGER*4 IMax,JMax,KMax,NM(4,12),FileType + INTEGER*4 StrandID,ParentZn + INTEGER*4 SharingZone(3) + REAL*8 XP, YP, ZP, FH, LineSpacing, PatternLength + REAL*8 BoxMargin, BoxLineThickness, TextAngle + INTEGER*4 AttachToZone, Zone, Scope, PositionCoordSys + INTEGER*4 Clipping + INTEGER*4 FontType, HeightUnits, Anchor, BoxType + INTEGER*4 IsFilled, GeomType, LinePattern, NumEllipsePts + INTEGER*4 BoxColor, BoxFillColor, TextColor, Color, FillColor + INTEGER*4 ArrowheadStyle, ArrowheadAttachment, NumSegments + INTEGER*4 NumSegPts(1) + REAL*8 LineThickness, ArrowheadSize, ArrowheadAngle + REAL*4 XGeomData(1), YGeomData(1), ZGeomData(1) + CHARACTER*1 NULCHAR + INTEGER*4 Zero + POINTER (NullPtr,Null) + INTEGER*4 Null(*) + + Debug = 2 + VIsDouble = 0 + FileType = 0 + DIsDouble = 0 + NULCHAR = CHAR(0) + Zero = 0 + NullPtr = 0 +C +C Open field.plt and write the header information. +C + I = TECINI112('DATASET WITH 1 ORDERED ZONE, '// + & '1 QUAD ZONE OVER 2 TIME STEPS'//NULCHAR, + & 'X Y P'//NULCHAR, + & 'field.plt'//NULCHAR, + & '.'//NULCHAR, + & FileType, + & Debug, + & VIsDouble) +C +C Open line.plt and write the header information. +C + VIsDouble = 1 + I = TECINI112('DATASET WITH ONE I-ORDERED ZONE'//NULCHAR, + & 'X Y'//NULCHAR, + & 'line.plt'//NULCHAR, + & '.'//NULCHAR, + & FileType, + & Debug, + & VIsDouble) + +C +C Calculate values for the field variables. +C + Do 10 J = 1,5 + Do 10 I = 1,4 + X(I,J) = I + Y(I,J) = J + P(I,J) = I*J + 10 Continue + +C +C Make sure writing to file #1. +C + III = 1 + I = TECFIL112(III) + +C +C Write the zone header information for the ordered zone. +C + IMax = 4 + JMax = 5 + KMax = 1 + SolTime = 10.0 + StrandID = 1 + ParentZn = 0 + I = TECZNE112('Ordered Zone 1'//NULCHAR, + & 0, ! ZONETYPE + & IMax, + & JMax, + & KMax, + & 0, + & 0, + & 0, + & SolTime, + & StrandID, + & ParentZn, + & 1, ! ISBLOCK + & 0, ! NumFaceConnections + & 0, ! FaceNeighborMode + & 0, ! TotalNumFaceNodes + & 0, ! NumConnectedBoundaryFaces + & 0, ! TotalNumBoundaryConnections + & Null, ! PassiveVarList + & Null, ! ValueLocation + & Null, ! ShareVarFromZone + & 0) ! ShareConnectivityFromZone) + +C +C Write out the field data for the ordered zone. +C + III = IMax*JMax + I = TECDAT112(III,X,DIsDouble) + I = TECDAT112(III,Y,DIsDouble) + I = TECDAT112(III,P,DIsDouble) + +C +C Calculate values for the I-ordered zone. +C + + Do 20 I = 1,50 + XL(I) = I + YL(I) = sin(I/20.0) + 20 Continue +C +C Switch to the 'line.plt' file (file number 2) +C and write out the line plot data. +C + III = 2 + I = TECFIL112(III) +C +C Write the zone header information for the XY-data. +C + IMax = 50 + JMax = 1 + KMax = 1 + SolTime = 0.0 + StrandID = 0 + I = TECZNE112('XY Line plot'//NULCHAR, + & 0, + & IMax, + & JMax, + & KMax, + & 0, + & 0, + & 0, + & SolTime, + & StrandID, + & ParentZn, + & 1, + & 0, + & 0, + & 0, + & 0, + & 0, + & Null, + & Null, + & Null, + & 0) +C +C Write out the line plot. +C + DIsDouble = 1 + III = IMax + I = TECDAT112(III,XLDummy,DIsDouble) + I = TECDAT112(III,YLDummy,DIsDouble) + +C +C Switch back to the field plot file and write out +C the finite-element zone. +C + III = 1 + I = TECFIL112(III) +C +C Move the coordinates so this zone's not on top of the other +C + Do 30 J = 1,5 + Do 30 I = 1,4 + X(I,J) = I+5 + Y(I,J) = J + P(I,J) = I*J + 30 Continue +C +C Write the zone header information for the finite-element zone. +C + NPts = 20 + NElm = 12 + KMax = 1 + SolTime = 10.0 + StrandID = 2 + I = TECZNE112('Finite Zone 1'//NULCHAR, + & 3, ! FEQUADRILATERAL + & NPts, + & NElm, + & KMax, + & 0, + & 0, + & 0, + & SolTime, + & StrandID, + & ParentZn, + & 1, + & 0, + & 0, + & 0, + & 0, + & 0, + & Null, + & Null, + & Null, + & 0) +C +C Write out the field data for the finite-element zone. +C + IMax = 4 + JMax = 5 + III = IMax*JMax + DIsDouble = 0 + I = TECDAT112(III,X,DIsDouble) + I = TECDAT112(III,Y,DIsDouble) + I = TECDAT112(III,P,DIsDouble) + +C +C Calculate and then write out the connectivity list. +C Note: The NM array references cells starting with +C offset of 1. +C + + Do 40 I = 1,IMax-1 + Do 40 J = 1,JMax-1 + K = I+(J-1)*(IMax-1) + L = I+(J-1)*IMax + NM(1,K) = L + NM(2,K) = L+1 + NM(3,K) = L+IMax+1 + NM(4,K) = L+IMax + 40 Continue + + I = TECNOD112(NM) +C +C Calculate vlues for the new solution variable. +C + Do 50 J = 1,5 + Do 50 I = 1,4 + P(I,J) = 2*I*J + 50 Continue +C +C Write the zone header information for time step 2 +C + IMax = 4 + JMax = 5 + KMax = 1 + SolTime = 20.0 + StrandID = 1 + SharingZone(1) = 1 + SharingZone(2) = 1 + SharingZone(3) = 0 + I = TECZNE112('Ordered Zone 2'//NULCHAR, + & 0, ! ORDERED + & IMax, + & JMax, + & KMax, + & 0, + & 0, + & 0, + & SolTime, + & StrandID, + & ParentZn, + & 1, + & 0, + & 0, + & 0, + & 0, + & 0, + & Null, + & Null, + & SharingZone, + & 0) +C +C Write out the solution variable the grid variables are shared. +C + IMax = 4 + JMax = 5 + III = IMax*JMax + DIsDouble = 0 + I = TECDAT112(III,P,DIsDouble) +C +C Calculate values for the new solution variable. +C + Do 60 J = 1,5 + Do 60 I = 1,4 + P(I,J) = 3*I*J + 60 Continue +C +C Write another time step for the FEZone and share from the first +C + SolTime = 20.0 + StrandID = 2 + KMax = 0 + SharingZone(1) = 2 + SharingZone(2) = 2 + SharingZone(3) = 0 + I = TECZNE112('Finite Zone 2'//NULCHAR, + & 3, ! FEQUADRILATERAL + & NPts, + & NElm, + & KMax, + & 0, + & 0, + & 0, + & SolTime, + & StrandID, + & ParentZn, + & 1, + & 0, + & 0, + & 0, + & 0, + & 0, + & Null, + & Null, + & SharingZone, + & 2) +C +C Write out the solution variable the grid variables are shared. +C + IMax = 4 + JMax = 5 + III = IMax*JMax + DIsDouble = 0 + I = TECDAT112(III,P,DIsDouble) + +C +C Prepare to write out text record. Text is positioned +C at 50, 50 in frame units and has a height 5 frame units. +C + XP = 50 + YP = 50 + FH = 5 + Scope = 1 + Clipping = 0 + PositionCoordSys = 1 + FontType = 1 + HeightUnits = 1 + AttachToZone = 0 + Zone = 0 + BoxType = 0 + BoxMargin = 5.0 + BoxLineThickness = 0.5 + BoxColor = 3 + BoxFillColor = 7 + TextAngle = 0.0 + Anchor = 0 + LineSpacing = 1.5 + TextColor = 0 + + III = TECTXT112(XP, + & YP, + & 0.0d0, + & PositionCoordSys, + & AttachToZone, + & Zone, + & FontType, + & HeightUnits, + & FH, + & BoxType, + & BoxMargin, + & BoxLineThickness, + & BoxColor, + & BoxFillColor, + & TextAngle, + & Anchor, + & LineSpacing, + & TextColor, + & Scope, + & Clipping, + & 'Hi Mom'//NULCHAR, + & NULCHAR) + +C +C Prepare to write out geometry record (circle). Circle is +C positioned at 25, 25 in frame units and has a radius of 30. +C Circle is drawn using a dashed line pattern. +C + + + XP = 25 + YP = 25 + ZP = 0.0 + IsFilled = 0 + Color = 0 + FillColor = 7 + GeomType = 2 + LinePattern = 1 + LineThickness = 0.3 + PatternLength = 1 + NumEllipsePts = 72 + ArrowheadStyle = 0 + ArrowheadAttachment = 0 + ArrowheadSize = 0.0 + ArrowheadAngle = 15.0 + NumSegments = 1 + NumSegPts(1) = 1 + + XGeomData(1) = 30 + YGeomData(1) = 0.0 + ZGeomData(1) = 0.0 + + + III = TECGEO112(XP, + & YP, + & ZP, + & PositionCoordSys, + & AttachToZone, + & Zone, + & Color, + & FillColor, + & IsFilled, + & GeomType, + & LinePattern, + & PatternLength, + & LineThickness, + & NumEllipsePts, + & ArrowheadStyle, + & ArrowheadAttachment, + & ArrowheadSize, + & ArrowheadAngle, + & Scope, + & Clipping, + & NumSegments, + & NumSegPts, + & XGeomData, + & YGeomData, + & ZGeomData, + & NULCHAR) + +C +C Close out file 1. +C + I = TECEND112() + +C +C Close out file 2. +C + III = 2 + I = TECFIL112(III) + I = TECEND112() + STOP + END diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.f90 b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.f90 new file mode 100644 index 0000000000000000000000000000000000000000..56b3d560c39bee690d927fb11a3cde3694921d77 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.f90 @@ -0,0 +1,467 @@ +! +! Complex example FORTRAN program to write a +! binary data file for Tecplot. This example +! does the following: +! +! 1. Open a data file called "field.plt." +! 2. Open a data file called "line.plt." +! 3. Assign values for X, Y and P. These will be used +! in both the ordered and FE data files. +! 4. Write out an ordered zone dimensioned 4 x 5 to "field.plt." +! 5. Assign values for XL and YL arrays. +! 6. Write out data for line plot to "line.plt." Make the data +! use double precision. +! 7. Write out a finite element zone to "field.plt." +! 8. Write out a text record to "field.plt." +! 9. Write out a geometry (circle) record to "field.plt." +! 10. Close file 1. +! 11. Close file 2. +! + Program ComplexTest + + Include "tecio.f90" + + REAL*4 X(4,5), Y(4,5), P(4,5) + REAL*8 XL(50), YL(50) + REAL*4 XLDummy(1), YLDummy(1) + EQUIVALENCE (XLDummy(1), XL(1)) + EQUIVALENCE (YLDummy(1), YL(1)) + REAL*8 SolTime + INTEGER*4 Debug,I,J,K,L,III,NPts,NElm,DIsDouble,VIsDouble,FileType + INTEGER*4 IMax,JMax,KMax,NM(4,12) + INTEGER*4 StrandID,ParentZn + INTEGER*4 SharingZone(3) + REAL*8 XP, YP, ZP, FH, LineSpacing, PatternLength + REAL*8 BoxMargin, BoxLineThickness, TextAngle + INTEGER*4 AttachToZone, Zone, Scope, PositionCoordSys + INTEGER*4 Clipping + INTEGER*4 FontType, HeightUnits, Anchor, BoxType + INTEGER*4 IsFilled, GeomType, LinePattern, NumEllipsePts + INTEGER*4 BoxColor, BoxFillColor, TextColor, Color, FillColor + INTEGER*4 ArrowheadStyle, ArrowheadAttachment, NumSegments + INTEGER*4 NumSegPts(1) + REAL*8 LineThickness, ArrowheadSize, ArrowheadAngle + REAL*4 XGeomData(1), YGeomData(1), ZGeomData(1) + CHARACTER*1 NULCHAR + INTEGER*4 Zero + POINTER (NullPtr,Null) + INTEGER*4 Null(*) + + Debug = 2 + VIsDouble = 0 + FileType = 0 + DIsDouble = 0 + NULCHAR = CHAR(0) + Zero = 0 + NullPtr = 0 +! +! Open field.plt and write the header information. +! + I = TECINI112('DATASET WITH 1 ORDERED ZONE, '// & + '1 QUAD ZONE OVER 2 TIME STEPS'//NULCHAR, & + 'X Y P'//NULCHAR, & + 'field.plt'//NULCHAR, & + '.'//NULCHAR, & + FileType, & + Debug, & + VIsDouble) +! +! Open line.plt and write the header information. +! + VIsDouble = 1 + I = TECINI112('DATASET WITH ONE I-ORDERED ZONE'//NULCHAR, & + 'X Y'//NULCHAR, & + 'line.plt'//NULCHAR, & + '.'//NULCHAR, & + FileType, & + Debug, & + VIsDouble) + +! +! Calculate values for the field variables. +! + Do 10 J = 1,5 + Do 10 I = 1,4 + X(I,J) = I + Y(I,J) = J + P(I,J) = I*J + 10 Continue + +! +! Make sure writing to file #1. +! + III = 1 + I = TECFIL112(III) + +! +! Write the zone header information for the ordered zone. +! + IMax = 4 + JMax = 5 + KMax = 1 + SolTime = 10.0 + StrandID = 1 + ParentZn = 0 + I = TECZNE112('Ordered Zone 1'//NULCHAR, & + 0, & ! ZONETYPE + IMax, & + JMax, & + KMax, & + 0, & + 0, & + 0, & + SolTime, & + StrandID, & + ParentZn, & + 1, & ! ISBLOCK + 0, & ! NumFaceConnections + 0, & ! FaceNeighborMode + 0, & ! TotalNumFaceNodes + 0, & ! NumConnectedBoundaryFaces + 0, & ! TotalNumBoundaryConnections + Null, & ! PassiveVarList + Null, & ! ValueLocation + Null, & ! ShareVarFromZone + 0) ! ShareConnectivityFromZone) + +! +! Write out the field data for the ordered zone. +! + III = IMax*JMax + I = TECDAT112(III,X,DIsDouble) + I = TECDAT112(III,Y,DIsDouble) + I = TECDAT112(III,P,DIsDouble) + +! +! Calculate values for the I-ordered zone. +! + + Do 20 I = 1,50 + XL(I) = I + YL(I) = sin(I/20.0) + 20 Continue +! +! Switch to the 'line.plt' file (file number 2) +! and write out the line plot data. +! + III = 2 + I = TECFIL112(III) +! +! Write the zone header information for the XY-data. +! + IMax = 50 + JMax = 1 + KMax = 1 + SolTime = 0.0 + StrandID = 0 + I = TECZNE112('XY Line plot'//NULCHAR, & + 0, & + IMax, & + JMax, & + KMax, & + 0, & + 0, & + 0, & + SolTime, & + StrandID, & + ParentZn, & + 1, & + 0, & + 0, & + 0, & + 0, & + 0, & + Null, & + Null, & + Null, & + 0) +! +! Write out the line plot. +! + DIsDouble = 1 + III = IMax + I = TECDAT112(III,XLDummy,DIsDouble) + I = TECDAT112(III,YLDummy,DIsDouble) + +! +! Switch back to the field plot file and write out +! the finite-element zone. +! + III = 1 + I = TECFIL112(III) +! +! Move the coordinates so this zone's not on top of the other +! + Do 30 J = 1,5 + Do 30 I = 1,4 + X(I,J) = I+5 + Y(I,J) = J + P(I,J) = I*J + 30 Continue +! +! Write the zone header information for the finite-element zone. +! + NPts = 20 + NElm = 12 + KMax = 1 + SolTime = 10.0 + StrandID = 2 + I = TECZNE112('Finite Zone 1'//NULCHAR, & + 3, & ! FEQUADRILATERAL + NPts, & + NElm, & + KMax, & + 0, & + 0, & + 0, & + SolTime, & + StrandID, & + ParentZn, & + 1, & + 0, & + 0, & + 0, & + 0, & + 0, & + Null, & + Null, & + Null, & + 0) +! +! Write out the field data for the finite-element zone. +! + IMax = 4 + JMax = 5 + III = IMax*JMax + DIsDouble = 0 + I = TECDAT112(III,X,DIsDouble) + I = TECDAT112(III,Y,DIsDouble) + I = TECDAT112(III,P,DIsDouble) + +! +! Calculate and then write out the connectivity list. +! Note: The NM array references cells starting with +! offset of 1. +! + + Do 40 I = 1,IMax-1 + Do 40 J = 1,JMax-1 + K = I+(J-1)*(IMax-1) + L = I+(J-1)*IMax + NM(1,K) = L + NM(2,K) = L+1 + NM(3,K) = L+IMax+1 + NM(4,K) = L+IMax + 40 Continue + + I = TECNOD112(NM) +! +! Calculate vlues for the new solution variable. +! + Do 50 J = 1,5 + Do 50 I = 1,4 + P(I,J) = 2*I*J + 50 Continue +! +! Write the zone header information for time step 2 +! + IMax = 4 + JMax = 5 + KMax = 1 + SolTime = 20.0 + StrandID = 1 + SharingZone(1) = 1 + SharingZone(2) = 1 + SharingZone(3) = 0 + I = TECZNE112('Ordered Zone 2'//NULCHAR, & + 0, & ! ORDERED + IMax, & + JMax, & + KMax, & + 0, & + 0, & + 0, & + SolTime, & + StrandID, & + ParentZn, & + 1, & + 0, & + 0, & + 0, & + 0, & + 0, & + Null, & + Null, & + SharingZone, & + 0) +! +! Write out the solution variable the grid variables are shared. +! + IMax = 4 + JMax = 5 + III = IMax*JMax + DIsDouble = 0 + I = TECDAT112(III,P,DIsDouble) +! +! Calculate values for the new solution variable. +! + Do 60 J = 1,5 + Do 60 I = 1,4 + P(I,J) = 3*I*J + 60 Continue +! +! Write another time step for the FEZone and share from the first +! + SolTime = 20.0 + StrandID = 2 + KMax = 0 + SharingZone(1) = 2 + SharingZone(2) = 2 + SharingZone(3) = 0 + I = TECZNE112('Finite Zone 2'//NULCHAR, & + 3, & ! FEQUADRILATERAL + NPts, & + NElm, & + KMax, & + 0, & + 0, & + 0, & + SolTime, & + StrandID, & + ParentZn, & + 1, & + 0, & + 0, & + 0, & + 0, & + 0, & + Null, & + Null, & + SharingZone, & + 2) +! +! Write out the solution variable the grid variables are shared. +! + IMax = 4 + JMax = 5 + III = IMax*JMax + DIsDouble = 0 + I = TECDAT112(III,P,DIsDouble) + +! +! Prepare to write out text record. Text is positioned +! at 50, 50 in frame units and has a height 5 frame units. +! + XP = 50 + YP = 50 + FH = 5 + Scope = 1 + Clipping = 0 + PositionCoordSys = 1 + FontType = 1 + HeightUnits = 1 + AttachToZone = 0 + Zone = 0 + BoxType = 0 + BoxMargin = 5.0 + BoxLineThickness = 0.5 + BoxColor = 3 + BoxFillColor = 7 + TextAngle = 0.0 + Anchor = 0 + LineSpacing = 1.5 + TextColor = 0 + + III = TECTXT112(XP, & + YP, & + 0.0d0, & + PositionCoordSys, & + AttachToZone, & + Zone, & + FontType, & + HeightUnits, & + FH, & + BoxType, & + BoxMargin, & + BoxLineThickness, & + BoxColor, & + BoxFillColor, & + TextAngle, & + Anchor, & + LineSpacing, & + TextColor, & + Scope, & + Clipping, & + 'Hi Mom'//NULCHAR, & + NULCHAR) + +! +! Prepare to write out geometry record (circle). Circle is +! positioned at 25, 25 in frame units and has a radius of 30. +! Circle is drawn using a dashed line pattern. +! + + + XP = 25 + YP = 25 + ZP = 0.0 + IsFilled = 0 + Color = 0 + FillColor = 7 + GeomType = 2 + LinePattern = 1 + LineThickness = 0.3 + PatternLength = 1 + NumEllipsePts = 72 + ArrowheadStyle = 0 + ArrowheadAttachment = 0 + ArrowheadSize = 0.0 + ArrowheadAngle = 15.0 + NumSegments = 1 + NumSegPts(1) = 1 + + XGeomData(1) = 30 + YGeomData(1) = 0.0 + ZGeomData(1) = 0.0 + + + III = TECGEO112(XP, & + YP, & + ZP, & + PositionCoordSys, & + AttachToZone, & + Zone, & + Color, & + FillColor, & + IsFilled, & + GeomType, & + LinePattern, & + PatternLength, & + LineThickness, & + NumEllipsePts, & + ArrowheadStyle, & + ArrowheadAttachment, & + ArrowheadSize, & + ArrowheadAngle, & + Scope, & + Clipping, & + NumSegments, & + NumSegPts, & + XGeomData, & + YGeomData, & + ZGeomData, & + NULCHAR) + +! +! Close out file 1. +! + I = TECEND112() + +! +! Close out file 2. +! + III = 2 + I = TECFIL112(III) + I = TECEND112() + STOP + END diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtestc.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtestc.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..23da375e8d60fac96e30d9adf617845c53c791b6 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtestc.vcproj @@ -0,0 +1,346 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="comtestc" + ProjectGUID="{723FBFD1-5AF2-4154-B77A-CE3849EAFCA2}" + RootNamespace="comtestc" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" + IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + AdditionalLibraryDirectories="" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + AdditionalLibraryDirectories="" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" + IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + AdditionalLibraryDirectories="" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + AdditionalLibraryDirectories="" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\comtest.c" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtestf.vfproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtestf.vfproj new file mode 100644 index 0000000000000000000000000000000000000000..dc894475f3dab497d6b1c191b1850c737c59b90e --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtestf.vfproj @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<VisualStudioProject ProjectCreator="Intel Fortran" Keyword="Console Application" Version="9.10" ProjectIdGuid="{861BC05F-1E95-401A-A80E-7589ADD1C79E}"> + <Platforms> + <Platform Name="Win32"/></Platforms> + <Configurations> + <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" DeleteExtensionsOnClean="*.obj;*.mod;*.pdb;*.asm;*.map;*.dyn;*.dpi;*.tmp;*.log;*.ilk;*.exe;$(TargetPath)"> + <Tool Name="VFMidlTool" SuppressStartupBanner="true" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/> + <Tool Name="VFPreBuildEventTool"/> + <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" AdditionalIncludeDirectories="$(TEC_360_2009)/Include" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" Traceback="true" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebug" CompileOnly="true"/> + <Tool Name="VFPostBuildEventTool"/> + <Tool Name="VFCustomBuildTool"/> + <Tool Name="VFLinkerTool" OutputFile="$(OUTDIR)/comtestf.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(TEC_360_2009)/Bin" GenerateDebugInformation="true" ProgramDatabaseFile="$(OUTDIR)/comtestf.pdb" SubSystem="subSystemConsole" AdditionalDependencies="tecio.lib"/> + <Tool Name="VFResourceCompilerTool" ResourceOutputFileName="$(IntDir)/$(InputName).res"/> + <Tool Name="VFPreLinkEventTool"/></Configuration> + <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" DeleteExtensionsOnClean="*.obj;*.mod;*.pdb;*.asm;*.map;*.dyn;*.dpi;*.tmp;*.log;*.ilk;*.exe;$(TargetPath)" MustRebuild="true"> + <Tool Name="VFMidlTool" SwitchesHaveChanged="true" SuppressStartupBanner="true" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/> + <Tool Name="VFPreBuildEventTool"/> + <Tool Name="VFFortranCompilerTool" SwitchesHaveChanged="true" SuppressStartupBanner="true" AdditionalIncludeDirectories="$(TEC_360_2009)/Include" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" RuntimeLibrary="rtMultiThreaded" CompileOnly="true"/> + <Tool Name="VFPostBuildEventTool"/> + <Tool Name="VFCustomBuildTool"/> + <Tool Name="VFLinkerTool" SwitchesHaveChanged="true" MustRebuild="true" OutputFile="$(OUTDIR)/comtestf.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(TEC_360_2009)/Bin" SubSystem="subSystemConsole" AdditionalDependencies="tecio.lib"/> + <Tool Name="VFResourceCompilerTool" SwitchesHaveChanged="true" ResourceOutputFileName="$(IntDir)/$(InputName).res"/> + <Tool Name="VFPreLinkEventTool"/></Configuration></Configurations> + <Files> + <File RelativePath="comtest.f90"/></Files> + <Globals/></VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/FaceNeighbors.plt b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/FaceNeighbors.plt new file mode 100644 index 0000000000000000000000000000000000000000..6581f95bdce627599a21174508c20d3b7eabb0b7 Binary files /dev/null and b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/FaceNeighbors.plt differ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..cc8b9bf18e217702771b7c6188d97df31d233c7f --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/Makefile @@ -0,0 +1,11 @@ +# Set to appropriate C++ compiler +CPP=g++ +CPPFLAGS=-I../../tecsrc ../../tecio.a +EXECUTABLE=faceneighbors +FILES=$(EXECUTABLE).cpp + +build: + $(CPP) $(FILES) $(CPPFLAGS) -o $(EXECUTABLE) + +clean: + rm -f $(EXECUTABLE) \ No newline at end of file diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/faceneighbors.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/faceneighbors.cpp new file mode 100644 index 0000000000000000000000000000000000000000..30b949e3f8e3d85d8bcaf9192e637344005e97c5 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/faceneighbors.cpp @@ -0,0 +1,354 @@ +/* This example illustrates how to create two simple + * FE-quadilateral zones and create a face neighbor + * connection between the two zones. In order to keep the + * example as simple as possible, error checking is not included. + */ + +#include "TECIO.h" +#include "MASTER.h" + +int main() +{ + /* Initialize the Data File using TECINI. TECINI is required + * for all data files. It is used to: open the data file and + * initialize the file header information (name the data file, + * the variables for the data file, and the file type). + */ + + /* DOCSTART:faceneighbors_tecini.txt*/ + + INTEGER4 Debug = 1; + INTEGER4 VIsDouble = 0; + INTEGER4 FileType = 0; + INTEGER4 I = 0; /* Used to track return codes */ + + I = TECINI112((char*)"Face Neighbors Example", /* Specifies the name + * of the entire + * dataset + */ + (char*)"X Y P", /* Defines the + * variables for the + * data file. Each + * zone must contain + * each of the vars + * listed. The order + * of the variables in + * the list is used to + * define the variable + * number (e.g. X is + * Var 1.) + */ + + (char*)"FaceNeighbors.plt", /* Specifies the + * file name. + */ + (char*)".", + &FileType, /* The FileType is set to + * zero, indicating it is + * a full file (containing + * both grid and solution + * data). + */ + &Debug, + &VIsDouble); + /* DOCEND */ + + /* After TECINI is called, call TECZNE to create one or + * more zones for your data file. + */ + /* DOCSTART:faceneighbors_teczne1.txt*/ + INTEGER4 ZoneType = 3; /* set the zone type to + * FEQuadrilateral + */ + INTEGER4 NumPts = 6; + INTEGER4 NumElems = 2; + INTEGER4 NumFaces = 8; + INTEGER4 ICellMax = 0; /* not used */ + INTEGER4 JCellMax = 0; /* not used */ + INTEGER4 KCellMax = 0; /* not used */ + double SolTime = 360.0; + INTEGER4 StrandID = 0; /* StaticZone */ + INTEGER4 ParentZn = 0; + INTEGER4 IsBlock = 1; /* Block */ + INTEGER4 NFConns = 1; /* Specify the number of Face + * Neighbor Connections in the + * Zone. When this value is + * greater than zero, TECFACE must + * be called prior to creating the + * next zone or ending the file. + */ + + /* Specify the Face Neighbor Mode. + * A value of 2 indicated that the face neighbor mode is global + * one-to-one. The scope of the face neighbors (local or + * global) is with respect to the zones. A value of global + * indicates that the face neighbor(s) is/are shared aross zones; + * a value of local indicates that the face neighbor(s) are + * shared within the current zone. The terms one-to-one and + * one-to-many are used to indicate whether the face in question + * is shared with one cell or several cells. + * For example, if your data is arranged as follows: + + ----------------------- + | | | | + | 1 | 2 | 3 | + | | | | + ----------------------- + | | | + | 4 | 5 | + | | | + ----------------------- + * The face between 1 & 4 is local-one-to-one. The face between + * 5 and (2 & 3) is local one-to-many. + */ + + INTEGER4 FNMode = 2; + + INTEGER4 TotalNumFaceNodes = 1; /* Not used for + * FEQuad zones*/ + INTEGER4 NumConnectedBoundaryFaces = 1; /* Not used for + * FEQuad zones*/ + INTEGER4 TotalNumBoundaryConnections = 1; /* Not used for + * FEQuad zones*/ + INTEGER4 ShrConn = 0; + + INTEGER4 ValueLocation[3] = {1, 1, 1}; /* Specify the variable + * values at the nodes. + * NOTE: Because all of + * the variables are + * defined at the nodes, + * we can just pass + * NULL for this array. + * We are providing the + * array for illustration + * purposes. + */ + + I = TECZNE112((char*)"Zone 1", + &ZoneType, + &NumPts, + &NumElems, + &NumFaces, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZn, + &IsBlock, + &NFConns, + &FNMode, + &TotalNumFaceNodes, + &NumConnectedBoundaryFaces, + &TotalNumBoundaryConnections, + NULL, + ValueLocation, + NULL, + &ShrConn); + /* DOCEND */ + + /* Set up the variable values. The variable values will be + * written to the file using TECDAT. Because we are specifying + * nodal variables (as specified via the ValueLocation + * parameter in TECZNE, each variable is dimensioned by the + * number of points (NumPts) in the Zone. You have the option + * to specify some variables with nodal values and some with + * cell-centered values. Refer to the Binary Function + * Reference for details. + */ + + /* DOCSTART:faceneighbors_tecdat1.txt*/ + float *X = new float[NumPts]; + float *Y = new float[NumPts]; + float *P = new float[NumPts]; + + /* For this example, we will create 2 rectangular cells in Zone + * 1. Before defining your variables, you must establish a + * consistent node numbering scheme for your data. Once the + * node numbers are defined, supply the variable values in the + * node numbering order. In this example, node 1 is defined at + * X = 0 and Y = 0. As such, the first value supplied for X + * (i.e. X[0]) is 0. Similarly, the first value supplied for Y + * is 0. + * + * It is important that you refer to node numbers consistently. + * The node numbers will be used later to define the + * connectivity for each element. + */ + + X[0] = 0; + X[1] = 0; + X[2] = 1; + X[3] = 1; + X[4] = 2; + X[5] = 2; + + Y[0] = 0; + Y[1] = 1; + Y[2] = 0; + Y[3] = 1; + Y[4] = 0; + Y[5] = 1; + + for (INTEGER4 ii = 0; ii < NumPts; ii++) + P[ii] = (float)(NumPts - ii); + + INTEGER4 DIsDouble = 0; /* Set DIsDouble to zero to use + * variables in float format. + */ + + /* Call TECDAT once for each variable */ + I = TECDAT112(&NumPts, &X[0], &DIsDouble); + I = TECDAT112(&NumPts, &Y[0], &DIsDouble); + I = TECDAT112(&NumPts, &P[0], &DIsDouble); + /* DOCEND */ + + /* Define the face neighbors connections. + * The Connectivity List is used to specify the nodes that + * compose each element. When working with nodal variables, the + * numbering of the nodes is implicitly defined when the + * variables are declared. The first value of each variable is + * for node one, the second value for node two, and so on. + * + * Because this zone contains two quadilateral elements, we must + * supply 8 values in the connectivity list. The first four + * values define the nodes that form element 1. Similarly, the + * second four values define the nodes that form element 2. + */ + + /* DOCSTART:faceneighbors_tecnod1.txt*/ + INTEGER4 ConnList[8] = {1, 3, 4, 2, + 3, 5, 6, 4 + }; + I = TECNOD112(ConnList); + /* DOCEND */ + + /* TIP! It is important to provide the node list in either a + * clockwise or counter-clockwise order. Otherwise, your + * elements will be misformed. For example, if the first two + * numbers in the above connectivity list, the zone would + * appear as follows: + */ + + /* Now that TECNOD has been called, the creation of Zone 1 + * is complete. However, in this example, we will define a + * face neighbor between Zone 1 and Zone 2 (to be created + * later in the example). Face Neighbor connections are used + * to define connections that are not created via the + * connectivity list. For example, local face neighbors may + * need to be defined when a zone wraps itself and global face + * neighbors may need to be defined to smooth edges across + * zones. Face Neighbors are used when deriving variables and + * drawing contours. + * + * In this example, we are creating a face neighbor connection + * between cell 2 in Zone 1 and cell 1 in Zone 2. The + * information required when specifying face neighbors + * depends upon the type of connection. + * + * In this case, we must supply (in this order): + * - the cell number in the current zone that contains the + * - the number of the face in that cell that contains the + * face neighbor + * - the number of the other zone to which the face is + * connected + * - the number of the cell in the other zone to which the + * face is connected + * The face numbering for cell-based finite elements is + * defined using the picture displayed in the Data Format + * Guide. In this example, face 2 in cell 2 in the current + * zone is connected to cell 1 in zone 2. + */ + + /* DOCSTART:faceneighbors_tecface1.txt*/ + INTEGER4 FaceConn[4] = {2, 2, 2, 1}; + I = TECFACE112(FaceConn); + /* DOCEND */ + + /* The creation of Zone 1 is complete. We are ready to create + * Zone 2. For simplicity, Zone 2 is a copy of Zone 1 shifted + * along the X-axis. As such, many of the variables used to + * create Zone 1 are re-used here. + */ + /* DOCSTART:faceneighbors_teczne2.txt*/ + /* Call TECZNE to create Zone 2 */ + I = TECZNE112((char*)"Zone 2", + &ZoneType, + &NumPts, + &NumElems, + &NumFaces, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZn, + &IsBlock, + &NFConns, + &FNMode, + &TotalNumFaceNodes, + &NumConnectedBoundaryFaces, + &TotalNumBoundaryConnections, + NULL, + ValueLocation, + NULL, + &ShrConn); + /* DOCEND */ + + /* Define the variables for Zone 2. Because Zone 2 is a copy + * of Zone 1, shifted along the X-axis, we can share the Y + * variable definition used to Zone. We will also create a + * second pressure variable for Zone 2 (P2). + */ + + /* DOCSTART:faceneighbors_tecdat2.txt*/ + float *X2 = new float[NumPts]; + float *P2 = new float[NumPts]; + + for (INTEGER4 ii = 0; ii < NumPts; ii++) + { + X2[ii] = X[ii] + 2; + P2[ii] = 2 * (float)ii; + } + + I = TECDAT112(&NumPts, &X2[0], &DIsDouble); + I = TECDAT112(&NumPts, &Y[0], &DIsDouble); + I = TECDAT112(&NumPts, &P2[0], &DIsDouble); + + delete X; + delete Y; + delete P; + delete X2; + delete P2; + /* DOCEND */ + + /* As with Zone 1, we must define the connectivity list for + * Zone 2. Because, the node numbering restarts at one for each + * new zone and the nodal arrangement is identical between the + * two zones, we may reuse the connectivity list from Zone 1. + */ + + /* DOCSTART:faceneighbors_tecnod2.txt*/ + I = TECNOD112(ConnList); + /* DOCEND */ + + /* We will now specify the face neighbor connection with + * respect to our new current zone of Zone 2. + */ + + /* DOCSTART:faceneighbors_tecface2.txt*/ + INTEGER4 FaceConn2[4] = {1, 4, 1, 2}; /* cell 1, face 4 in + * current zone is a + * neighbor to cell 2 in + * zone 1. + */ + I = TECFACE112(FaceConn2); + /* DOCEND */ + + /* Call TECEND to close the file */ + /* DOCSTART:faceneighbors_tecend.txt*/ + I = TECEND112(); + /* DOCEND */ + + return 0; +} diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/faceneighbors.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/faceneighbors.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..c3099ffedb9f173bdcb8776047d2b4586ad16906 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/faceneighbors.vcproj @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="faceneighbors" + ProjectGUID="{1074FD63-4831-4D1B-8A27-94A3AC33A509}" + RootNamespace="faceneighbors" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + RuntimeLibrary="2" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\faceneighbors.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..d901ed95c19213aa88cf9dffea79c48a62897657 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/Makefile @@ -0,0 +1,11 @@ +# Set to appropriate C++ compiler +CPP=g++ +CPPFLAGS=-I../../tecsrc ../../tecio.a +EXECUTABLE=gridsolution +FILES=$(EXECUTABLE).cpp + +build: + $(CPP) $(FILES) $(CPPFLAGS) -o $(EXECUTABLE) + +clean: + rm -f $(EXECUTABLE) diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/gridsolution.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/gridsolution.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8cf2e5489493aebf31bf8a0f452c86302ea2e7fc --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/gridsolution.cpp @@ -0,0 +1,376 @@ +/* This example illustrates using separate grid + * and solution files. + */ + +#include "TECIO.h" +#include "MASTER.h" /* for defintion of NULL */ + +int main() +{ + /* DOCSTART:gridsolution_grid_tecini.txt*/ + INTEGER4 I; /* use to check return values */ + + INTEGER4 Debug = 1; + INTEGER4 VIsDouble = 0; + INTEGER4 FileType = 1; /* 1 = grid file. */ + + I = TECINI112((char*)"Example: Separate grid and solution files", + (char*)"X Y Z", /* Defines the variables for the data file. + * Each zone must contain each of the vars + * listed here. The order of the variables + * in the list is used to define the + * variable number (e.g. X is Variable 1). + * When referring to variables in other + * TecIO functions, you will refer to the + * variable by its number. + */ + (char*)"grid.plt", + (char*)".", /* scratch directory */ + &FileType, + &Debug, + &VIsDouble); + /* DOCEND */ + + /* DOCSTART:gridsolution_grid_teczne.txt*/ + /* TECZNE Parameters */ + INTEGER4 ZoneType = 7; /* FE Polyhedron */ + INTEGER4 NumPts = 20; /* the number of unique + * nodes in the zone. + */ + INTEGER4 NumElems = 1; + INTEGER4 NumFaces = 12; /* the number of unique + * faces in the zone. + */ + INTEGER4 ICellMax = 0; /* not used */ + INTEGER4 JCellMax = 0; /* not used */ + INTEGER4 KCellMax = 0; /* not used */ + double SolutionTime = 0.0; + INTEGER4 StrandID = 1; /* time strand for + * unsteady solution. + */ + INTEGER4 ParentZone = 0; + INTEGER4 IsBlock = 1; + INTEGER4 NumFaceConnections = 0; + INTEGER4 FaceNeighborMode = 1; + INTEGER4 SharConn = 0; + + /* For this zone, the total number of face nodes is + * five times number of faces, because each face + * is a pentagon. + */ + INTEGER4 TotalNumFaceNodes = 5 * NumFaces; + + /* This zone has no connected boundary faces. + */ + INTEGER4 TotalNumBndryFaces = 0; + INTEGER4 TotalNumBndryConns = 0; + + I = TECZNE112((char*)"Dodecahedron", /* Name of the zone. */ + &ZoneType, + &NumPts, + &NumElems, + &NumFaces, + &ICellMax, + &JCellMax, + &KCellMax, + &SolutionTime, + &StrandID, + &ParentZone, + &IsBlock, + &NumFaceConnections, + &FaceNeighborMode, + &TotalNumFaceNodes, + &TotalNumBndryFaces, + &TotalNumBndryConns, + NULL, + NULL, /* All nodal variables */ + NULL, + &SharConn); + /* DOCEND */ + + /* DOCSTART:gridsolution_grid_tecdat.txt*/ + + /* TECDAT Parameters */ + double Phi = 0.5 * (1.0 + sqrt(5.0)); + double Pi = 3.141592653578; + double *X = new double[NumPts]; + double *Y = new double[NumPts]; + double *Z = new double[NumPts]; + int Count = 0; + + for(int J = 0; J <= 4; J++) + { + X[Count] = 2.0 * cos(2.0 / 5.0 * Pi * J); + Y[Count] = 2.0 * sin(2.0 / 5.0 * Pi * J); + Z[Count] = Phi + 1.0; + Count++; + + X[Count] = -X[Count - 1]; + Y[Count] = -Y[Count - 1]; + Z[Count] = -Z[Count - 1]; + Count++; + + X[Count] = 2.0 * Phi * cos(2.0 / 5.0 * Pi * J); + Y[Count] = 2.0 * Phi * sin(2.0 / 5.0 * Pi * J); + Z[Count] = Phi - 1.0; + Count++; + + X[Count] = -X[Count - 1]; + Y[Count] = -Y[Count - 1]; + Z[Count] = -Z[Count - 1]; + Count++; + } + + INTEGER4 IsDouble = 1; + + I = TECDAT112(&NumPts, X, &IsDouble); + I = TECDAT112(&NumPts, Y, &IsDouble); + I = TECDAT112(&NumPts, Z, &IsDouble); + + delete X; + delete Y; + delete Z; + + /* DOCEND */ + + /* DOCSTART:gridsolution_grid_facenodes.txt*/ + /* TecPoly Parameters */ + + /* Create a FaceNodes array, dimensioned by the total number + * of face nodes in the zone. + */ + INTEGER4 *FaceNodes = new INTEGER4[TotalNumFaceNodes]; + int n = 0; + + /* Face Nodes for face 1 of the dodecahedron */ + FaceNodes[n++] = 2; + FaceNodes[n++] = 6; + FaceNodes[n++] = 10; + FaceNodes[n++] = 14; + FaceNodes[n++] = 18; + + /* Face Nodes for face 2 */ + FaceNodes[n++] = 6; + FaceNodes[n++] = 8; + FaceNodes[n++] = 19; + FaceNodes[n++] = 12; + FaceNodes[n++] = 10; + + /* Face Nodes for face 3 */ + FaceNodes[n++] = 3; + FaceNodes[n++] = 12; + FaceNodes[n++] = 10; + FaceNodes[n++] = 14; + FaceNodes[n++] = 16; + + /* Face Nodes for face 4 */ + FaceNodes[n++] = 7; + FaceNodes[n++] = 16; + FaceNodes[n++] = 14; + FaceNodes[n++] = 18; + FaceNodes[n++] = 20; + + /* Face Nodes for face 5 */ + FaceNodes[n++] = 2; + FaceNodes[n++] = 4; + FaceNodes[n++] = 11; + FaceNodes[n++] = 20; + FaceNodes[n++] = 18; + + /* Face Nodes for face 6 */ + FaceNodes[n++] = 2; + FaceNodes[n++] = 4; + FaceNodes[n++] = 15; + FaceNodes[n++] = 8; + FaceNodes[n++] = 6; + + /* Face Nodes for face 7 */ + FaceNodes[n++] = 1; + FaceNodes[n++] = 3; + FaceNodes[n++] = 12; + FaceNodes[n++] = 19; + FaceNodes[n++] = 17; + + /* Face Nodes for face 8 */ + FaceNodes[n++] = 1; + FaceNodes[n++] = 3; + FaceNodes[n++] = 16; + FaceNodes[n++] = 7; + FaceNodes[n++] = 5; + + /* Face Nodes for face 9 */ + FaceNodes[n++] = 5; + FaceNodes[n++] = 7; + FaceNodes[n++] = 20; + FaceNodes[n++] = 11; + FaceNodes[n++] = 9; + + /* Face Nodes for face 10 */ + FaceNodes[n++] = 4; + FaceNodes[n++] = 11; + FaceNodes[n++] = 9; + FaceNodes[n++] = 13; + FaceNodes[n++] = 15; + + /* Face Nodes for face 11 */ + FaceNodes[n++] = 8; + FaceNodes[n++] = 15; + FaceNodes[n++] = 13; + FaceNodes[n++] = 17; + FaceNodes[n++] = 19; + + /* Face Nodes for face 12 */ + FaceNodes[n++] = 1; + FaceNodes[n++] = 5; + FaceNodes[n++] = 9; + FaceNodes[n++] = 13; + FaceNodes[n++] = 17; + + /* DOCEND */ + + /* Specify the number of nodes for each face, and the right and + * left neighboring elements. The neighboring elements can be + * determined using the right-hand rule. For each face, curl + * the fingers of your right hand in the direction of + * incrementing node numbers (i.e. from Node 1 to Node 2 and + * so on). Your thumb will point toward the right element. + * A value of zero indicates that there is no + * neighboring element on that side. A negative value + * indicates that the neighboring element is in another zone. + * In that case, the number is a pointer into the + * FaceBndryConnectionElems and FaceBndryConnectionZones arrays. + */ + + /* DOCSTART:gridsolution_grid_tecpoly.txt*/ + INTEGER4 *FaceNodeCounts = new INTEGER4[NumFaces]; + INTEGER4 *FaceLeftElems = new INTEGER4[NumFaces]; + INTEGER4 *FaceRightElems = new INTEGER4[NumFaces]; + + /* For this particular zone, each face has the 5 nodes. */ + for(int J = 0; J < NumFaces; J++) + FaceNodeCounts[J] = 5; + + /* Set the right and left elements for each face. */ + FaceRightElems[0] = 1; + FaceRightElems[1] = 1; + FaceRightElems[2] = 0; + FaceRightElems[3] = 0; + FaceRightElems[4] = 0; + FaceRightElems[5] = 1; + FaceRightElems[6] = 1; + FaceRightElems[7] = 0; + FaceRightElems[8] = 0; + FaceRightElems[9] = 1; + FaceRightElems[10] = 1; + FaceRightElems[11] = 0; + + FaceLeftElems[0] = 0; + FaceLeftElems[1] = 0; + FaceLeftElems[2] = 1; + FaceLeftElems[3] = 1; + FaceLeftElems[4] = 1; + FaceLeftElems[5] = 0; + FaceLeftElems[6] = 0; + FaceLeftElems[7] = 1; + FaceLeftElems[8] = 1; + FaceLeftElems[9] = 0; + FaceLeftElems[10] = 0; + FaceLeftElems[11] = 1; + + I = TECPOLY112(FaceNodeCounts, + FaceNodes, + FaceLeftElems, + FaceRightElems, + NULL, /* No boundary connections. */ + NULL, + NULL); + + delete FaceNodes; + delete FaceLeftElems; + delete FaceRightElems; + + /* DOCEND */ + + + /* DOCSTART:gridsolution_grid_tecend.txt*/ + I = TECEND112(); + /* DOCEND */ + + /* DOCSTART:gridsolution_solution_tecini.txt*/ + for(int J = 0; J < 5; J++) + { + char SolutionFileName[128]; + sprintf(SolutionFileName, "solution%d.plt", J); + + /* DOCSTART:gridsolution_solution_tecini.txt*/ + FileType = 2; /* 1 = solution file. */ + + I = TECINI112((char*)"Example: Separate grid and solution files", + (char*)"P T", /* Defines the variables for the solution file. + * Note that these are different variables from + * the grid file. + */ + SolutionFileName, + (char*)".", /* scratch directory */ + &FileType, + &Debug, + &VIsDouble); + /* DOCEND */ + + /* DOCSTART:gridsolution_solution_teczne.txt*/ + /* TECZNE Parameters are mostly unchanged from creation of the grid file. */ + TotalNumFaceNodes = 0; + SolutionTime = J; + + char ZoneName[128]; + sprintf(ZoneName, "Dodecahedron Time=%g", SolutionTime); + I = TECZNE112(ZoneName, + &ZoneType, + &NumPts, + &NumElems, + &NumFaces, + &ICellMax, + &JCellMax, + &KCellMax, + &SolutionTime, + &StrandID, + &ParentZone, + &IsBlock, + &NumFaceConnections, + &FaceNeighborMode, + &TotalNumFaceNodes, + &TotalNumBndryFaces, + &TotalNumBndryConns, + NULL, + NULL, /* All nodal variables */ + NULL, + &SharConn); + /* DOCEND */ + + /* DOCSTART:gridsolution_solution_tecdat.txt*/ + + /* TECDAT Parameters */ + double *P = new double[NumPts]; + double *T = new double[NumPts]; + + for(int K = 0; K < NumPts; K++) + { + P[K] = (double)(K + J); + T[K] = 1.0 + K + K; + } + + I = TECDAT112(&NumPts, P, &IsDouble); + I = TECDAT112(&NumPts, T, &IsDouble); + + delete P; + delete T; + + /* DOCEND */ + + /* DOCSTART:gridsolution_solution_tecend.txt*/ + I = TECEND112(); + /* DOCEND */ + } + + return 0; +} diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/gridsolution.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/gridsolution.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..7e333fd22708314290305bc0345e86642c24e485 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/gridsolution.vcproj @@ -0,0 +1,321 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="gridsolution" + ProjectGUID="{D2747EA6-7807-42E1-984D-C946B3D97D95}" + RootNamespace="mulitplepolygons" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + RuntimeLibrary="2" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + RuntimeLibrary="2" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\gridsolution.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..90411d11e22dbb5b2625cb51ed580a598d6e0709 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/Makefile @@ -0,0 +1,11 @@ +# Set to appropriate C++ compiler +CPP=g++ +CPPFLAGS=-I../../tecsrc ../../tecio.a +EXECUTABLE=ij_ordered +FILES=$(EXECUTABLE).cpp + +build: + $(CPP) $(FILES) $(CPPFLAGS) -o $(EXECUTABLE) + +clean: + rm -f $(EXECUTABLE) \ No newline at end of file diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/ij_ordered.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/ij_ordered.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2f13c1f4a37f46f00483d38184f1c3e036b9acf9 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/ij_ordered.cpp @@ -0,0 +1,149 @@ +/* This example creates a simple set of IJ-ordered zones */ +/* DOCSTART:ij_ordered.txt*/ +#include "TECIO.h" +#include "MASTER.h" /* for defintion of NULL */ + +int main() +{ + INTEGER4 Debug = 1; + INTEGER4 VIsDouble = 0; + INTEGER4 FileType = 0; + INTEGER4 I = 0; /* Used to track return codes */ + + /* + * Open the file and write the tecplot datafile + * header information + */ + I = TECINI112((char*)"IJ Ordered Zones", /* Name of the entire + * dataset. + */ + (char*)"X Y P", /* Defines the variables for the data + * file. Each zone must contain each of + * the variables listed here. The order + * of the variables in the list is used + * to define the variable number (e.g. + * X is Var 1). + */ + (char*)"ij_ordered.plt", + (char*)".", /* Scratch Directory */ + &FileType, + &Debug, + &VIsDouble); + + float X1[4]; + float Y1[4]; + float P1[4]; + float X2[4]; + float Y2[4]; + float P2[4]; + + INTEGER4 ICellMax = 0; + INTEGER4 JCellMax = 0; + INTEGER4 KCellMax = 0; + INTEGER4 DIsDouble = 0; + double SolTime = 360.0; + INTEGER4 StrandID = 0; /* StaticZone */ + INTEGER4 ParentZn = 0; + INTEGER4 IsBlock = 1; /* Block */ + INTEGER4 NFConns = 0; + INTEGER4 FNMode = 0; + INTEGER4 TotalNumFaceNodes = 1; + INTEGER4 TotalNumBndryFaces = 1; + INTEGER4 TotalNumBndryConnections = 1; + INTEGER4 ShrConn = 0; + + /*Ordered Zone Parameters*/ + INTEGER4 IMax = 2; + INTEGER4 JMax = 2; + INTEGER4 KMax = 1; + + X1[0] = .125; + Y1[0] = .5; + P1[0] = 5; + + X1[1] = .625; + Y1[1] = .5; + P1[1] = 7.5; + + X1[2] = .125; + Y1[2] = .875; + P1[2] = 10; + + X1[3] = .625; + Y1[3] = .875; + P1[3] = 7.5; + + X2[0] = .375; + Y2[0] = .125; + P2[0] = 5; + + X2[1] = .875; + Y2[1] = .125; + P2[1] = 7.5; + + X2[2] = .375; + Y2[2] = .5; + P2[2] = 10; + + X2[3] = .875; + Y2[3] = .5; + P2[3] = 7.5; + + /* Ordered Zone */ + INTEGER4 ZoneType = 0; + I = TECZNE112((char*)"Ordered Zone", + &ZoneType, + &IMax, + &JMax, + &KMax, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZn, + &IsBlock, + &NFConns, + &FNMode, + &TotalNumFaceNodes, + &TotalNumBndryFaces, + &TotalNumBndryConnections, + NULL, + NULL, + NULL, + &ShrConn); + INTEGER4 III = IMax * JMax * KMax; + I = TECDAT112(&III, X1, &DIsDouble); + I = TECDAT112(&III, Y1, &DIsDouble); + I = TECDAT112(&III, P1, &DIsDouble); + + I = TECZNE112((char*)"Ordered Zone2", + &ZoneType, + &IMax, + &JMax, + &KMax, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZn, + &IsBlock, + &NFConns, + &FNMode, + &TotalNumFaceNodes, + &TotalNumBndryFaces, + &TotalNumBndryConnections, + NULL, + NULL, + NULL, + &ShrConn); + + I = TECDAT112(&III, X2, &DIsDouble); + I = TECDAT112(&III, Y2, &DIsDouble); + I = TECDAT112(&III, P2, &DIsDouble); + + I = TECEND112(); + return 0; +} +/* DOCEND */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/ij_ordered.plt b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/ij_ordered.plt new file mode 100644 index 0000000000000000000000000000000000000000..81f210b6c2d7abc0e87795395027da100999e7af Binary files /dev/null and b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/ij_ordered.plt differ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/ij_ordered.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/ij_ordered.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..94c67c6c071e2636874d7be8727461c41af11a7f --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/ij_ordered.vcproj @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="ij_ordered" + ProjectGUID="{47556A00-C441-4B9A-8920-91CA63AC1595}" + RootNamespace="ij_ordered" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + RuntimeLibrary="2" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\ij_ordered.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..d55d2ee044072de104c6ec3e8ab53bccf1a6e061 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/Makefile @@ -0,0 +1,11 @@ +# Set to appropriate C++ compiler +CPP=g++ +CPPFLAGS=-I../../tecsrc ../../tecio.a +EXECUTABLE=multiplefiles +FILES=$(EXECUTABLE).cpp + +build: + $(CPP) $(FILES) $(CPPFLAGS) -o $(EXECUTABLE) + +clean: + rm -f $(EXECUTABLE) \ No newline at end of file diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/file1.plt b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/file1.plt new file mode 100644 index 0000000000000000000000000000000000000000..b0c368e03f3ff83c0a739471d901361b130eb257 Binary files /dev/null and b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/file1.plt differ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/file2.plt b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/file2.plt new file mode 100644 index 0000000000000000000000000000000000000000..8a36da392bfd89d1328b3cf5bec0e5bfbb1fbd0d Binary files /dev/null and b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/file2.plt differ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/multiplefiles.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/multiplefiles.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b79085ff561fad2a323ae1bdc092d8a13feecf42 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/multiplefiles.cpp @@ -0,0 +1,214 @@ +/* This example illustrates working with TecFil to create multiple + * plt files simultaneously. + */ +#if defined _MSC_VER +#pragma warning (disable: 4996) /* Windows strcpy warning off */ +#endif +/* DOCSTART:mulitplefiles.txt */ +#include "TECIO.h" +#include "MASTER.h" /* for defintion of NULL */ +#include <string.h> + +int main() +{ + /* + * Open the file and write the tecplot datafile + * header information + */ + INTEGER4 Debug = 1; + INTEGER4 VIsDouble = 0; + INTEGER4 FileType = 0; + INTEGER4 I = 0; /* Used to check the return value */ + + I = TECINI112((char*)"SIMPLE DATASET", /* Name of the entire dataset.*/ + + (char*)"X1 Y1 P1", /* Defines the variables for the data + * file. Each zone must contain each of + * the variables listed here. The order + * of the variables in the list is used + * to define the variable number (e.g. + * X1 is Var 1). + */ + (char*)"file1.plt", + (char*)".", /* Scratch Directory */ + &FileType, + &Debug, + &VIsDouble); + + /* Set the parameters for TecZne */ + INTEGER4 ZoneType = 0; /* sets the zone type to + * ordered + */ + INTEGER4 IMax = 2; /* Create an IJ-ordered zone, + * by using IMax and JMax + * values that are greater + * than one, and setting KMax + * to one. + */ + INTEGER4 JMax = 2; + INTEGER4 KMax = 1; + + double SolTime = 0; + INTEGER4 StrandID = 0; /* StaticZone */ + INTEGER4 ParentZn = 0; /* used for surface streams */ + + INTEGER4 ICellMax = 0; /* not used */ + INTEGER4 JCellMax = 0; /* not used */ + INTEGER4 KCellMax = 0; /* not used */ + + INTEGER4 IsBlock = 1; /* Block */ + + INTEGER4 NFConns = 0; /* this example does not use + * face neighbors */ + INTEGER4 FNMode = 0; + INTEGER4 TotalNumFaceNodes = 1; + INTEGER4 TotalNumBndryFaces = 1; + INTEGER4 TotalNumBndryConn = 1; + INTEGER4 ShrConn = 0; + + + /* Create an Ordered Zone */ + I = TECZNE112((char*)"Ordered Zone", + &ZoneType, + &IMax, + &JMax, + &KMax, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZn, + &IsBlock, + &NFConns, + &FNMode, + &TotalNumFaceNodes, + &TotalNumBndryFaces, + &TotalNumBndryConn, + NULL, + NULL, + NULL, + &ShrConn); + + /* Set the variable values for the ordered zone. */ + float X1[4]; + float Y1[4]; + float P1[4]; + + X1[0] = 0.125; + Y1[0] = 0.5; + P1[0] = 7.5; + + X1[1] = 0.625; + Y1[1] = 0.5; + P1[1] = 10.0; + + X1[2] = 0.125; + Y1[2] = 0.875; + P1[2] = 5.0; + + X1[3] = 0.625; + Y1[3] = 0.875; + P1[3] = 7.5; + + INTEGER4 DIsDouble = 0; /* set DIsDouble to 0, for float + * values. + */ + + INTEGER4 III = IMax * JMax * KMax; + I = TECDAT112(&III, X1, &DIsDouble); + I = TECDAT112(&III, Y1, &DIsDouble); + I = TECDAT112(&III, P1, &DIsDouble); + + /* Open a new data file. note: the first file is still open + * because TecEnd was not called. + */ + I = TECINI112((char*)"Auxiliary Data", + (char*)"X1 Y1 P1", + (char*)"file2.plt", + (char*)".", + &FileType, + &Debug, + &VIsDouble); + + /* Switch the active file to the newly created data file + * (file2.plt) which is the second file opened with TECINI112 + * so we use 2. + */ + INTEGER4 WhichFile = 2; + I = TECFIL112(&WhichFile); + + /* Create a second zone, using many of the values from the first + * zone, and write it to the second data file. + */ + + I = TECZNE112((char*)"Ordered Zone2", + &ZoneType, + &IMax, + &JMax, + &KMax, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZn, + &IsBlock, + &NFConns, + &FNMode, + &TotalNumFaceNodes, + &TotalNumBndryFaces, + &TotalNumBndryConn, + NULL, + NULL, + NULL, + &ShrConn); + /* set the variable values for the second zone */ + float X2[4]; + float Y2[4]; + float P2[4]; + + X2[0] = 0.375; + Y2[0] = 0.125; + P2[0] = 5; + + X2[1] = 0.875; + Y2[1] = 0.125; + P2[1] = 7.5; + + X2[2] = 0.375; + Y2[2] = 0.5; + P2[2] = 10; + + Y2[3] = 0.5; + X2[3] = 0.875; + P2[3] = 7.5; + + III = IMax * JMax * KMax; + I = TECDAT112(&III, X2, &DIsDouble); + I = TECDAT112(&III, Y2, &DIsDouble); + I = TECDAT112(&III, P2, &DIsDouble); + + /* Switch to the first file. */ + WhichFile = 1; + I = TECFIL112(&WhichFile); + + /* Create an auxiliary data value and write it to the file */ + char DeformationValue[128]; + strcpy(DeformationValue, "0.98"); + + I = TECAUXSTR112((char*)"DeformationValue", + DeformationValue); + /* Close the first file */ + I = TECEND112(); + + /* The remaining file will become the active file. As such, + * TecFil does not need to be called again to close the second + * file. + */ + I = TECEND112(); + + return 0; +} + +/* DOCEND */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/multiplefiles.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/multiplefiles.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..84651a69d03fdb5c920b3239c46f5df7be908a76 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/multiplefiles.vcproj @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="multiplefiles" + ProjectGUID="{93CB23B2-530F-4D6F-900F-893815299C7F}" + RootNamespace="multiplefiles" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + RuntimeLibrary="2" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\multiplefiles.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/HexagonsAndOctagon.plt b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/HexagonsAndOctagon.plt new file mode 100644 index 0000000000000000000000000000000000000000..3b4f3042c69b7ea023e8de723b7e40c5b7f6eaf2 Binary files /dev/null and b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/HexagonsAndOctagon.plt differ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..d11ec5afd65b1b797a81c71dfc6da34109dd018f --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/Makefile @@ -0,0 +1,11 @@ +# Set to appropriate C++ compiler +CPP=g++ +CPPFLAGS=-I../../tecsrc ../../tecio.a +EXECUTABLE=multiplepolygons +FILES=$(EXECUTABLE).cpp + +build: + $(CPP) $(FILES) $(CPPFLAGS) -o $(EXECUTABLE) + +clean: + rm -f $(EXECUTABLE) \ No newline at end of file diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/multiplepolygons.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/multiplepolygons.cpp new file mode 100644 index 0000000000000000000000000000000000000000..25632634f98b972d4e4f48282d91279ff1d39217 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/multiplepolygons.cpp @@ -0,0 +1,569 @@ +/* This example illustrates using TecPoly to create two polygonal + * zones. The first zone contains six hexagons, and the second + * zone contains a hexagon and an octagon. Refer to the Data + * Format Guide for a picture of the configuration, including node + * and face numbers. + */ + +#include "TECIO.h" +#include "MASTER.h" /* for defintion of NULL */ + +int main() +{ + /* DOCSTART:hexagons_tecini.txt*/ + INTEGER4 I; /* use to check return values */ + + INTEGER4 Debug = 1; + INTEGER4 VIsDouble = 0; + INTEGER4 FileType = 0; + + I = TECINI112((char*)"Example: Multiple polygonal zones", + (char*)"X Y P", /* Defines the variables for the data file. + * Each zone must contain each of the vars + * listed here. The order of the variables + * in the list is used to define the + * variable number (e.g. X is Variable 1). + * When referring to variables in other + * TecIO functions, you will refer to the + * variable by its number. + */ + (char*)"HexagonsAndOctagon.plt", + (char*)".", /* scratch directory */ + &FileType, + &Debug, + &VIsDouble); + /* DOCEND */ + + /* DOCSTART:hexagons_zone1_teczne.txt*/ + /* TECZNE Parameters */ + INTEGER4 ZoneType = 6; /* FE Polygon */ + INTEGER4 NumPts_Z1 = 13; /* the number of unique + * nodes in the zone. + */ + INTEGER4 NumElems_Z1 = 3; + INTEGER4 NumFaces_Z1 = 15; /* the number of unique + * faces in the zone. + */ + INTEGER4 ICellMax = 0; /* not used */ + INTEGER4 JCellMax = 0; /* not used */ + INTEGER4 KCellMax = 0; /* not used */ + double SolutionTime = 0.0; + INTEGER4 StrandID = 0; + INTEGER4 ParentZone = 0; + INTEGER4 IsBlock = 1; + INTEGER4 NumFaceConnections = 0; + INTEGER4 FaceNeighborMode = 1; + INTEGER4 SharConn = 0; + + INTEGER4 ValueLocation[3] = { 1, 1, 0 }; + + /* For a polygonal zone, the total number of face nodes is + * twice the total number of faces. This is because each face + * is composed of exactly two nodes. + */ + INTEGER4 TotalNumFaceNodes_Z1 = 2 * NumFaces_Z1; + + /* A boundary face is a face that is neighbored by an element + * or elements in another zone or zone(s). In Zone 1, Face 9, + * Face 10 and Face 12 have a neighbor in Zone 2. Therefore, + * the total number of boundary faces is “3”. + */ + INTEGER4 TotalNumBndryFaces_Z1 = 3; + + /* Each boundary face has one or more boundary connections. A + * boundary connection is defined as another element in another + * zone. Face 9 has a boundary connection with Element 1 in + * Zone 2. In this example, each boundary face is connected to + * one other element, so the total number of boundary + * connections is equivalent to the total number of boundary + * faces (3). + */ + INTEGER4 TotalNumBndryConns_Z1 = 3; + + I = TECZNE112((char*)"Zone 1: 3 Hexagons", /* Specifies the name of + * the entire dataset. When + * the file is loaded into + * Tecplot, the value is + * available via the Data + * Set Info dialog. + */ + &ZoneType, + &NumPts_Z1, + &NumElems_Z1, + &NumFaces_Z1, + &ICellMax, + &JCellMax, + &KCellMax, + &SolutionTime, + &StrandID, + &ParentZone, + &IsBlock, + &NumFaceConnections, + &FaceNeighborMode, + &TotalNumFaceNodes_Z1, + &TotalNumBndryFaces_Z1, + &TotalNumBndryConns_Z1, + NULL, + ValueLocation, + NULL, + &SharConn); + /* DOCEND */ + + /* DOCSTART:hexagons_zone1_tecdat.txt*/ + + /* TECDAT Parameters */ + double *X_Z1 = new double[NumPts_Z1]; + double *Y_Z1 = new double[NumPts_Z1]; + + X_Z1[0] = 1; + Y_Z1[0] = 6; + + X_Z1[1] = 2; + Y_Z1[1] = 6; + + X_Z1[2] = 3; + Y_Z1[2] = 5; + + X_Z1[3] = 2; + Y_Z1[3] = 4; + + X_Z1[4] = 1; + Y_Z1[4] = 4; + + X_Z1[5] = 0; + Y_Z1[5] = 5; + + X_Z1[6] = 4; + Y_Z1[6] = 5; + + X_Z1[7] = 5; + Y_Z1[7] = 4; + + X_Z1[8] = 4; + Y_Z1[8] = 3; + + X_Z1[9] = 3; + Y_Z1[9] = 3; + + X_Z1[10] = 2; + Y_Z1[10] = 2; + + X_Z1[11] = 1; + Y_Z1[11] = 2; + + X_Z1[12] = 0; + Y_Z1[12] = 3; + + + double *P_Z1 = new double[NumElems_Z1]; + P_Z1[0] = 2; + P_Z1[1] = 4; + P_Z1[2] = 5; + + + INTEGER4 IsDouble = 1; + I = TECDAT112(&NumPts_Z1, X_Z1, &IsDouble); + I = TECDAT112(&NumPts_Z1, Y_Z1, &IsDouble); + I = TECDAT112(&NumElems_Z1, P_Z1, &IsDouble); + delete X_Z1; + delete Y_Z1; + delete P_Z1; + /* DOCEND */ + + /* DOCSTART:hexagons_zone1_facenodes.txt*/ + /* TecPoly Parameters */ + + /* Create a FaceNodes array, dimensioned by the total number + * of face nodes in the zone. + */ + INTEGER4 *FaceNodes_Z1 = new INTEGER4[TotalNumFaceNodes_Z1]; + + /* Face Nodes for Element 1 */ + FaceNodes_Z1[0] = 1; + FaceNodes_Z1[1] = 2; + + FaceNodes_Z1[2] = 2; + FaceNodes_Z1[3] = 3; + + FaceNodes_Z1[4] = 3; + FaceNodes_Z1[5] = 4; + + FaceNodes_Z1[6] = 4; + FaceNodes_Z1[7] = 5; + + FaceNodes_Z1[8] = 5; + FaceNodes_Z1[9] = 6; + + FaceNodes_Z1[10] = 6; + FaceNodes_Z1[11] = 1; + + /* Face Nodes for Element 2 */ + FaceNodes_Z1[12] = 3; + FaceNodes_Z1[13] = 7; + + FaceNodes_Z1[14] = 7; + FaceNodes_Z1[15] = 8; + + FaceNodes_Z1[16] = 8; + FaceNodes_Z1[17] = 9; + + FaceNodes_Z1[18] = 9; + FaceNodes_Z1[19] = 10; + + FaceNodes_Z1[20] = 10; + FaceNodes_Z1[21] = 4; + + /* Face Nodes for Element 3 */ + FaceNodes_Z1[22] = 10; + FaceNodes_Z1[23] = 11; + + FaceNodes_Z1[24] = 11; + FaceNodes_Z1[25] = 12; + + FaceNodes_Z1[26] = 12; + FaceNodes_Z1[27] = 13; + + FaceNodes_Z1[28] = 13; + FaceNodes_Z1[29] = 5; + + /* DOCEND */ + + /* Specify the right and left neighboring elements. + * The neighboring elements can be determined using the + * right-hand rule. For each face, place your right-hand along + * the face with your fingers pointing the direction of + * incrementing node numbers (i.e. from Node 1 to Node 2). The + * right side of your hand will indicate the right element, + * and the left side of your hand will indicate the left + * element. A value of zero indicates that there is no + * neighboring element on that side. A negative value + * indicates that the neighboring element is in another zone. + * The number is a pointer into the FaceBndryConnectionElems + * and FaceBndryConnectionZones arrays. + */ + + /* DOCSTART:hexagons_zone1_neighbors.txt*/ + INTEGER4 *FaceLeftElems_Z1 = new INTEGER4[NumFaces_Z1]; + INTEGER4 *FaceRightElems_Z1 = new INTEGER4[NumFaces_Z1]; + + /* Left Face Elems for Element 1 */ + FaceLeftElems_Z1[0] = 0; + FaceLeftElems_Z1[1] = 0; + FaceLeftElems_Z1[2] = 2; + FaceLeftElems_Z1[3] = 3; + FaceLeftElems_Z1[4] = 0; + + /* Left Face Elems for Element 2 */ + FaceLeftElems_Z1[5] = 0; + FaceLeftElems_Z1[6] = 0; + FaceLeftElems_Z1[7] = 0; + FaceLeftElems_Z1[8] = -1; + FaceLeftElems_Z1[9] = -2; + FaceLeftElems_Z1[10] = 2; + + /* Left Face Elems for Element 3 */ + FaceLeftElems_Z1[11] = -3; + FaceLeftElems_Z1[12] = 0; + FaceLeftElems_Z1[13] = 0; + FaceLeftElems_Z1[14] = 0; + + /* Set Right Face Elems. Because of the way we numbered the + * nodes and faces, the right element for every face is the + * element itself. + */ + for (INTEGER4 ii = 0; ii < 6; ii++) + FaceRightElems_Z1[ii] = 1; + + for (INTEGER4 ii = 6; ii < 10; ii++) + FaceRightElems_Z1[ii] = 2; + + for (INTEGER4 ii = 10; ii <= 14; ii++) + FaceRightElems_Z1[ii] = 3; + /* DOCEND */ + + /* DOCSTART:hexagons_zone1_tecpoly.txt */ + + /* The FaceBndryConnectionCounts array is used to define the + * number of boundary connections for each face that has a + * boundary connection. For example, if a zone has three + * boundary connections in total (NumConnectedBoundaryFaces), + * two of those boundary connections are in one face, and the + * remaining boundary connection is in a second face, the + * FaceBndryConnectionCounts array would be: [2 1]. + * + * In this example, the total number of connected boundary + * faces (specified via TECZNE) is equal to three. Each + * boundary face is connected to only one other element, + * so the FaceBoundaryConnectionCounts array is (1, 1, 1). + */ + INTEGER4 FaceBndryConnectionCounts_Z1[3] = {1, 1, 1}; + + /* The value(s) in the FaceBndryConnectionElems and + * FaceBndryConnectionZones arrays specifies the element number + * and zone number, respectively, that a given boundary + * connection is connected to. In this case, the first + * boundary connection face is connected to Element 1 in Zone 2 + * and the remaining connection is to Element 2 in Zone 2. + */ + INTEGER4 FaceBndryConnectionElems_Z1[3] = {1, 2, 2}; + INTEGER4 FaceBndryConnectionZones_Z1[3] = {2, 2, 2}; + + + I = TECPOLY112(NULL, /* Not used for polygon zones */ + FaceNodes_Z1, + FaceLeftElems_Z1, + FaceRightElems_Z1, + FaceBndryConnectionCounts_Z1, + FaceBndryConnectionElems_Z1, + FaceBndryConnectionZones_Z1); + + delete FaceNodes_Z1; + delete FaceLeftElems_Z1; + delete FaceRightElems_Z1; + + /* DOCEND */ + + /* Define Zone 2. Zone 2 contains an octagon and a hexagon. */ + /* TECZNE Parameters */ + /* DOCSTART:hexagons_zone2_teczne.txt*/ + INTEGER4 NumPts_Z2 = 12; /* number of unique + * nodes in the zone + */ + INTEGER4 NumElems_Z2 = 2; + INTEGER4 NumFaces_Z2 = 13; /* number of unique + * faces in the zone + */ + INTEGER4 NumFaceConnections_Z2 = 0; + /* In polygonal zones, each face has exactly two nodes */ + INTEGER4 TotalNumFaceNodes_Z2 = NumFaces_Z2 * 2; + + /* A boundary face is a face that is neighbored by an element or + * elements from another zone or zone(s). In Zone 2, Face 6, + * Face 7 and Face 13 have a neighbor in Zone 1. Therefore, the + * total number of boundary faces is “3”. + */ + INTEGER4 TotalNumBndryFaces_Z2 = 3; + + /* Each boundary face has one or more boundary connections. In + * this example, each boundary face is connected to one other + * element (i.e. the number of boundary faces and the number of + * boundary connections is one-to-one). + */ + INTEGER4 TotalNumBndryConns_Z2 = 3; + + I = TECZNE112((char*)"Zone 2: 1 Hexagon and 1 Octagon", + &ZoneType, + &NumPts_Z2, + &NumElems_Z2, + &NumFaces_Z2, + &ICellMax, + &JCellMax, + &KCellMax, + &SolutionTime, + &StrandID, + &ParentZone, + &IsBlock, + &NumFaceConnections_Z2, + &FaceNeighborMode, + &TotalNumFaceNodes_Z2, + &TotalNumBndryFaces_Z2, + &TotalNumBndryConns_Z2, + NULL, + ValueLocation, + NULL, + &SharConn); + /* DOCEND */ + + /* TECDAT Parameters */ + /* DOCSTART:hexagons_zone2_tecdat.txt*/ + double *X_Z2 = new double[NumPts_Z2]; + double *Y_Z2 = new double[NumPts_Z2]; + + X_Z2[0] = 5; + Y_Z2[0] = 4; + + X_Z2[1] = 6; + Y_Z2[1] = 4; + + X_Z2[2] = 7; + Y_Z2[2] = 3; + + X_Z2[3] = 6; + Y_Z2[3] = 2; + + X_Z2[4] = 5; + Y_Z2[4] = 2; + + X_Z2[5] = 4; + Y_Z2[5] = 3; + + + X_Z2[6] = 3; + Y_Z2[6] = 3; + + X_Z2[7] = 5; + Y_Z2[7] = 1; + + X_Z2[8] = 4; + Y_Z2[8] = 0; + + X_Z2[9] = 3; + Y_Z2[9] = 0; + + X_Z2[10] = 2; + Y_Z2[10] = 1; + + X_Z2[11] = 2; + Y_Z2[11] = 2; + + /* In the call to TecZne, P was set to a cell centered variable. + * As such, only two values need to be defined. + */ + double *P_Z2 = new double[NumPts_Z2]; + + P_Z2[0] = 8; + P_Z2[1] = 6; + + I = TECDAT112(&NumPts_Z2, X_Z2, &IsDouble); + I = TECDAT112(&NumPts_Z2, Y_Z2, &IsDouble); + I = TECDAT112(&NumElems_Z2, P_Z2, &IsDouble); + + delete X_Z2; + delete Y_Z2; + delete P_Z2; + /* DOCEND */ + + /* TecPoly Parameters */ + /* DOCSTART:hexagons_zone2_facemap.txt*/ + INTEGER4 *FaceNodes_Z2; + FaceNodes_Z2 = new INTEGER4[TotalNumFaceNodes_Z2]; + + /* Face Nodes for Element 1 */ + FaceNodes_Z2[0] = 1; + FaceNodes_Z2[1] = 2; + + FaceNodes_Z2[2] = 2; + FaceNodes_Z2[3] = 3; + + FaceNodes_Z2[4] = 3; + FaceNodes_Z2[5] = 4; + + FaceNodes_Z2[6] = 4; + FaceNodes_Z2[7] = 5; + + FaceNodes_Z2[8] = 5; + FaceNodes_Z2[9] = 6; + + FaceNodes_Z2[10] = 6; + FaceNodes_Z2[11] = 1; + + + /* Face Nodes for Element 2 */ + FaceNodes_Z2[12] = 7; + FaceNodes_Z2[13] = 6; + + FaceNodes_Z2[14] = 5; + FaceNodes_Z2[15] = 8; + + FaceNodes_Z2[16] = 8; + FaceNodes_Z2[17] = 9; + + FaceNodes_Z2[18] = 9; + FaceNodes_Z2[19] = 10; + + FaceNodes_Z2[20] = 10; + FaceNodes_Z2[21] = 11; + + FaceNodes_Z2[22] = 11; + FaceNodes_Z2[23] = 12; + + FaceNodes_Z2[24] = 12; + FaceNodes_Z2[25] = 7; + /* DOCEND */ + + + /* DOCSTART:hexagons_zone2_tecpoly.txt*/ + /* Specify the right and left neighboring elements. + * The neighboring elements can be determined using the + * right-hand rule. For each face, place your right-hand along + * the face with your fingers pointing the direction of + * incrementing node numbers (i.e. from Node 1 to Node 2). The + * right side of your hand will indicate the right element, + * and the left side of your hand will indicate the left + * element. A value of zero indicates that there is no + * neighboring element on that side. A negative value + * indicates that the neighboring element is in another zone. + * The number is a pointer into the FaceBndryConnectionElems + * and FaceBndryConnectionZones arrays. + */ + + INTEGER4 *FaceLeftElems_Z2 = new INTEGER4[NumFaces_Z2]; + INTEGER4 *FaceRightElems_Z2 = new INTEGER4[NumFaces_Z2]; + + /* Left Face Elems for Element 1 */ + FaceLeftElems_Z2[0] = 0; + FaceLeftElems_Z2[1] = 0; + FaceLeftElems_Z2[2] = 0; + FaceLeftElems_Z2[3] = 0; + FaceLeftElems_Z2[4] = 2; + FaceLeftElems_Z2[5] = -1; + + /* Left Face Elems for Element 2 */ + FaceLeftElems_Z2[6] = -2; + FaceLeftElems_Z2[7] = 0; + FaceLeftElems_Z2[8] = 0; + FaceLeftElems_Z2[9] = 0; + FaceLeftElems_Z2[10] = 0; + FaceLeftElems_Z2[11] = 0; + FaceLeftElems_Z2[12] = -3; + + /* Set Right Face Elems. Because of the way we numbered the + * nodes and faces, the right element for every face is the + * element itself. */ + for (INTEGER4 ii = 0; ii < 6; ii++) + FaceRightElems_Z2[ii] = 1; + + for (INTEGER4 ii = 6; ii < 13; ii++) + FaceRightElems_Z2[ii] = 2; + /* DOCEND */ + + /* DOCSTART:hexagons_zone2_tecpoly.txt*/ + /* The FaceBndryConnectionCounts array is used to define the + * number of boundary connections for each face that has a + * boundary connection. In this example, the total number of + * connected boundary faces (specified via TECZNE) is equal to + * three. Each boundary face is connected to only one other + * element, so the FaceBoundaryConnectionCounts array is + * (1, 1, 1). + */ + INTEGER4 FaceBndryConnectionCounts_Z2[3] = {1, 1, 1}; + + /* The value(s) in the FaceBndryConnectionElems and + * FaceBndryConnectionZones arrays specifies that element + * number and zone number, respectively, that a given boundary + * connection is connected to. In this case, the first boundary + * connection face is connected to Element 2 in Zone 1 and the + * remaining connections are Element 3 in Zone 1. + */ + INTEGER4 FaceBndryConnectionElems_Z2[3] = {2, 3, 3}; + INTEGER4 FaceBndryConnectionZones_Z2[3] = {1, 1, 1}; + + I = TECPOLY112(NULL, + FaceNodes_Z2, + FaceLeftElems_Z2, + FaceRightElems_Z2, + FaceBndryConnectionCounts_Z2, + FaceBndryConnectionElems_Z2, + FaceBndryConnectionZones_Z2); + + delete FaceNodes_Z2; + delete FaceLeftElems_Z2; + delete FaceRightElems_Z2; + /* DOCEND */ + + /* DOCSTART:hexagons_tecend.txt*/ + I = TECEND112(); + /* DOCEND */ + + return 0; +} diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/multiplepolygons.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/multiplepolygons.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..da0df3a5c35353857954fd8dda130437a55e88f9 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/multiplepolygons.vcproj @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="multiplepolygons" + ProjectGUID="{D2747EA6-7807-42E1-984D-C946B3D97D95}" + RootNamespace="mulitplepolygons" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + RuntimeLibrary="2" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\multiplepolygons.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..b1a061516567b7dd35dc40e1b89027cd268cbccc --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/Makefile @@ -0,0 +1,11 @@ +# Set to appropriate C++ compiler +CPP=g++ +CPPFLAGS=-I../../tecsrc ../../tecio.a +EXECUTABLE=octagon +FILES=$(EXECUTABLE).cpp + +build: + $(CPP) $(FILES) $(CPPFLAGS) -o $(EXECUTABLE) + +clean: + rm -f $(EXECUTABLE) \ No newline at end of file diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/Octagon.plt b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/Octagon.plt new file mode 100644 index 0000000000000000000000000000000000000000..e09f4f79b80a9b520bcfb359211fa932e5f2e8c0 Binary files /dev/null and b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/Octagon.plt differ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/octagon.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/octagon.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c9d64aece179bcb89452d338a6a2ac45a6651553 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/octagon.cpp @@ -0,0 +1,248 @@ +/* This example illustrates how to create a zone with a single + * polygonal cell. Please refer to the Data Format Guide for + * additional information, including figures that display node + * numbering. + */ + +#include "TECIO.h" +#include "MASTER.h" /* for defintion of NULL */ + +int main() +{ + /* DOCSTART:octagon_tecini.txt*/ + INTEGER4 Debug = 1; + INTEGER4 VIsDouble = 0; + INTEGER4 FileType = 0; + INTEGER4 I; /* used to check return codes */ + + /* + * Open the file and write the Tecplot datafile + * header information + */ + + I = TECINI112((char*)"Octagon", + (char*)"X Y P", /* Defines the variables for the data + * file. Each zone must contain each + * of the vars listed here. The order + * of the variables in the list is + * used to define the variable number + * (e.g. X is Variable 1). When + * referring to variables in other + * TecIO functions, you will refer to + * thevariable by its number. + */ + (char*)"Octagon.plt", + (char*)".", /* scratch directory */ + &FileType, + &Debug, + &VIsDouble); + /* DOCEND */ + + /* Declare TECZNE variables */ + /* DOCSTART:octagon_teczne.txt*/ + /* In this example, we will create a single octagonal cell in + * Tecplot 360's polyhedral file format. + */ + INTEGER4 ZoneType = 6; /* FEPolygon */ + INTEGER4 NumNodes = 8; /* Number of nodes in the octagon.*/ + INTEGER4 NumElems = 1; /* Number of octagonal elements. */ + INTEGER4 NumFaces = 8; /* Number of faces in the octagon.*/ + INTEGER4 ICellMax = 0; /* Not Used */ + INTEGER4 JCellMax = 0; /* Not Used */ + INTEGER4 KCellMax = 0; /* Not Used */ + double SolTime = 360.0; + INTEGER4 StrandID = 0; /* Static Zone */ + INTEGER4 ParentZn = 0; /* No Parent Zone */ + INTEGER4 IsBlock = 1; /* Block */ + INTEGER4 NFConns = 0; + INTEGER4 FNMode = 0; + + + /* For polygonal zones, the total number of face nodes is equal + * to twice the number of nodes. This is because, each face + * has exactly two nodes. + */ + INTEGER4 NumFaceNodes = 2 * NumNodes; + /* Boundary Faces and Boundary Connections are not used in this + * example. + */ + INTEGER4 NumBFaces = 0; + INTEGER4 NumBConnections = 0; + + INTEGER4 ShrConn = 0; + + I = TECZNE112((char*)"Octagonal Zone", + &ZoneType, + &NumNodes, + &NumElems, + &NumFaces, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZn, + &IsBlock, + &NFConns, + &FNMode, + &NumFaceNodes, + &NumBFaces, + &NumBConnections, + NULL, + NULL, /* When Value Location is not specified, + * Tecplot will treat all variables as + * nodal variables. + */ + NULL, + &ShrConn); + /* DOCEND */ + + /* Establish numbering. + * For this example, we will a single octagonal cell. + * Before defining your variables, you must establish a + * consistent node numbering scheme for your data. Once the + * node numbers are defined, supply the variable values in the + * node numbering order. In this example, node 1 is defined at + * X = 0 and Y = 0. As such, the first value supplied for X + * (i.e. X[0]) is 0. Similarly, the first value supplied for + * Y is 0. + * + * It is important that you refer to node numbers consistently. + * The node numbers will be used later to define the + * connectivity for each element. + */ + + /* TECDAT Variables */ + /* Set up the variable values. The variable values will be + * written to the file using TECDAT. Because we are specifying + * nodal variables (as specified via the ValueLocation + * parameter in TECZNE, each variable is dimensioned by the + * number of points (NumPts) in the Zone. You have the option + * to specify some variables with nodal values and some with + * cell-centered values. Refer to the Binary Function Reference + * for details. + */ + /* DOCSTART:octagon_tecdat.txt*/ + float *X = new float[NumNodes]; + float *Y = new float[NumNodes]; + float *P = new float[NumNodes]; + + //Define the grid values. + X[0] = 0.25; + Y[0] = 0.0; + + X[1] = 0.75; + Y[1] = 0.0; + + X[2] = 1.0; + Y[2] = 0.25; + + X[3] = 1.0; + Y[3] = 0.75; + + X[4] = 0.75; + Y[4] = 1.0; + + X[5] = 0.25; + Y[5] = 1.0; + + X[6] = 0.0; + Y[6] = 0.75; + + X[7] = 0.0; + Y[7] = 0.25; + + for (INTEGER4 ii = 0; ii < 8; ii++) + P[ii] = .5; + + /* Write out the field data using TECDAT */ + INTEGER4 DIsDouble = 0; /* set IsDouble to 0 to use float + * variables. */ + + I = TECDAT112(&NumNodes, X, &DIsDouble); + I = TECDAT112(&NumNodes, Y, &DIsDouble); + I = TECDAT112(&NumNodes, P, &DIsDouble); + + delete X; + delete Y; + delete P; + /* DOCEND */ + + /* Define the Face Nodes. + + * The FaceNodes array is used to indicate which nodes define + * which face. As mentioned earlier, the number of the nodes is + * implicitly defined by the order in which the nodal data is + * provided. The first value of each nodal variable describes + * node 1, the second value describes node 2, and so on. + * + * The face numbering is implicitly defined. Because there are + * two nodes in each face, the first two nodes provided define + * face 1, the next two define face 2 and so on. If there was + * a variable number of nodes used to define the faces, the + * array would be more complicated. + */ + /* DOCSTART:octagon_facenodes.txt*/ + INTEGER4 *FaceNodes = new INTEGER4[NumFaceNodes]; + + /* + * Loop over number of sides, and set each side to two + * consecutive nodes. + */ + for (INTEGER4 ii = 0; ii < 8; ii++) + { + FaceNodes[2*ii] = ii + 1; + FaceNodes[2*ii+1] = ii + 2; + } + FaceNodes[15] = 1; + + /* DOCEND */ + /* Define the right and left elements of each face. + + * The last step for writing out the polyhedral data is to + * define the right and left neighboring elements for each + * face. The neighboring elements can be determined using the + * right-hand rule. For each face, place your right-hand along + * the face which your fingers pointing the direction of + * incrementing node numbers (i.e. from node 1 to node 2). + * Your right thumb will point towards the right element; the + * element on the other side of your hand is the left element. + * + * The number zero is used to indicate that there isn't an + * element on that side of the face. + * + * Because of the way we numbered the nodes and faces, the + * right element for every face is the element itself + * (element 1) and the left element is "no-neighboring element" + * (element 0). + */ + /* DOCSTART:octagon_rightleft.txt*/ + INTEGER4 *FaceLeftElems = new INTEGER4[NumFaces]; + INTEGER4 *FaceRightElems = new INTEGER4[NumFaces]; + + for (INTEGER4 ii = 0; ii < NumFaces; ii++) + { + FaceLeftElems[ii] = 0; + FaceRightElems[ii] = 1; + } + /* DOCEND */ + /* Write the polyhedral data to the file. */ + /* DOCSTART:octagon_tecpoly.txt*/ + I = TECPOLY112(NULL, + FaceNodes, + FaceLeftElems, + FaceRightElems, + NULL, + NULL, + NULL); + + delete FaceNodes; + delete FaceLeftElems; + delete FaceRightElems; + /* DOCEND */ + /* DOCSTART:octagon_tecend.txt*/ + I = TECEND112(); + /* DOCEND */ + + return 0; +} diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/octagon.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/octagon.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..9d33ad0bde4dfa89e9296247d2139b4e3bbfadbe --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/octagon.vcproj @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="octagon" + ProjectGUID="{C4BEE7D4-6449-468F-81CC-3BEFDA554F31}" + RootNamespace="octagon" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + RuntimeLibrary="2" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\octagon.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..38cb009fcab781d3cb723d83445fccdf408624bd --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/Makefile @@ -0,0 +1,11 @@ +# Set to appropriate C++ compiler +CPP=g++ +CPPFLAGS=-I../../tecsrc ../../tecio.a +EXECUTABLE=pyramid +FILES=$(EXECUTABLE).cpp + +build: + $(CPP) $(FILES) $(CPPFLAGS) -o $(EXECUTABLE) + +clean: + rm -f $(EXECUTABLE) \ No newline at end of file diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/pyramid.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/pyramid.cpp new file mode 100644 index 0000000000000000000000000000000000000000..864bb754bad228d233bd89fa81509de08d60abcf --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/pyramid.cpp @@ -0,0 +1,222 @@ +/* This example creates a zone with a single polyhedral cell. */ + +/* DOCSTART:pyramid.txt*/ +#include "TECIO.h" +#include "MASTER.h" /* for defintion of NULL */ + +int main() +{ + /* Call TECINI112 */ + INTEGER4 FileType = 0; /* 0 for full file */ + INTEGER4 Debug = 0; + INTEGER4 VIsDouble = 1; + INTEGER4 I = 0; /* use to check return codes */ + + I = TECINI112((char*)"Pyramid", /* Data Set Title */ + (char*)"X Y Z", /* Variable List */ + (char*)"pyramid.plt", /* File Name */ + (char*)".", /* Scratch Directory */ + &(FileType), + &(Debug), + &(VIsDouble)); + + + /* Call TECZNE112 */ + INTEGER4 ZoneType = 7; /* 7 for FEPolyhedron */ + INTEGER4 NumNodes = 5; /* number of unique nodes */ + INTEGER4 NumElems = 1; /* number of elements */ + INTEGER4 NumFaces = 5; /* number of unique faces */ + + INTEGER4 ICellMax = 0; /* Not Used, set to zero */ + INTEGER4 JCellMax = 0; /* Not Used, set to zero */ + INTEGER4 KCellMax = 0; /* Not Used, set to zero */ + + double SolTime = 12.65; /* solution time */ + INTEGER4 StrandID = 0; /* static zone */ + INTEGER4 ParentZone = 0; /* no parent zone */ + + INTEGER4 IsBlock = 1; /* block format */ + + INTEGER4 NFConns = 0; /* not used for FEPolyhedron + * zones + */ + INTEGER4 FNMode = 0; /* not used for FEPolyhedron + * zones + */ + + INTEGER4 *PassiveVarArray = NULL; + INTEGER4 *ValueLocArray = NULL; + INTEGER4 *VarShareArray = NULL; + + INTEGER4 ShrConn = 0; + + /* The number of face nodes in the zone. This example creates + * a zone with a single pyramidal cell. This cell has four + * triangular faces and one rectangular face, yielding a total + * of 16 face nodes. + */ + INTEGER4 NumFaceNodes = 16; + INTEGER4 NumBConns = 0; /* No Boundary Connections */ + INTEGER4 NumBItems = 0; /* No Boundary Items */ + + I = TECZNE112((char*)"Polyhedral Zone (Octahedron)", + &ZoneType, + &NumNodes, + &NumElems, + &NumFaces, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZone, + &IsBlock, + &NFConns, + &FNMode, + &NumFaceNodes, + &NumBConns, + &NumBItems, + PassiveVarArray, + ValueLocArray, + VarShareArray, + &ShrConn); + + /* Initialize arrays of nodal data */ + double *X = new double[NumNodes]; + double *Y = new double[NumNodes]; + double *Z = new double[NumNodes]; + + X[0] = 0; + Y[0] = 0; + Z[0] = 0; + + X[1] = 1; + Y[1] = 1; + Z[1] = 2; + + X[2] = 2; + Y[2] = 0; + Z[2] = 0; + + X[3] = 2; + Y[3] = 2; + Z[3] = 0; + + X[4] = 0; + Y[4] = 2; + Z[4] = 0; + + /* Write the data (using TECDAT112) */ + INTEGER4 DIsDouble = 1; /* One for double precision */ + I = TECDAT112(&NumNodes, X, &DIsDouble); + I = TECDAT112(&NumNodes, Y, &DIsDouble); + I = TECDAT112(&NumNodes, Z, &DIsDouble); + + delete X; + delete Y; + delete Z; + + /* Define the Face Nodes. + + * The FaceNodes array is used to indicate which nodes define + * which face. As mentioned earlier, the number of the nodes is + * implicitly defined by the order in which the nodal data is + * provided. The first value of each nodal variable describes + * node 1, the second value describes node 2, and so on. + * + * The face numbering is implicitly defined. Because there are + * two nodes in each face, the first two nodes provided define + * face 1, the next two define face 2 and so on. If there was + * a variable number of nodes used to define the faces, the + * array would be more complicated. + */ + + INTEGER4 *FaceNodeCounts = new INTEGER4[NumFaces]; + /* The first four faces are triangular, i.e. have three nodes. + * The fifth face is rectangular, i.e. has four nodes. */ + FaceNodeCounts[0] = 3; + FaceNodeCounts[1] = 3; + FaceNodeCounts[2] = 3; + FaceNodeCounts[3] = 3; + FaceNodeCounts[4] = 4; + + INTEGER4 *FaceNodes = new INTEGER4[NumFaceNodes]; + /* Face Nodes for Face 1 */ + FaceNodes[0] = 1; + FaceNodes[1] = 2; + FaceNodes[2] = 3; + + /* Face Nodes for Face 2 */ + FaceNodes[3] = 3; + FaceNodes[4] = 2; + FaceNodes[5] = 4; + + /* Face Nodes for Face 3 */ + FaceNodes[6] = 5; + FaceNodes[7] = 2; + FaceNodes[8] = 4; + + /* Face Nodes for Face 4 */ + FaceNodes[9] = 1; + FaceNodes[10] = 2; + FaceNodes[11] = 5; + + /* Face Nodes for Face 5 */ + FaceNodes[12] = 1; + FaceNodes[13] = 5; + FaceNodes[14] = 4; + FaceNodes[15] = 3; + + /* Define the right and left elements of each face. + * + * The last step for writing out the polyhedral data is to + * define the right and left neighboring elements for each + * face. The neighboring elements can be determined using the + * right-hand rule. For each face, place your right-hand along + * the face which your fingers pointing the direction of + * incrementing node numbers (i.e. from node 1 to node 2). + * Your right thumb will point towards the right element; the + * element on the other side of your hand is the left element. + * + * The number zero is used to indicate that there isn't an + * element on that side of the face. + * + * Because of the way we numbered the nodes and faces, the + * right element for every face is the element itself + * (element 1) and the left element is "no-neighboring element" + * (element 0). + */ + + INTEGER4 *FaceLeftElems = new INTEGER4[NumFaces]; + FaceLeftElems[0] = 1; + FaceLeftElems[1] = 1; + FaceLeftElems[2] = 0; + FaceLeftElems[3] = 0; + FaceLeftElems[4] = 0; + + INTEGER4 *FaceRightElems = new INTEGER4[NumFaces]; + FaceRightElems[0] = 0; + FaceRightElems[1] = 0; + FaceRightElems[2] = 1; + FaceRightElems[3] = 1; + FaceRightElems[4] = 1; + + /* Write the face map (created above) using TECPOLY112. */ + I = TECPOLY112(FaceNodeCounts, /* The face node counts array */ + FaceNodes, /* The face nodes array */ + FaceLeftElems, /* The left elements array */ + FaceRightElems, /* The right elements array */ + NULL, /* No boundary connection counts */ + NULL, /* No boundary connection elements */ + NULL); /* No boundary connection zones */ + + delete FaceNodeCounts; + delete FaceNodes; + delete FaceLeftElems; + delete FaceRightElems; + + I = TECEND112(); + return 0; +} + +/* DOCEND */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/pyramid.plt b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/pyramid.plt new file mode 100644 index 0000000000000000000000000000000000000000..d85447466118fc7a63af724aa0bd550a2382ac6b Binary files /dev/null and b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/pyramid.plt differ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/pyramid.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/pyramid.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..e44e390db6fdb06573ed960f31a186150732f3fc --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/pyramid.vcproj @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="pyramid" + ProjectGUID="{CFED06AE-48C6-491C-AE5F-E1B7882A44E9}" + RootNamespace="pyramid" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + RuntimeLibrary="2" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\pyramid.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..9e40ebe34bc211c6f4f450dca331aa3b93a39d11 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/Makefile @@ -0,0 +1,11 @@ +# Set to appropriate C++ compiler +CPP=g++ +CPPFLAGS=-I../../tecsrc ../../tecio.a +EXECUTABLE=simtest +FILES=$(EXECUTABLE).c + +build: + $(CPP) $(FILES) $(CPPFLAGS) -o $(EXECUTABLE) + +clean: + rm -f $(EXECUTABLE) diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.c b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.c new file mode 100644 index 0000000000000000000000000000000000000000..fe35a33234ad2583614c0cf55337a2668598a905 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.c @@ -0,0 +1,100 @@ +/* + * Simple example c program to write a + * binary datafile for tecplot. This example + * does the following: + * + * 1. Open a datafile called "t.plt" + * 2. Assign values for X,Y, and P + * 3. Write out a zone dimensioned 4x5 + * 4. Close the datafile. + */ + +#include "TECIO.h" + +#ifndef NULL +#define NULL 0 +#endif + +enum FileType { FULL = 0, GRID = 1, SOLUTION = 2 }; + +int main(void) +{ + float X[5][4], Y[5][4], P[5][4]; + double SolTime; + INTEGER4 Debug, I, J, III, DIsDouble, VIsDouble, IMax, JMax, KMax, ZoneType, StrandID, ParentZn, IsBlock; + INTEGER4 ICellMax, JCellMax, KCellMax, NFConns, FNMode, ShrConn, FileType; + + Debug = 1; + VIsDouble = 0; + DIsDouble = 0; + IMax = 4; + JMax = 5; + KMax = 1; + ZoneType = 0; /* Ordered */ + SolTime = 360.0; + StrandID = 0; /* StaticZone */ + ParentZn = 0; /* No Parent */ + IsBlock = 1; /* Block */ + ICellMax = 0; + JCellMax = 0; + KCellMax = 0; + NFConns = 0; + FNMode = 0; + ShrConn = 0; + FileType = FULL; + + /* + * Open the file and write the tecplot datafile + * header information + */ + I = TECINI112((char*)"SIMPLE DATASET", + (char*)"X Y P", + (char*)"t.plt", + (char*)".", + &FileType, + &Debug, + &VIsDouble); + + for (J = 0; J < 5; J++) + for (I = 0; I < 4; I++) + { + X[J][I] = (float)(I + 1); + Y[J][I] = (float)(J + 1); + P[J][I] = (float)((I + 1) * (J + 1)); + } + /* + * Write the zone header information. + */ + I = TECZNE112((char*)"Simple Zone", + &ZoneType, + &IMax, + &JMax, + &KMax, + &ICellMax, + &JCellMax, + &KCellMax, + &SolTime, + &StrandID, + &ParentZn, + &IsBlock, + &NFConns, + &FNMode, + 0, /* TotalNumFaceNodes */ + 0, /* NumConnectedBoundaryFaces */ + 0, /* TotalNumBoundaryConnections */ + NULL, /* PassiveVarList */ + NULL, /* ValueLocation = Nodal */ + NULL, /* SharVarFromZone */ + &ShrConn); + /* + * Write out the field data. + */ + III = IMax * JMax; + I = TECDAT112(&III, &X[0][0], &DIsDouble); + I = TECDAT112(&III, &Y[0][0], &DIsDouble); + I = TECDAT112(&III, &P[0][0], &DIsDouble); + + I = TECEND112(); + + return 0; +} diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.f b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.f new file mode 100644 index 0000000000000000000000000000000000000000..d980915100f49ca991a9402c4814a31f19211482 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.f @@ -0,0 +1,98 @@ +C +C Simple example fortran program to write a +C binary datafile for tecplot. This example +C does the following: +C +C 1. Open a datafile called "t.plt" +C 2. Assign values for X,Y, and P +C 3. Write out a zone dimensioned 4x5 +C 4. Close the datafile. +C +C + program test + + INCLUDE 'tecio.inc' + + character*1 NULLCHR + Integer*4 Debug,III,NPts,NElm + + Dimension X(4,5), Y(4,5), P(4,5) + Real*8 SolTime + Integer*4 VIsDouble, FileType + Integer*4 ZoneType,StrandID,ParentZn,IsBlock + Integer*4 ICellMax,JCellMax,KCellMax,NFConns,FNMode,ShrConn + POINTER (NullPtr,Null) + Integer*4 Null(*) + + NULLCHR = CHAR(0) + NullPtr = 0 + Debug = 1 + FileType = 0 + VIsDouble = 0 + IMax = 4 + JMax = 5 + KMax = 1 + ZoneType = 0 + SolTime = 360.0 + StrandID = 0 + ParentZn = 0 + IsBlock = 1 + ICellMax = 0 + JCellMax = 0 + KCellMax = 0 + NFConns = 0 + FNMode = 0 + ShrConn = 0 +C +C... Open the file and write the tecplot datafile +C... header information. +C + I = TecIni112('SIMPLE DATASET'//NULLCHR, + & 'X Y P'//NULLCHR, + & 't.plt'//NULLCHR, + & '.'//NULLCHR, + & FileType, + & Debug, + & VIsDouble) + + Do 10 I = 1,4 + Do 10 J = 1,5 + X(I,J) = I + Y(I,J) = J + P(I,J) = I*J + 10 Continue +C +C... Write the zone header information. +C + I = TecZne112('Simple Zone'//NULLCHR, + & ZoneType, + & IMax, + & JMax, + & KMax, + & ICellMax, + & JCellMax, + & KCellMax, + & SolTime, + & StrandID, + & ParentZn, + & IsBlock, + & NFConns, + & FNMode, + & 0, + & 0, + & 0, + & Null, + & Null, + & Null, + & ShrConn) +C +C... Write out the field data. +C + III = IMax*JMax + I = TecDat112(III,X,0) + I = TecDat112(III,Y,0) + I = TecDat112(III,P,0) + + I = TecEnd112() + Stop + End diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.f90 b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.f90 new file mode 100644 index 0000000000000000000000000000000000000000..1706de59841ed1795e3b79fe9df00088363eb4a0 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.f90 @@ -0,0 +1,98 @@ +! +! Simple example fortran program to write a +! binary datafile for tecplot. This example +! does the following: +! +! 1. Open a datafile called "t.plt" +! 2. Assign values for X,Y, and P +! 3. Write out a zone dimensioned 4x5 +! 4. Close the datafile. +! +! + program test + + INCLUDE 'tecio.f90' + + character*1 NULLCHR + Integer*4 Debug,III,NPts,NElm + + Dimension X(4,5), Y(4,5), P(4,5) + Real*8 SolTime + Integer*4 VIsDouble, FileType + Integer*4 ZoneType,StrandID,ParentZn,IsBlock + Integer*4 ICellMax,JCellMax,KCellMax,NFConns,FNMode,ShrConn + POINTER (NullPtr,Null) + Integer*4 Null(*) + + NULLCHR = CHAR(0) + NullPtr = 0 + Debug = 1 + FileType = 0 + VIsDouble = 0 + IMax = 4 + JMax = 5 + KMax = 1 + ZoneType = 0 + SolTime = 360.0 + StrandID = 0 + ParentZn = 0 + IsBlock = 1 + ICellMax = 0 + JCellMax = 0 + KCellMax = 0 + NFConns = 0 + FNMode = 0 + ShrConn = 0 +! +!... Open the file and write the tecplot datafile +!... header information. +! + I = TecIni112('SIMPLE DATASET'//NULLCHR, & + 'X Y P'//NULLCHR, & + 't.plt'//NULLCHR, & + '.'//NULLCHR, & + FileType, & + Debug, & + VIsDouble) + + Do 10 I = 1,4 + Do 10 J = 1,5 + X(I,J) = I + Y(I,J) = J + P(I,J) = I*J + 10 Continue +! +!... Write the zone header information. +! + I = TecZne112('Simple Zone'//NULLCHR, & + ZoneType, & + IMax, & + JMax, & + KMax, & + ICellMax, & + JCellMax, & + KCellMax, & + SolTime, & + StrandID, & + ParentZn, & + IsBlock, & + NFConns, & + FNMode, & + 0, & + 0, & + 0, & + Null, & + Null, & + Null, & + ShrConn) +! +!... Write out the field data. +! + III = IMax*JMax + I = TecDat112(III,X,0) + I = TecDat112(III,Y,0) + I = TecDat112(III,P,0) + + I = TecEnd112() + Stop + End diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestc.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestc.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..814cc761f3db60f677f273b5269c9bdd65766478 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestc.vcproj @@ -0,0 +1,346 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="simtestc" + ProjectGUID="{62FA6E8C-388E-4047-BC9D-574B470B94DE}" + RootNamespace="simtestc" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" + IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + AdditionalLibraryDirectories="" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + AdditionalLibraryDirectories="" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" + IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + AdditionalLibraryDirectories="" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + AdditionalLibraryDirectories="" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\simtest.c" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestf.vfproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestf.vfproj new file mode 100644 index 0000000000000000000000000000000000000000..2b20da05b12e68fa0e676b330ff90f2e71896e12 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestf.vfproj @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<VisualStudioProject ProjectCreator="Intel Fortran" Keyword="Console Application" Version="9.10" ProjectIdGuid="{861BC05F-1E95-401A-A80E-7589ADD1C79E}"> + <Platforms> + <Platform Name="Win32"/></Platforms> + <Configurations> + <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" DeleteExtensionsOnClean="*.obj;*.mod;*.pdb;*.asm;*.map;*.dyn;*.dpi;*.tmp;*.log;*.ilk;*.exe;$(TargetPath)"> + <Tool Name="VFMidlTool" SuppressStartupBanner="true" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/> + <Tool Name="VFPreBuildEventTool"/> + <Tool Name="VFPostBuildEventTool"/> + <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" AdditionalIncludeDirectories="$(TEC_360_2009)/Include" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" Traceback="true" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebug" CompileOnly="true"/> + <Tool Name="VFCustomBuildTool"/> + <Tool Name="VFLinkerTool" OutputFile="$(OUTDIR)/simtestf.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(TEC_360_2009)/Bin" GenerateDebugInformation="true" ProgramDatabaseFile="$(OUTDIR)/simtestf.pdb" SubSystem="subSystemConsole" AdditionalDependencies="tecio.lib"/> + <Tool Name="VFPreLinkEventTool"/> + <Tool Name="VFResourceCompilerTool" ResourceOutputFileName="$(IntDir)/$(InputName).res"/></Configuration> + <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" DeleteExtensionsOnClean="*.obj;*.mod;*.pdb;*.asm;*.map;*.dyn;*.dpi;*.tmp;*.log;*.ilk;*.exe;$(TargetPath)"> + <Tool Name="VFMidlTool" SuppressStartupBanner="true" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/> + <Tool Name="VFPreBuildEventTool"/> + <Tool Name="VFPostBuildEventTool"/> + <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" AdditionalIncludeDirectories="$(TEC_360_2009)/Include" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" RuntimeLibrary="rtMultiThreaded" CompileOnly="true"/> + <Tool Name="VFCustomBuildTool"/> + <Tool Name="VFLinkerTool" OutputFile="$(OUTDIR)/simtestf.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(TEC_360_2009)/Bin" SubSystem="subSystemConsole" AdditionalDependencies="tecio.lib"/> + <Tool Name="VFPreLinkEventTool"/> + <Tool Name="VFResourceCompilerTool" ResourceOutputFileName="$(IntDir)/$(InputName).res"/></Configuration></Configurations> + <Files> + <File RelativePath="simtest.f90"/></Files> + <Globals/></VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..120b910d62d926cad659313c6a1d48308765ae10 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/Makefile @@ -0,0 +1,11 @@ +# Set to appropriate C++ compiler +CPP=g++ +CPPFLAGS=-I../../tecsrc ../../tecio.a +EXECUTABLE=squares +FILES=$(EXECUTABLE).cpp + +build: + $(CPP) $(FILES) $(CPPFLAGS) -o $(EXECUTABLE) + +clean: + rm -f $(EXECUTABLE) \ No newline at end of file diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/squares.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/squares.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e5d9a0f5e2bba0a945ac5f2873d5f3cccc0c0825 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/squares.cpp @@ -0,0 +1,124 @@ +/* This example creates a group of square geometries, each with a + * different fill color */ +#if defined _MSC_VER +#pragma warning (disable: 4996) /* Windows strcpy warning off */ +#endif + +/* DOCSTART:tecgeo.txt*/ +#include "TECIO.h" +#include <string.h> + +int main() +{ + INTEGER4 Debug = 1; + INTEGER4 VIsDouble = 0; + INTEGER4 FileType = 0; + INTEGER4 I = 0; /* use to check return values */ + + + /* Open the file and write the tecplot datafile + * header information + */ + I = TECINI112((char*)"Square Geometries", + (char*)"X Y P", + (char*)"squares.plt", + (char*)".", + &FileType, + &Debug, + &VIsDouble); + + double ZPos = 0.0; /* N/A for squares */ + double XPos; + double YPos; + + INTEGER4 PosCoordMode = 0; /* use grid coordinates */ + + /* opt not to attach the text to a given zone. When text is + * attached to a given zone, it is displayed only when the zone + * is displayed. + */ + INTEGER4 AttachToZone = 0; + INTEGER4 Zone = 1; + + /* Set the Geometry Style Values */ + INTEGER4 Color = 0; /* set the outline color to + * black + */ + INTEGER4 IsFilled = 1; + INTEGER4 GeomType = 2; /* set the geometry type to + * square + */ + INTEGER4 LinePattern = 5; /* set the line pattern to + * DashDotDot + */ + double PatternLength = .1; + double LineThick = .2; + + /* N/A for square geometries */ + INTEGER4 NumPts = 100; + INTEGER4 ArrowStyle = 1; + INTEGER4 ArrowAttach = 0; + double ArrowSize = 1; + double ArrowAngle = 30; + INTEGER4 NumSegments = 15; + INTEGER4 NumSegPts = 25; + + + INTEGER4 Scope = 1; /* set the text to "local", i.e. + * available in the current frame + * only. + */ + INTEGER4 Clipping = 1; + + /* Specify the length of a side of the square. The units used + * are those defined with PosCoordMode. + */ + float XGeomData = 2.5; + + float YGeomData = 0; /* N/A for square geometries */ + float ZGeomData = 0; /* N/A for square geometries */ + + char * MFC = new char[128]; + strcpy(MFC, "SQUARE"); + + for (INTEGER4 ii = 0; ii <= 7; ii++) + { + INTEGER4 FillColor = ii; + XPos = (double) ii; + YPos = (double) ii; + + I = TECGEO112(&XPos, + &YPos, + &ZPos, + &PosCoordMode, + &AttachToZone, + &Zone, + &Color, + &FillColor, + &IsFilled, + &GeomType, + &LinePattern, + &PatternLength, + &LineThick, + &NumPts, + &ArrowStyle, + &ArrowAttach, + &ArrowSize, + &ArrowAngle, + &Scope, + &Clipping, + &NumSegments, + &NumSegPts, + &XGeomData, + &YGeomData, + &ZGeomData, + MFC); + } + + I = TECEND112(); + + delete MFC; + return 0; +} + +/* DOCEND */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/squares.plt b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/squares.plt new file mode 100644 index 0000000000000000000000000000000000000000..c8e0848cfae0353501b89930becf07c7dd920c72 Binary files /dev/null and b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/squares.plt differ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/squares.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/squares.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..359ce967c4d251dd3a9ac6fba2e8c126e9d717c2 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/squares.vcproj @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="squares" + ProjectGUID="{2E5EC0A5-5902-4A66-8A67-A61EC9EB0855}" + RootNamespace="squares" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + RuntimeLibrary="2" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\squares.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..415b65fd1338f042275397f5c4d5fdf265b82f47 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/Makefile @@ -0,0 +1,11 @@ +# Set to appropriate C++ compiler +CPP=g++ +CPPFLAGS=-I../../tecsrc ../../tecio.a +EXECUTABLE=text +FILES=$(EXECUTABLE).cpp + +build: + $(CPP) $(FILES) $(CPPFLAGS) -o $(EXECUTABLE) + +clean: + rm -f $(EXECUTABLE) \ No newline at end of file diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/text.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/text.cpp new file mode 100644 index 0000000000000000000000000000000000000000..66df8d723d2c86241987a8969878a4c8add75542 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/text.cpp @@ -0,0 +1,112 @@ +/* This example demonstrates adding a text object to a Tecplot + * data file. + */ +#if defined _MSC_VER +#pragma warning (disable: 4996) /* Windows strcpy warning off */ +#endif + +/* DOCSTART:tectxt.txt*/ +#include "TECIO.h" +#include <string.h> + +int main() +{ + /* Open the file & write the datafile header information */ + INTEGER4 Debug = 1; + INTEGER4 VIsDouble = 0; + INTEGER4 FileType = 0; + INTEGER4 I = 0; /* used to check the return value */ + + I = TECINI112((char*)"Text", + (char*)"X Y P", + (char*)"text.plt", + (char*)".", + &FileType, + &Debug, + &VIsDouble); + + /* Specify the X, Y and Z position of the anchor point */ + double XPos = 0.0; + double YPos = 1.0; + double ZPos = 0.0; /* N/A for 2D text */ + + INTEGER4 PosCoordMode = 0; /* use grid coordinates */ + + /* opt not to attach the text to a given zone. When text is + * attached to a given zone, it is displayed only when the zone + * is displayed. + */ + INTEGER4 AttachToZone = 0; + INTEGER4 Zone = 2; + + + /* Specify the font values */ + INTEGER4 Font = 1; /* Helvetica Bold */ + INTEGER4 FontHeightUnits = 2; /* in grid coordinates */ + double FontHeight = 18; + + /* Set the box style parameters */ + INTEGER4 BoxType = 1; /* filled box */ + double BoxMargin = .5; /* margin between the text + * and the text box + */ + double BoxLineThickness = .1; + INTEGER4 BoxColor = 0; /* set the box line color + * to black. + */ + INTEGER4 BoxFillColor = 1; /* set the box fill color + * to red. + */ + + /* set the font properties */ + double Angle = 30; /* angle of the text */ + INTEGER4 Anchor = 1; /* set the anchor point to + * the center of the text + * box. + */ + double LineSpacing = 1.5; + INTEGER4 TextColor = 7; /* set the font color to + * white + */ + + INTEGER4 Scope = 1; /* set the text to "local", + * i.e. available in the + * current frame only. + */ + INTEGER4 Clipping = 1; + + + char Text[60]; + char MFC[24]; + strcpy(Text, "Sample Text"); + strcpy(MFC, "My Macro"); + + I = TECTXT112(&XPos, + &YPos, + &ZPos, + &PosCoordMode, + &AttachToZone, + &Zone, + &Font, + &FontHeightUnits, + &FontHeight, + &BoxType, + &BoxMargin, + &BoxLineThickness, + &BoxColor, + &BoxFillColor, + &Angle, + &Anchor, + &LineSpacing, + &TextColor, + &Scope, + &Clipping, + Text, + MFC); + + I = TECEND112(); + + return 0; +} + +/* DOCEND */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/text.plt b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/text.plt new file mode 100644 index 0000000000000000000000000000000000000000..5d0ecd945ad1051efda3afc29c1ee7fcdc53a335 Binary files /dev/null and b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/text.plt differ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/text.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/text.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..9018c6a89c04c678c65a3f77ff14db7632ae441c --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/text.vcproj @@ -0,0 +1,172 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="text" + ProjectGUID="{FE2A061A-1787-410B-ABA0-366D6EA603FB}" + RootNamespace="text" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + InheritedPropertySheets="..\TecIO_Examples.vsprops" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + RuntimeLibrary="2" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + GenerateDebugInformation="true" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\text.cpp" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/pltview.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/pltview.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fd9dd63976dd0bef2a6e6845f8e33c3657c83633 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/pltview.cpp @@ -0,0 +1,559 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +***************************************************************** +***************************************************************** +******* ******** +****** (C) Copyright 2004-2006 by Tecplot, Inc. ******** +****** (C) Copyright 1989-2003 by AMTEC ENGINEERING INC.******** +******* All Rights Reserved. ******** +******* ******** +***************************************************************** +***************************************************************** +*/ + + +/* +**************************************************************** +****************** BEGIN DEVELOPMENT NOTES ********************* +**************************************************************** + +BEGIN CODELOG PLTVIEW +V 09/04/98 +V **************************************************************** +V * Build 1.0 9-04-98 * +V **************************************************************** +END CODELOG + +********************************************************************* +* IMPORTANT NOTE: Only development notes for "pltview" stand-alone * +* belong in this file. See "ADDONVER.h" for changes * +* related to the add-on. * +********************************************************************* + +**************************************************************** +* V in column 1 marks date information. * +* C in column 1 marks notes on new changes. * +* B in column 1 marks notes on bug fixes. * +**************************************************************** + +**************************************************************** +****************** END DEVELOPMENT NOTES *********************** +**************************************************************** +*/ + +#if defined ADDON +#include "TECADDON.h" +#include "GUIDEFS.h" +#include "GUI.h" +#define READTEC TecUtilReadBinaryData +#define SHOWINFO(S) TecGUITextAppendString(Output_T_D1,S); +#define ERRMSG(S) TecUtilDialogErrMsg(S) +#define ALLOC_ARRAY(N,Type,S) (Type *)TecUtilStringAlloc((N)*sizeof(Type),"debug info") +#define FREE_ARRAY(N,S) TecUtilStringDealloc((char **)&N) +#define STRINGLISTGETSTRING(S,N) TecUtilStringListGetString(S,N) +#define STRINGLISTGETCOUNT(S) TecUtilStringListGetCount(S) +#define STRINGLISTDEALLOC(S) TecUtilStringListDealloc(S) +#else +#include "MASTER.h" +#include "GLOBAL.h" +#include "TASSERT.h" +#define ALLOC_ARRAY(N,Type,S) (Type *)TecAlloc((N)*sizeof(Type)) +#define FREE_ARRAY(N,S) TecFree((void *)N) +#include "ARRLIST.h" +#include "STRLIST.h" +#include "DATAUTIL.h" + +/* +#include "TECADDON.h" +#include "TECXXX.h" +#include "DATAUTIL.h" +#include "STRLIST.h" +*/ + +#define READTEC ReadTec +#define SHOWINFO(S) printf("%s",S); +#define ERRMSG(S) printf("Err: %s\n",S); +#define STRINGLISTGETSTRING(S,N) StringListGetString(S,(N)-1) +#define STRINGLISTGETCOUNT(S) StringListCount(S) +#define STRINGLISTDEALLOC(S) StringListDealloc(S) +#define MaxCharsUserRec 500 +#endif + + +static int GetNumPtsPerCell(ZoneType_e ZoneType) +{ + int NumPts = 0; + switch (ZoneType) + { + case ZoneType_FETriangle : NumPts = 3; break; + case ZoneType_FEQuad : NumPts = 4; break; + case ZoneType_FETetra : NumPts = 4; break; + case ZoneType_FEBrick : NumPts = 8; break; + default : NumPts = 0; + } + return (NumPts); +} + +static int GetNumPts(ZoneType_e ZoneType, + LgIndex_t NumPtsI, + LgIndex_t NumPtsJ, + LgIndex_t NumPtsK) +{ + int NumPts = 0; + switch (ZoneType) + { + case ZoneType_FETriangle : + case ZoneType_FEQuad : + case ZoneType_FETetra : + case ZoneType_FEBrick : + case ZoneType_FEPolygon : + case ZoneType_FEPolyhedron: NumPts = NumPtsI; break; + default : NumPts = NumPtsI*NumPtsJ*NumPtsK; + } + return (NumPts); +} + + + +static void DeallocHeaderInfo(char **DataSetTitle, + StringList_pa *VarNames, + StringList_pa *ZoneNames, + LgIndex_t **NumPtsI, + LgIndex_t **NumPtsJ, + LgIndex_t **NumPtsK, + ZoneType_e **ZoneType, + StringList_pa *UserRec) +{ + if (*DataSetTitle) + FREE_ARRAY(*DataSetTitle, "data set title"); + if (*VarNames) + STRINGLISTDEALLOC(VarNames); + if (*ZoneNames) + STRINGLISTDEALLOC(ZoneNames); + if (*NumPtsI) + FREE_ARRAY(*NumPtsI, "NumPtsI Array"); + if (*NumPtsJ) + FREE_ARRAY(*NumPtsJ, "NumPtsJ Array"); + if (*NumPtsK) + FREE_ARRAY(*NumPtsK, "NumPtsK Array"); + if (*ZoneType) + FREE_ARRAY(*ZoneType, "ZoneType Array"); + if (*UserRec) + STRINGLISTDEALLOC(UserRec); + + *DataSetTitle = NULL; + *VarNames = NULL; + *ZoneNames = NULL; + *NumPtsI = NULL; + *NumPtsJ = NULL; + *NumPtsK = NULL; + *ZoneType = NULL; + *UserRec = NULL; +} + + + +#define MAXCHARSINFOLINE 5000 + + +void ReportFileInfo(char *FName, + Boolean_t LoadRawData, + Boolean_t AllocateRawDataSpaceLocally) +{ + short IVersion; + EntIndex_t NumZones; + EntIndex_t NumVars; + char *DataSetTitle = NULL; + StringList_pa VarNames = NULL; + StringList_pa ZoneNames = NULL; + LgIndex_t *NumPtsI = NULL; + LgIndex_t *NumPtsJ = NULL; + LgIndex_t *NumPtsK = NULL; + ZoneType_e *ZoneType = NULL; + StringList_pa UserRec = NULL; + int CZ, CV; + char InfoLine[MAXCHARSINFOLINE+1]; + double **VDataBase = NULL; + NodeMap_t **NodeMap = NULL; + + /* + * Load in the header information only. + */ + + if (!READTEC(TRUE, + FName, + &IVersion, + &DataSetTitle, + &NumZones, + &NumVars, + &VarNames, + &ZoneNames, + &NumPtsI, + &NumPtsJ, + &NumPtsK, + &ZoneType, + &UserRec, + FALSE, + (NodeMap_t ***)NULL, + (double ***)NULL)) + { + sprintf(InfoLine, "Cannot read file \"%s\"\nor file is not a Tecplot binary data file.\n", FName); + ERRMSG(InfoLine); + } + else + { + Boolean_t IsOk = TRUE; + if (LoadRawData) + { + if (AllocateRawDataSpaceLocally) + { + int NumPts; + VDataBase = ALLOC_ARRAY(NumZones * NumVars, double *, "vdatabase array"); + for (CZ = 0; CZ < NumZones; CZ++) + for (CV = 0; CV < NumVars; CV++) + { + NumPts = GetNumPts(ZoneType[CZ], NumPtsI[CZ], NumPtsJ[CZ], NumPtsK[CZ]); + if (NumPts >= 1) + VDataBase[CZ*NumVars+CV] = ALLOC_ARRAY(NumPts, double, "vdatabase array"); + else + VDataBase[CZ*NumVars+CV] = NULL; + } + + NodeMap = ALLOC_ARRAY(NumZones, NodeMap_t *, "nodemap array"); + for (CZ = 0; CZ < NumZones; CZ++) + { + if (ZoneType[CZ] == ZoneType_Ordered) + NodeMap[CZ] = NULL; + else + { + int PtsPerCell = GetNumPtsPerCell(ZoneType[CZ]); + NodeMap[CZ] = ALLOC_ARRAY(PtsPerCell * NumPtsJ[CZ], + NodeMap_t, "zone nodemap"); + } + } + } + else + { + VDataBase = NULL; + NodeMap = NULL; + } + + /* + * NOTE: If any of the above alloc's failed then no big deal. ReadTec + * itself "skips" vars if memory was not allocated for it. + */ + + DeallocHeaderInfo(&DataSetTitle, + &VarNames, + &ZoneNames, + &NumPtsI, + &NumPtsJ, + &NumPtsK, + &ZoneType, + &UserRec); + + /* + * Reread the datafile. This time load in the header AND the raw data + * Note that VDataBase may be preallocated or may be left up to ReadTec + * to allocate (See AllocateRawDataSpaceLocally above). + */ + if (!READTEC(FALSE, + FName, + &IVersion, + &DataSetTitle, + &NumZones, + &NumVars, + &VarNames, + &ZoneNames, + &NumPtsI, + &NumPtsJ, + &NumPtsK, + &ZoneType, + &UserRec, + AllocateRawDataSpaceLocally, + &NodeMap, + &VDataBase)) + { + if (IVersion > 99) + { + sprintf(InfoLine, + "Error: ***\n" + " This add-on can only display raw nodal data\n" + " and it appears to contain cell centered data.\n"); + SHOWINFO(InfoLine); + } + else + { + sprintf(InfoLine, + "Cannot Read File, %s.\n" + "File may not be a tecplot binary data file.", + FName); + ERRMSG(InfoLine); + } + IsOk = FALSE; + } + } + + SHOWINFO("\n"); + sprintf(InfoLine, "FileName : %s\n", FName); + SHOWINFO(InfoLine); + sprintf(InfoLine, "File Version: %3.1f\n", IVersion / 10.0); + SHOWINFO(InfoLine); + + /* if the file contains filetype, then retrieve that separately since ReadTec should not be changed */ + if (IVersion >= 109) + { + DataFileType_e FileType = DataFileType_Full; + char FileTypeStr[32]; + FILE *F = NULL; + + /* open the file and get the filetype */ + F = fopen(FName, "rb"); + if (F) + { + char Buffer[8]; + Int32_t One; + Int32_t FileTypeInt; + + /* 8 bytes for magic# and version and 4 bytes for Int32 */ + fread(Buffer, sizeof(Buffer[0]), 8, F); + fread(&One, sizeof(One), 1, F); + fread(&FileTypeInt, sizeof(FileTypeInt), 1, F); + FileType = (DataFileType_e)FileTypeInt; + fclose(F); + F = NULL; + } + /* map the filetype */ + switch (FileType) + { + case DataFileType_Full: + strcpy(FileTypeStr, "Full"); + break; + case DataFileType_Grid: + strcpy(FileTypeStr, "Grid"); + break; + case DataFileType_Solution: + strcpy(FileTypeStr, "Solution"); + break; + default: + IsOk = FALSE; + CHECK(FALSE); + break; + } + sprintf(InfoLine, "File Type : %s\n", FileTypeStr); + SHOWINFO(InfoLine); + } + + sprintf(InfoLine, "DataSetTitle: %s\n", DataSetTitle ? DataSetTitle : " "); + SHOWINFO(InfoLine); + sprintf(InfoLine, "NumZones : %d\n", (int)NumZones); + SHOWINFO(InfoLine); + sprintf(InfoLine, "NumVars : %d\n", (int)NumVars); + SHOWINFO(InfoLine); + if (IsOk && (NumZones > 0)) + { + SHOWINFO("Var Names : "); + for (CZ = 0; CZ < NumVars; CZ++) + { + char *VarName = STRINGLISTGETSTRING(VarNames, CZ + 1); + sprintf(InfoLine, "%s", VarName ? VarName : "NULL"); + if (CZ < NumVars - 1) + strcat(InfoLine, ","); + else + strcat(InfoLine, "\n\n"); + SHOWINFO(InfoLine); + if (VarName) + FREE_ARRAY(VarName, "VarName array"); + } + SHOWINFO("ZoneName IMax JMax KMax Node Face Elmt EType\n"); + SHOWINFO("-------------------------------------------------------------------------------\n"); + + for (CZ = 0; CZ < NumZones; CZ++) + { + char *ZoneName = STRINGLISTGETSTRING(ZoneNames, CZ + 1); + if (ZoneType[CZ] != ZoneType_Ordered) + { + if (ZoneType[CZ] == ZoneType_FEPolygon || + ZoneType[CZ] == ZoneType_FEPolyhedron) + sprintf(InfoLine, "%-20s --- --- --- %-8ld %-8ld %-8ld ", + (ZoneName ? ZoneName : "NULL"), + (long)NumPtsI[CZ], + (long)NumPtsK[CZ], + (long)NumPtsJ[CZ]); + else + sprintf(InfoLine, "%-20s --- --- --- %-8ld --- %-8ld ", + (ZoneName ? ZoneName : "NULL"), + (long)NumPtsI[CZ], + (long)NumPtsJ[CZ]); + SHOWINFO(InfoLine); + switch (ZoneType[CZ]) + { + case ZoneType_FETriangle : SHOWINFO("Tri\n"); break; + case ZoneType_FEQuad : SHOWINFO("Quad\n"); break; + case ZoneType_FETetra : SHOWINFO("Tetra\n"); break; + case ZoneType_FEBrick : SHOWINFO("Brick\n"); break; + case ZoneType_FELineSeg : SHOWINFO("LineSeg\n"); break; + case ZoneType_FEPolygon : SHOWINFO("Polygon\n"); break; + case ZoneType_FEPolyhedron: SHOWINFO("Polyhed\n"); break; + default: CHECK(FALSE); break; + } + } + else + { + sprintf(InfoLine, "%-20s %-7ld %-7ld %-7ld --- --- --- ---\n", + (ZoneName ? ZoneName : "NULL"), + (long)NumPtsI[CZ], + (long)NumPtsJ[CZ], + (long)NumPtsK[CZ]); + SHOWINFO(InfoLine); + } + if (ZoneName) + FREE_ARRAY(ZoneName, "ZoneName Array"); + } + } + + if (IsOk) + { + for (CZ = 1; CZ <= STRINGLISTGETCOUNT(UserRec); CZ++) + { + char *S = STRINGLISTGETSTRING(UserRec, CZ); + if (S) + { + int L; + strcpy(InfoLine, "UserRec: "); + L = (int)strlen(InfoLine); + strncat(&InfoLine[L], S, MAXCHARSINFOLINE - L - 2); + strcat(&InfoLine[strlen(InfoLine)], "\n"); + SHOWINFO(InfoLine); + FREE_ARRAY(S, "temp string"); + } + } + + + if (LoadRawData) + { + for (CZ = 0; CZ < NumZones; CZ++) + { + int CV; + for (CV = 0; CV < NumVars; CV++) + if (VDataBase[CZ*NumVars+CV]) + { + int I; + int NumPts = GetNumPts(ZoneType[CZ], NumPtsI[CZ], NumPtsJ[CZ], NumPtsK[CZ]); + int SLen = 0; + sprintf(InfoLine, "\n\nVariable data for zone %d, Var %d\n", CZ + 1, CV + 1); + SHOWINFO(InfoLine); + InfoLine[0] = '\0'; + for (I = 0; I < NumPts; I++) + { + char PString[50]; + if (SLen + 50 > MAXCHARSINFOLINE) + { + SHOWINFO(InfoLine); + InfoLine[0] = '\0'; + SLen = 0; + } + + sprintf(PString, "%lG ", VDataBase[CZ*NumVars+CV][I]); + strcat(InfoLine, PString); + SLen += (int)strlen(PString); + + if ((I % 5) == 4) + { + strcat(InfoLine, "\n"); + SLen++; + } + } + if (*InfoLine) + SHOWINFO(InfoLine); + FREE_ARRAY(VDataBase[CZ*NumVars+CV], "vdatabase double"); + } + if (NodeMap[CZ]) + { + int I, J; + int PtsPerCell = GetNumPtsPerCell(ZoneType[CZ]); + int SLen = 0; + SHOWINFO("\nConnectivity list:\n"); + InfoLine[0] = '\0'; + for (J = 0; J < NumPtsJ[CZ]; J++) + { + if (SLen + 200 > MAXCHARSINFOLINE) + { + SHOWINFO(InfoLine); + InfoLine[0] = '\0'; + SLen = 0; + } + for (I = 0; I < PtsPerCell; I++) + { + char NString[20]; + sprintf(NString, "%u ", (unsigned int)NodeMap[CZ][J*PtsPerCell+I] + 1); + strcat(InfoLine, NString); + SLen += (int)strlen(NString); + } + strcat(InfoLine, "\n"); + SLen++; + } + if (*InfoLine) + SHOWINFO(InfoLine); + FREE_ARRAY(NodeMap[CZ], "nodemap"); + } + } + FREE_ARRAY(NodeMap, "Nodemap base array"); + FREE_ARRAY(VDataBase, "vdatabase base array"); + } + } + + SHOWINFO("\n\n"); + + DeallocHeaderInfo(&DataSetTitle, + &VarNames, + &ZoneNames, + &NumPtsI, + &NumPtsJ, + &NumPtsK, + &ZoneType, + &UserRec); + } +} + + + +#if !defined ADDON +int main(int argc, char *(argv[])) +{ + short CurFile; + + if (argc == 1) + { + printf("Err: Need: pltview file1 [file2] ...\n"); + exit(-1); + } + + for (CurFile = 1; CurFile < argc; CurFile++) + ReportFileInfo(argv[CurFile], FALSE, FALSE); + + return 0; +} +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/readme.txt b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..5b47bdb4eae7d52f588aec0629402c9d3b187361 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/readme.txt @@ -0,0 +1,51 @@ +*********************************************** +** README ** +*********************************************** + +To build the TecIO library and/or the pltview utility +simply run the Runmake script in this directory. + +If customization is needed it will most likely be done +in GLOBAL.h (to identify machine as 64 bit) and/or in +dataio4.c. Just look for CRAY in dataio4.c and you +will find most of the critical areas. Note that the +existing code defined by CRAY is quite old and has +not been in use for some time. + +Each example has its own Makefile. You may have to adjust +the variables at the top of the Makefile for your platform. + + +ReadTec() + +The ReadTec() is included in the tecio library but is +not supported by Tecplot, Inc. ReadTec is used +to read Tecplot binary data files (all versions at or +older than the Tecplot version providing the tecio +library). See tecsrc/DATAUTIL.h for more information. + +The pltview example app gives an example of using ReadTec +to read just the header from a file as well as loading all +field data from a file./* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ALLOC.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ALLOC.h new file mode 100644 index 0000000000000000000000000000000000000000..f07fc07f905a3873d2002b5d3133fab453a28d78 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ALLOC.h @@ -0,0 +1,205 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2009 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ +#ifndef ALLOC_H +#define ALLOC_H + +#include "TASSERT.h" +#if defined __cplusplus +#include <new> +#endif + +#if !defined __cplusplus +#define ALLOC_ARRAY(N,Type,str) (Type *)malloc((N)*sizeof(Type)) +#define ALLOC_ITEM(Type,str) (Type *)malloc(sizeof(Type)) +#ifdef _DEBUG +/* NOTE: the pointer is set to 0xFFFF after the free for debug */ +/* versions in the hopes of catching invalid pointer usage */ +#define FREE_ARRAY(X,str) do { free((void *)(X)); *((void **)&(X)) = (void *)0xFFFF; } while (0) +#define FREE_ITEM(X,str) do { free((void *)(X)); *((void **)&(X)) = (void *)0xFFFF; } while (0) +#else +#define FREE_ARRAY(X,str) free((void *)(X)) +#define FREE_ITEM(X,str) free((void *)(X)) +#endif +#else +#ifdef TRACK_MEMORY_USAGE +extern void initMemoryUsageTracking(void); +extern void cleanUpMemoryUsageTracking(void); +extern void trackMemoryAlloc(size_t size); +extern void trackMemoryFree(size_t size); +extern void trackMemoryClearHighMark(void); +extern void trackMemorySaveHighMark(void); +extern void getMemoryUsage(size_t* memoryInUse, + size_t* memoryCurrentHighMark, + size_t* memorySavedHighMark, + size_t* memoryTotalHighMark); +#endif +/* +* Create a version of new that returns NULL instead +* of throwing std::bad_alloc. A lot of code is written using +* ALLOC_ITEM and ALLOC_ARRAY that expect a return value of +* NULL on failure instead of the exception. 2008-05-08 CAM +*/ +#if defined MSWIN && defined _DEBUG +template <typename T> +inline T *nonExceptionNew(size_t numItems, + const char* fileName, + int lineNumber) +{ + REQUIRE(numItems > 0); + REQUIRE(VALID_REF(fileName)); + REQUIRE(lineNumber > 0); + T* result; + try + { +#ifdef DEBUG_NEW +#ifdef new +#undef new +#define USING_DEBUG_NEW +#endif + result = new(fileName, lineNumber) T[numItems]; +#ifdef USING_DEBUG_NEW +#define new DEBUG_NEW +#undef USING_DEBUG_NEW +#endif +#else + result = new T[numItems]; +#endif + } + catch (std::bad_alloc&) + { + result = NULL; + } +#ifdef TRACK_MEMORY_USAGE + if (result != NULL) + { +#ifdef MSWIN + trackMemoryAlloc(_msize(result)); +#else + trackMemoryAlloc(malloc_usable_size(result)); +#endif + } +#endif + ENSURE(VALID_REF_OR_NULL(result)); + return result; +} +#define ALLOC_ARRAY(N,Type,str) nonExceptionNew<Type>((N),__FILE__,__LINE__) +#else +template <typename T> +inline T *nonExceptionNew(size_t numItems) +{ + REQUIRE(numItems > 0); + T *result; + try + { + result = new T[numItems]; + } + catch (std::bad_alloc&) + { + result = NULL; + } +#ifdef TRACK_MEMORY_USAGE + if (result != NULL) + { +#ifdef MSWIN + trackMemoryAlloc(_msize(result)); +#else + trackMemoryAlloc(malloc_usable_size(result)); +#endif + } +#endif + ENSURE(VALID_REF_OR_NULL(result)); + return result; +} +#define ALLOC_ARRAY(N,Type,str) nonExceptionNew<Type>((N)) +#endif +#define ALLOC_ITEM(Type,str) ALLOC_ARRAY(1,Type,str) + +/* +* Although delete doesn't throw exceptions, this function matches +* nonExceptionNew, and also reports the size of the block if we +* are tracking memory. +*/ +template <typename T> +inline void nonExceptionDelete(T* &ptr) +{ +#if defined MSWIN && !defined NO_ASSERTS + CHECK(!IsBadReadPtr((void*)ptr, 1)); +#endif +#if defined TRACK_MEMORY_USAGE + if (ptr != NULL) + { +#ifdef MSWIN + trackMemoryFree(_msize(ptr)); +#else + trackMemoryFree(malloc_usable_size(ptr)); +#endif + } +#endif + + delete [] ptr; +#if !defined NO_ASSERTS + /* + * NOTE: the pointer is set to 0xFFFF after the free for asserted + * builds in the hopes of catching invalid pointer usage + */ + ptr = (T*)(void*)0xFFFF; +#endif +} +#define FREE_ARRAY(ptr,str) nonExceptionDelete((ptr)) +#define FREE_ITEM(ptr,str) FREE_ARRAY(ptr,str) +#endif + +/** +* The following functor can be used to easily deallocate memory from containers +* that hold pointers to allocated objects. For example: +* +* vector<MyObject*> container; +* for (int ii = 0; ii < 10; ii++ +* container.push_back(new MyObject); +* ... do something with the objects ... +* ... now we need to clean up ... +* for_each(container.begin(), +* container.end(), +* DeleteItem()); +*/ +struct DeleteItem +{ + template<typename T> + void operator()(T*& object) + { + delete object; + object = NULL; + } +}; + +#endif /* ALLOC_H */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ARRLIST.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ARRLIST.h new file mode 100644 index 0000000000000000000000000000000000000000..0203dae29b7cf02a2f228d7dfd561c1c899f83b5 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ARRLIST.h @@ -0,0 +1,626 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +***************************************************************** +***************************************************************** +******* ******** +****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +***************************************************************** +***************************************************************** +*/ +#if !defined ARRLIST_h +#define ARRLIST_h + +#if defined EXTERN +# undef EXTERN +#endif +#if defined ARRLISTMODULE +# define EXTERN +#else +# define EXTERN extern +#endif + +typedef enum +{ + ArrayListType_UnsignedChar, + ArrayListType_UnsignedShort, + ArrayListType_UnsignedInt, + ArrayListType_UnsignedLong, + ArrayListType_Int64, + ArrayListType_Char, + ArrayListType_Short, + ArrayListType_Int, + ArrayListType_Long, + ArrayListType_Float, + ArrayListType_Double, + ArrayListType_LgIndex, + ArrayListType_EntIndex, + ArrayListType_SmInteger, + ArrayListType_Boolean, + ArrayListType_ArbParam, + ArrayListType_UnsignedCharPtr, + ArrayListType_UnsignedShortPtr, + ArrayListType_UnsignedIntPtr, + ArrayListType_UnsignedLongPtr, + ArrayListType_Int64Ptr, + ArrayListType_CharPtr, + ArrayListType_ShortPtr, + ArrayListType_IntPtr, + ArrayListType_LongPtr, + ArrayListType_FloatPtr, + ArrayListType_DoublePtr, + ArrayListType_LgIndexPtr, + ArrayListType_EntIndexPtr, + ArrayListType_SmIntegerPtr, + ArrayListType_BooleanPtr, + ArrayListType_ArbParamPtr, + ArrayListType_VoidPtr, + ArrayListType_FunctionPtr, + ArrayListType_Any, + END_ArrayListType_e, + ArrayListType_Invalid = BadEnumValue +} ArrayListType_e; + +typedef union +{ + unsigned char UnsignedChar; + unsigned short UnsignedShort; + unsigned int UnsignedInt; + unsigned long UnsignedLong; + Int64_t Int64; + char Char; + short Short; + int Int; + long Long; + float Float; + double Double; + LgIndex_t LgIndex; + EntIndex_t EntIndex; + SmInteger_t SmInteger; + Boolean_t BBoolean; /* X-Windows uses Boolean */ + ArbParam_t ArbParam; + unsigned char *UnsignedCharPtr; + unsigned short *UnsignedShortPtr; + unsigned int *UnsignedIntPtr; + unsigned long *UnsignedLongPtr; + Int64_t *Int64Ptr; + char *CharPtr; + short *ShortPtr; + int *IntPtr; + long *LongPtr; + float *FloatPtr; + double *DoublePtr; + LgIndex_t *LgIndexPtr; + EntIndex_t *EntIndexPtr; + SmInteger_t *SmIntegerPtr; + Boolean_t *BooleanPtr; + ArbParam_t *ArbParamPtr; + void *VoidPtr; + void (*FunctionPtr)(void); +} ArrayListItem_u; + +/** + * NULL array list item for added convenience of inserting a NULL item without + * having to declare and assign one. Can be used as follows: + * + * IsOk = ArrayListInsertItem(SomeArrayList, SomeIndex, ArrayListNumItem); + * + * NOTE: This value must be set to zero before Tecplot uses array lists. + * memset(&ArrayListNullItem, 0, sizeof(ArrayListType_Any)); + */ +EXTERN ArrayListItem_u ArrayListNullItem; + +/** + * Visitor for traversing an array list. An iterator may not perform any + * operation that will adjust the size of the list. In other words it may not + * insert or delete items from the list. However an iterator may perform a get + * operation or a set operation that do not expand the list size. + * + * param ItemRef + * Reference to the array list item visited. + * param ClientData + * Any client data required for the visitor. + * + * return + * TRUE to continue visiting items, otherwise + * FALSE to discontinue visiting + */ +typedef Boolean_t (*ArrayListItemVisitor_pf)(void *ItemRef, + ArbParam_t ClientData); +#if 0 /* use this stub as a starting place */ +{ + REQUIRE(VALID_REF(TypeRef)); + REQUIRE(VALID_REF(*TypeRef) || *TypeRef == NULL); + + Boolean_t DoContinue = TRUE; + <type> *TypeRef = (<type> *)ItemRef; + + ENSURE(VALID_BOOLEAN(DoContinue)); + return DoContinue; +} +#endif + + +/** + * Destructor for cleaning up one or more array list items. If a destructor is + * not supplied then the array items are simply discarded. + * + * NOTE: The only change to ArrayListItemVisitor_pf is the policy which + * requires that the return value is TRUE. + * + * param ItemRef + * Reference to the array list item to cleanup. + * param ClientData + * Any client data required for cleanup. + * + * return + * TRUE is a requirement + */ +typedef ArrayListItemVisitor_pf ArrayListItemDestructor_pf; + + +/** + * Duplicator for copying one or more array list items. If a duplicator is not + * supplied then the array items are simply copied. For pointer types this + * means by reference. Note that if a duplicator is used the rules for + * duplication and subsequent cleanup are defined by the client. + * + * param TargetItemRef + * Reference to the array list to receive the duplicate. + * param SourceItemRef + * Reference to the array list item to duplicate. + * param ClientData + * Any client data required for duplication. + * + * return + * TRUE if the duplication was a success + * FALSE otherwise. If the duplication failed it + * is the client's responsibility to cleanup any + * partial duplication + */ +typedef Boolean_t (*ArrayListItemDuplicator_pf)(void *TargetItemRef, + void *SourceItemRef, + ArbParam_t ClientData); +#if 0 /* use this stub as a starting place */ +{ + REQUIRE(VALID_REF(TargetTypeRef)); + REQUIRE(VALID_REF(SourceTypeRef)); + REQUIRE(VALID_REF(*SourceTypeRef) || *SourceTypeRef == NULL); + + Boolean_t IsOk = TRUE; + <type> *TargetTypeRef = (<type> *)TargetItemRef; + <type> *SourceTypeRef = (<type> *)SourceItemRef; + + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} +#endif + + +/** + * Adjusts the capacity request as necessary to minimize memory reallocations + * for large lists. Unless the request exceeds the maximum the adjusted + * capacity will be at least as big as requested however it may be larger if it + * is determined that the space requirement is growing faster. If the maximum + * is exceeded zero should be returned. + * + * param ArrayList + * Array list requesting the change in capacity. + * param CurrentCapacity + * Current capacity of the array list. + * param RequestedCapacity + * Capacity request or zero for default size. + * param ClientData + * Any client data needed for the adjustment. + * + * return + * Adjusted capacity that is at least as large as the request or zero if + * unable to satisfy the requested capacity. + */ +typedef LgIndex_t (*ArrayListCapacityRequestAdjuster_pf)(ArrayList_pa ArrayList, + LgIndex_t CurrentCapacity, + LgIndex_t RequestedCapacity, + ArbParam_t ClientData); +#if 0 /* use this stub as a starting place */ +{ + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE((RequestedCapacity == 0 && CurrentCapacity == 0) || + RequestedCapacity > ArrayList->Capacity); + + LgIndex_t Result; + + ENSURE(Result == 0 || Result >= RequestedCapacity); + return Result; +} +#endif + + +/* private ArrayList structure: only exposed so STRUTIL can use it */ +typedef struct _ArrayList_s +{ + char *Array; /* byte array for holding the items */ + ArrayListType_e Type; /* type of array items */ + SmInteger_t ItemSize; /* byte size of an individual item */ + LgIndex_t Count; /* number of items in the array */ + LgIndex_t Capacity; /* maximum holding capacity of the array */ + Boolean_t IsVisitingItems; /* indicates if an iteration is in progress */ + ArrayListCapacityRequestAdjuster_pf CapacityRequestAdjuster; + ArbParam_t CapacityRequestAdjusterClientData; +} ArrayList_s; + + +/** + * Compares two array list elements. Note that either string may be + * NULL as array lists allow for NULL elements. + * + * @param Item1 + * Element to compare against Item2. + * @param Item2 + * Element to compare against Item1. + * @param ClientData + * Contextual information that was passed to the 'ArrayListQSort' function. + * + * @return + * - A value less than zero if Item1 is less than Item2. + * - A value of zero if Item1 is equal to Item2. + * - A value greater than zero if Item1 is greater than Item2. + */ +typedef int (STDCALL *ArrayListItemComparator_pf)(ArrayListItem_u Item1, + ArrayListItem_u Item2, + ArbParam_t ClientData); + +EXTERN Boolean_t ArrayListIsValid(ArrayList_pa ArrayList); +EXTERN ArrayListType_e ArrayListGetType(ArrayList_pa ArrayList); +EXTERN Boolean_t ArrayListEnlargeCapacity(ArrayList_pa ArrayList, + LgIndex_t RequestedCapacity); +EXTERN ArrayList_pa ArrayListAlloc(LgIndex_t EstimatedCapacity, + ArrayListType_e Type, + ArrayListCapacityRequestAdjuster_pf CapacityRequestAdjuster, + ArbParam_t CapacityRequestAdjusterClientData); +EXTERN void ArrayListDealloc(ArrayList_pa *ArrayList, + ArrayListItemDestructor_pf ItemDestructor, + ArbParam_t ClientData); +EXTERN void ArrayListDeleteAllItems(ArrayList_pa ArrayList, + ArrayListItemDestructor_pf ItemDestructor, + ArbParam_t ClientData); +EXTERN void ArrayListDeleteItems(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + LgIndex_t Count, + ArrayListItemDestructor_pf ItemDestructor, + ArbParam_t ClientData); +EXTERN void ArrayListDeleteItem(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + ArrayListItemDestructor_pf ItemDestructor, + ArbParam_t ClientData); +EXTERN ArrayList_pa ArrayListRemoveItems(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + LgIndex_t Count); +EXTERN ArrayListItem_u ArrayListRemoveItem(ArrayList_pa ArrayList, + LgIndex_t ItemOffset); +EXTERN Boolean_t ArrayListInsertItem(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + ArrayListItem_u Item); +EXTERN Boolean_t ArrayListInsert(ArrayList_pa Target, + LgIndex_t ItemOffset, + ArrayList_pa Source); +EXTERN Boolean_t ArrayListVisitItems(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + LgIndex_t Count, + ArrayListItemVisitor_pf ItemVisitor, + ArbParam_t ClientData); +EXTERN ArrayList_pa ArrayListGetItems(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + LgIndex_t Count); +EXTERN ArrayListItem_u ArrayListGetItem(ArrayList_pa ArrayList, + LgIndex_t ItemOffset); +EXTERN Boolean_t ArrayListSetItem(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + ArrayListItem_u Item, + ArrayListItemDestructor_pf ItemDestructor, + ArbParam_t ClientData); +EXTERN Boolean_t ArrayListAppendItem(ArrayList_pa ArrayList, + ArrayListItem_u Item); +EXTERN Boolean_t ArrayListAppend(ArrayList_pa Target, + ArrayList_pa Source); +EXTERN ArrayList_pa ArrayListCopy(ArrayList_pa ArrayList, + ArrayListItemDuplicator_pf ItemDuplicator, + ArbParam_t ClientData); +EXTERN void *ArrayListToArray(ArrayList_pa ArrayList, + ArrayListItemDuplicator_pf ItemDuplicator, + ArbParam_t ClientData); +EXTERN ArrayList_pa ArrayListFromArray(void *Source, + LgIndex_t Count, + ArrayListType_e Type, + ArrayListItemDuplicator_pf ItemDuplicator, + ArbParam_t ClientData); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +EXTERN void ArrayListQSort(ArrayList_pa ArrayList, + ArrayListItemComparator_pf Comparator, + ArbParam_t ClientData); +EXTERN Boolean_t ArrayListBSearch(ArrayList_pa ArrayList, + ArrayListItem_u Item, + ArrayListItemComparator_pf Comparator, + ArbParam_t ClientData, + LgIndex_t *ItemIndex); + +#if defined USE_MACROS_FOR_FUNCTIONS +/** + * Gets the array list's internal buffer representation. + * Use ArrayListGetXxx accessors whenever possible as their + * implementation in the release build is as fast as using + * the array directly anyway. + * + * WARNING: + * Some array list functions modify the internal buffer. + * This will invalidate this reference however it is + * the client's responsibility not to make further use + * of it. In addition, this reference should never be + * deallocated directly as the array list assumes the + * responsible for the cleanup. + * + * param ArrayList + * Array list for which a reference to the internal + * buffer is desired. + * + * return + * Reference to the array list's internal buffer. + */ +# define ArrayListGetInternalRef ArrayListGetInternalRef_MACRO +/** + * Gets the item's internal reference at the specified offset in the list. + * + * WARNING: + * Some array list functions modify the internal buffer. + * This will invalidate this reference however it is + * the client's responsibility not to make further use + * of it. In addition, this reference should never be + * deallocated directly as the array list assumes the + * responsible for the cleanup. + * + * param ArrayList + * Array list containing the desired item. + * param ItemOffset + * Offset to the item in the list. + * + * return + * The internal reference to the requested item. + */ +# define ArrayListGetItemInternalRef ArrayListGetItemInternalRef_MACRO +# define ArrayListGetCount ArrayListGetCount_MACRO + +# define ArrayListGetUnsignedChar(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, unsigned char) +# define ArrayListGetUnsignedShort(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, unsigned short) +# define ArrayListGetUnsignedInt(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, unsigned int) +# define ArrayListGetUnsignedLong(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, unsigned long) +# define ArrayListGetInt64(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, Int64_t) +# define ArrayListGetChar(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, char) +# define ArrayListGetShort(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, short) +# define ArrayListGetInt(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, int) +# define ArrayListGetLong(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, long) +# define ArrayListGetFloat(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, float) +# define ArrayListGetDouble(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, double) +# define ArrayListGetLgIndex(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, LgIndex_t) +# define ArrayListGetEntIndex(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, EntIndex_t) +# define ArrayListGetSmInteger(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, SmInteger_t) +# define ArrayListGetBoolean(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, Boolean_t) +# define ArrayListGetArbParam(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, ArbParam_t) +# define ArrayListGetUnsignedCharPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, unsigned char *) +# define ArrayListGetUnsignedShortPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, unsigned short *) +# define ArrayListGetUnsignedIntPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, unsigned int *) +# define ArrayListGetUnsignedLongPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, unsigned long *) +# define ArrayListGetInt64Ptr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, Int64_t *) +# define ArrayListGetCharPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, char *) +# define ArrayListGetShortPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, short *) +# define ArrayListGetIntPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, int *) +# define ArrayListGetLongPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, long *) +# define ArrayListGetFloatPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, float *) +# define ArrayListGetDoublePtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, double *) +# define ArrayListGetLgIndexPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, LgIndex_t *) +# define ArrayListGetEntIndexPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, EntIndex_t *) +# define ArrayListGetSmIntegerPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, SmInteger_t *) +# define ArrayListGetBooleanPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, Boolean_t *) +# define ArrayListGetArbParamPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, ArbParam_t *) +# define ArrayListGetVoidPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, void *) +# define ArrayListGetFunctionPtr(ArrayList, ItemOffset) ArrayListGetTypedItem(ArrayList, ItemOffset, (**)(void)) +#else +# define ArrayListGetInternalRef ArrayListGetInternalRef_FUNC +# define ArrayListGetItemInternalRef ArrayListGetItemInternalRef_FUNC +# define ArrayListGetCount ArrayListGetCount_FUNC + +# define ArrayListGetUnsignedChar(ArrayList, ItemOffset) (*((unsigned char *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetUnsignedShort(ArrayList, ItemOffset) (*((unsigned short *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetUnsignedInt(ArrayList, ItemOffset) (*((unsigned int *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetUnsignedLong(ArrayList, ItemOffset) (*((unsigned long *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetInt64(ArrayList, ItemOffset) (*((Int64_t *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetChar(ArrayList, ItemOffset) (*((char *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetShort(ArrayList, ItemOffset) (*((short *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetInt(ArrayList, ItemOffset) (*((int *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetLong(ArrayList, ItemOffset) (*((long *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetFloat(ArrayList, ItemOffset) (*((float *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetDouble(ArrayList, ItemOffset) (*((double *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetLgIndex(ArrayList, ItemOffset) (*((LgIndex_t *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetEntIndex(ArrayList, ItemOffset) (*((EntIndex_t *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetSmInteger(ArrayList, ItemOffset) (*((SmInteger_t *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetBoolean(ArrayList, ItemOffset) (*((Boolean_t *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetArbParam(ArrayList, ItemOffset) (*((ArbParam_t *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetUnsignedCharPtr(ArrayList, ItemOffset) (*((unsigned char * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetUnsignedShortPtr(ArrayList, ItemOffset) (*((unsigned short * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetUnsignedIntPtr(ArrayList, ItemOffset) (*((unsigned int * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetUnsignedLongPtr(ArrayList, ItemOffset) (*((unsigned long * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetInt64Ptr(ArrayList, ItemOffset) (*((Int64_t * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetCharPtr(ArrayList, ItemOffset) (*((char * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetShortPtr(ArrayList, ItemOffset) (*((short * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetIntPtr(ArrayList, ItemOffset) (*((int * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetLongPtr(ArrayList, ItemOffset) (*((long * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetFloatPtr(ArrayList, ItemOffset) (*((float * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetDoublePtr(ArrayList, ItemOffset) (*((double * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetLgIndexPtr(ArrayList, ItemOffset) (*((LgIndex_t * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetEntIndexPtr(ArrayList, ItemOffset) (*((EntIndex_t * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetSmIntegerPtr(ArrayList, ItemOffset) (*((SmInteger_t * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetBooleanPtr(ArrayList, ItemOffset) (*((Boolean_t * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetArbParamPtr(ArrayList, ItemOffset) (*((ArbParam_t * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetVoidPtr(ArrayList, ItemOffset) (*((void * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +# define ArrayListGetFunctionPtr(ArrayList, ItemOffset) (*(((**)(void) *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) +#endif + +#if !defined USE_MACROS_FOR_FUNCTIONS +EXTERN const void *ArrayListGetInternalRef_FUNC(ArrayList_pa ArrayList); +EXTERN const void *ArrayListGetItemInternalRef_FUNC(ArrayList_pa ArrayList, + LgIndex_t ItemOffset); +EXTERN LgIndex_t ArrayListGetCount_FUNC(ArrayList_pa ArrayList); +#endif + +#define ArrayListGetInternalRef_MACRO(ArrayList) ((const void *)((ArrayList)->Array)) +#define ArrayListGetItemInternalRef_MACRO(ArrayList, ItemOffset) ((const void *)&((ArrayList)->Array[(ItemOffset)*(ArrayList)->ItemSize])) +#define ArrayListGetCount_MACRO(ArrayList) ((ArrayList)->Count) +#define ArrayListGetTypedArrayRef(ArrayList, NativeType) ((NativeType *)((ArrayList)->Array)) +#define ArrayListGetTypedItem(ArrayList, ItemOffset, NativeType) (ArrayListGetTypedArrayRef(ArrayList,NativeType)[ItemOffset]) + +/** + * Simple macro to determine if the item offset is within the array list + * capacity. In the debug or checked builds we also perform a lower bound + * assertion check. + */ +#if defined NO_ASSERTS +# define ArrayListOffsetWithinCapacity(ArrayList, ItemOffset) ((ItemOffset) < (ArrayList)->Capacity) +#else +/** + * Using 'assert' rather than 'REQUIRE' because under Windows, REQUIRE (and ASSERT) trickles down to being a + * do-while loop, which doesn't jive well with the comma operator. + */ +# define ArrayListOffsetWithinCapacity(ArrayList, ItemOffset) ((assert((ItemOffset) >= 0),TRUE) && ((ItemOffset) < (ArrayList)->Capacity)) +#endif + +/** + * Places the item at the specified offset. If the offset is beyond the + * end of the list it is sized accordingly and the intervening items + * between the last item of the original state and the last item of the + * new state are guaranteed to be 0. + * + * This is the workhorse of the set and append convenience macros that follow. + * Please note that unlike ArrayListSetItem no destructor facility is provided + * therefore if an item previously occupied 'ItemOffset' it will be replaced. + * + * param ArrayList + * Array list target in which to set the item. + * param ItemOffset + * Offset of the item. + * param Item + * Item to set at the specified offset. Its native type must + * match 'NativeType' + * param NativeType + * Native type of 'Item'. + * + * return + * TRUE if sufficient memory permitted the operation, otherwise FALSE. + */ +#define ArrayListSetTypedItem(ArrayList, ItemOffset, Item, NativeType) \ + ((ArrayListOffsetWithinCapacity((ArrayList), (ItemOffset)) || \ + ArrayListEnlargeCapacity((ArrayList), (ItemOffset)+1)) \ + ? (((((NativeType *)((ArrayList)->Array))[(ItemOffset)]) = (Item)), \ + (((ItemOffset)+1 > (ArrayList)->Count) \ + ? (((ArrayList)->Count = (ItemOffset)+1), TRUE) \ + : (TRUE))) \ + : (FALSE)) + +/** + * This section provides macros for high speed setting and appending to an + * array list of a known type. The only additional overhead incurred versus just + * using a simple array is the cost of testing the array list capacity. + */ +#define ArrayListSetUnsignedChar(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned char) +#define ArrayListSetUnsignedShort(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned short) +#define ArrayListSetUnsignedInt(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned int) +#define ArrayListSetUnsignedLong(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned long) +#define ArrayListSetInt64(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, Int64_t) +#define ArrayListSetChar(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, char) +#define ArrayListSetShort(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, short) +#define ArrayListSetInt(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, int) +#define ArrayListSetLong(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, long) +#define ArrayListSetFloat(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, float) +#define ArrayListSetDouble(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, double) +#define ArrayListSetLgIndex(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, LgIndex_t) +#define ArrayListSetEntIndex(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, EntIndex_t) +#define ArrayListSetSmInteger(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, SmInteger_t) +#define ArrayListSetBoolean(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, Boolean_t) +#define ArrayListSetArbParam(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, ArbParam_t) +#define ArrayListSetUnsignedCharPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned char *) +#define ArrayListSetUnsignedShortPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned short *) +#define ArrayListSetUnsignedIntPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned int *) +#define ArrayListSetUnsignedLongPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned long *) +#define ArrayListSetInt64Ptr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, Int64_t *) +#define ArrayListSetCharPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, char *) +#define ArrayListSetShortPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, short *) +#define ArrayListSetIntPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, int *) +#define ArrayListSetLongPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, long *) +#define ArrayListSetFloatPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, float *) +#define ArrayListSetDoublePtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, double *) +#define ArrayListSetLgIndexPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, LgIndex_t *) +#define ArrayListSetEntIndexPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, EntIndex_t *) +#define ArrayListSetSmIntegerPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, SmInteger_t *) +#define ArrayListSetBooleanPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, Boolean_t *) +#define ArrayListSetArbParamPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, ArbParam_t *) +#define ArrayListSetVoidPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, void *) +#define ArrayListSetFunctionPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, (**)(void)) + +#define ArrayListAppendUnsignedChar(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned char) +#define ArrayListAppendUnsignedShort(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned short) +#define ArrayListAppendUnsignedInt(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned int) +#define ArrayListAppendUnsignedLong(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned long) +#define ArrayListAppendInt64(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, Int64_t) +#define ArrayListAppendChar(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, char) +#define ArrayListAppendShort(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, short) +#define ArrayListAppendInt(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, int) +#define ArrayListAppendLong(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, long) +#define ArrayListAppendFloat(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, float) +#define ArrayListAppendDouble(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, double) +#define ArrayListAppendLgIndex(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, LgIndex_t) +#define ArrayListAppendEntIndex(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, EntIndex_t) +#define ArrayListAppendSmInteger(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, SmInteger_t) +#define ArrayListAppendBoolean(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, Boolean_t) +#define ArrayListAppendArbParam(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, ArbParam_t) +#define ArrayListAppendUnsignedCharPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned char *) +#define ArrayListAppendUnsignedShortPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned short *) +#define ArrayListAppendUnsignedIntPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned int *) +#define ArrayListAppendUnsignedLongPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned long *) +#define ArrayListAppendInt64Ptr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, Int64_t *) +#define ArrayListAppendCharPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, char *) +#define ArrayListAppendShortPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, short *) +#define ArrayListAppendIntPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, int *) +#define ArrayListAppendLongPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, long *) +#define ArrayListAppendFloatPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, float *) +#define ArrayListAppendDoublePtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, double *) +#define ArrayListAppendLgIndexPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, LgIndex_t *) +#define ArrayListAppendEntIndexPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, EntIndex_t *) +#define ArrayListAppendSmIntegerPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, SmInteger_t *) +#define ArrayListAppendBooleanPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, Boolean_t *) +#define ArrayListAppendArbParamPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, ArbParam_t *) +#define ArrayListAppendVoidPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, void *) +#define ArrayListAppendFunctionPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, (**)(void)) + +#endif /* ARRLIST_h */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/AUXDATA.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/AUXDATA.h new file mode 100644 index 0000000000000000000000000000000000000000..27c4747a3d2867dce50e248e3b06d0acc407943a --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/AUXDATA.h @@ -0,0 +1,130 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* + ***************************************************************** + ***************************************************************** + ******* ******** + ****** Copyright (C) 1988-2008 Tecplot, Inc. ******* + ******* ******** + ***************************************************************** + ***************************************************************** + */ +#if !defined AUXDATA_h +#define AUXDATA_h + +#if defined EXTERN +# undef EXTERN +#endif +#if defined AUXDATAMODULE +# define EXTERN +#else +# define EXTERN extern +#endif + +/** + */ +EXTERN Boolean_t AuxDataIsValidNameChar(char Char, + Boolean_t IsLeadChar); +/** + */ +EXTERN Boolean_t AuxDataIsValidName(const char *Name); + +/** + */ +EXTERN AuxData_pa AuxDataAlloc(void); + +/** + */ +EXTERN void AuxDataDealloc(AuxData_pa *AuxData); + +/** + */ +EXTERN Boolean_t AuxDataItemDestructor(void *ItemRef, + ArbParam_t ClientData); +/** + */ +EXTERN AuxData_pa AuxDataCopy(AuxData_pa AuxData, + Boolean_t ConsiderRetain); + +/** + */ +EXTERN LgIndex_t AuxDataGetNumItems(AuxData_pa AuxData); + +/** + */ +EXTERN Boolean_t AuxDataGetItemIndex(AuxData_pa AuxData, + const char *Name, + LgIndex_t *ItemIndex); +/** + */ +EXTERN void AuxDataGetItemByIndex(AuxData_pa AuxData, + LgIndex_t Index, + const char **Name, + ArbParam_t *Value, + AuxDataType_e *Type, + Boolean_t *Retain); + +/** + */ +EXTERN Boolean_t AuxDataGetItemByName(AuxData_pa AuxData, + const char *Name, + ArbParam_t *Value, + AuxDataType_e *Type, + Boolean_t *Retain); + +/** + */ +EXTERN Boolean_t AuxDataGetBooleanItemByName(AuxData_pa AuxData, + const char *Name, + Boolean_t *Value, + AuxDataType_e *Type, + Boolean_t *Retain); + +/** + */ +EXTERN Boolean_t AuxDataSetItem(AuxData_pa AuxData, + const char *Name, + ArbParam_t Value, + AuxDataType_e Type, + Boolean_t Retain); + +/** + */ +EXTERN Boolean_t AuxDataDeleteItemByName(AuxData_pa AuxData, + const char *Name); + +/** + */ +EXTERN Boolean_t AuxDataAppendItems(AuxData_pa TargetAuxData, + AuxData_pa SourceAuxData); +/** + */ +EXTERN void AuxDataDeleteItemByIndex(AuxData_pa AuxData, + LgIndex_t Index); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + +#endif /* !defined AUXDATA_h */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO.h new file mode 100644 index 0000000000000000000000000000000000000000..c57df19edd93eadabe8fa3138f110ab9411121a4 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO.h @@ -0,0 +1,63 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#if defined EXTERN +#undef EXTERN +#endif +#if defined DATAIOMODULE +#define EXTERN +#else +#define EXTERN extern +#endif + +EXTERN Boolean_t OpenBinaryFileAndCheckMagicNumber(FileStream_s **FileStream, + char *FName, + FileOffset_t StartOffset, + short *IVersion); + +EXTERN Boolean_t ReadDataFileHeader(FileStream_s *FileStream, + short IVersion, + Boolean_t ShowDataIOStatus, + EntIndex_t *NumZones, + EntIndex_t *NumVars, + SmInteger_t *NumCustomLabelSets, + char **DataSetTitle, + Text_s **BaseText, + Geom_s **BaseGeom, + StringList_pa **CustomLabelBase, + StringList_pa *UserRec, + AuxData_pa *DataSetAuxData, + Set_pa **IsVarCellCentered, + Boolean_t *HasText, + Boolean_t *HasGeoms, + ArrayList_pa *ZoneSpecList, + StringList_pa *VarNames, + ArrayList_pa *VarAuxDataList, /*<AuxData_pa>[NumVars]*/ + Set_pa *IsRawFNAvailable, /* classic data only */ + LgIndex_t **FNNumBndryConns, /* classic data only */ + DataFileType_e *FileType); + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO4.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO4.h new file mode 100644 index 0000000000000000000000000000000000000000..7e97dc98f646954e43808fccab76f31488ee2db0 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO4.h @@ -0,0 +1,213 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#ifndef DATAIO4_H +#define DATAIO4_H +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +#include <set> + +#if defined EXTERN +#undef EXTERN +#endif +#if defined DATAIO4MODULE +#define EXTERN +#else +#define EXTERN extern +#endif + +EXTERN double GetNextValue(FileStream_s *FileStream, + FieldDataType_e FieldDataType, + double Min, + double Max, + Boolean_t *IsOk); +EXTERN LgIndex_t GetNextI(FileStream_s *FileStream, + Boolean_t *IsOk); +EXTERN LgIndex_t GetIoFileInt(FileStream_s *FileStream, + short Version, + LgIndex_t Min, + LgIndex_t Max, + Boolean_t *IsOk); +EXTERN Boolean_t ReadInString(FileStream_s *FileStream, + short IVersion, + int MaxCharacters, + char **S, + Boolean_t ProcessData); +EXTERN void ReadByteBlock(FileStream_s *FileStream, + Boolean_t DoRead, + Byte_t *Buffer, + HgIndex_t StartIndex, + HgIndex_t NumValues, + Boolean_t *IsOk); +EXTERN void ReadInt16Block(FileStream_s *FileStream, + Boolean_t DoRead, + Int16_t *Buffer, + HgIndex_t StartIndex, + HgIndex_t NumValues, + Boolean_t *IsOk); +EXTERN void ReadInt16BlockToInt32(FileStream_s *FileStream, + Boolean_t DoRead, + Int32_t *Buffer, + HgIndex_t StartIndex, + HgIndex_t NumValues, + Boolean_t *IsOk); +EXTERN void ReadInt32Block(FileStream_s *FileStream, + Boolean_t DoRead, + Int32_t *Buffer, + HgIndex_t StartIndex, + HgIndex_t NumValues, + Boolean_t *IsOk); +EXTERN void ReadPureBlock(FileStream_s *FileStream, + Boolean_t DoRead, + void *Buffer, + FieldDataType_e FieldDataType, + HgIndex_t StartIndex, + HgIndex_t NumValues, + Boolean_t *IsOk); +EXTERN void ReadBlock(FileStream_s *FileStream, + FieldData_pa FieldData, + Boolean_t DoRead, + FieldDataType_e FieldDataTypeInFile, + HgIndex_t StartIndex, + HgIndex_t EndIndex, + Boolean_t *IsOk); +EXTERN void ReadClassicOrderedCCBlock(FileStream_s *DataFileStream, + FieldData_pa FieldData, + FieldDataType_e FieldDataTypeInFile, + LgIndex_t NumIPtsInFile, + LgIndex_t NumJPtsInFile, + LgIndex_t NumKPtsInFile, + Boolean_t *IsOk); +EXTERN Boolean_t ReadInDataFileTypeTitleAndVarNames(FileStream_s *FileStream, + short IVersion, + char **DataSetTitle, + DataFileType_e *FileType, + int *NumVars, + StringList_pa *VarNames); +EXTERN Boolean_t ReadInZoneHeader(FileStream_s *FileStream, + short IVersion, + ZoneSpec_s *ZoneSpec, + Set_pa IsVarCellCentered, + EntIndex_t NumVars, + Boolean_t *IsRawFNAvailable, + LgIndex_t *FNNumBndryConns); +EXTERN Boolean_t ReadInCustomLabels(FileStream_s *FileStream, + short IVersion, + Boolean_t OkToLoad, + StringList_pa *CustomLabelBase); +EXTERN Boolean_t ReadInUserRec(FileStream_s *FileStream, + short IVersion, + int MaxCharactersAllowed, + char **UserRec); +EXTERN Boolean_t ReadInAuxData(FileStream_s *FileStream, + short IVersion, + AuxData_pa AuxData); +EXTERN Boolean_t ReadInGeometry(FileStream_s *FileStream, + short IVersion, + Boolean_t OkToLoad, + Geom_s *G, + LgIndex_t MaxDataPts); +EXTERN Boolean_t ReadInText(FileStream_s *FileStream, + short IVersion, + Boolean_t OkToLoad, + Text_s *T, + LgIndex_t MaxTextLen); +/* + * STDCALL since PreplotAsciiDatafile is sent to RegisterDataSetReader + * which can also be used by addons. + */ +EXTERN Boolean_t STDCALL PreplotAsciiDatafile(char *CurFName, + char *BinaryFName, + char **MessageString); +EXTERN short GetInputVersion(FileStream_s *FileStream); + +EXTERN Boolean_t WriteBinaryInt16BlockUnaligned(FileStream_s *FileStream, + Byte_t *Int16Values, + HgIndex_t NumValues, + Boolean_t ValuesInNativeOrdering); +EXTERN Boolean_t WriteBinaryInt32BlockUnaligned(FileStream_s *FileStream, + Byte_t *Int32Values, + HgIndex_t NumValues, + Boolean_t ValuesInNativeOrdering); +EXTERN Boolean_t WriteBinaryByteBlock(FileStream_s *FileStream, + const Byte_t *ByteValues, + const HgIndex_t NumValues); +EXTERN Boolean_t WriteBinaryInt16(FileStream_s *FileStream, + Int16_t Value); +EXTERN Boolean_t WriteBinaryInt32(FileStream_s *FileStream, + Int32_t Value); +EXTERN Boolean_t WriteBinaryReal(FileStream_s *FileStream, + double RR, + FieldDataType_e FieldDataType); +EXTERN Boolean_t WriteFieldDataType(FileStream_s *FileStream, + FieldDataType_e FDT, + Boolean_t WriteBinary); +EXTERN Boolean_t WriteBinaryFieldDataBlock(FileStream_s *FileStream, + FieldData_pa D, + LgIndex_t StartI, + LgIndex_t NumValues); +EXTERN Boolean_t WriteCCFieldDataBlock(FileStream_s *FileStream, + FieldData_pa FieldData, + Boolean_t IsOrderedData, + LgIndex_t NumIPts, + LgIndex_t NumJPts, + LgIndex_t NumKPts, + Boolean_t WriteBinary, + SmInteger_t AsciiPrecision); +EXTERN Boolean_t DumpDatafileString(FileStream_s *FileStream, + const char *S, + Boolean_t WriteBinary); +bool DumpGeometry(FileStream_s* FileStream, + Geom_s const* Geom, + Boolean_t WriteBinary, + Boolean_t WriteGridDataAsPolar); +bool DumpText(FileStream_s* FileStream, + Text_s const* Text, + Boolean_t WriteBinary, + Boolean_t WriteGridDataAsPolar); +EXTERN Boolean_t DumpCustomAxisLabels(FileStream_s *FileStream, + Boolean_t WriteBinary, + StringList_pa LabelBase); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +EXTERN Boolean_t WriteBinaryMagic(FileStream_s *FileStream); + +bool writeBinaryVersionNumber(FileStream_s& fileStream, + int versionNumber); + +#endif //DATAIO4_H diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET.h new file mode 100644 index 0000000000000000000000000000000000000000..89cc27ff9c313daa8c6d0dd960afed66a09e91e4 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET.h @@ -0,0 +1,90 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#ifndef DATASET_h__ +#define DATASET_h__ + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + + +/* + * DataSet functions involving zones, vars and the + * DataSet_s structure. See dataset0.c for low level + * dataset functions and dataset2 for higher level + * functions. + */ + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined USE_MACROS_FOR_FUNCTIONS +#else +#endif +#endif /* TECPLOTKERNEL */ + +Boolean_t FieldDataItemDestructor(void *ItemRef, + ArbParam_t ClientData); +Boolean_t ZoneSpecItemDestructor(void *ItemRef, + ArbParam_t ClientData); +LgIndex_t ZoneOrVarListAdjustCapacityRequest(ArrayList_pa ZoneOrVarArrayList, + LgIndex_t CurrentCapacity, + LgIndex_t RequestedCapacity, + ArbParam_t ClientData); +void CleanoutZoneSpec(ZoneSpec_s *ZoneSpec); +void ZoneSpecExcludeBndryConnsFromMetrics(ZoneSpec_s* ZoneSpec); +ZoneSpec_s *ZoneSpecAlloc(void); +void ZoneSpecDealloc(ZoneSpec_s **ZoneSpec); +void SetZoneSpecDefaults(ZoneSpec_s *ZoneSpec); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined USE_MACROS_FOR_FUNCTIONS +#else +#endif +#endif + +#define GetZoneSpec(ZoneSpecList,Zone) ((ZoneSpec_s *)ArrayListGetVoidPtr(ZoneSpecList,Zone)) +#define GetZoneAuxData(DataSet, Zone) (GetZoneSpec((DataSet)->ZoneSpecList, (Zone))->AuxData) +#define GetVarSpec(VarSpecList,Var) ((VarSpec_s *)ArrayListGetVoidPtr(VarSpecList,Var)) +#define GetVarAuxData(DataSet, Var) (GetVarSpec((DataSet)->VarSpecList, (Var))->AuxData) +#define GetStrandInfo(StrandInfoList, StrandID) ((StrandInfo_s *)ArrayListGetVoidPtr(StrandInfoList,StrandID)) + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* defined TECPLOTKERNEL */ + +#endif // DATASET_h__ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET0.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET0.h new file mode 100644 index 0000000000000000000000000000000000000000..ee33773f304c8480d263c751482bf130359e58f0 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET0.h @@ -0,0 +1,404 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#if defined EXTERN +#undef EXTERN +#endif +#if defined DATASET0MODULE +#define EXTERN +#else +#define EXTERN extern +#endif + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +namespace tecplot +{ +namespace io +{ +class File; +} +} + +EXTERN void OutOfMemoryMsg(void); + +/* + * Turn on DEBUG_FIELDVALUES by default in any build with assertions on + * (including checked builds), but allow turning this off with + * NO_DEBUG_FIELDVALUES + */ +#if !defined NO_ASSERTS && !defined NO_DEBUG_FIELDVALUES && !defined DEBUG_FIELDVALUES +#define DEBUG_FIELDVALUES +#endif + +/* FieldData_a is intentionally not defined to further + * deter usage of this private structure */ +struct _FieldData_a +{ + void *Data; /* ...placed first in the structure for fastest access */ +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# else + void *GetValueCallback[1]; /* ...this field is for TecIO only */ + void *SetValueCallback[1]; /* ...this field is for TecIO only */ +# endif + + /* PRIVATE */ + FieldDataType_e Type; + ValueLocation_e ValueLocation; + LgIndex_t RefCount; + LgIndex_t VarShareRefCount; + LgIndex_t NumValues; +# if defined TECPLOTKERNEL /* TecIO doesn't require these features yet. */ +/* CORE SOURCE CODE REMOVED */ +# endif +}; + + +/* * + * * NOTE: "FieldData_pa" here is an "abstract type". + * * Any routines dealing with the internals workings + * * of FieldData_pa must be in the same file as these + * * routines + * */ + +#if defined USE_MACROS_FOR_FUNCTIONS +#define USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +#endif + +/* + * These are low-level (private) FD manipulation functions. In + * most cases, you should use some higher-level function. These + * macros are supplied for the dataset functions to use. + */ +#if defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +#define GetFieldDataType GetFieldDataType_MACRO +#define GetFieldDataGetFunction GetFieldDataGetFunction_MACRO +#define GetFieldDataSetFunction GetFieldDataSetFunction_MACRO +#define GetFieldDataNumValues GetFieldDataNumValues_MACRO +#define GetFieldDataValueLocation GetFieldDataValueLocation_MACRO +#define IsFieldDataDirectAccessAllowed IsFieldDataDirectAccessAllowed_MACRO +#else +#define GetFieldDataType GetFieldDataType_FUNC +#define GetFieldDataGetFunction GetFieldDataGetFunction_FUNC +#define GetFieldDataSetFunction GetFieldDataSetFunction_FUNC +#define GetFieldDataNumValues GetFieldDataNumValues_FUNC +#define GetFieldDataValueLocation GetFieldDataValueLocation_FUNC +#define IsFieldDataDirectAccessAllowed IsFieldDataDirectAccessAllowed_FUNC +#endif + +#define GetFieldDataType_MACRO(FieldData) ((FieldData)->Type) +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else /* ...for TecIO only */ +#define GetFieldDataGetFunction_MACRO(FieldData) ((FieldValueGetFunction_pf)(FieldData)->GetValueCallback[0]) +#define GetFieldDataSetFunction_MACRO(FieldData) ((FieldValueSetFunction_pf)(FieldData)->SetValueCallback[0]) +#endif +#define GetFieldDataNumValues_MACRO(FieldData) ((FieldData)->NumValues) +#define GetFieldDataValueLocation_MACRO(FieldData) ((FieldData)->ValueLocation) + +EXTERN double STDCALL GetFieldValueForFloat(const FieldData_pa fd, LgIndex_t pt); +EXTERN double STDCALL GetFieldValueForDouble(const FieldData_pa fd, LgIndex_t pt); +EXTERN double STDCALL GetFieldValueForInt32(const FieldData_pa fd, LgIndex_t pt); +EXTERN double STDCALL GetFieldValueForInt16(const FieldData_pa fd, LgIndex_t pt); +EXTERN double STDCALL GetFieldValueForByte(const FieldData_pa fd, LgIndex_t pt); +EXTERN double STDCALL GetFieldValueForBit(const FieldData_pa fd, LgIndex_t pt); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else +#define IsFieldDataDirectAccessAllowed_MACRO(FieldData) ((FieldData)->Data != NULL) +#endif + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +EXTERN FieldDataType_e GetFieldDataType_FUNC(FieldData_pa FieldData); +EXTERN FieldValueGetFunction_pf GetFieldDataGetFunction_FUNC(FieldData_pa FieldData); +EXTERN FieldValueSetFunction_pf GetFieldDataSetFunction_FUNC(FieldData_pa FieldData); +EXTERN LgIndex_t GetFieldDataNumValues_FUNC(FieldData_pa FieldData); +EXTERN ValueLocation_e GetFieldDataValueLocation_FUNC(FieldData_pa FieldData); +EXTERN Boolean_t IsFieldDataDirectAccessAllowed_FUNC(FieldData_pa FieldData); +#endif + + +/* + * Use separate types for reversed byte data than unreversed data so we + * have better compiler checking. + */ +typedef UInt32_t FloatRev_t; +typedef UInt64_t DoubleRev_t; +typedef UInt16_t Int16Rev_t; +typedef UInt32_t Int32Rev_t; +typedef UInt64_t Int64Rev_t; + + +/* + * Note: there are so many GetFieldData*Ptr functions because we + * want a bunch of error checking. The Type and TypeRev check + * for that type. The Byte, 2Byte, etc. just make sure it is + * that type. + * GetFieldDataVoidPtr checks nothing, and thus should only be + * used with extreme caution (that is, checking the alignment + * and byte order by hand). + */ +#if defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +#define GetFieldDataFloatPtr GetFieldDataFloatPtr_MACRO +#define GetFieldDataFloatRevPtr GetFieldDataFloatRevPtr_MACRO +#define GetFieldDataDoublePtr GetFieldDataDoublePtr_MACRO +#define GetFieldDataDoubleRevPtr GetFieldDataDoubleRevPtr_MACRO +#define GetFieldDataInt64Ptr GetFieldDataInt64Ptr_MACRO +#define GetFieldDataInt64RevPtr GetFieldDataInt64RevPtr_MACRO +#define GetFieldDataInt32Ptr GetFieldDataInt32Ptr_MACRO +#define GetFieldDataInt32RevPtr GetFieldDataInt32RevPtr_MACRO +#define GetFieldDataInt16Ptr GetFieldDataInt16Ptr_MACRO +#define GetFieldDataInt16RevPtr GetFieldDataInt16RevPtr_MACRO +#define GetFieldDataBytePtr GetFieldDataBytePtr_MACRO +#define GetFieldData2BytePtr GetFieldData2BytePtr_MACRO +#define GetFieldData4BytePtr GetFieldData4BytePtr_MACRO +#define GetFieldData8BytePtr GetFieldData8BytePtr_MACRO +#define GetFieldDataVoidPtr GetFieldDataVoidPtr_MACRO /*danger:see above*/ +#else +#define GetFieldDataFloatPtr GetFieldDataFloatPtr_FUNC +#define GetFieldDataFloatRevPtr GetFieldDataFloatRevPtr_FUNC +#define GetFieldDataDoublePtr GetFieldDataDoublePtr_FUNC +#define GetFieldDataDoubleRevPtr GetFieldDataDoubleRevPtr_FUNC +#define GetFieldDataInt64Ptr GetFieldDataInt64Ptr_FUNC +#define GetFieldDataInt64RevPtr GetFieldDataInt64RevPtr_FUNC +#define GetFieldDataInt32Ptr GetFieldDataInt32Ptr_FUNC +#define GetFieldDataInt32RevPtr GetFieldDataInt32RevPtr_FUNC +#define GetFieldDataInt16Ptr GetFieldDataInt16Ptr_FUNC +#define GetFieldDataInt16RevPtr GetFieldDataInt16RevPtr_FUNC +#define GetFieldDataBytePtr GetFieldDataBytePtr_FUNC +#define GetFieldData2BytePtr GetFieldData2BytePtr_FUNC +#define GetFieldData4BytePtr GetFieldData4BytePtr_FUNC +#define GetFieldData8BytePtr GetFieldData8BytePtr_FUNC +#define GetFieldDataVoidPtr GetFieldDataVoidPtr_FUNC /*danger:see above*/ +#endif + +#define GetFieldDataFloatPtr_MACRO(FieldData) ((float *)((FieldData)->Data)) +#define GetFieldDataFloatRevPtr_MACRO(FieldData) ((FloatRev_t *)((FieldData)->Data)) +#define GetFieldDataDoublePtr_MACRO(FieldData) ((double *)((FieldData)->Data)) +#define GetFieldDataDoubleRevPtr_MACRO(FieldData) ((DoubleRev_t *)((FieldData)->Data)) +#define GetFieldDataInt64Ptr_MACRO(FieldData) ((Int64_t *)((FieldData)->Data)) +#define GetFieldDataInt64RevPtr_MACRO(FieldData) ((Int64Rev_t *)((FieldData)->Data)) +#define GetFieldDataInt32Ptr_MACRO(FieldData) ((Int32_t *)((FieldData)->Data)) +#define GetFieldDataInt32RevPtr_MACRO(FieldData) ((Int32Rev_t *)((FieldData)->Data)) +#define GetFieldDataInt16Ptr_MACRO(FieldData) ((Int16_t *)((FieldData)->Data)) +#define GetFieldDataInt16RevPtr_MACRO(FieldData) ((Int16Rev_t *)((FieldData)->Data)) +#define GetFieldDataBytePtr_MACRO(FieldData) ((Byte_t *)((FieldData)->Data)) +#define GetFieldData2BytePtr_MACRO(FieldData) ((UInt16_t *)((FieldData)->Data)) +#define GetFieldData4BytePtr_MACRO(FieldData) ((UInt32_t *)((FieldData)->Data)) +#define GetFieldData8BytePtr_MACRO(FieldData) ((UInt64_t *)((FieldData)->Data)) +#define GetFieldDataVoidPtr_MACRO(FieldData) ((void *)((FieldData)->Data)) /*danger:see above*/ + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +EXTERN float *GetFieldDataFloatPtr_FUNC(FieldData_pa fd); +EXTERN FloatRev_t *GetFieldDataFloatRevPtr_FUNC(FieldData_pa fd); +EXTERN double *GetFieldDataDoublePtr_FUNC(FieldData_pa fd); +EXTERN DoubleRev_t *GetFieldDataDoubleRevPtr_FUNC(FieldData_pa fd); +EXTERN Int64_t *GetFieldDataInt64Ptr_FUNC(FieldData_pa fd); +EXTERN Int64Rev_t *GetFieldDataInt64RevPtr_FUNC(FieldData_pa fd); +EXTERN Int32_t *GetFieldDataInt32Ptr_FUNC(FieldData_pa fd); +EXTERN Int32Rev_t *GetFieldDataInt32RevPtr_FUNC(FieldData_pa fd); +EXTERN Int16_t *GetFieldDataInt16Ptr_FUNC(FieldData_pa fd); +EXTERN Int16Rev_t *GetFieldDataInt16RevPtr_FUNC(FieldData_pa fd); +EXTERN Byte_t *GetFieldDataBytePtr_FUNC(FieldData_pa fd); +EXTERN UInt16_t *GetFieldData2BytePtr_FUNC(FieldData_pa fd); +EXTERN UInt32_t *GetFieldData4BytePtr_FUNC(FieldData_pa fd); +EXTERN UInt64_t *GetFieldData8BytePtr_FUNC(FieldData_pa fd); +EXTERN void *GetFieldDataVoidPtr_FUNC(FieldData_pa fd); /*danger:see above*/ +#endif + +/** + */ +EXTERN FieldData_pa AllocScratchNodalFieldDataPtr(LgIndex_t NumValues, + FieldDataType_e Type, + Boolean_t ShowErrMsg); + +/** + */ +EXTERN void DeallocScratchNodalFieldDataPtr(FieldData_pa *ScratchFieldData); + +/** + * Assume that indexrange has already been converted to the actual indices. + */ +EXTERN void CalcFieldDataMinMaxUsingRange(FieldData_pa field_data, + double *min_ptr, + double *max_ptr, + LgIndex_t startindex, + IndexRange_s *indexrange); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +/** + */ +EXTERN void CopyTypedValueArray(FieldDataType_e ValueType, + void *DstArray, + LgIndex_t DstStart, + void *SrcArray, + LgIndex_t SrcStart, + LgIndex_t SrcEnd); + +EXTERN void SwapBytesInTypedValueArray(FieldDataType_e ValueType, + void *SrcArray, + LgIndex_t SrcStart, + LgIndex_t SrcEnd, + LgIndex_t SrcSkip); + +EXTERN void SwapBytesInUnalignedTypedValueArray(FieldDataType_e ValueType, + void *SrcArray, + LgIndex_t SrcStart, + LgIndex_t SrcEnd, + LgIndex_t SrcSkip); + + +/* + * Copies values from "src" to "dst". "src" or "dst" may + * be differing types. Either or both may be V3D data pointers. + */ +EXTERN void CopyFieldDataRange(FieldData_pa dst, + LgIndex_t dst_start, + FieldData_pa src, + LgIndex_t src_start, + LgIndex_t src_end); /* -1 means last point */ + +/* + * Copy all values in field data + */ +EXTERN void CopyFieldData(FieldData_pa dst, + FieldData_pa src); + +/* + * Like CopyFieldData except for single value. + */ +EXTERN void CopyFieldValue(FieldData_pa dst, + LgIndex_t dstindex, + FieldData_pa src, + LgIndex_t srcindex); + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +/* + * Sets all values in the field data pointer "field_data" + * to zero. + */ +EXTERN void SetFieldDataPtrToAllZeros(FieldData_pa field_data); + +/* + * GetFieldValue macro + */ +#if !defined GET_FIELD_VALUE_BY_VIRTUAL_FUNCTION && \ + !defined GET_FIELD_VALUE_BY_FLOAT_ONLY_MACRO && \ + !defined GET_FIELD_VALUE_BY_DOUBLE_ONLY_MACRO && \ + !defined GET_FIELD_VALUE_BY_FLOAT_AND_DOUBLE_MACRO +#if !defined NO_ASSERTS || defined DEBUG_FIELDVALUES +#define GET_FIELD_VALUE_BY_VIRTUAL_FUNCTION +#else +#define GET_FIELD_VALUE_BY_FLOAT_AND_DOUBLE_MACRO +#endif +#endif + +#if defined GET_FIELD_VALUE_BY_VIRTUAL_FUNCTION +#define GetFieldValue(fd,pt) ((GetFieldDataGetFunction(fd))((fd),(pt))) +#elif defined GET_FIELD_VALUE_BY_FLOAT_ONLY_MACRO +#define GetFieldValue(fd,pt) (GetFieldDataGetFunction(fd)==GetFieldValueForFloat \ + ?GetFieldDataFloatPtr(fd)[(pt)] \ + :(GetFieldDataGetFunction(fd))((fd),(pt))) +#elif defined GET_FIELD_VALUE_BY_DOUBLE_ONLY_MACRO +#define GetFieldValue(fd,pt) (GetFieldDataGetFunction(fd)==GetFieldValueForDouble \ + ?GetFieldDataDoublePtr(fd)[(pt)] \ + :(GetFieldDataGetFunction(fd))((fd),(pt))) +#elif defined GET_FIELD_VALUE_BY_FLOAT_AND_DOUBLE_MACRO +#define GetFieldValue(fd,pt) (GetFieldDataGetFunction(fd)==GetFieldValueForFloat \ + ?GetFieldDataFloatPtr(fd)[(pt)] \ + :GetFieldDataGetFunction(fd)==GetFieldValueForDouble \ + ?GetFieldDataDoublePtr(fd)[(pt)] \ + :(GetFieldDataGetFunction(fd))((fd),(pt))) +#else +#error "Need to define one of FIELD_VALUE_MACRO constants" +#endif + + +/* + * SetFieldValue macro + */ +#define SetFieldValue(fd,pt,val) ((GetFieldDataSetFunction(fd))((fd),(pt),(val))) + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + +#if defined _DEBUG +#define USEFUNCTIONSFORNODEVALUES +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined NO_ASSERTS +#endif +#endif /* TECPLOTKERNEL */ + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASHR.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASHR.h new file mode 100644 index 0000000000000000000000000000000000000000..ea8b1d26d20f7f8df627e654f5248d48fac18c5e --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASHR.h @@ -0,0 +1,70 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#if defined EXTERN +#undef EXTERN +#endif +#if defined DATASHRMODULE +#define EXTERN +#else +#define EXTERN extern +#endif + +/* +***************************************************************** +***************************************************************** +******* ******** +****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +***************************************************************** +***************************************************************** +*/ + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + +/* + * General set of macros for reference count mananagement. + */ +#define IncStructureReference(V) ((V)->RefCount++) +#define DecStructureReference(V) ((V)->RefCount--) +#define IsStructureShared(V) ((V)->RefCount > 1) +#define IsStructureReferenced(V) ((V)->RefCount > 0) + +/* + * Special set of macros for field data that is having variable sharing between + * zones tracked. Field data maintains two reference counts: The first, + * RefCount, is used to keep track of when the field data needs to be + * deallocated; the second, VarShareRefCount, is used to track variable sharing + * between zones. + */ +#define IncVarStructureReference(V) ((V)->VarShareRefCount++) +#define DecVarStructureReference(V) ((V)->VarShareRefCount--) +#define IsVarStructureShared(V) ((V)->VarShareRefCount > 1) +#define IsVarStructureReferenced(V) ((V)->VarShareRefCount > 0) + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAUTIL.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAUTIL.h new file mode 100644 index 0000000000000000000000000000000000000000..cf0195fffc2381dfea21df155b1e7f558d163335 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAUTIL.h @@ -0,0 +1,116 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* + * DATAUTIL.h : COPYRIGHT (C)1987-2002 Tecplot, Inc. + * ALL RIGHTS RESERVED + * + * NOTE: THIS MODULE NOW IS PART OF THE TECPLOT SOURCE + * ONLY EDIT THIS IN THE MAIN TECPLOT SOURCE DIRECTORY. + * + * + */ +#ifndef DATAUTIL_H +#define DATAUTIL_H +#define DATAUTIL_VERSION 61 + +#if defined MAKEARCHIVE +extern void InitInputSpecs(void); +#endif + + +/* + * + * Read a binary tecplot datafile. + * + * @param GetHeaderInfoOnly + * Return only the header info from the datafile. + * + * @param FName + * Name of the file to read. + * + * @param IVersion + * Returns version of the input file. + * + * @param DataSetTitle + * Allocates space for and returns dataset title. + * + * @param NumZones + * Returns the number of zones. + * + * @param NumVars + * Returns the number of variables. + * + * @param VarNames + * Allocates space for and returns the var names. + * + * @param ZoneNames + * Allocates space for and returns the zone names. + * + * @param NumPtsI, NumPtsJ, NumPtsK + * Zone dimensions loaded into LgIndex_t arrays. + * + * @param ZoneNames + * Zone types loaded into ZoneType_e array. + * + * @param UserRec + * Allocates space for and returns the user records. + * + * @param RawDataspaceAllocated + * Only used if GetHeaderInfoOnly is FALSE. TRUE = calling program has alloced space for + * the raw data. FALSE= let ReadTec allocate space for the raw data. + * + * @param NodeMap + * Finite Element connectivity information. ReadTec + * will allocate the space for you if RawDataspaceAllocated is FALSE. + * + * @param VDataBase + * Raw field data loaded into double arrays. ReadTec + * will allocate the space for you if RawDataspaceAllocated is + * FALSE. If RawDataspaceAllocated is TRUE then ReadTec will + * only load the arrays that have non NULL addresses. + * + */ +LIBFUNCTION Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly, + char *FName, + short *IVersion, + char **DataSetTitle, + EntIndex_t *NumZones, + EntIndex_t *NumVars, + StringList_pa *VarNames, + StringList_pa *ZoneNames, + LgIndex_t **NumPtsI, + LgIndex_t **NumPtsJ, + LgIndex_t **NumPtsK, + ZoneType_e **ZoneType, + StringList_pa *UserRec, + Boolean_t RawDataspaceAllocated, + NodeMap_t ***NodeMap, + double ***VDataBase); + +LIBFUNCTION void * STDCALL TecAlloc(size_t size); + +LIBFUNCTION void STDCALL TecFree(void *ptr); + + +#endif /* !DATAUTIL_H */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FACE.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FACE.h new file mode 100644 index 0000000000000000000000000000000000000000..c0c89a9b432872f32760eb47191dc162c18af7df --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FACE.h @@ -0,0 +1,149 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ +#ifndef _FACE_H_ +#define _FACE_H_ + +#if defined EXTERN +#undef EXTERN +#endif +#if defined FACEMODULE +#define EXTERN +#else +#define EXTERN extern +#endif + +namespace tecplot +{ +namespace kernel +{ +class SubElemValueProducerInterface; +} +} + + +/** + */ +inline Boolean_t IsCellFaceLogicallyCollapsed(LgIndex_t I1, + LgIndex_t I2, + LgIndex_t I3, + LgIndex_t I4) +{ + return ((I1 == I2 && I3 == I4) || + (I1 == I4 && I2 == I3) || + (I1 == I3) || + (I2 == I4)); +} + +/** + * IMPORTANT NOTE: + * A face obscuration of FaceObscuration_LogicallyObscured means that the + * face is entirely obscured by either an implicit neighbor for inside faces + * of ordered data or an auto generated neighbor for finite element data. In + * either case, logical obscuration is not considered if user defined + * neighbors have been specified for the face. Therefore, interior faces of + * ordered data can have an indication of FaceObscuration_PartiallyObscured. + */ +typedef enum +{ + FaceObscuration_NotObscured, + FaceObscuration_PartiallyObscured, + FaceObscuration_EntirelyObscured, + FaceObscuration_LogicallyObscured, + END_FaceObscuration_e, + FaceObscuration_Invalid = BadEnumValue +} FaceObscuration_e; + +/** + */ +EXTERN LgIndex_t GetLogicalOrderedNeighbor(LgIndex_t NumIPts, + LgIndex_t NumJPts, + LgIndex_t NumKPts, + LgIndex_t Element, + LgIndex_t Face); + +/** + * Function to determine a cell's neighbor. It calls FaceNeighborGetSurfaceCellNeighbor() + * for classic zones. + */ +EXTERN void GetSurfaceCellNeighbor(CZInfo_s const* CZInfo, + CZData_s const* CZData, + LgIndex_t SurfaceCellIndex, + tecplot::kernel::SubElemValueProducerInterface* NodeValueProducer, + ElemFaceOffset_t PlaneOrFaceOffset, + ElemFaceOffset_t Edge, + LgIndex_t* NeighborSurfaceCellElem, + EntIndex_t* NeighborSurfaceCellZone); +/** + */ +EXTERN FaceObscuration_e GetFaceObscuration(CZInfo_s const* CZInfo, + CZData_s const* CZData, + Set_pa ActiveRelevantZones, + LgIndex_t Element, + LgIndex_t FOffset, + Boolean_t ConsiderValueBlanking, + Boolean_t ConsiderIJKBlanking, + Boolean_t ConsiderDepthBlanking); + +EXTERN EntIndex_t GetNodesPerElementFace(ZoneType_e ZoneType); + +EXTERN EntIndex_t GetFacesPerElement(ZoneType_e ZoneType, + LgIndex_t IMax, + LgIndex_t JMax, + LgIndex_t KMax); + +EXTERN CollapsedStatus_e GetSurfaceCellCollapsedStatus(CZInfo_s const* CZInfo, + CZData_s const* CZData, + tecplot::kernel::SubElemValueProducerInterface* SubElemValueProducer); +EXTERN CollapsedStatus_e GetSurfaceCellCollapsedStatus(CZInfo_s const* CZInfo, + CZData_s const* CZData, + LgIndex_t I1, + LgIndex_t I2, + LgIndex_t I3, + LgIndex_t I4); +EXTERN CollapsedStatus_e GetSurfaceCellLogicalCollapsedStatus(ZoneType_e ZoneType, + LgIndex_t I1, + LgIndex_t I2, + LgIndex_t I3, + LgIndex_t I4); +EXTERN CollapsedStatus_e GetSurfEdgeOrVolFaceLogicalCollapsedStatus(NodeMap_pa NodeMap, + LgIndex_t Element, + EntIndex_t Face); +#if defined ALLOW_USERDEF_NO_NEIGHBORING_ELEMENT +/** + */ +EXTERN Boolean_t IsUserDefFaceNeighborBoundary(FaceNeighbor_pa FaceNeighbor, + LgIndex_t Element, + LgIndex_t Face); +#endif + +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FILESTREAM.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FILESTREAM.h new file mode 100644 index 0000000000000000000000000000000000000000..edb10ce253204c3b8b8390df395b058ff5300246 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FILESTREAM.h @@ -0,0 +1,75 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* + ***************************************************************** + ***************************************************************** + ******* ******** + ****** Copyright (C) 1988-2008 Tecplot, Inc. ******* + ******* ******** + ***************************************************************** + ***************************************************************** +*/ +#if !defined FILESTREAM_h +#define FILESTREAM_h + +#if defined EXTERN +# undef EXTERN +#endif +#if defined FILESTREAMMODULE +# define EXTERN +#else +# define EXTERN extern +#endif + +typedef struct +{ + FILE *File; + Boolean_t IsByteOrderNative; +} FileStream_s; + +/** + * Creates a structure for associating an open file stream with its byte + * order. The byte order can changed at any time. + * + * @param File + * Handle to a file which can be NULL. + * @param IsByteOrderNative + * TRUE if the file's byte order is native, FALSE if foreign. + * + * @return + * An allocated structure associating an open file to its byte order. + */ +EXTERN FileStream_s *FileStreamAlloc(FILE *File, + Boolean_t IsByteOrderNative); + +/** + * Deallocates the structure associating the file stream with the byte order. + * This function does NOT close the file. + * + * @param FileStream + * Pointer to an open file stream or a pointer to NULL. + */ +EXTERN void FileStreamDealloc(FileStream_s **FileStream); + +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM.h new file mode 100644 index 0000000000000000000000000000000000000000..092b92dfd2d993fffc0f100936de22bf87651182 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM.h @@ -0,0 +1,71 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +***************************************************************** +***************************************************************** +******* ******** +****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +***************************************************************** +***************************************************************** +*/ + +#if defined EXTERN +#undef EXTERN +#endif +#if defined GEOMMODULE +#define EXTERN +#else +#define EXTERN extern +#endif + + +/* * macros for checking CoordSys_e * */ +#define VALID_RECTANGLE_COORDSYS(sys) \ + (((sys)==CoordSys_Frame) || \ + ((sys)==CoordSys_Grid)) +#define VALID_SQUARE_COORDSYS(sys) VALID_RECTANGLE_COORDSYS((sys)) +#define VALID_ELLIPSE_COORDSYS(sys) VALID_RECTANGLE_COORDSYS((sys)) +#define VALID_CIRCLE_COORDSYS(sys) VALID_ELLIPSE_COORDSYS((sys)) +#define VALID_IMAGE_COORDSYS(sys) VALID_RECTANGLE_COORDSYS((sys)) +#define VALID_LINESEG_COORDSYS(sys) \ + (((sys)==CoordSys_Frame) || \ + ((sys)==CoordSys_Grid) || \ + ((sys)==CoordSys_Grid3D)) +#define VALID_GEOM_COORDSYS(sys) \ + (((sys)==CoordSys_Frame) || \ + ((sys)==CoordSys_Grid) || \ + ((sys)==CoordSys_Grid3D)) + +#define VALID_GEOM_TYPE(geomtype) \ + ( VALID_ENUM((geomtype),GeomType_e) && \ + (geomtype)!=GeomType_LineSegs3D ) + +#define VALID_GEOM_FIELD_DATA_TYPE(datatype) \ + ( ( (datatype) == FieldDataType_Float ) || \ + ( (datatype) == FieldDataType_Double ) ) + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM2.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM2.h new file mode 100644 index 0000000000000000000000000000000000000000..9dcd68acbacfbd647566fd1e41837b73f698294f --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM2.h @@ -0,0 +1,46 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +***************************************************************** +***************************************************************** +******* ******** +****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +***************************************************************** +***************************************************************** +*/ +#if defined EXTERN +#undef EXTERN +#endif +#if defined GEOM2MODULE +#define EXTERN +#else +#define EXTERN extern +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + +EXTERN FieldDataType_e GetGeomFieldDataType(Geom_s const* Geom); diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GLOBAL.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GLOBAL.h new file mode 100644 index 0000000000000000000000000000000000000000..21e35a947c20131cee3a77b1294ad7fdd9d39c7c --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GLOBAL.h @@ -0,0 +1,7271 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* BEGINREMOVEFROMADDON */ +/* NOTE: All code contained between comments that look like + * BEGINREMOVEFROMADDON + * ENDREMOVEFROMADDON + * are pulled out to create the GLOBAL.h file used in addons. + */ +/* ENDREMOVEFROMADDON */ + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +#ifndef _GLOBAL_H +#define _GLOBAL_H + +#if defined EXTERN +#undef EXTERN +#endif +#if defined Q_MAINMODULE && defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else +#define EXTERN extern +#endif + +#define EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY +/* BEGINREMOVEFROMADDON */ +/* + * The reason for wrapping this test with "begin and end remove from addon" key + * words is so that the ADK users doesn't have to see this mess. + */ +#if !defined COREAPI && \ + !defined TECUTILMMODULE && \ + !defined TECUTILOMODULE && \ + !defined TECUTILQMODULE && \ + !defined TECUTILSMODULE +/* we don't want Tecplot internals using deprecated interfaces */ +# undef EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY +#endif +/* ENDREMOVEFROMADDON */ + + +/**************************************************************** + * * + * MACROS * + * * + ****************************************************************/ +#if defined TRUE +#undef TRUE +#endif +#if defined FALSE +#undef FALSE +#endif +#if defined MIN +#undef MIN +#endif +#if defined MAX +#undef MAX +#endif +#if defined ROUND +#undef ROUND +#endif +#if defined ROUND2 +#undef ROUND2 +#endif +#if defined TRUNC +#undef TRUNC +#endif + +#define TRUE ((Boolean_t)1) +#define FALSE ((Boolean_t)0) + +/**************************************************************** + * * + * MACROS * + * * + ****************************************************************/ +#define ABS(X) ((X) >= 0 ? (X) : -(X) ) +#define MAX(X,Y) ((X) > (Y) ? (X) : (Y) ) +#define MIN(X,Y) ((X) < (Y) ? (X) : (Y) ) +#define BESTSHOWCOLOR(X) ((X) == White_C ? Black_C : White_C) +#define ROUND_TO_BYTE(X) ((BYTE)((X)+0.499)) +#define ROUNDS(X) ((short)((X)+0.499)) +#define ROUNDL(X) ((LgIndex_t)((X)+0.499)) +#define ROUND2(X) ((X) >= 0 ? ((int)((X)+0.499)) : ((int)((X)-0.499))) +#define TRUNC(X) ((short) (X)) +#define RAD_TO_DEG(rad) (180.*(rad)/PI) +#define DEG_TO_RAD(deg) (PI*(deg)/180.) + +# define CAPITAL(C) ( ('a'<=(C)&&(C)<='z') ? ((C)+('A'-'a')) : (C) ) /* okay for UNICODE */ + +#include "TASSERT.h" + +#if defined TECPLOTKERNEL && defined MSWIN +/* CORE SOURCE CODE REMOVED */ +#else +#define ISEMPTYSTRING(S) ( ((const char*)(S))[0] == '\0' ) +#endif + +#define ISWHITESPACE(C) ((C == ' ') || (C == '\t') || (C == '\n')) +#define ISSEPARATOR(C) ((C == ' ') || (C == '\t') || (C == ',')) +/* clamp the input to the specified range */ +#define CLAMP(value,low,high) ((value)<(low) ? (low) : (value) > (high) ? (high) : (value)) +/* integer division rounds any fraction up (for example n=16,d=3 results in 6) */ +#define INTEGER_DIVIDE_AND_ROUND_UP(n, d) (((int)(n)+(int)(d)-1)/(int)(d)) + +/* BEGINREMOVEFROMADDON */ +/** + * Calcualtes the cell's primary corner or cell centered index from the I, J, + * and K indices. + * + * Consider this IJ zone dimensioned 4 by 3: + * @verbatim + +-------+-------+-------+-------+ + | | | | | + | <8> | <9> | <10> | <11> | <--- ghost cells + | | | | | + |8 |9 |10 |11 | + +-------+-------+-------+-------+ + | | | | | + | <4> | <5> | <6> | <7> | + | | | | | + |4 |5 |6 |7 | + +-------+-------+-------+-------+ + | | | | | + | <0> | <1> | <2> | <3> | + | | | | | + |0 |1 |2 |3 | + +-------+-------+-------+-------+ + . + /|\ + | + | + ghost cells +@endverbatim + */ +#define IJKINDEX(CZData,I,J,K) ((I) + \ + ((J)*(CZData)->NumIPts) + \ + ((K)*(CZData)->NumIJPts)) + +/** + * Calculates the I indice from the cell's primary corner or cell centered + * index. See IJKINDEX() for a picture. + */ +#define IINDEX(CZData,N) ((N) % (CZData)->NumIPts) + +/** + * Calculates the J indice from the cell's primary corner or cell centered + * index. See IJKINDEX() for a picture. + */ +#define JINDEX(CZData,N) (((N) % (CZData)->NumIJPts)/(CZData)->NumIPts) + +/** + * Calculates the K indice from the cell's primary corner or cell centered + * index. See IJKINDEX() for a picture. + */ +#define KINDEX(CZData,N) ((N)/(CZData)->NumIJPts) +/* ENDREMOVEFROMADDON */ + +/* */ +#define SWITCH(Type,A,B) do {Type T = (A); (A) = (B); (B) = T;} while (FALSE) +#define SWITCH_DOUBLES(A,B) SWITCH(double, (A), (B)) +#define FPRINTFOK(x) (Boolean_t)((x) > 0) +#define GRAPHICSARE3D(F) ((F->PlotType == PlotType_Cartesian3D)) + +/* convenience macros for implication, P -> Q, and equivalence, P <-> Q. */ +#define IMPLICATION(P,Q) (!(P) || (Q)) +#define EQUIVALENCE(P,Q) ((P) == (Q)) + +/* suppress compiler warnings about unused parameters */ +#if defined UNUSED +#undef UNUSED +#endif +#define UNUSED(param) (void)param + +/** + * Converts a double into a float value + * + * param val + * double value to be converted + */ +#define CONVERT_DOUBLE_TO_FLOAT(val) \ + ( (val) >= SMALLFLOAT \ + ? ( (val) < LARGEFLOAT \ + ? (float)(val) \ + : (float)LARGEFLOAT \ + ) \ + : ( (val) <= -SMALLFLOAT \ + ? ( (val) > -LARGEFLOAT \ + ? (float)(val) \ + : (float)-LARGEFLOAT \ + ) \ + : (float)0.0 \ + ) \ + ) + + +/** + * Clamps a double at the limits of Tecplot's precision + * + * param val + * double value to be clamped + */ +#define CLAMP_DOUBLE(val) \ + ( (val) >= SMALLDOUBLE \ + ? ( (val) < LARGEDOUBLE \ + ? (double)(val) \ + : (double)LARGEDOUBLE \ + ) \ + : ( (val) <= -SMALLDOUBLE \ + ? ( (val) > -LARGEDOUBLE \ + ? (double)(val) \ + : (double)-LARGEDOUBLE \ + ) \ + : (double)0.0 \ + ) \ + ) + + +/** + * Converts a double into a 4-byte (signed) integer value + * + * param val + * double value to be converted + */ +#define CONVERT_DOUBLE_TO_INT32(val) \ + ( (val) >= 1.0 \ + ? ( (val) < MAXINT32 \ + ? (Int32_t)(val) \ + : (Int32_t)MAXINT32 \ + ) \ + : ( (val) <= -1.0 \ + ? ( (val) > (Int32_t)-MAXINT32 \ + ? (Int32_t)(val) \ + : (Int32_t)-MAXINT32 \ + ) \ + : (Int32_t)0.0 \ + ) \ + ) + + +/** + * Converts a double into a 2-byte (signed) integer value + * + * param val + * double value to be converted + */ +#define CONVERT_DOUBLE_TO_INT16(val) \ + ( (val) >= 1.0 \ + ? ( (val) < MAXINT16 \ + ? (Int16_t)(val) \ + : (Int16_t)MAXINT16 \ + ) \ + : ( (val) <= -1.0 \ + ? ( (val) > (Int16_t)-MAXINT16 \ + ? (Int16_t)(val) \ + : (Int16_t)-MAXINT16 \ + ) \ + : (Int16_t)0.0 \ + ) \ + ) + +/** + * Copies two bytes from SrcBuffer to DstBuffer without causing a page + * fault due to misaligned words. + * + * param DstBuffer + * Pointer the buffer to send the two bytes to + * param SrcBuffer + * Pointer the buffer to get the two bytes from + */ +#define COPY_2_UNALIGNED_BYTES(DstBuffer, SrcBuffer) \ + do { \ + /* cannot check sizeof(SrcBuffer) or sizeof(DstBuffer) because they are */ \ + /* most likely single byte pointers into unaligned blocks of data */ \ + ((Byte_t *)(DstBuffer))[0] = ((Byte_t *)(SrcBuffer))[0]; \ + ((Byte_t *)(DstBuffer))[1] = ((Byte_t *)(SrcBuffer))[1]; \ + } while (FALSE) + +/** + * Copies two bytes from SrcBuffer to DstBuffer swapping the bytes + * as it copies. Will not cause a page fault due to misaligned words. + * + * param DstBuffer + * Pointer the buffer to send the two bytes to + * param SrcBuffer + * Pointer the buffer to get the two bytes from + */ +#define COPY_AND_REVERSE_2_UNALIGNED_BYTES(DstBuffer, SrcBuffer) \ + do { \ + /* cannot check sizeof(SrcBuffer) or sizeof(DstBuffer) because they are */ \ + /* most likely single byte pointers into unaligned blocks of data */ \ + ((Byte_t *)(DstBuffer))[0] = ((Byte_t *)(SrcBuffer))[1]; \ + ((Byte_t *)(DstBuffer))[1] = ((Byte_t *)(SrcBuffer))[0]; \ + } while (FALSE) + +/** + * Copies four bytes from SrcBuffer to DstBuffer without causing a page + * fault due to misaligned words. + * + * param DstBuffer + * Pointer the buffer to send the four bytes to + * param SrcBuffer + * Pointer the buffer to get the four bytes from + */ +#define COPY_4_UNALIGNED_BYTES(DstBuffer, SrcBuffer) \ + do { \ + /* cannot check sizeof(SrcBuffer) or sizeof(DstBuffer) because they are */ \ + /* most likely single byte pointers into unaligned blocks of data */ \ + ((Byte_t *)(DstBuffer))[0] = ((Byte_t *)(SrcBuffer))[0]; \ + ((Byte_t *)(DstBuffer))[1] = ((Byte_t *)(SrcBuffer))[1]; \ + ((Byte_t *)(DstBuffer))[2] = ((Byte_t *)(SrcBuffer))[2]; \ + ((Byte_t *)(DstBuffer))[3] = ((Byte_t *)(SrcBuffer))[3]; \ + } while (FALSE) + +/** + * Copies four bytes from SrcBuffer to DstBuffer swapping the bytes + * as it copies. Will not cause a page fault due to misaligned words. + * + * param DstBuffer + * Pointer the buffer to send the four bytes to + * param SrcBuffer + * Pointer the buffer to get the four bytes from + */ +#define COPY_AND_REVERSE_4_UNALIGNED_BYTES(DstBuffer, SrcBuffer) \ + do { \ + /* cannot check sizeof(SrcBuffer) or sizeof(DstBuffer) because they are */ \ + /* most likely single byte pointers into unaligned blocks of data */ \ + ((Byte_t *)(DstBuffer))[0] = ((Byte_t *)(SrcBuffer))[3]; \ + ((Byte_t *)(DstBuffer))[1] = ((Byte_t *)(SrcBuffer))[2]; \ + ((Byte_t *)(DstBuffer))[2] = ((Byte_t *)(SrcBuffer))[1]; \ + ((Byte_t *)(DstBuffer))[3] = ((Byte_t *)(SrcBuffer))[0]; \ + } while (FALSE) + +/** + * Copies four bytes from SrcBuffer to DstBuffer without causing a page + * fault due to misaligned words. + * + * param DstBuffer + * Pointer the buffer to send the four bytes to + * param SrcBuffer + * Pointer the buffer to get the four bytes from + */ +#define COPY_8_UNALIGNED_BYTES(DstBuffer, SrcBuffer) \ + do { \ + /* cannot check sizeof(SrcBuffer) or sizeof(DstBuffer) because they are */ \ + /* most likely single byte pointers into unaligned blocks of data */ \ + ((Byte_t *)(DstBuffer))[0] = ((Byte_t *)(SrcBuffer))[0]; \ + ((Byte_t *)(DstBuffer))[1] = ((Byte_t *)(SrcBuffer))[1]; \ + ((Byte_t *)(DstBuffer))[2] = ((Byte_t *)(SrcBuffer))[2]; \ + ((Byte_t *)(DstBuffer))[3] = ((Byte_t *)(SrcBuffer))[3]; \ + ((Byte_t *)(DstBuffer))[4] = ((Byte_t *)(SrcBuffer))[4]; \ + ((Byte_t *)(DstBuffer))[5] = ((Byte_t *)(SrcBuffer))[5]; \ + ((Byte_t *)(DstBuffer))[6] = ((Byte_t *)(SrcBuffer))[6]; \ + ((Byte_t *)(DstBuffer))[7] = ((Byte_t *)(SrcBuffer))[7]; \ + } while (FALSE) + +/** + * Copies eight bytes from SrcBuffer to DstBuffer swapping the bytes + * as it copies. Will not cause a page fault due to misaligned words. + * + * param DstBuffer + * Pointer the buffer to send the four bytes to + * param SrcBuffer + * Pointer the buffer to get the four bytes from + */ +#define COPY_AND_REVERSE_8_UNALIGNED_BYTES(DstBuffer, SrcBuffer) \ + do { \ + /* cannot check sizeof(SrcBuffer) or sizeof(DstBuffer) because they are */ \ + /* most likely single byte pointers into unaligned blocks of data */ \ + ((Byte_t *)(DstBuffer))[0] = ((Byte_t *)(SrcBuffer))[7]; \ + ((Byte_t *)(DstBuffer))[1] = ((Byte_t *)(SrcBuffer))[6]; \ + ((Byte_t *)(DstBuffer))[2] = ((Byte_t *)(SrcBuffer))[5]; \ + ((Byte_t *)(DstBuffer))[3] = ((Byte_t *)(SrcBuffer))[4]; \ + ((Byte_t *)(DstBuffer))[4] = ((Byte_t *)(SrcBuffer))[3]; \ + ((Byte_t *)(DstBuffer))[5] = ((Byte_t *)(SrcBuffer))[2]; \ + ((Byte_t *)(DstBuffer))[6] = ((Byte_t *)(SrcBuffer))[1]; \ + ((Byte_t *)(DstBuffer))[7] = ((Byte_t *)(SrcBuffer))[0]; \ + } while (FALSE) + +/** + * Reverses the byte order of the specified 2 byte buffer. + * + * param Buffer + * Pointer to the 2 bytes needing byte order reversal. + */ +#define REVERSE_2_BYTES_1_AT_A_TIME(Buffer) \ + do { \ + Byte_t Byte0 = ((Byte_t *)(Buffer))[0]; \ + CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==2); \ + ((Byte_t *)(Buffer))[0] = ((Byte_t *)(Buffer))[1]; \ + ((Byte_t *)(Buffer))[1] = Byte0; \ + } while (FALSE) + +#define REVERSE_2_BYTES_2_AT_A_TIME(Buffer) \ + do { \ + UInt16_t data_bits = ((UInt16_t *)(Buffer))[0]; \ + CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==2); \ + ((UInt16_t *)(Buffer))[0] = (((data_bits)<<8) | \ + ((data_bits&0xff))); \ + } while (FALSE) + +/* REVERSE_2_BYTES_2_AT_A_TIME may actually be slower, needs testing. */ +#define REVERSE_2_BYTES REVERSE_2_BYTES_1_AT_A_TIME + +/** + * Reverses the byte order of the specified 4 byte buffer. + * + * param Buffer + * Pointer to the 4 bytes needing byte order reversal. + * + * How this works: + * + * ABCD + * D--- <<24 (1) + * + * ABCD + * --C- &0x0000ff00 + * -C-- <<8 (2) + * + * ABCD + * -B-- &0x00ff0000 + * --B- >>8 (3) + * + * ABCD + * ---A >>24 (4) + * + * (1) | (2) | (3) | (4) = DCBA. + * + */ +#define REVERSE_4_BYTES_1_AT_A_TIME(Buffer) \ + do { \ + Byte_t Byte0 = ((Byte_t *)(Buffer))[0]; \ + Byte_t Byte1 = ((Byte_t *)(Buffer))[1]; \ + CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==4); \ + ((Byte_t *)(Buffer))[0] = ((Byte_t *)(Buffer))[3]; \ + ((Byte_t *)(Buffer))[1] = ((Byte_t *)(Buffer))[2]; \ + ((Byte_t *)(Buffer))[2] = Byte1; \ + ((Byte_t *)(Buffer))[3] = Byte0; \ + } while (FALSE) + +#define REVERSE_4_BYTES_4_AT_A_TIME(Buffer) \ + do { \ + UInt32_t data_bits = *((UInt32_t *)(Buffer)); \ + CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==4); \ + *((UInt32_t *)(Buffer)) = (((data_bits)<<24) | \ + ((data_bits&0x0000ff00)<<8) | \ + ((data_bits&0x00ff0000)>>8) | \ + ((data_bits)>>24)); \ + } while (FALSE) + +#if defined MSWIN +/* + * The DevStuido compiler seems to be the only one that can truly handle this + * when optimization is turned on. + */ +#define REVERSE_4_BYTES REVERSE_4_BYTES_4_AT_A_TIME +#else +#define REVERSE_4_BYTES REVERSE_4_BYTES_1_AT_A_TIME +#endif + +/** + * Reverses the byte order of the specified 8 byte buffer. + * + * param Buffer + * Pointer to the 8 bytes needing byte order reversal. + */ +#define REVERSE_8_BYTES_1_AT_A_TIME(Buffer) \ + do { \ + Byte_t Byte0 = ((Byte_t *)(Buffer))[0]; \ + Byte_t Byte1 = ((Byte_t *)(Buffer))[1]; \ + Byte_t Byte2 = ((Byte_t *)(Buffer))[2]; \ + Byte_t Byte3 = ((Byte_t *)(Buffer))[3]; \ + CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==8); \ + ((Byte_t *)(Buffer))[0] = ((Byte_t *)(Buffer))[7]; \ + ((Byte_t *)(Buffer))[1] = ((Byte_t *)(Buffer))[6]; \ + ((Byte_t *)(Buffer))[2] = ((Byte_t *)(Buffer))[5]; \ + ((Byte_t *)(Buffer))[3] = ((Byte_t *)(Buffer))[4]; \ + ((Byte_t *)(Buffer))[4] = Byte3; \ + ((Byte_t *)(Buffer))[5] = Byte2; \ + ((Byte_t *)(Buffer))[6] = Byte1; \ + ((Byte_t *)(Buffer))[7] = Byte0; \ + } while (FALSE) + +#define REVERSE_8_BYTES_2_AT_A_TIME(Buffer) \ + do { \ + UInt16_t data_bits_0 = ((UInt16_t *)(Buffer))[0]; \ + UInt16_t data_bits_1 = ((UInt16_t *)(Buffer))[1]; \ + UInt16_t data_bits_2 = ((UInt16_t *)(Buffer))[2]; \ + UInt16_t data_bits_3 = ((UInt16_t *)(Buffer))[3]; \ + CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==8); \ + ((UInt16_t *)(Buffer))[0] = (((data_bits_3)<<8) | \ + ((data_bits_3&0xff))); \ + ((UInt16_t *)(Buffer))[1] = (((data_bits_2)<<8) | \ + ((data_bits_2&0xff))); \ + ((UInt16_t *)(Buffer))[2] = (((data_bits_1)<<8) | \ + ((data_bits_1&0xff))); \ + ((UInt16_t *)(Buffer))[3] = (((data_bits_0)<<8) | \ + ((data_bits_0&0xff))); \ + } while (FALSE) + +#define REVERSE_8_BYTES_4_AT_A_TIME(Buffer) \ + do { \ + UInt32_t data_bits_0 = ((UInt32_t *)(Buffer))[0]; \ + UInt32_t data_bits_1 = ((UInt32_t *)(Buffer))[1]; \ + CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==8); \ + ((UInt32_t *)(Buffer))[0] = (((data_bits_1)<<24) | \ + ((data_bits_1&0x0000ff00)<<8) | \ + ((data_bits_1&0x00ff0000)>>8) | \ + ((data_bits_1)>>24)); \ + ((UInt32_t *)(Buffer))[1] = (((data_bits_0)<<24) | \ + ((data_bits_0&0x0000ff00)<<8) | \ + ((data_bits_0&0x00ff0000)>>8) | \ + ((data_bits_0)>>24)); \ + } while (FALSE) + +#define REVERSE_8_BYTES_8_AT_A_TIME(Buffer) \ + do { \ + UInt64_t data_bits = *((UInt64_t *)(Buffer)); \ + CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==8); \ + *((UInt64_t *)(Buffer)) = (((data_bits)<<56) | \ + ((data_bits&0x000000000000ff00)<<40) | \ + ((data_bits&0x0000000000ff0000)<<24) | \ + ((data_bits&0x00000000ff000000)<<8) | \ + ((data_bits&0x000000ff00000000)>>8) | \ + ((data_bits&0x0000ff0000000000)>>24) | \ + ((data_bits&0x00ff000000000000)>>40) | \ + ((data_bits)>>56)); \ + } while (FALSE) + + +#if defined MSWIN +/* + * The DevStuido compiler seems to be the only one that can truly handle this + * when optimization is turned on. + */ +#define REVERSE_8_BYTES REVERSE_8_BYTES_4_AT_A_TIME +#else +#define REVERSE_8_BYTES REVERSE_8_BYTES_1_AT_A_TIME +#endif + + +/**************************************************************** + * * + * ADD-ON MSWIN IMPORT/EXPORT DEFINITIONS * + * * + ****************************************************************/ +#if defined MSWIN +# define STDCALL __stdcall +#else +# define STDCALL +#endif /* MSWIN */ + +#if defined (__cplusplus) +# define EXTERNC extern "C" +#else +# define EXTERNC +#endif /* __cplusplus */ + +#if defined MSWIN +#if defined AMTEC_INTERNAL_MAKELIBTEC || defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# else +# define TECPLOT_DLLAPI _declspec ( dllimport ) +# endif +#else +# define TECPLOT_DLLAPI +#endif + +#define LINKTOADDON EXTERNC TECPLOT_DLLAPI + + +/* + * + * Usage: + * EXPORTFROMADDON void STDCALL InitTecAddOn(void) { ... } + * + */ +#if defined MSWIN +# define EXPORTFROMADDON EXTERNC _declspec ( dllexport ) +#else +# define EXPORTFROMADDON EXTERNC +#endif /* MSWIN */ + +#define EXPORTFROMDLL EXPORTFROMADDON + +#define InitTecAddOn InitTecAddOn113 +#define TEC_INIT_FUNCTION_NAME "InitTecAddOn113" + +/* BEGINREMOVEFROMADDON */ +/* Use INLINE for static functions that could be optimized as inline. */ +#if defined (__cplusplus) && !defined _DEBUG +# define INLINE inline +#else +# define INLINE static +#endif /* __cplusplus */ +/* ENDREMOVEFROMADDON */ + + +/* BEGINREMOVEFROMADDON */ +#if defined (MSWIN) ||\ + defined (INTERX) ||\ + defined (LINUX) ||\ + defined (SUNSOLARIS86X) ||\ + defined (COMPAQALPHA) ||\ + defined (DEC) ||\ + defined (__LITTLE_ENDIAN__) +#define MACHINE_DOES_INTEL_ORDER +#endif + +#if defined( MACHINE_DOES_INTEL_ORDER ) +# define SwapBytes(IntelOrder) (!(IntelOrder)) +#else +# define SwapBytes(IntelOrder) (IntelOrder) +#endif +/* ENDREMOVEFROMADDON */ + +#if defined DECALPHA || \ + defined LINUXALPHA || \ + defined LINUXI64 || \ + defined LINUX64 || \ + defined MAC64 || \ + defined COMPAQALPHA +#define LONGIS64 +#endif + +/**************************************************************** + * * + * HARD CONSTANTS * + * * + ****************************************************************/ +#define LARGEMEMORY ((size_t)-1) + +/* BEGINREMOVEFROMADDON */ +/* Tclinterp add-on barfs on these huge integer constants */ +/* Note: Tecplot is conservative by one on LARGEINTs max */ +#define LARGEINT64 9223372036854775806LL +/* ENDREMOVEFROMADDON */ +#define LARGEINT32 2147483646 +#define LARGEINT16 32766 +#define LARGEINT8 126 + +/* BEGINREMOVEFROMADDON */ +#define LARGEUINT64 18446744073709551614ULL +/* ENDREMOVEFROMADDON */ +#define LARGEUINT32 4294967294 +#define LARGEUINT16 65534 +#define LARGEUINT8 254 + +#ifdef INDEX_16_BIT +#define MAXINDEX ((LgIndex_t)LARGEINT16) +#else +#define MAXINDEX ((LgIndex_t)LARGEINT32) +#endif +#define MAXZONEMAP MAXINDEX +#define LARGEDOUBLE 1.0e+150 +#define SMALLDOUBLE 1.0e-150 +#define LARGESTEXPONENT 150 +#define SMALLESTEXPONENT -150 + +#define SMALLESTDOUBLE SMALLDOUBLE + +#define LARGESTDOUBLEEXPONENT 308 +#define SMALLESTDOUBLEEXPONENT -307 +#define LARGESTDOUBLE 1.0e+308 +#define LARGEFLOAT 3.40282347E+38 +#define SMALLFLOAT 1.17549435E-38 +#define SMALLSTDOUBLE 1.0e-307 + +/* Visual Studio 2008 defines MAXINT32, MAXINT16 which collide with ours */ +#if defined MAXINT32 +#undef MAXINT32 +#endif +#if defined MAXINT16 +#undef MAXINT16 +#endif + +#define MAXINT32 LARGEINT32 +#define MAXINT16 LARGEINT16 +#define ETX 3 +#define LN2 0.69314718055994530942 +#define LN10 2.30258509299404568402 +#define PIOVER2 1.57079632679489661923 +#define TWOPI 6.28318530717958647692 +#if defined PI +#undef PI +#endif +#define PI 3.14159265358979323846 +#define ANGLEEPSILON 1.0e-10 +#define LARGESTANGLE (4*PI+ANGLEEPSILON) +#define DEGPERRADIANS 57.295779513082323 +#define CMPERINCH 2.54 +#define POINTSPERINCH 72.0 +#define FONTMOVEMARK 192 +#define FONTDECISIONMARK 128 +#define FONTLINEMARK 64 +#define BAD_SET_VALUE ((SetIndex_t)-1) +#define MENU_POSITION_FIRST (0) +#define MENU_POSITION_LAST (-1) +#define INVALID_UNIQUE_ID 0 + +#define BADSETVALUE BAD_SET_VALUE +#define SOLID_TRANSLUCENCY 0 +#define BAD_DISTANCE (-1.0) +/* MIN_CIRCUMFERENTIAL_INDEX is the min J dimension for circular zones */ +#define MIN_CIRCUMFERENTIAL_INDEX 4 + +#define VALID_STRAND_ID(StrandID) (0 <= (StrandID) && (StrandID) < MAXZONEMAP) +#define STRAND_ID_STATIC (-1) +#define STRAND_ID_PENDING (-2) + +/* + * Need 3 passes for "Rest of pie" method but can only use 3 clip planes + * Need only 1 pass for "Piece of pie" method and can use 6 clip planes +*/ +#define MAX_ALLOWABLE_CLIPPASSES 1 +#define MAX_ALLOWABLE_CLIPPLANES 6 + +/* BEGINREMOVEFROMADDON */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined _DEBUG +#else +#endif +#if 0 /* NOTUSED */ +#endif +#endif /* TECPLOTKERNEL */ +/* ENDREMOVEFROMADDON */ + + +/* + * NOTE: If you change TecplotBinaryFileVersion, you MUST also: + * + * 1. Update preplot: + * - Change this define symbol in preplot.cpp + * - Change version number in the data file format in the comments in preplot.cpp + * - Change the version number of Preplot itself in preplot.cpp + * 2. Maintain the ability to write the old plt file format: + * - Add a new entry to BinaryFileVersion_e + * - Add a concrete class of the VersionWriterInterface, and update + * VersionWriterAbstractFactory to return the correct instance for the previous and + * new BinaryFileVersion_e + * - Abstract away the difference in the two versions behind an interface (if one does + * not yet exist) and create concrete implementations that can write the old and the + * new versions. For a trivial example of this, see FileTypeWriterInterface and its + * associated factory and concrete classes. + */ +#define TecplotBinaryFileVersion 112 +#define TecplotInterfaceVersion 120 +#define TecplotInterfaceVersionStr "120" /* stay in lockstep with TecplotInterfaceVersion */ +#if defined FLEXLM +#define TecplotLicenseVersion 119 /* may vary from TecplotInterfaceVersion */ +#define TecplotLicenseVersionStr "11.9" /* stay in lockstep with TecplotLicenseVersion */ +#else /* FLEXLM */ +#define TecplotLicenseVersion 120 /* may vary from TecplotInterfaceVersion */ +#define TecplotLicenseVersionStr "12.0" /* stay in lockstep with TecplotLicenseVersion */ +#endif /* FLEXLM */ +/* Also change the macro version number in COMMAND.MASTER.h */ + +#define MaxNumZonesOrVars MAXZONEMAP +#define MaxXAxes 5 +#define MaxYAxes 5 +#define MaxGeoSegments 50 +#define MaxPtsCircleOrEllipse 720 +#define MaxFrames 2048 +#define MaxCustomLabelSets 10 +#define MaxFontMoves 20000 +#define MaxColorMapOverrides 16 +#define MaxValueBlankConstraints 8 +#define MaxContourGroups 8 +#define MaxIsoSurfaceGroups 8 +#define MaxSliceGroups 8 + +#define MaxColorMapGroups 8 +#define DefaultNumContLevels 15 + + +#define DefaultColorMapGroup ((SmInteger_t)0) +#define BADGROUPNUMBER ((SmInteger_t)-1) +#define UNUSEDGROUPNUMBER ((SmInteger_t)0) + +#define VALID_ISOSURFACE_GROUP(Group) (((((SmInteger_t)Group) >= 0) && (((SmInteger_t)Group) < MaxIsoSurfaceGroups))) +#define VALID_SLICE_GROUP(Group) (((((SmInteger_t)Group) >= 0) && (((SmInteger_t)Group) < MaxSliceGroups))) +#define VALID_COLORMAP_GROUP(Group) (((((SmInteger_t)Group) >= 0) && (((SmInteger_t)Group) < MaxColorMapGroups))) + + + +/* + * If any of these values changes its corresponding value in preplot.c must + * change to match it so that files created by preplot and Tecplot are + * consistent. + */ +#define MaxChrsDatasetTitle 256 +#define MaxChrsZnTitle 128 +#define MaxChrsVarName 128 +#define MaxChrsZnOrVarName 128 +/* currently limited to MaxLineIndex in preplot.c */ +#define MaxChrsAuxValueString 32000 + +#define MaxNumViews 16 +#define MaxBasicSizes 5 +#define MaxColorMapControlPoints 50 +#define MaxRawColorMapEntries 800 +#define MaxDataSetReaders 100 +#define MaxExtendedCurveFits 100 +#define MaxColorMapCycles 20 + + +/* Dimension Limits */ + +#define MinPaperDimInWorkArea 0.5 +#define MinFrameWidth 0.25 +#define MinFrameHeight 0.25 +#define MinAxisLength 0.1 + + +#define BadEnumValue 255 + +/* BEGINREMOVEFROMADDON */ +/* define class element limits */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +/* ENDREMOVEFROMADDON */ + +/* + * Floating point values are written to layouts with a certain precision. + * A high precision is necessary in some cases (like streamtrace starting locations) + * This used to be set to 12 which was not high enough. It is now set to 16 which + * appears to be sufficient. This also seems to jive with the number of digits of + * precision that are found in "ieee double precision" values which is 53 bits or + * equivalent to approximately 16 digits. -bdp + * + */ +#define STYLE_FLOAT_PRECISION 16 + + +/* + * Auxiliary data common names. + * + * Define Name Data Name Data Type Data Location + * ------------------------------------------ ------------------------------------ --------- ------------- + */ +#define AuxData_Common_Incompressible "Common.Incompressible" /* Boolean_t Dataset */ +#define AuxData_Common_Density "Common.Density" /* double Dataset */ +#define AuxData_Common_SpecificHeat "Common.SpecificHeat" /* double Dataset */ +#define AuxData_Common_SpecificHeatVar "Common.SpecificHeatVar" /* int Dataset */ +#define AuxData_Common_GasConstant "Common.GasConstant" /* double Dataset */ +#define AuxData_Common_GasConstantVar "Common.GasConstantVar" /* int Dataset */ +#define AuxData_Common_Gamma "Common.Gamma" /* double Dataset */ +#define AuxData_Common_GammaVar "Common.GammaVar" /* int Dataset */ +#define AuxData_Common_Viscosity "Common.Viscosity" /* double Dataset */ +#define AuxData_Common_ViscosityVar "Common.ViscosityVar" /* int Dataset */ +#define AuxData_Common_Conductivity "Common.Conductivity" /* double Dataset */ +#define AuxData_Common_ConductivityVar "Common.ConductivityVar" /* int Dataset */ +#define AuxData_Common_AngleOfAttack "Common.AngleOfAttack" /* double Dataset */ +#define AuxData_Common_SpeedOfSound "Common.SpeedOfSound" /* double Dataset */ +#define AuxData_Common_ReferenceU "Common.ReferenceU" /* double Dataset */ +#define AuxData_Common_ReferenceV "Common.ReferenceV" /* double Dataset */ +#define AuxData_Common_XVar "Common.XVar" /* int Dataset */ +#define AuxData_Common_YVar "Common.YVar" /* int Dataset */ +#define AuxData_Common_ZVar "Common.ZVar" /* int Dataset */ +#define AuxData_Common_CVar "Common.CVar" /* int Dataset */ +#define AuxData_Common_UVar "Common.UVar" /* int Dataset */ +#define AuxData_Common_VVar "Common.VVar" /* int Dataset */ +#define AuxData_Common_WVar "Common.WVar" /* int Dataset */ +#define AuxData_Common_VectorVarsAreVelocity "Common.VectorVarsAreVelocity" /* Boolean_t Dataset */ +#define AuxData_Common_PressureVar "Common.PressureVar" /* int Dataset */ +#define AuxData_Common_TemperatureVar "Common.TemperatureVar" /* int Dataset */ +#define AuxData_Common_DensityVar "Common.DensityVar" /* int Dataset */ +#define AuxData_Common_StagnationEnergyVar "Common.StagnationEnergyVar" /* int Dataset */ +#define AuxData_Common_MachNumberVar "Common.MachNumberVar" /* int Dataset */ +#define AuxData_Common_ReferenceMachNumber "Common.ReferenceMachNumber" /* double Dataset */ +#define AuxData_Common_ReferenceW "Common.ReferenceW" /* double Dataset */ +#define AuxData_Common_PrandtlNumber "Common.PrandtlNumber" /* double DataSet */ +#define AuxData_Common_Axisymmetric "Common.Axisymmetric" /* Boolean_t Dataset */ +#define AuxData_Common_AxisOfSymmetryVarAssignment "Common.AxisOfSymmetryVarAssignment" /* int Dataset */ +#define AuxData_Common_AxisValue "Common.AxisValue" /* double Dataset */ +#define AuxData_Common_SteadyState "Common.SteadyState" /* Boolean_t Dataset */ +#define AuxData_Common_TurbulentKineticEnergyVar "Common.TurbulentKineticEnergyVar" /* int Dataset */ +#define AuxData_Common_TurbulentDissipationRateVar "Common.TurbulentDissipationRateVar" /* int Dataset */ +#define AuxData_Common_TurbulentViscosityVar "Common.TurbulentViscosityVar" /* int Dataset */ +#define AuxData_Common_TurbulentFrequencyVar "Common.TurbulentFrequencyVar" /* int Dataset */ +#define AuxData_Common_Gravity "Common.Gravity" /* double Dataset */ +#define AuxData_Common_IsBoundaryZone "Common.IsBoundaryZone" /* Boolean_t Zone */ +#define AuxData_Common_BoundaryCondition "Common.BoundaryCondition" /* BCondition Zone */ +#define AuxData_Common_Time "Common.Time" /* double Zone */ +#define AuxData_Common_Mean "Common.Mean" /* double Variable */ +#define AuxData_Common_Median "Common.Median" /* double Variable */ +#define AuxData_Common_Variance "Common.Variance" /* double Variable */ +#define AuxData_Common_StdDev "Common.StdDev" /* double Variable */ +#define AuxData_Common_AvgDev "Common.AvgDev" /* double Variable */ +#define AuxData_Common_GeoMean "Common.GeoMean" /* double Variable */ +#define AuxData_Common_ChiSqre "Common.ChiSqre" /* double Variable */ + + + + + + + +/* BEGINREMOVEFROMADDON */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined THREED +#endif +#endif /* TECPLOTKERNEL */ +/* ENDREMOVEFROMADDON */ + +/* Tecplot Add-on Custom Products */ + +/* BEGINREMOVEFROMADDON */ +/* In activeX, the color constants are an enum type, + so the activeX source code parser handles these as + a special case, and the types do not need to be + indicated as with the other hard #define constants */ +/* ENDREMOVEFROMADDON */ + +#define Black_C ((ColorIndex_t)0) +#define Red_C ((ColorIndex_t)1) +#define Green_C ((ColorIndex_t)2) +#define Blue_C ((ColorIndex_t)3) +#define Cyan_C ((ColorIndex_t)4) +#define Yellow_C ((ColorIndex_t)5) +#define Purple_C ((ColorIndex_t)6) +#define White_C ((ColorIndex_t)7) + +#define Custom1_C ((ColorIndex_t)8) +#define Custom2_C ((ColorIndex_t)9) +#define Custom3_C ((ColorIndex_t)10) +#define Custom4_C ((ColorIndex_t)11) +#define Custom5_C ((ColorIndex_t)12) +#define Custom6_C ((ColorIndex_t)13) +#define Custom7_C ((ColorIndex_t)14) +#define Custom8_C ((ColorIndex_t)15) +#define Custom9_C ((ColorIndex_t)16) + +#define Custom10_C ((ColorIndex_t)17) +#define Custom11_C ((ColorIndex_t)18) +#define Custom12_C ((ColorIndex_t)19) +#define Custom13_C ((ColorIndex_t)20) +#define Custom14_C ((ColorIndex_t)21) +#define Custom15_C ((ColorIndex_t)22) +#define Custom16_C ((ColorIndex_t)23) +#define Custom17_C ((ColorIndex_t)24) +#define Custom18_C ((ColorIndex_t)25) +#define Custom19_C ((ColorIndex_t)26) + +#define Custom20_C ((ColorIndex_t)27) +#define Custom21_C ((ColorIndex_t)28) +#define Custom22_C ((ColorIndex_t)29) +#define Custom23_C ((ColorIndex_t)30) +#define Custom24_C ((ColorIndex_t)31) +#define Custom25_C ((ColorIndex_t)32) +#define Custom26_C ((ColorIndex_t)33) +#define Custom27_C ((ColorIndex_t)34) +#define Custom28_C ((ColorIndex_t)35) +#define Custom29_C ((ColorIndex_t)36) + +#define Custom30_C ((ColorIndex_t)37) +#define Custom31_C ((ColorIndex_t)38) +#define Custom32_C ((ColorIndex_t)39) +#define Custom33_C ((ColorIndex_t)40) +#define Custom34_C ((ColorIndex_t)41) +#define Custom35_C ((ColorIndex_t)42) +#define Custom36_C ((ColorIndex_t)43) +#define Custom37_C ((ColorIndex_t)44) +#define Custom38_C ((ColorIndex_t)45) +#define Custom39_C ((ColorIndex_t)46) + +#define Custom40_C ((ColorIndex_t)47) +#define Custom41_C ((ColorIndex_t)48) +#define Custom42_C ((ColorIndex_t)49) +#define Custom43_C ((ColorIndex_t)50) +#define Custom44_C ((ColorIndex_t)51) +#define Custom45_C ((ColorIndex_t)52) +#define Custom46_C ((ColorIndex_t)53) +#define Custom47_C ((ColorIndex_t)54) +#define Custom48_C ((ColorIndex_t)55) +#define Custom49_C ((ColorIndex_t)56) + +#define Custom50_C ((ColorIndex_t)57) +#define Custom51_C ((ColorIndex_t)58) +#define Custom52_C ((ColorIndex_t)59) +#define Custom53_C ((ColorIndex_t)60) +#define Custom54_C ((ColorIndex_t)61) +#define Custom55_C ((ColorIndex_t)62) +#define Custom56_C ((ColorIndex_t)63) + +#define MultiColor_C ((ColorIndex_t)(-1)) +#define NoColor_C ((ColorIndex_t)(-2)) +#define MultiColor2_C ((ColorIndex_t)(-3)) +#define MultiColor3_C ((ColorIndex_t)(-4)) +#define MultiColor4_C ((ColorIndex_t)(-5)) +#define RGBColor_C ((ColorIndex_t)(-6)) +#define MultiColor5_C ((ColorIndex_t)(-7)) +#define MultiColor6_C ((ColorIndex_t)(-8)) +#define MultiColor7_C ((ColorIndex_t)(-9)) +#define MultiColor8_C ((ColorIndex_t)(-10)) +#define InvalidColor_C ((ColorIndex_t)(-255)) + +#define FirstCustomColor Custom1_C +#define LastCustomColor Custom56_C +#define NumCustomColors (LastCustomColor-FirstCustomColor+1) + +#define FirstBasicColor Black_C +#define LastBasicColor LastCustomColor +#define NumBasicColors (LastBasicColor-FirstBasicColor+1) + +/* BEGINREMOVEFROMADDON */ + +/* + * V8 and earlier used this for MultiColor_C. We adjust this + * to the new value in the SetValue layer so old addons work. + */ +#define OldMultiColor_C ((ColorIndex_t)255) +/* + * Gray is only used in the interface for workspace background and + * for insensitive buttons in Motif. + * True Black and True White are also interface only. They draw + * true black or true white - regardless of what the user has set + * the RGB values for the black and white basic colors. + * XOrColor_C is also for interface only. + */ +#define Gray_C (LastBasicColor+1) +#define DarkGray_C (LastBasicColor+2) /* Used for inactive frame border color */ +#define XOrColor_C (LastBasicColor+3) +#define FirstInterfaceColor Gray_C +#define LastInterfaceColor XOrColor_C + +#define NumInterfaceColors (LastInterfaceColor-FirstInterfaceColor+1) +#define NumContourShades (GeneralBase.Limits.MaxNumContourLevels+1) +#define NumColorsInColorTable (NumBasicColors+NumInterfaceColors+NumContourShades) +#define BasicColorOffset (0) +#define InterfaceColorOffset (NumBasicColors) +#define ContourColorOffset (NumBasicColors+NumInterfaceColors) + +#define BadKey (short)31 +#define Plus (short)43 +#define Minus (short)45 +#define RetKey (short)13 +#define DeleteKey (short)127 +#define ShiftDelete (short)128 +#define BackSpace (short)8 +#define LeftArrow (short)29 +#define RightArrow (short)30 +#define UpArrow (short)11 +#define DownArrow (short)10 +#define Toggle (short)19 +#define Esc (short)27 +#define RegFrame (short)18 +#define DoBitDump (short)2 + + +/* File Markers */ +#define ZoneMarker 299.0 +#define GeomMarker 399.0 +#define TextMarker 499.0 +#define CustomLabelMarker 599.0 +#define UserRecMarker 699.0 +#define DataSetAuxMarker 799.0 +#define VarAuxMarker 899.0 +#define EndHeaderMarker 357.0 + + +/* + * Additional objects that have plotter + * pens assigned to them. + */ +#define AxisPen Custom8_C+1 +#define MajGridPen Custom8_C+2 +#define MinGridPen Custom8_C+3 +#define StreamlinePen Custom8_C+4 +#define ColoredLinePen Custom8_C+5 +#define BoundaryPen Custom8_C+6 +#define LabelPen Custom8_C+7 +#define NumPlotterPens Custom8_C+8 +/* AutoSelectPen will select the correct pen from Black_C thru Custom8_C or ColoredLinePen */ +#define AutoSelectPen Custom8_C+9 +#define InvalidPen Custom8_C+99 + +#define FirstObjectPen AxisPen +#define LastObjectPen LabelPen + +#define DelZFactor 0.0001 + +#define BadBaseValue NULL + + +/* + * NOTES ON TYPEDEFS: + * + * TYPEDEF TYPE Suffix + * ------------ ------ + * simple _t + * enumerated _e + * structure _s + * union _u + * abstract _a + * pointer to simple _pt + * pointer to enumerated _pe + * pointer to structure _ps + * pointer to union _pu + * pointer to abstract _pa + * pointer to function _pf + * + * + * The only execption is char * typedef's these use _t + * + * Abstract types are intentionally made to be + * obscure. The programmer should not have to know + * what the underlying structure really is for abstract + * types. + * + */ + + +#ifdef MSWIN +# define DIR_SEPARATOR "\\" +#else +# define DIR_SEPARATOR "/" +#endif + +/* ENDREMOVEFROMADDON */ + +/* BEGINREMOVEFROMADDON */ +#if defined MSWIN +#define TP_FWRITE fwrite +#define TP_FFLUSH fflush +#define TP_FCLOSE fclose + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else +#define TP_UNLINK remove +#define TP_RMDIR _rmdir +#define TP_FREAD ::fread +#define TP_FOPEN ::fopen +#define TP_FREOPEN ::freopen +#define TP_STAT ::_stat +#define TP_GETENV ::getenv +#endif /* TECPLOTKERNEL */ + +#if defined _WIN64 +#define TP_FSEEK(stream,offset,whence) _fseeki64((stream),(__int64)(offset),(whence)) +#define TP_FTELL _ftelli64 +#else +#define TP_FSEEK(stream, offset, whence) fseek((stream), (long)(offset), (whence)) +#define TP_FTELL ftell +#endif + +#else +#define TP_RMDIR rmdir +#define TP_UNLINK unlink +#define TP_FOPEN fopen +#define TP_FREOPEN freopen +#define TP_FCLOSE fclose +#define TP_FREAD fread +#define TP_FWRITE fwrite +#define TP_FFLUSH fflush +#define TP_FSEEK fseeko +#define TP_FTELL ftello +#define TP_STAT stat +#define _stat stat // ...make the UNIXX and MSWIN platforms have the same syntax to use "struct _stat" +#define TP_GETENV getenv +#endif +/* ENDREMOVEFROMADDON */ + +/**************************************************************** + * * + * SIMPLE TYPEDEFS * + * * + ****************************************************************/ + + + +/* How to define UInt64_t/Int64_t is platform specific, but they are always 8-bytes */ +#if defined MSWIN +typedef unsigned __int64 UInt64_t; +typedef __int64 Int64_t; +#else +#if defined CRAY +typedef unsigned int UInt64_t; +typedef int Int64_t; +#else +#if defined LONGIS64 +typedef unsigned long UInt64_t; +typedef long Int64_t; +#else +typedef unsigned long long UInt64_t; +typedef long long Int64_t; +#endif +#endif +#endif + +#if defined LONGIS64 +typedef unsigned int UInt32_t; +typedef int Int32_t; +typedef int LgInteger_t; +#else +typedef unsigned int UInt32_t; +typedef int Int32_t; +typedef int LgInteger_t; +#endif + +typedef short Int16_t; +typedef unsigned short UInt16_t; +typedef signed char Int8_t; +typedef unsigned char UInt8_t; + +#ifdef INDEX_16_BIT +typedef Int16_t LgIndex_t; +#else +typedef Int32_t LgIndex_t; +#endif +typedef LgIndex_t NodeMap_t; +typedef LgIndex_t ScreenDim_t; + +/** + * ArbParam_t type is used for passing arbitrary integers or pointers in + * parameters. HgIndex_t is used for counting node maps and other things that + * may individually be LgIndex_t, but in total exceed 32-bit. + * The general rule is that these are 4 bytes on "32-bit" machines + * and 8 bytes on "64-bit" machines. + */ +#if defined CRAY +typedef char *ArbParam_t; +typedef long HgIndex_t; +#elif defined LONGIS64 +typedef long ArbParam_t; +typedef long HgIndex_t; +#elif defined MSWIN && (defined _M_IA64 || defined _M_AMD64) +typedef INT_PTR ArbParam_t; +typedef INT_PTR HgIndex_t; +#else +typedef int ArbParam_t; +typedef int HgIndex_t; +#endif + +typedef ArbParam_t UniqueID_t; + +/* 64 bit offset used to hold file offset and size values. */ +typedef Int64_t FileOffset_t; + +/** + * 64 bit offset for memory mapped I/O. + */ +typedef UInt64_t MemMapOffset_t; + +/* + * SmInteger must be at least a short.... + */ + +typedef unsigned char Byte_t; +typedef short SmInteger_t; +typedef SmInteger_t ColorIndex_t; +#ifdef INDEX_16_BIT +typedef Int16_t EntIndex_t; +#else +typedef Int32_t EntIndex_t; +#endif +typedef Int16_t SubZoneIndex_t; + +typedef char Boolean_t; +typedef char *ZoneName_t; +typedef char *VarName_t; +typedef char *LString_t; + +typedef LgIndex_t Strand_t; +typedef LgIndex_t HeapLength_t; +typedef LgIndex_t SegPtsArray_t[MaxGeoSegments]; +typedef double BasicSize_t[MaxBasicSizes]; +typedef double *VarList_t; + +typedef long SetIndex_t; + +typedef unsigned long SetData_t; +typedef SetData_t *SetData_pt; + +/* BEGINREMOVEFROMADDON */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + +/* The following list identifies items that can be inhibited. */ +#define FEATURE_3D (1L << 0) +#define FEATURE_3DVOLUME (1L << 1) +#define FEATURE_2D (1L << 2) +#define FEATURE_XY (1L << 3) +#define FEATURE_DATAALTER (1L << 4) +#define FEATURE_UNSTRUCTUREDDATA (1L << 5) +#define FEATURE_MULTIPLEFRAMES1 (1L << 6) +#define FEATURE_MULTIPLEZONES1 (1L << 7) +#define FEATURE_MULTIPLEFRAMES5 (1L << 8) +#define FEATURE_MULTIPLEZONES5 (1L << 9) +#define FEATURE_MULTIPLEFRAMES10 (1L << 10) +#define FEATURE_MULTIPLEZONES10 (1L << 11) +#define FEATURE_READNONOEMDATA (1L << 12) /* Added 07/22/2000 */ +#define FEATURE_DATALOADERS (1L << 13) /* Added 07/22/2000 */ +#define FEATURE_DATALOADERS_EXCEPTONE (1L << 14) /* Added 11/26/2001 */ +#define FEATURE_LOADONDEMAND (1L << 15) /* Added 09/13/2007 */ +#define FEATURE_MULTIPLEWORKERTHREADS (1L << 16) /* Added 09/13/2007 */ +#define FEATURE_ISOSURFACEGROUPS (1L << 17) /* Added 09/21/2007 */ +#define FEATURE_SLICEGROUPS (1L << 18) /* Added 09/21/2007 */ +#define FEATURE_STREAMTRACEGROUPS (1L << 19) /* Added 09/25/2007 not used yet */ +#define FEATURE_FEPOLYHEDRON (1L << 20) /* Added 09/25/2007 */ +#define FEATURE_FEPOLYGON (1L << 21) /* Added 09/25/2007 */ + +/* + * KnowFeaturesToInhibit must be updated whenever a new + * item is added above. + */ +#define KnownFeaturesToInhibit (FEATURE_3D |\ + FEATURE_3DVOLUME |\ + FEATURE_2D |\ + FEATURE_XY |\ + FEATURE_DATAALTER |\ + FEATURE_UNSTRUCTUREDDATA |\ + FEATURE_MULTIPLEFRAMES1 |\ + FEATURE_MULTIPLEZONES1 |\ + FEATURE_MULTIPLEFRAMES5 |\ + FEATURE_MULTIPLEZONES5 |\ + FEATURE_MULTIPLEFRAMES10 |\ + FEATURE_MULTIPLEZONES10 |\ + FEATURE_READNONOEMDATA |\ + FEATURE_DATALOADERS |\ + FEATURE_DATALOADERS_EXCEPTONE |\ + FEATURE_LOADONDEMAND |\ + FEATURE_MULTIPLEWORKERTHREADS |\ + FEATURE_ISOSURFACEGROUPS |\ + FEATURE_SLICEGROUPS |\ + FEATURE_STREAMTRACEGROUPS |\ + FEATURE_FEPOLYHEDRON |\ + FEATURE_FEPOLYGON) + +#define VALID_FEATURE_INHIBIT_FLAG(feature) (((feature) & KnownFeaturesToInhibit) != 0) +#define VALID_FEATURE_INHIBIT_MASK(mask) (((mask) & ~KnownFeaturesToInhibit)==0) + + + +/* The following are used by the OEM libs, so they need + to be outside of TECPLOTKERNEL */ +typedef unsigned long FeatureFlag_t; +typedef unsigned long FeatureMask_t; + +/* ENDREMOVEFROMADDON */ + +typedef char SymbolChar_t[3]; + +/** + * Face node offset used for identifying which node of a polytope face is + * desired. + */ +typedef LgIndex_t FaceNodeOffset_t; + +/** + * Element face offset used for identifying which face of a polytope element is + * desired. + */ +typedef LgIndex_t ElemFaceOffset_t; + +/** + * Face boundary item offset used for identifying which boundary item of a + * polytope face is desired. + */ +typedef LgIndex_t FaceBndryItemOffset_t; + +/**************************************************************** + * * + * ENUMERATED TYPEDEFS * + * * + ****************************************************************/ + +typedef enum +{ + PlacementPlaneOrientation_X, + PlacementPlaneOrientation_Y, + PlacementPlaneOrientation_Z, + END_PlacementPlaneOrientation_e, + PlacementPlaneOrientation_Invalid = BadEnumValue +} PlacementPlaneOrientation_e; + +typedef enum +{ + StringMode_ASCII, + StringMode_UTF8, + StringMode_Blend, + END_StringMode_e, + StringMode_Invalid = BadEnumValue + +} StringMode_e; + +typedef enum +{ + SidebarSizing_MaxOfAll, + SidebarSizing_Dynamic, + END_SidebarSizing_e, + SidebarSizing_Invalid = BadEnumValue + +} SidebarSizing_e; + +typedef enum +{ + SidebarLocation_Left, + SidebarLocation_Right, /* Not allowed at this time */ + SidebarLocation_Top, /* Not allowed at this time */ + SidebarLocation_Bottom, /* Not allowed at this time */ + END_SidebarLocation_e, + SidebarLocation_Invalid = BadEnumValue + +} SidebarLocation_e; + +typedef enum +{ + MenuItem_Option, + MenuItem_Toggle, + MenuItem_Separator, + MenuItem_SubMenu, + END_MenuItem_e, + MenuItem_Invalid = BadEnumValue +} MenuItem_e; + +typedef enum +{ + StandardMenu_File, + StandardMenu_Edit, + StandardMenu_View, + StandardMenu_Plot, + StandardMenu_Insert, + StandardMenu_Data, + StandardMenu_Frame, + StandardMenu_Workspace, /* deprecated: use Options instead */ + StandardMenu_Tools, + StandardMenu_Help, + StandardMenu_Animate, + StandardMenu_Options, + StandardMenu_Scripting, + END_StandardMenu_e, + StandardMenu_Invalid = BadEnumValue +} StandardMenu_e; + +typedef enum +{ + FieldProbeDialogPage_NodalValues, + FieldProbeDialogPage_CellCenteredValues, + FieldProbeDialogPage_ZoneCellInfo, + FieldProbeDialogPage_FaceNeighbors, + END_FieldProbeDialogPage_e, + FieldProbeDialogPage_Invalid = BadEnumValue +} FieldProbeDialogPage_e; + +/* BEGINREMOVEFROMADDON */ + +/* used for caches of boolean type */ +typedef enum +{ + BooleanCache_False, /* Value is cached and is FALSE */ + BooleanCache_True, /* Value is cached and is TRUE */ + BooleanCache_Uncached, /* Value is not cached. Value is unknown. */ + END_BooleanCache_e, + BooleanCache_Invalid = BadEnumValue +} BooleanCache_e; + +/* + * For determining pick location along a line + */ +typedef enum +{ + LinePickLocation_None, + LinePickLocation_StartHandle, + LinePickLocation_MidLineOnHandle, + LinePickLocation_MidLineOffHandles, + LinePickLocation_EndHandle, + END_LinePickLocation_e, + LinePickLocation_Invalid = BadEnumValue +} LinePickLocation_e; + + +/* + * Defines destination for setting up views: hardware (ie, OpenGL) or + * software (ie, internal transformation matrices). + */ +typedef enum +{ + ViewDest_Hardware, + ViewDest_Software, + END_ViewDest_e, + ViewDest_Invalid = BadEnumValue +} ViewDest_e; + +/* used for identifying the origin of the dataset reader */ +typedef enum +{ + DataSetReaderOrigin_Native, /* created by Tecplot */ + DataSetReaderOrigin_Foreign, /* created by an add-on */ + END_DataSetReaderOrigin_e, + DataSetReaderOrigin_Invalid = BadEnumValue +} DataSetReaderOrigin_e; + +/* used for identifying the origin of the extended curve fit */ +typedef enum +{ + ExtendedCurveFitOrigin_Native, /* created by Tecplot */ + ExtendedCurveFitOrigin_Foreign, /* created by an add-on */ + END_ExtendedCurveFitOrigin_e, + ExtendedCurveFitOrigin_Invalid = BadEnumValue +} ExtendedCurveFitOrigin_e; + +typedef enum +{ + CollapsedStatus_NotCollapsed, + CollapsedStatus_CollapsedToPoint, + CollapsedStatus_CollapsedToLine, + CollapsedStatus_CollapsedToSegmentedLine, + CollapsedStatus_CollapsedToTriangle, + END_CollapsedStatus_e, + CollapsedStatus_Invalid = BadEnumValue +} CollapsedStatus_e; +/* ENDREMOVEFROMADDON */ + +/** + */ +typedef enum +{ + UndoStateCategory_Frame, + UndoStateCategory_Picked, /* picked changes, not the pick itself */ + UndoStateCategory_Text, + UndoStateCategory_Geom, + UndoStateCategory_View, + UndoStateCategory_WorkspaceView, + UndoStateCategory_Style, /* style less text and geometries */ + UndoStateCategory_SpecificStyle, /* meaning that specific undo style will be added by the caller */ + UndoStateCategory_Data, + UndoStateCategory_DataAndStyle, + UndoStateCategory_StyleIncTextGeom, /* style including text and geometires */ + UndoStateCategory_GlobalStyle, /* style less field, map, text and geometries */ + UndoStateCategory_PageAction, + END_UndoStateCategory_e, + UndoStateCategory_Invalid = BadEnumValue +} UndoStateCategory_e; + + +/* + * Used only for Action_PropagateLinking + */ +typedef enum +{ + LinkType_WithinFrame, + LinkType_BetweenFrames, + END_LinkType_e, + LinkType_Invalid = BadEnumValue +} LinkType_e; + +typedef enum +{ + FrameCollection_All, + FrameCollection_Picked, + END_FrameCollection_e, + FrameCollection_Invalid = BadEnumValue +} FrameCollection_e; + + + +typedef enum +{ + LegendProcess_DrawLegend, + LegendProcess_EraseLegend, + LegendProcess_GetExtents, + END_LegendProcess_e, + LegendProcess_Invalid = BadEnumValue +} LegendProcess_e; + + +typedef enum +{ + RGBLegendOrientation_RGB, + RGBLegendOrientation_GBR, + RGBLegendOrientation_BRG, + RGBLegendOrientation_RBG, + RGBLegendOrientation_GRB, + RGBLegendOrientation_BGR, + END_RGBLegendOrientation_e, + RGBLegendOrientation_Invalid = BadEnumValue +} RGBLegendOrientation_e; + + + +/* BEGINREMOVEFROMADDON */ +/* Used by some of the image exporters/animators */ +typedef struct +{ + Byte_t R; + Byte_t G; + Byte_t B; +} RGBTriple_s; + +typedef RGBTriple_s RGBPalette_t[256]; + +/* ENDREMOVEFROMADDON */ + +/* BEGINREMOVEFROMADDON */ +/* The tag on the following line is so that the Windows + build script can parse all of the current state changes + out of this file, and compare them to the state changes + found in the main.c template file. + Do not change or delete the line below.*/ +/*StateChange_e_BeginDef*/ +/* ENDREMOVEFROMADDON */ + +typedef enum +{ + StateChange_VarsAltered, + StateChange_VarsAdded, + StateChange_ZonesDeleted, + StateChange_ZonesAdded, + StateChange_NodeMapsAltered, + StateChange_FrameDeleted, + StateChange_NewTopFrame, /* deprecated: use NewActiveFrame and/or FrameOrderChange */ + StateChange_Style, + StateChange_DataSetReset, + StateChange_NewLayout, + StateChange_CompleteReset, /* deprecated: no longer broadcast */ + StateChange_LineMapAssignment, /* was StateChange_XYMapAssignment */ + StateChange_ContourLevels, + StateChange_ModalDialogLaunch, + StateChange_ModalDialogDismiss, + StateChange_QuitTecplot, + StateChange_ZoneName, + StateChange_VarName, + StateChange_LineMapName, /* was StateChange_XYMapName */ + StateChange_LineMapAddDeleteOrReorder, /* was StateChange_XYMapAddDeleteOrReorder */ + StateChange_View, + StateChange_ColorMap, + StateChange_ContourVar, + StateChange_Streamtrace, + StateChange_NewAxisVariables, + StateChange_MouseModeUpdate, + StateChange_PickListCleared, + StateChange_PickListGroupSelect, + StateChange_PickListSingleSelect, + StateChange_PickListStyle, + StateChange_DataSetFileName, + StateChange_UnsuspendInterface, /* was StateChange_DrawGraphicsOn */ + StateChange_SuspendInterface, /* was StateChange_DrawGraphicsOff */ + StateChange_DataSetLockOn, + StateChange_DataSetLockOff, + StateChange_Text, + StateChange_Geom, + StateChange_DataSetTitle, + StateChange_DrawingInterrupted, + StateChange_PrintPreviewLaunch, + StateChange_PrintPreviewDismiss, + StateChange_AuxDataAdded, + StateChange_AuxDataDeleted, + StateChange_AuxDataAltered, + StateChange_VarsDeleted, + StateChange_TecplotIsInitialized, + StateChange_ImageExported, + StateChange_VariableLockOn, + StateChange_VariableLockOff, + StateChange_PageDeleted, + StateChange_NewTopPage, + StateChange_NewActiveFrame, + StateChange_FrameOrderChanged, + END_StateChange_e, + StateChange_Invalid = BadEnumValue, + /* deprecated values */ + StateChange_DrawGraphicsOn = StateChange_UnsuspendInterface, + StateChange_DrawGraphicsOff = StateChange_SuspendInterface, + StateChange_XYMapAssignment = StateChange_LineMapAssignment, + StateChange_XYMapName = StateChange_LineMapName, + StateChange_XYMapAddDeleteOrReorder = StateChange_LineMapAddDeleteOrReorder +} StateChange_e; + +typedef enum +{ + StateChangeMode_v75, + StateChangeMode_v80, + StateChangeMode_v100, + StateChangeMode_v113, + END_StateChangeMode_e, + StateChangeMode_Invalid = BadEnumValue +} StateChangeMode_e; + +typedef enum +{ + StateChangeCallbackAPI_Classic, + StateChangeCallbackAPI_ChangeOnly, + StateChangeCallbackAPI_ChangePlusClient, + END_StateChangeCallbackAPI_e, + StateChangeCallbackAPI_Invalid = BadEnumValue +} StateChangeCallbackAPI_e; + +typedef enum +{ + AppMode_Normal, + AppMode_Demo, + AppMode_OEM, + END_AppMode_e, + AppMode_Invalid = BadEnumValue +} AppMode_e; + +typedef enum +{ + ProductFlavor_TecplotFocus, + ProductFlavor_Tecplot360, + ProductFlavor_TecplotRS, + ProductFlavor_TecplotSDK, + END_ProductFlavor_e, + ProductFlavor_Invalid = BadEnumValue, + ProductFlavor_Focus = ProductFlavor_TecplotFocus, /* deprecated */ + ProductFlavor_360 = ProductFlavor_Tecplot360, /* deprecated */ + ProductFlavor_RS = ProductFlavor_TecplotRS, /* deprecated */ + ProductFlavor_SDK = ProductFlavor_TecplotSDK /* deprecated */ +} ProductFlavor_e; + +typedef enum +{ + LayoutPackageObject_Image, + LayoutPackageObject_Layout, + LayoutPackageObject_Data, + END_LayoutPackageObject_e, + LayoutPackageObject_Invalid = BadEnumValue +} LayoutPackageObject_e; + +typedef enum +{ + VarLoadMode_ByName, + VarLoadMode_ByPosition, + END_VarLoadMode_e, + VarLoadMode_Invalid = BadEnumValue +} VarLoadMode_e; + +typedef enum +{ + ImageSelection_OnePerFrame, + ImageSelection_WorkspaceOnly, + END_ImageSelection_e, + ImageSelection_Invalid = BadEnumValue +} ImageSelection_e; + +typedef enum +{ + LibraryType_Foreign, + LibraryType_V7Standard, + LibraryType_V7ActiveX, + END_LibraryType_e, + LibraryType_Invalid = BadEnumValue +} LibraryType_e; /* <help> "Add-on types" */ + + +typedef enum +{ + AssignOp_Equals, + AssignOp_PlusEquals, + AssignOp_MinusEquals, + AssignOp_TimesEquals, + AssignOp_DivideEquals, + AssignOp_ConvertFromCm, + AssignOp_ConvertFromIn, + AssignOp_ConvertFromPt, + AssignOp_ConvertFromPix, + END_AssignOp_e, + AssignOp_Invalid = BadEnumValue +} AssignOp_e; + +typedef enum +{ + Dialog_ColorMap, + Dialog_Equation, + Dialog_MacroViewer, + Dialog_ZoneMapStyle, /* was Dialog_PlotAttributes*/ + Dialog_QuickEdit, + Dialog_QuickMacroPanel, + Dialog_ValueBlanking, + Dialog_Probe, /* used for dialog positioning only */ + Dialog_ProbeAt, + Dialog_NewLayout, + Dialog_OpenLayout, + Dialog_Save, + Dialog_SaveAs, + Dialog_LoadData, + Dialog_WriteData, + Dialog_Print, + Dialog_Import, + Dialog_Export, + Dialog_MacroPlay, + Dialog_MacroRecord, + Dialog_AxisEdit, + Dialog_SpatialVars, + Dialog_Reset3DAxes, + Dialog_ThreeDAxisLimits, + Dialog_ThreeDOrientationAxis, + Dialog_Streamtraces, + Dialog_IsoSurfaces, + Dialog_Slices, + Dialog_Contour, + Dialog_VectorLength, + Dialog_VectorVars, + Dialog_VectorArrowheads, + Dialog_VectorReferenceVector, + Dialog_ScatterSizeAndFont, + Dialog_ScatterLegend, + Dialog_ScatterReferenceSymbol, + Dialog_RGBColorVarsAndRange, + Dialog_RGBColorLegend, + Dialog_LineMapLegend, + Dialog_IJKBlanking, + Dialog_DepthBlanking, + Dialog_LightSource, + Dialog_Advanced3DControl, + Dialog_TwoDDrawOrder, + Dialog_PolarDrawingOptions, + Dialog_DataLabels, + Dialog_StyleLinking, + Dialog_Smooth, + Dialog_TransformCoordinates, + Dialog_Rotate2DData, + Dialog_Create1DLine, + Dialog_CreateRectangularZone, + Dialog_CreateCircularZone, + Dialog_DuplicateZone, + Dialog_MirrorZone, + Dialog_CreateZoneFromPolylines, + Dialog_CreateZoneFromValues, + Dialog_DeleteVariables, + Dialog_DeleteZones, + Dialog_ExtractContourLines, + Dialog_ExtractFEBoundary, + Dialog_ExtractIsoSurfaces, + Dialog_ExtractSlices, + Dialog_ExtractSliceFromPlane, + Dialog_ExtractStreamtraces, + Dialog_ExtractSubZone, + Dialog_ExtractDiscretePoints, + Dialog_ExtractPointsFromPolyline, + Dialog_ExtractPointsFromGeometry, + Dialog_LinearInterpolation, + Dialog_InverseDistanceInterpolation, + Dialog_KrigingInterpolation, + Dialog_Triangulate, + Dialog_DataInfo, + Dialog_CurveInfo, + Dialog_DataSpreadsheet, + Dialog_PaperSetup, + Dialog_OrderFrames, + Dialog_RulerGrid, + Dialog_ThreeDViewRotate, + Dialog_ThreeDViewDetails, + Dialog_TranslateMagnify, + Dialog_PrintPreview, + Dialog_ColorPreferences, + Dialog_MiscPreferences, + Dialog_SizePreferences, + Dialog_SaveConfiguration, + Dialog_SaveColorMap, + Dialog_LoadColorMap, + Dialog_HelpAboutTecplot, + Dialog_HelpAboutAddOns, + Dialog_Publish, + Dialog_EditFrame, + Dialog_CopyToClipboard, + Dialog_ThreeDEdge, + Dialog_TimeDetails, + Dialog_Performance, + END_Dialog_e, + Dialog_Invalid = BadEnumValue, + /* deprecated values */ + Dialog_PlotAttributes = Dialog_ZoneMapStyle +} Dialog_e; /* <help> "Tecplot dialog types" */ + +typedef enum +{ + AnchorAlignment_TopLeft, + AnchorAlignment_TopCenter, + AnchorAlignment_TopRight, + AnchorAlignment_MiddleLeft, + AnchorAlignment_MiddleCenter, + AnchorAlignment_MiddleRight, + AnchorAlignment_BottomLeft, + AnchorAlignment_BottomCenter, + AnchorAlignment_BottomRight, + END_AnchorAlignment_e, + AnchorAlignment_Invalid = BadEnumValue +} AnchorAlignment_e; + +/* BEGINREMOVEFROMADDON */ +typedef enum +{ + PositionAtAnchor_Never, + PositionAtAnchor_Once, + PositionAtAnchor_Always, + END_PositionAtAnchor_e, + PositionAtAnchor_Invalid = BadEnumValue +} PositionAtAnchor_e; +/* ENDREMOVEFROMADDON */ + +/* BEGINREMOVEFROMADDON */ +typedef struct +{ + AnchorAlignment_e AnchorAlignment; + Boolean_t AnchorHorizontalInside; + Boolean_t AnchorVerticalInside; + SmInteger_t MinVisibilityPercentage; + LgIndex_t IOffset; + LgIndex_t JOffset; + PositionAtAnchor_e PositionAtAnchor; + Boolean_t HasBeenPositioned; /* not persistent */ +} DialogPosition_s; +/* ENDREMOVEFROMADDON */ + + +#if defined EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY +/** + * @deprecated + * Please use \ref CurveInfoMode_e instead. + */ +typedef enum +{ + ProcessXYMode_NotUsed1, /* deprecated: do not use */ + ProcessXYMode_NotUsed2, /* deprecated: do not use */ + ProcessXYMode_NotUsed3, /* deprecated: do not use */ + ProcessXYMode_NotUsed4, /* deprecated: do not use */ + ProcessXYMode_NotUsed5, /* deprecated: do not use */ + ProcessXYMode_NotUsed6, /* deprecated: do not use */ + ProcessXYMode_NotUsed7, /* deprecated: do not use */ + ProcessXYMode_NotUsed8, /* deprecated: do not use */ + ProcessXYMode_NotUsed9, /* deprecated: do not use */ + ProcessXYMode_WriteCurveCoef, /* deprecated: use CurveInfoMode_Coefficients */ + ProcessXYMode_WriteCurvePoints, /* deprecated: use CurveInfoMode_RawData */ + END_ProcessXYMode_e, + ProcessXYMode_Invalid = BadEnumValue +} ProcessXYMode_e; +#endif + +typedef enum +{ + CurveInfoMode_Coefficients, /* ProcessXYMode_WriteCurveCoef */ + CurveInfoMode_RawData, /* ProcessXYMode_WriteCurvePoints */ + CurveInfoMode_Macro, /* ProcessXYMode_WriteCurveCoefMacro */ + END_CurveInfoMode_e, + CurveInfoMode_Invalid = BadEnumValue +} CurveInfoMode_e; + +/* BEGINREMOVEFROMADDON */ +typedef enum +{ + ProcessLineMapMode_Draw, + ProcessLineMapMode_GetXYMinMax, + ProcessLineMapMode_GetDataMinMax, + ProcessLineMapMode_GetSinglePick, + ProcessLineMapMode_CheckOnlyForGroupPick, + ProcessLineMapMode_GetGroupPick, + ProcessLineMapMode_GetFirstValidDataPoint, + ProcessLineMapMode_GetNearestPoint, + ProcessLineMapMode_GetDependentValue, + ProcessLineMapMode_GetRSquaredGoodness, + ProcessLineMapMode_DisplayCurveCoef, + ProcessLineMapMode_WriteCurveCoef, + ProcessLineMapMode_WriteCurvePoints, + ProcessLineMapMode_InsertLabels, + ProcessLineMapMode_GetIndependentValue, + ProcessLineMapMode_WriteCurveCoefMacro, + END_ProcessLineMapMode_e, + ProcessLineMapMode_Invalid = BadEnumValue +} ProcessLineMapMode_e; +/* ENDREMOVEFROMADDON */ + +typedef enum +{ + StyleBase_Factory, + StyleBase_Config, + END_StyleBase_e, + StyleBase_Invalid = BadEnumValue +} StyleBase_e; + + +typedef enum +{ + ReadDataOption_NewData, + ReadDataOption_AppendData, + ReadDataOption_ReplaceData, + END_ReadDataOption_e, + ReadDataOption_Invalid = BadEnumValue +} ReadDataOption_e; + +#if defined EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY +/** + * @deprecated + * Please use \ref LabelType_e instead. + */ +typedef enum +{ + NodeLabel_Index, /* deprecated: use LabelType_Index */ + NodeLabel_VarValue, /* deprecated: use LabelType_VarValue */ + NodeLabel_XAndYVarValue, /* deprecated: use LabelType_XAndYVarValue */ + END_NodeLabel_e, + NodeLabel_Invalid = BadEnumValue +} NodeLabel_e; +#endif + +typedef enum +{ + LabelType_Index, /* NodeLabel_Index */ + LabelType_VarValue, /* NodeLabel_VarValue */ + LabelType_XAndYVarValue, /* NodeLabel_XAndYVarValue */ + END_LabelType_e, + LabelType_Invalid = BadEnumValue +} LabelType_e; + + +#if defined EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY +/** + * @deprecated + * Please use \ref BorderAction_e instead. + */ +typedef enum +{ + SubBoundaryEditOption_All, /* deprecated: use BorderAction_AddAll */ + SubBoundaryEditOption_Add, /* deprecated: use BorderAction_Add */ + SubBoundaryEditOption_Remove, /* deprecated: use BorderAction_Remove */ + SubBoundaryEditOption_AddOnly, /* deprecated: use BorderAction_AddOnly */ + END_SubBoundaryEditOption_e, + SubBoundaryEditOption_Invalid = BadEnumValue +} SubBoundaryEditOption_e; +#endif + +typedef enum +{ + BorderAction_AddAll, /* SubBoundaryEditOption_All */ + BorderAction_Add, /* SubBoundaryEditOption_Add */ + BorderAction_Remove, /* SubBoundaryEditOption_Remove */ + BorderAction_AddOnly, /* SubBoundaryEditOption_AddOnly */ + END_BorderAction_e, + BorderAction_Invalid = BadEnumValue +} BorderAction_e; + + +typedef enum +{ + PointerStyle_NotUsed1, + PointerStyle_NotUsed2, + PointerStyle_NotUsed3, + PointerStyle_AllDirections, + PointerStyle_NotUsed4, + PointerStyle_NotUsed5, + PointerStyle_NotUsed6, + PointerStyle_UpperLeftBracket, + PointerStyle_UpperRightBracket, + PointerStyle_LeftBracket, + PointerStyle_LowerLeftBracket, + PointerStyle_LowerRightBracket, + PointerStyle_RightBracket, + PointerStyle_BottomBracket, + PointerStyle_TopBracket, + PointerStyle_UpDown, + PointerStyle_LeftRight, + END_PointerStyle_e, + PointerStyle_Invalid = BadEnumValue +} PointerStyle_e; + +typedef enum +{ + CursorStyle_Undefined, + CursorStyle_StandardArrow, + CursorStyle_AdjusterArrow, + CursorStyle_AllDirections, + CursorStyle_Rotate, + CursorStyle_Zoom, + CursorStyle_Locate, + CursorStyle_UpperLeftBracket, + CursorStyle_UpperRightBracket, + CursorStyle_LeftBracket, + CursorStyle_LowerLeftBracket, + CursorStyle_LowerRightBracket, + CursorStyle_RightBracket, + CursorStyle_BottomBracket, + CursorStyle_TopBracket, + CursorStyle_UpDown, + CursorStyle_LeftRight, + CursorStyle_Waiting, + END_CursorStyle_e, + CursorStyle_Invalid = BadEnumValue +} CursorStyle_e; + + +typedef enum +{ + PickSubPosition_All, + PickSubPosition_Top, + PickSubPosition_Bottom, + PickSubPosition_Left, + PickSubPosition_Right, + PickSubPosition_TopLeft, + PickSubPosition_TopRight, + PickSubPosition_BottomLeft, + PickSubPosition_BottomRight, + PickSubPosition_BottomAndTop, + PickSubPosition_LeftAndRight, + END_PickSubPosition_e, + PickSubPosition_Invalid = BadEnumValue +} PickSubPosition_e; + +typedef enum +{ + TecEngInitReturnCode_Ok, + TecEngInitReturnCode_LicenseIsInvalid, + TecEngInitReturnCode_LicenseExpired, + TecEngInitReturnCode_InternalInitializationError, + END_TecEngInitReturnCode_e, + TecEngInitReturnCode_Invalid = BadEnumValue +} TecEngInitReturnCode_e; + +typedef enum +{ + GetValueReturnCode_Ok, + GetValueReturnCode_ResultTypeError, + GetValueReturnCode_SyntaxError, + GetValueReturnCode_ContextError, + GetValueReturnCode_DeprecatedError, + END_GetValueReturnCode_e, + GetValueReturnCode_Invalid = BadEnumValue, + /* deprecated values */ + GetValue_Ok = GetValueReturnCode_Ok, /* deprecated */ + GetValue_ResultTypeError = GetValueReturnCode_ResultTypeError, /* deprecated */ + GetValue_SyntaxError = GetValueReturnCode_SyntaxError, /* deprecated */ + GetValue_ContextError = GetValueReturnCode_ContextError, /* deprecated */ + GetValue_DeprecatedError = GetValueReturnCode_DeprecatedError, /* deprecated */ + GetValue_Invalid = GetValueReturnCode_Invalid /* deprecated */ +} GetValueReturnCode_e; + +typedef enum +{ + SetValueReturnCode_Ok, + SetValueReturnCode_DuplicateValue, + SetValueReturnCode_InvalidCommandOption, + SetValueReturnCode_NoAttachedDatasetError, + SetValueReturnCode_NoAttachedFrameError, + SetValueReturnCode_NotAllowedInConfigError, + SetValueReturnCode_ValueRangeError, + SetValueReturnCode_ValueSyntaxError, + SetValueReturnCode_AssignOpError, + SetValueReturnCode_InvalidVarOrZone, + SetValueReturnCode_InternalMemoryError, + SetValueReturnCode_ContextError1, + SetValueReturnCode_ContextError2, + SetValueReturnCode_OnlyAllowedInConfigError, + SetValueReturnCode_FeatureNotAvailable, + END_SetValueReturnCode_e, + /* BEGINREMOVEFROMADDON */ + /* For now this value is only used in Tecplot code. + * the value is here as an option for the future. */ + SetValueReturnCode_Ignored = SetValueReturnCode_DuplicateValue, + /* ENDREMOVEFROMADDON */ + SetValueReturnCode_Invalid = BadEnumValue, + /* deprecated values */ + SetValue_Ok = SetValueReturnCode_Ok, /* deprecated */ + SetValue_DuplicateValue = SetValueReturnCode_DuplicateValue, /* deprecated */ + SetValue_InvalidCommandOption = SetValueReturnCode_InvalidCommandOption, /* deprecated */ + SetValue_NoAttachedDatasetError = SetValueReturnCode_NoAttachedDatasetError, /* deprecated */ + SetValue_NoAttachedFrameError = SetValueReturnCode_NoAttachedFrameError, /* deprecated */ + SetValue_NotAllowedInConfigError = SetValueReturnCode_NotAllowedInConfigError, /* deprecated */ + SetValue_ValueRangeError = SetValueReturnCode_ValueRangeError, /* deprecated */ + SetValue_ValueSyntaxError = SetValueReturnCode_ValueSyntaxError, /* deprecated */ + SetValue_AssignOpError = SetValueReturnCode_AssignOpError, /* deprecated */ + SetValue_InvalidVarOrZone = SetValueReturnCode_InvalidVarOrZone, /* deprecated */ + SetValue_InternalMemoryError = SetValueReturnCode_InternalMemoryError, /* deprecated */ + SetValue_ContextError1 = SetValueReturnCode_ContextError1, /* deprecated */ + SetValue_ContextError2 = SetValueReturnCode_ContextError2, /* deprecated */ + SetValue_OnlyAllowedInConfigError = SetValueReturnCode_OnlyAllowedInConfigError, /* deprecated */ + SetValue_FeatureNotAvailable = SetValueReturnCode_FeatureNotAvailable, /* deprecated */ + /* BEGINREMOVEFROMADDON */ + SetValue_Ignored = SetValueReturnCode_Ignored, /* deprecated */ + /* ENDREMOVEFROMADDON */ + SetValue_Invalid = SetValueReturnCode_Invalid /* deprecated */ +} SetValueReturnCode_e; + + +typedef enum +{ + ObjectAlign_LeftJustify, + ObjectAlign_RightJustify, + ObjectAlign_Center, + ObjectAlign_Top, + ObjectAlign_Bottom, + END_ObjectAlign_e, + ObjectAlign_Invalid = BadEnumValue +} ObjectAlign_e; + + +/* + * For 3D axis labels only. + */ +typedef enum +{ + LabelAlignment_ByAngle, + LabelAlignment_AlongAxis, + LabelAlignment_PerpendicularToAxis, + END_LabelAlignment_e, + LabelAlignment_Invalid = BadEnumValue +} LabelAlignment_e; /* <help> Label alignment for 3D axis labels only" */ + +/* + * View_SetMagnification added 02/24/03 so all plot types + * can behave the same way "do a 'centered' magnifacation change". + * Line plots will still accept View_Scale option and zoom towards + * the corner so old macros/addons still work. + */ +typedef enum +{ + View_Fit, + View_DataFit, + View_AxisFit, + View_Scale, /* deprecated, Use SetMagnification */ + View_Center, + View_Translate, + View_Zoom, + View_Last, + View_Copy, + View_Paste, + View_Push, /* End of V9 enums */ + View_SetMagnification, + View_NiceFit, + View_AxisNiceFit, + View_MakeCurrentViewNice, + View_AxisMakeCurrentValuesNice, + View_AxisResetToEntireCircle, + View_FitSurfaces, + END_View_e, + View_Invalid = BadEnumValue +} View_e; + + + +typedef enum +{ + WorkspaceView_FitSelectedFrames, + WorkspaceView_FitAllFrames, + WorkspaceView_FitPaper, + WorkspaceView_Maximize, + WorkspaceView_LastView, + WorkspaceView_Zoom, + WorkspaceView_Translate, + WorkspaceView_UnMaximize, + END_WorkspaceView_e, + WorkspaceView_Invalid = BadEnumValue +} WorkspaceView_e; + + +typedef enum +{ + ArrowheadStyle_Plain, + ArrowheadStyle_Filled, + ArrowheadStyle_Hollow, + END_ArrowheadStyle_e, + ArrowheadStyle_Invalid = BadEnumValue, + /* deprecated values */ + Arrowhead_Plain = ArrowheadStyle_Plain, /* deprecated */ + Arrowhead_Filled = ArrowheadStyle_Filled, /* deprecated */ + Arrowhead_Hollow = ArrowheadStyle_Hollow, /* deprecated */ + Arrowhead_Invalid = ArrowheadStyle_Invalid /* deprecated */ +} ArrowheadStyle_e; + + +typedef enum +{ + ArrowheadAttachment_None, + ArrowheadAttachment_AtBeginning, + ArrowheadAttachment_AtEnd, + ArrowheadAttachment_AtBothEnds, + END_ArrowheadAttachment_e, + ArrowheadAttachment_Invalid = BadEnumValue, + /* deprecated values */ + ArrowheadAttach_None = ArrowheadAttachment_None, /* deprecated */ + ArrowheadAttach_AtBeginning = ArrowheadAttachment_AtBeginning, /* deprecated */ + ArrowheadAttach_AtEnd = ArrowheadAttachment_AtEnd, /* deprecated */ + ArrowheadAttach_AtBothEnds = ArrowheadAttachment_AtBothEnds, /* deprecated */ + ArrowheadAttach_Invalid = ArrowheadAttachment_Invalid /* deprecated */ +} ArrowheadAttachment_e; + +typedef enum +{ + Clipping_ClipToViewport, + Clipping_ClipToFrame, + END_Clipping_e, + Clipping_Invalid = BadEnumValue +} Clipping_e; + +typedef enum +{ + StatusInfo_Hover, + StatusInfo_Identify, + StatusInfo_Instruction, + StatusInfo_Working, + StatusInfo_PercentDone, + END_StatusInfo_e, + StatusInfo_Invalid = BadEnumValue +} StatusInfo_e; + + +#if defined EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY +/** + * @deprecated + * Please use \ref PlotType_e instead. + */ +typedef enum +{ + FrameMode_Empty, /* deprecated: use PlotType_Automatic */ + FrameMode_ThreeD, /* deprecated: use PlotType_Cartesian3D */ + FrameMode_TwoD, /* deprecated: use PlotType_Cartesian2D */ + FrameMode_XY, /* deprecated: use PlotType_XYLine */ + FrameMode_Sketch, /* deprecated: use PlotType_Sketch */ + END_FrameMode_e, + FrameMode_Invalid = BadEnumValue, + /* deprecated values */ + Frame_Empty = FrameMode_Empty, /* deprecated */ + Frame_ThreeD = FrameMode_ThreeD, /* deprecated */ + Frame_TwoD = FrameMode_TwoD, /* deprecated */ + Frame_XY = FrameMode_XY, /* deprecated */ + Frame_Sketch = FrameMode_Sketch, /* deprecated */ + Frame_Invalid = FrameMode_Invalid /* deprecated */ +} FrameMode_e; +#endif + + +typedef enum +{ + PlotType_Automatic, /* Frame_Empty */ + PlotType_Cartesian3D, /* Frame_ThreeD */ + PlotType_Cartesian2D, /* Frame_TwoD */ + PlotType_XYLine, /* Frame_XY */ + PlotType_Sketch, /* Frame_Sketch */ + PlotType_PolarLine, + END_PlotType_e, + PlotType_Invalid = BadEnumValue +} PlotType_e; + + +#define VALID_PLOTTYPE(PlotType) ( VALID_ENUM((PlotType), PlotType_e) && \ + ((PlotType) != PlotType_Automatic) ) +#define VALID_LINEPLOT_PLOTTYPE(PlotType) ( (PlotType) == PlotType_XYLine || \ + (PlotType) == PlotType_PolarLine ) +#define VALID_FIELDPLOT_PLOTTYPE(PlotType) ( (PlotType) == PlotType_Cartesian2D || \ + (PlotType) == PlotType_Cartesian3D ) +#define PLOTTYPE_USES_FIELDZONES(PlotType) VALID_FIELDPLOT_PLOTTYPE((PlotType)) +#define PLOTTYPE_USES_LINEMAPS(PlotType) VALID_LINEPLOT_PLOTTYPE((PlotType)) +#define VALID_V9_PLOTTYPE(PlotType) ( (PlotType) == PlotType_Sketch || \ + (PlotType) == PlotType_XYLine || \ + (PlotType) == PlotType_Cartesian2D || \ + (PlotType) == PlotType_Cartesian3D ) + + +typedef enum +{ + ContLineCreateMode_OneZonePerContourLevel, + ContLineCreateMode_OneZonePerIndependentPolyline, + END_ContLineCreateMode_e, + ContLineCreateMode_Invalid = BadEnumValue +} ContLineCreateMode_e; + + +typedef enum +{ + PickObjects_None, + PickObjects_Frame, + PickObjects_Axis, + PickObjects_ThreeDOrientationAxis, + PickObjects_Geom, + PickObjects_Text, + PickObjects_ContourLegend, + PickObjects_ContourLabel, + PickObjects_ScatterLegend, + PickObjects_LineLegend, + PickObjects_ReferenceVector, + PickObjects_ReferenceScatterSymbol, + PickObjects_StreamtracePosition, + PickObjects_StreamtraceTermLine, + PickObjects_Paper, + PickObjects_Zone, + PickObjects_XYMapping, /* deprecated: use PickObject_LineMapping */ + PickObjects_StreamtraceCOB, + PickObjects_SliceCOB, + PickObjects_IsoSurfaceCOB, + PickObjects_RGBLegend, + PickObjects_LineMapping, + END_PickObjects_e, + PickObjects_Invalid = BadEnumValue, + /* deprecated values */ + PickObject_None = PickObjects_None, /* deprecated */ + PickObject_Frame = PickObjects_Frame, /* deprecated */ + PickObject_Axis = PickObjects_Axis, /* deprecated */ + PickObject_3DOrientationAxis = PickObjects_ThreeDOrientationAxis, /* deprecated */ + PickObject_Geom = PickObjects_Geom, /* deprecated */ + PickObject_Text = PickObjects_Text, /* deprecated */ + PickObject_ContourLegend = PickObjects_ContourLegend, /* deprecated */ + PickObject_ContourLabel = PickObjects_ContourLabel, /* deprecated */ + PickObject_ScatterLegend = PickObjects_ScatterLegend, /* deprecated */ + PickObject_LineLegend = PickObjects_LineLegend, /* deprecated */ + PickObject_XYLegend = PickObjects_LineLegend, /* deprecated */ + PickObject_ReferenceVector = PickObjects_ReferenceVector, /* deprecated */ + PickObject_ReferenceScatterSymbol = PickObjects_ReferenceScatterSymbol, /* deprecated */ + PickObject_StreamtracePosition = PickObjects_StreamtracePosition, /* deprecated */ + PickObject_StreamtraceTermLine = PickObjects_StreamtraceTermLine, /* deprecated */ + PickObject_Paper = PickObjects_Paper, /* deprecated */ + PickObject_Zone = PickObjects_Zone, /* deprecated */ + PickObject_XYMapping = PickObjects_XYMapping, /* deprecated */ + PickObject_StreamtraceCOB = PickObjects_StreamtraceCOB, /* deprecated */ + PickObject_SliceCOB = PickObjects_SliceCOB, /* deprecated */ + PickObject_IsoSurfaceCOB = PickObjects_IsoSurfaceCOB, /* deprecated */ + PickObject_RGBLegend = PickObjects_RGBLegend, /* deprecated */ + PickObject_LineMapping = PickObjects_LineMapping, /* deprecated */ + PickObject_Invalid = PickObjects_Invalid /* deprecated */ +} PickObjects_e; + + +/* BEGINREMOVEFROMADDON */ +typedef enum +{ + SingleEditState_NotEditing, + SingleEditState_ActivelyEditing, + SingleEditState_WasEditing, + END_SingleEditState_e, + EditingInvalid = BadEnumValue +} SingleEditState_e; + + +typedef enum +{ + AxisSubObject_GridArea, + AxisSubObject_AxisLine, + AxisSubObject_Title, + END_AxisSubObject_e, + AxisSubObject_Invalid = BadEnumValue +} AxisSubObject_e; + +typedef enum +{ + AxisSubPosition_GridMinBorder, + AxisSubPosition_GridMaxBorder, + AxisSubPosition_MainAxisLine, + AxisSubPosition_BackAxisLine, + AxisSubPosition_PerpAxisLine, + AxisSubPosition_PerpBackAxisLine, + END_AxisSubPosition_e, + AxisSubPosition_Invalid = BadEnumValue, + AxisSubPosition_2DStart = AxisSubPosition_GridMinBorder, + AxisSubPosition_2DEnd = AxisSubPosition_MainAxisLine, + AxisSubPosition_PolarStart = AxisSubPosition_GridMinBorder, + AxisSubPosition_PolarEnd = AxisSubPosition_PerpBackAxisLine +} AxisSubPosition_e; +/* ENDREMOVEFROMADDON */ + +/* + * NOTE: The _NoOp value is not at the top so this + * enumeration aligns with the old AltMouseButtonMode_e + * enumeration. + */ +typedef enum +{ + MouseButtonClick_Redraw, + MouseButtonClick_RevertToSelect, + MouseButtonClick_NoOp, + END_MouseButtonClick_e, + MouseButtonClick_Invalid = BadEnumValue +} MouseButtonClick_e; + + +typedef enum +{ + MouseButtonDrag_NoOp, + MouseButtonDrag_ZoomPaper, + MouseButtonDrag_TranslatePaper, + MouseButtonDrag_ZoomData, + MouseButtonDrag_TranslateData, + MouseButtonDrag_RlrBallRtatData, + MouseButtonDrag_SpherRtatData, + MouseButtonDrag_XRotateData, + MouseButtonDrag_YRotateData, + MouseButtonDrag_ZRotateData, + MouseButtonDrag_TwistRotateData, + MouseButtonDrag_ZoomViewer, + MouseButtonDrag_TranslateViewer, + MouseButtonDrag_RlrBallRtatVwr, + MouseButtonDrag_SpherRotateVwr, + MouseButtonDrag_XRotateViewer, + MouseButtonDrag_YRotateViewer, + MouseButtonDrag_ZRotateViewer, + MouseButtonDrag_TwistRotateViewer, + END_MouseButtonDrag_e, + MouseButtonDrag_Invalid = BadEnumValue +} MouseButtonDrag_e; + + +/* BEGINREMOVEFROMADDON */ +typedef struct +{ + MouseButtonClick_e ButtonClick; + MouseButtonDrag_e SimpleDrag; + MouseButtonDrag_e ControlledDrag; + MouseButtonDrag_e AltedDrag; + MouseButtonDrag_e ShiftedDrag; + MouseButtonDrag_e ControlAltedDrag; + MouseButtonDrag_e ControlShiftedDrag; + MouseButtonDrag_e AltShiftedDrag; + MouseButtonDrag_e ControlAltShiftedDrag; +} MouseButtonAction_s; + + +typedef struct +{ + MouseButtonAction_s MiddleButton; + MouseButtonAction_s RightButton; +} MouseActions_s; +/* ENDREMOVEFROMADDON */ + + +typedef enum /* deprecated */ +{ + AltMouseButtonMode_Regen, + AltMouseButtonMode_RevertToSelect, + END_AltMouseButtonMode_e, + AltMouseButtonMode_Invalid = BadEnumValue +} AltMouseButtonMode_e; + + +typedef enum +{ + MouseButtonMode_NoMode, + MouseButtonMode_Select, + MouseButtonMode_Adjust, + MouseButtonMode_Zoom, + MouseButtonMode_Translate, + MouseButtonMode_Probe, + MouseButtonMode_Text, + MouseButtonMode_GeomPolyline, + MouseButtonMode_GeomSquare, + MouseButtonMode_GeomCircle, + MouseButtonMode_GeomRectangle, + MouseButtonMode_GeomEllipse, + MouseButtonMode_GeomSpline, + MouseButtonMode_CreateFrame, + MouseButtonMode_RotateSpherical, + MouseButtonMode_RotateRollerBall, + MouseButtonMode_RotateTwist, + MouseButtonMode_RotateXAxis, + MouseButtonMode_RotateYAxis, + MouseButtonMode_RotateZAxis, + MouseButtonMode_ContourLabel, + MouseButtonMode_ContourAdd, + MouseButtonMode_ContourDelete, + MouseButtonMode_StreamPoints, + MouseButtonMode_StreamEndLine, + MouseButtonMode_ExtractPoints, + MouseButtonMode_ExtractLine, + MouseButtonMode_CreateRectangularZone, + MouseButtonMode_CreateCircularZone, + MouseButtonMode_Slice, + MouseButtonMode_LightSource, + MouseButtonMode_User1, + MouseButtonMode_User2, + MouseButtonMode_User3, + MouseButtonMode_User4, + END_MouseButtonMode_e, + MouseButtonMode_Invalid = BadEnumValue, + /* deprecated values */ + Mouse_NoMode = MouseButtonMode_NoMode, /* deprecated */ + Mouse_Select = MouseButtonMode_Select, /* deprecated */ + Mouse_Adjust = MouseButtonMode_Adjust, /* deprecated */ + Mouse_Zoom = MouseButtonMode_Zoom, /* deprecated */ + Mouse_Translate = MouseButtonMode_Translate, /* deprecated */ + Mouse_Probe = MouseButtonMode_Probe, /* deprecated */ + Mouse_Text = MouseButtonMode_Text, /* deprecated */ + Mouse_GeomPolyline = MouseButtonMode_GeomPolyline, /* deprecated */ + Mouse_GeomSquare = MouseButtonMode_GeomSquare, /* deprecated */ + Mouse_GeomCircle = MouseButtonMode_GeomCircle, /* deprecated */ + Mouse_GeomRectangle = MouseButtonMode_GeomRectangle, /* deprecated */ + Mouse_GeomEllipse = MouseButtonMode_GeomEllipse, /* deprecated */ + Mouse_GeomSpline = MouseButtonMode_GeomSpline, /* deprecated */ + Mouse_CreateFrame = MouseButtonMode_CreateFrame, /* deprecated */ + Mouse_RotateSpherical = MouseButtonMode_RotateSpherical, /* deprecated */ + Mouse_RotateRollerBall = MouseButtonMode_RotateRollerBall, /* deprecated */ + Mouse_RotateTwist = MouseButtonMode_RotateTwist, /* deprecated */ + Mouse_RotateXAxis = MouseButtonMode_RotateXAxis, /* deprecated */ + Mouse_RotateYAxis = MouseButtonMode_RotateYAxis, /* deprecated */ + Mouse_RotateZAxis = MouseButtonMode_RotateZAxis, /* deprecated */ + Mouse_ContourLabel = MouseButtonMode_ContourLabel, /* deprecated */ + Mouse_ContourAdd = MouseButtonMode_ContourAdd, /* deprecated */ + Mouse_ContourDelete = MouseButtonMode_ContourDelete, /* deprecated */ + Mouse_StreamPoints = MouseButtonMode_StreamPoints, /* deprecated */ + Mouse_StreamEndLine = MouseButtonMode_StreamEndLine, /* deprecated */ + Mouse_ExtractPoints = MouseButtonMode_ExtractPoints, /* deprecated */ + Mouse_ExtractLine = MouseButtonMode_ExtractLine, /* deprecated */ + Mouse_CreateRectangularZone = MouseButtonMode_CreateRectangularZone, /* deprecated */ + Mouse_CreateCircularZone = MouseButtonMode_CreateCircularZone, /* deprecated */ + Mouse_Slice = MouseButtonMode_Slice, /* deprecated */ + Mouse_User1 = MouseButtonMode_User1, /* deprecated */ + Mouse_User2 = MouseButtonMode_User2, /* deprecated */ + Mouse_User3 = MouseButtonMode_User3, /* deprecated */ + Mouse_User4 = MouseButtonMode_User4, /* deprecated */ + Mouse_Invalid = MouseButtonMode_Invalid /* deprecated */ +} MouseButtonMode_e; + + +typedef enum +{ + DetailsButtonState_QuickEdit, + DetailsButtonState_ObjectDetails, + DetailsButtonState_ToolDetails, + END_DetailsButtonState_e, + DetailsButtonState_Invalid = BadEnumValue +} DetailsButtonState_e; + + +typedef enum +{ + Event_ButtonPress, + Event_ButtonRelease, + Event_ButtonDoublePress, + Event_Motion, + Event_Drag, + Event_KeyPress, + END_Event_e, + Event_Invalid = BadEnumValue +} Event_e; + + +typedef enum +{ + ObjectDrawMode_DrawFirst, + ObjectDrawMode_Move, + ObjectDrawMode_Remove, + ObjectDrawMode_Place, + END_ObjectDrawMode_e, + ObjectDrawMode_Invalid = BadEnumValue +} ObjectDrawMode_e; + + +typedef enum +{ + ThreeDViewChangeDrawLevel_Full, + ThreeDViewChangeDrawLevel_Trace, + END_ThreeDViewChangeDrawLevel_e, + ThreeDViewChangeDrawLevel_Invalid = BadEnumValue +} ThreeDViewChangeDrawLevel_e; /* <help> "ThreeDViewChangeDrawLevel is deprecated. Use PlotApproximateMode.\n"*/ + +typedef enum +{ + NonCurrentFrameRedrawLevel_Full, + NonCurrentFrameRedrawLevel_Trace, + END_NonCurrentFrameRedrawLevel_e, + NonCurrentFrameRedrawLevel_Invalid = BadEnumValue +} NonCurrentFrameRedrawLevel_e; /* <help> "NonCurrentFrameRedrawLevel is deprecated. Use PlotApproximateMode.\n"*/ + + +/** + * Enumerates the redraw reasons and is passed as an argument to registered + * draw event callbacks. + * + * - RedrawReason_UserReqRedrawActiveFrame:\n + * The full draw event is in response to the "redraw" action function. + * + * - RedrawReason_UserReqTraceActiveFrame:\n + * The approximate draw event is in response to the "redraw" action function. + * + * - RedrawReason_UserReqRedrawAllFrames:\n + * The full draw event is in response to the "redraw all" action function. + * + * - RedrawReason_UserReqTraceAllFrames:\n + * The approximate draw event is in response to the "redraw all" action function. + * + * - RedrawReason_InteractiveDataViewChange:\n + * The draw event is in response to an interactive data view change such as + * rotate, translate, zoom, etc. + * + * - RedrawReason_InteractivePaperViewChange:\n + * The draw event is in response to an interactive paper translate view or + * paper zoom view change. + * + * - RedrawReason_InteractiveStyleChange:\n + * The draw event is in response to an interactive style changes such as + * dragging a contour level or a slice. + * + * - RedrawReason_Animation:\n + * The draw event is in response to an animation. + * + * - RedrawReason_AutoRedraw:\n + * The draw event is in response to an auto redraw. + * + * - RedrawReason_RedrawForcedViewUpdate:\n + * The draw event is in response to forced view update when auto redraw is + * off such as a view fit or movement of the frame. + * + * - RedrawReason_RedrawForcedStyleUpdate:\n + * The draw event is in response to forced view update when auto redraw is + * off such as deleting a contour level. + * + * - RedrawReason_PreFullRedrawTraceOfAllFrames:\n + * The draw event is an approximate redraw done prior to a full redraw. + * + * @sa TecUtilEventAddPreDrawCallback(), TecUtilEventAddPostDrawCallback() + */ +typedef enum +{ + RedrawReason_UserReqRedrawActiveFrame, + RedrawReason_UserReqTraceActiveFrame, + RedrawReason_UserReqRedrawAllFrames, + RedrawReason_UserReqTraceAllFrames, + RedrawReason_InteractiveDataViewChange, + RedrawReason_InteractivePaperViewChange, + RedrawReason_InteractiveStyleChange, + RedrawReason_Animation, + RedrawReason_AutoRedraw, + RedrawReason_RedrawForcedViewUpdate, + RedrawReason_RedrawForcedStyleUpdate, + RedrawReason_PreFullRedrawTraceOfAllFrames, + END_RedrawReason_e, + RedrawReason_Invalid = BadEnumValue, + RedrawReason_UserReqRedrawCurrentFrame = RedrawReason_UserReqRedrawActiveFrame, + RedrawReason_UserReqTraceCurrentFrame = RedrawReason_UserReqTraceActiveFrame +} RedrawReason_e; + +typedef enum +{ + RotationMode_XYZAxis, + RotationMode_Spherical, + RotationMode_RollerBall, + END_RotationMode_e, + RotationMode_Invalid = BadEnumValue +} RotationMode_e; + +typedef enum +{ + RotateAxis_X, + RotateAxis_Y, + RotateAxis_Z, + RotateAxis_Psi, + RotateAxis_Theta, + RotateAxis_Alpha, + RotateAxis_Twist, + RotateAxis_VertRollerBall, + RotateAxis_HorzRollerBall, + RotateAxis_AboutVector, + /* BEGINREMOVEFROMADDON */ + RotateAxis_DontCare, /* internal use only */ + /* ENDREMOVEFROMADDON */ + END_RotateAxis_e, + RotateAxis_Invalid = BadEnumValue +} RotateAxis_e; + +typedef enum +{ + RotateOriginLocation_DefinedOrigin, + RotateOriginLocation_Viewer, + END_RotateOriginLocation_e, + RotateOriginLocation_Invalid = BadEnumValue +} RotateOriginLocation_e; + +/* + * NOTE: This is only used with the $!Reset3DOrigin command. + */ +typedef enum +{ + OriginResetLocation_DataCenter, + OriginResetLocation_ViewCenter, + END_OriginResetLocation_e, + OriginResetLocation_Invalid = BadEnumValue +} OriginResetLocation_e; + +/* + * NOTE: This is only used with the $!CreateSliceZoneFromPlane command. + */ +typedef enum +{ + SliceSource_SurfaceZones, + SliceSource_VolumeZones, + SliceSource_SurfacesOfVolumeZones, + SliceSource_LinearZones, + END_SliceSource_e, + SliceSource_Invalid = BadEnumValue +} SliceSource_e; + + + + + +typedef enum +{ + Input_SmInteger, + Input_Short, + Input_Integer, + Input_Float, + Input_Double, + Input_Radians, + Input_TimeDateDouble, + Input_ElapsedTimeDouble, + END_Input_e, + Input_Invalid = BadEnumValue +} Input_e; + + + +typedef enum +{ + PtSelection_All, + PtSelection_NearestN, + PtSelection_OctantN, + END_PtSelection_e, + PtSelection_Invalid = BadEnumValue +} PtSelection_e; + + + +typedef enum +{ + Drift_None, + Drift_Linear, + Drift_Quad, + END_Drift_e, + Drift_Invalid = BadEnumValue +} Drift_e; + + + +/* atpoint is simple boundary condition. + atpointb2 is better boundary condition. +*/ +typedef enum +{ + DerivPos_atpoint, + DerivPos_atpointb2, + DerivPos_kphalf, + DerivPos_jphalf, + DerivPos_iphalf, + END_DerivPos_e, + DerivPos_Invalid = BadEnumValue +} DerivPos_e; /*<help>"atpoint is the simple boundary condition\n"*/ +/*<help>"atpointb2 is a better boundary condition"*/ + + +typedef enum +{ + LinearInterpMode_DontChange, + LinearInterpMode_SetToConst, + END_LinearInterpMode_e, + LinearInterpMode_Invalid = BadEnumValue +} LinearInterpMode_e; + +typedef enum +{ + VolumeCellInterpolationMode_PiecewiseLinear, + VolumeCellInterpolationMode_TriLinear, + END_VolumeCellInterpolationMode_e, + VolumeCellInterpolationMode_Invalid = BadEnumValue +} VolumeCellInterpolationMode_e; + +typedef enum +{ + PolyCellInterpolationMode_UseCCValue, + PolyCellInterpolationMode_AverageNodes, + END_PolyCellInterpolationMode_e, + PolyCellInterpolationMode_Invalid = BadEnumValue +} PolyCellInterpolationMode_e; + +typedef enum +{ + ConstraintOp2Mode_UseVar, + ConstraintOp2Mode_UseConstant, + END_ConstraintOp2Mode_e, + ConstraintOp2Mode_Invalid = BadEnumValue +} ConstraintOp2Mode_e; + +/** + * Controls how data is loaded for interactive probe events. + * DataProbeVarLoadMode_IncrementallyLoadAll will load as much data as possible within + * load-on-demand time/space thresholds. DataProbeVarLoadMode_LoadRequiredVarsOnly will + * load only the data necessary to complete the probe request. + * DataProbeVarLoadMode_IncrementallyLoadAll is the default. + */ +typedef enum +{ + DataProbeVarLoadMode_IncrementallyLoadAll, + DataProbeVarLoadMode_LoadRequiredVarsOnly, + END_DataProbeVarLoadMode_e, + DataProbeVarLoadMode_Invalid = BadEnumValue +} DataProbeVarLoadMode_e; + +typedef enum +{ + ValueBlankCellMode_AllCorners, + ValueBlankCellMode_AnyCorner, + ValueBlankCellMode_PrimaryValue, + END_ValueBlankCellMode_e, + ValueBlankCellMode_Invalid = BadEnumValue, + /* deprecated values */ + ValueBlankCellMode_PrimaryCorner = ValueBlankCellMode_PrimaryValue +} ValueBlankCellMode_e; + + +/* + * deprecated: ValueBlankMode_e enumeration will not be supported after + * version 8. This API was retained for add-on developers + * using the TecUtilStyleSetLowLevel API. + */ +typedef enum +{ + ValueBlankMode_AndRule, + ValueBlankMode_OrRule, + ValueBlankMode_CornerRule, + END_ValueBlankMode_e, + ValueBlankMode_Invalid = BadEnumValue +} ValueBlankMode_e; /*<help>"DEPRECATED: ValueBlankMode_e will not be supported after version 8"*/ + + +typedef enum +{ + CellBlankedCond_NotBlanked, + CellBlankedCond_PartiallyBlanked, + CellBlankedCond_EntirelyBlanked, + CellBlankedCond_Uncertain, + END_CellBlankedCond_e, + CellBlankedCond_Invalid = BadEnumValue +} CellBlankedCond_e; + + +typedef enum +{ + RelOp_LessThanOrEqual, + RelOp_GreaterThanOrEqual, + RelOp_LessThan, + RelOp_GreaterThan, + RelOp_EqualTo, + RelOp_NotEqualTo, + END_RelOp_e, + RelOp_Invalid = BadEnumValue +} RelOp_e; + + + +typedef enum +{ + IJKBlankMode_BlankInterior, + IJKBlankMode_BlankExterior, + END_IJKBlankMode_e, + IJKBlankMode_Invalid = BadEnumValue +} IJKBlankMode_e; + + +typedef enum +{ + PlotApproximationMode_Automatic, + PlotApproximationMode_NonCurrentAlwaysApproximated, + PlotApproximationMode_AllFramesAlwaysApproximated, + END_PlotApproximationMode_e, + PlotApproximationMode_Invalid = BadEnumValue +} PlotApproximationMode_e; + +typedef enum +{ + SphereScatterRenderQuality_Low, + SphereScatterRenderQuality_Medium, + SphereScatterRenderQuality_High, + END_SphereScatterRenderQuality_e, + SphereScatterRenderQuality_Invalid = BadEnumValue +} SphereScatterRenderQuality_e; + +/* + * NOTE: FillPat_e is deprecated. It must be retained to maintain + * backward compatibility with the TecUtil layer however. + * This has been replaced by Translucency_e. + */ +typedef enum +{ + Pattern_Solid, + Pattern_LowTranslucent, + Pattern_MedTranslucent, + Pattern_HighTranslucent, + END_FillPat_e, + Pattern_Invalid = BadEnumValue +} FillPat_e; /*<help>"DEPRECATED: Replaced by Translucency_e"*/ + + +typedef enum +{ + Translucency_Solid, + Translucency_Low, + Translucency_Medium, + Translucency_High, + END_Translucency_e, + Translucency_Invalid = BadEnumValue +} Translucency_e; + + + +typedef enum +{ + SunRaster_OldFormat, + SunRaster_Standard, + SunRaster_ByteEncoded, + END_SunRaster_e, + SunRaster_Invalid = BadEnumValue +} SunRaster_e; + + +typedef enum +{ + BoundaryCondition_Fixed, + BoundaryCondition_ZeroGradient, + BoundaryCondition_Zero2nd, + END_BoundaryCondition_e, + BoundaryCondition_Invalid = BadEnumValue +} BoundaryCondition_e; + + + +/* Note: + * In 2D: AxisMode_Independent and AxisMode_XYDependent are used; + * in 3D: AxisMode_Independent, AxisMode_XYZDependent, and AxisMode_XYDependent are used. + */ +typedef enum +{ + AxisMode_Independent, + AxisMode_XYZDependent, + AxisMode_XYDependent, + END_AxisMode_e, + AxisMode_Invalid = BadEnumValue +} AxisMode_e;/*<help>"In 2D AxisMode_Independent and AxisMode_XYDependent are used\n"*/ +/*<help>"In 3D AxisMode_Independent, "*/ +/*<help>"AxisMode_XYZDependent, and AxisMode_XYDependent are used."*/ + +typedef enum +{ + Quick_LineColor, + Quick_FillColor, + Quick_TextColor, + END_QuickColorMode_e, + Quick_Invalid = BadEnumValue +} QuickColorMode_e; + + +typedef enum +{ + FillMode_None, + FillMode_UseSpecificColor, + FillMode_UseLineColor, + FillMode_UseBackgroundColor, + END_FillMode_e, + FillMode_Invalid = BadEnumValue +} FillMode_e; + + +typedef enum +{ + LinePattern_Solid, + LinePattern_Dashed, + LinePattern_DashDot, + LinePattern_Dotted, + LinePattern_LongDash, + LinePattern_DashDotDot, + END_LinePattern_e, + LinePattern_Invalid = BadEnumValue +} LinePattern_e; + + + +typedef enum +{ + Join_Miter, + Join_Round, + Join_Bevel, + END_LineJoin_e, + Join_Invalid = BadEnumValue +} LineJoin_e; + + + +typedef enum +{ + Cap_Flat, + Cap_Round, + Cap_Square, + END_LineCap_e, + Cap_Invalid = BadEnumValue +} LineCap_e; + + + +typedef enum +{ + GeomForm_LineSegs, + GeomForm_Rectangle, + GeomForm_Square, + GeomForm_Circle, + GeomForm_Ellipse, + GeomForm_LineSegs3D, /* deprecated: use GeomForm_LineSegs with CoordSys_Grid3D */ + GeomForm_Image, + END_GeomForm_e, + GeomForm_Invalid = BadEnumValue, + /* new value names */ + GeomType_LineSegs = GeomForm_LineSegs, + GeomType_Rectangle = GeomForm_Rectangle, + GeomType_Square = GeomForm_Square, + GeomType_Circle = GeomForm_Circle, + GeomType_Ellipse = GeomForm_Ellipse, + GeomType_LineSegs3D = GeomForm_LineSegs3D, /* deprecated: use GeomType_LineSegs with CoordSys_Grid3D */ + GeomType_Image = GeomForm_Image, + END_GeomType_e = END_GeomForm_e, + GeomType_Invalid = GeomForm_Invalid +} GeomForm_e; + +typedef GeomForm_e GeomType_e; + +typedef enum +{ + VariableDerivationMethod_Fast, + VariableDerivationMethod_Accurate, + END_VariableDerivationMethod_e, + VariableDerivationMethod_Invalid = BadEnumValue +} VariableDerivationMethod_e; + +/** + */ +typedef enum +{ + AuxDataType_String, + END_AuxDataType_e, + AuxDataType_Invalid = BadEnumValue +} AuxDataType_e; + +/** + */ +typedef enum +{ + AuxDataLocation_Zone, + AuxDataLocation_DataSet, + AuxDataLocation_Frame, + AuxDataLocation_Var, + AuxDataLocation_LineMap, + AuxDataLocation_Page, + END_AuxDataLocation_e, + AuxDataLocation_Invalid = BadEnumValue +} AuxDataLocation_e; + + +/* Note: This replaces Element_e */ +typedef enum +{ + ZoneType_Ordered, + ZoneType_FETriangle, + ZoneType_FEQuad, + ZoneType_FETetra, + ZoneType_FEBrick, + ZoneType_FELineSeg, + ZoneType_FEPolygon, + ZoneType_FEPolyhedron, + END_ZoneType_e, + ZoneType_Invalid = BadEnumValue +} ZoneType_e; + +typedef enum +{ + ZoneOrder_I, + ZoneOrder_J, + ZoneOrder_K, + ZoneOrder_IJ, + ZoneOrder_IK, + ZoneOrder_JK, + ZoneOrder_IJK, + END_ZoneOrder_e, + ZoneOrder_Invalid = BadEnumValue +} ZoneOrder_e; + +/* deprecated: replaced by ZoneType_e DataPacking_e */ +typedef enum +{ + DataFormat_IJKBlock, + DataFormat_IJKPoint, + DataFormat_FEBlock, + DataFormat_FEPoint, + END_DataFormat_e, + DataFormat_Invalid = BadEnumValue +} DataFormat_e; + +typedef enum +{ + DataPacking_Block, + DataPacking_Point, + END_DataPacking_e, + DataPacking_Invalid = BadEnumValue +} DataPacking_e; + + + +typedef enum +{ + PD_HPGL, + PD_HPGL2, + PD_PS, + PD_LASERG, /* deprecated */ + PD_EPS, + PD_WINDOWS, /* Windows Print Driver */ + PD_WMF, /* Windows MetaFile (used from Export only) */ + PD_X3D, + END_PrinterDriver_e, + PD_Invalid = BadEnumValue +} PrinterDriver_e; + + + +typedef enum +{ + Image_None, + Image_TIFF, + Image_EPSI2, + Image_FRAME, + END_EPSPreviewImage_e, + Image_Invalid = BadEnumValue +} EPSPreviewImage_e; + +typedef enum +{ + TIFFByteOrder_Intel, + TIFFByteOrder_Motorola, + END_TIFFByteOrder_e, + TIFFByteOrder_Invalid = BadEnumValue +} TIFFByteOrder_e; + +typedef enum +{ + JPEGEncoding_Standard, + JPEGEncoding_Progressive, + END_JPEGEncoding_e, + JPEGEncoding_Invalid = BadEnumValue +} JPEGEncoding_e; + + +typedef enum +{ + FlashImageType_Lossless, + FlashImageType_JPEG, + FlashImageType_Color256, + END_FlashImageType_e, + FlashImageType_Invalid = BadEnumValue, + /* deprecated values */ + FlashImageType_256Color = FlashImageType_Color256 +} FlashImageType_e; + +typedef enum +{ + FlashCompressionType_BestSpeed, + FlashCompressionType_SmallestSize, + END_FlashCompressionType_e, + FlashCompressionType_Invalid = BadEnumValue +} FlashCompressionType_e; + + +typedef enum +{ + ExportFormat_RasterMetafile, + ExportFormat_TIFF, + ExportFormat_SGI, + ExportFormat_SunRaster, + ExportFormat_XWindows, + ExportFormat_PSImage, /* deprecated */ + ExportFormat_HPGL, + ExportFormat_HPGL2, + ExportFormat_PS, + ExportFormat_EPS, + ExportFormat_LaserGraphics, /* deprecated */ + ExportFormat_WindowsMetafile, + ExportFormat_BMP, + ExportFormat_PNG, + ExportFormat_AVI, + ExportFormat_Custom, /* May be used in a future version */ + ExportFormat_JPEG, + ExportFormat_Flash, + ExportFormat_X3D, + ExportFormat_TecplotViewer, + END_ExportFormat_e, + ExportFormat_Invalid = BadEnumValue +} ExportFormat_e; + +typedef enum +{ + AVICompression_ColorPreserving, + AVICompression_LinePreserving, + AVICompression_LosslessUncompressed, + END_AVICompression_e, + AVICompression_Invalid = BadEnumValue +} AVICompression_e; + +typedef enum +{ + AnimationDest_Screen, + AnimationDest_AVI, + AnimationDest_RM, + AnimationDest_Flash, + END_AnimationDest_e, + AnimationDest_Invalid = BadEnumValue +} AnimationDest_e; + + + +typedef enum +{ + AnimationOperation_Forward, + AnimationOperation_Backward, + AnimationOperation_Loop, + AnimationOperation_Bounce, + END_AnimationOperation_e, + AnimationOperation_Invalid = BadEnumValue +} AnimationOperation_e; + +typedef enum +{ + AnimationStep_First, + AnimationStep_Second, + AnimationStep_Current, + AnimationStep_SecondToLast, + AnimationStep_Last, + AnimationStep_Previous, + AnimationStep_Next, + END_AnimationStep_e, + AnimationStep_Invalid = BadEnumValue +} AnimationStep_e; + +typedef enum +{ + ZoneAnimationMode_StepByNumber, + ZoneAnimationMode_GroupStepByNumber, + ZoneAnimationMode_StepByTime, + END_ZoneAnimationMode_e, + ZoneAnimationMode_Invalid = BadEnumValue +} ZoneAnimationMode_e; + +#if defined EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY +/** + * @deprecated + * Please use \ref ExportRegion_e instead. + */ +typedef enum +{ + BitDumpRegion_CurrentFrame, + BitDumpRegion_AllFrames, + BitDumpRegion_WorkArea, + END_BitDumpRegion_e, + BitDumpRegion_Invalid = BadEnumValue +} BitDumpRegion_e; +#endif + +typedef enum +{ + ExportRegion_CurrentFrame, + ExportRegion_AllFrames, + ExportRegion_WorkArea, + END_ExportRegion_e, + ExportRegion_Invalid = BadEnumValue +} ExportRegion_e; + +typedef enum +{ + Paper_Letter, + Paper_Double, + Paper_A4, + Paper_A3, + Paper_Custom1, + Paper_Custom2, + END_PaperSize_e, + Paper_Invalid = BadEnumValue +} PaperSize_e; + + + +typedef enum +{ + PaperUnitSpacing_HalfCentimeter, + PaperUnitSpacing_OneCentimeter, + PaperUnitSpacing_TwoCentimeters, + PaperUnitSpacing_QuarterInch, + PaperUnitSpacing_HalfInch, + PaperUnitSpacing_OneInch, + PaperUnitSpacing_TenPoints, + PaperUnitSpacing_TwentyFourPoints, + PaperUnitSpacing_ThirtySixPoints, + PaperUnitSpacing_FiftyPoints, + PaperUnitSpacing_SeventyTwoPoints, + PaperUnitSpacing_OneTenthInch, + PaperUnitSpacing_OneTenthCentimeter, + END_PaperUnitSpacing_e, + PaperUnitSpacing_Invalid = BadEnumValue +} PaperUnitSpacing_e; + + +typedef enum +{ + Palette_Monochrome, + Palette_PenPlotter, + Palette_Color, + END_Palette_e, + Palette_Invalid = BadEnumValue +} Palette_e; + + +typedef enum +{ + PrintRenderType_Vector, + PrintRenderType_Image, + END_PrintRenderType_e, + PrintRenderType_Invalid = BadEnumValue +} PrintRenderType_e; + + +typedef enum +{ + Units_Grid, + Units_Frame, + Units_Point, + Units_Screen, + Units_AxisPercentage, + END_Units_e, + Units_Invalid = BadEnumValue +} Units_e; + + +typedef enum +{ + CoordScale_Linear, + CoordScale_Log, + END_CoordScale_e, + CoordScale_Invalid = BadEnumValue, + /* old names for the same values */ + Scale_Linear = CoordScale_Linear, + Scale_Log = CoordScale_Log, + Scale_Invalid = CoordScale_Invalid +} CoordScale_e; + +/* BEGINREMOVEFROMADDON */ +#define GetLog10(R) ( ((R) < SMALLDOUBLE) ? SMALLESTEXPONENT : ( ((R) > LARGEDOUBLE) ? LARGESTEXPONENT : log10((R)) ) ) +/* ENDREMOVEFROMADDON */ + +typedef enum +{ + CoordSys_Grid, + CoordSys_Frame, + CoordSys_FrameOffset, + CoordSys_Paper, + CoordSys_Screen, + CoordSys_Hardcopy, + CoordSys_Grid3D, + END_CoordSys_e, + CoordSys_Invalid = BadEnumValue +} CoordSys_e; + +/* + * NOTE: CoordSys_FrameOffset always is stored in inches internally. + * in stylesheet this may be written in other units if + * appropriate suffix is added. + * + */ + + + +typedef enum +{ + Scope_Global, + Scope_Local, + END_Scope_e, + Scope_Invalid = BadEnumValue +} Scope_e; + + +typedef enum +{ + TextAnchor_Left, + TextAnchor_Center, + TextAnchor_Right, + TextAnchor_MidLeft, + TextAnchor_MidCenter, + TextAnchor_MidRight, + TextAnchor_HeadLeft, + TextAnchor_HeadCenter, + TextAnchor_HeadRight, + TextAnchor_OnSide, + END_TextAnchor_e, + TextAnchor_Invalid = BadEnumValue +} TextAnchor_e; + + + +typedef enum +{ + TextBox_None, + TextBox_Filled, + TextBox_Hollow, + END_TextBox_e, + TextBox_Invalid = BadEnumValue +} TextBox_e; + + + +typedef enum +{ + GeomShape_Square, + GeomShape_Del, + GeomShape_Grad, + GeomShape_RTri, + GeomShape_LTri, + GeomShape_Diamond, + GeomShape_Circle, + GeomShape_Cube, + GeomShape_Sphere, + GeomShape_Octahedron, + GeomShape_Point, + END_GeomShape_e, + GeomShape_Invalid = BadEnumValue +} GeomShape_e; + + +typedef enum +{ + BasicSize_Tiny, + BasicSize_Small, + BasicSize_Medium, + BasicSize_Large, + BasicSize_Huge, + END_BasicSize_e, + BasicSize_Invalid = BadEnumValue +} BasicSize_e; + + + +/* + * NOTE: LineForm_e is deprecated. It must be retained to maintain + * backward compatibility with the TecUtil layer however. + * This has been replaced by CurveType_e. + */ +typedef enum +{ + LineForm_LineSeg, + LineForm_CurvFit, + LineForm_EToRFit, + LineForm_PowerFit, + LineForm_Spline, + LineForm_ParaSpline, + END_LineForm_e, + LineForm_Invalid = BadEnumValue +} LineForm_e; + + +typedef enum +{ + CurveType_LineSeg, + CurveType_PolynomialFit, + CurveType_EToRFit, + CurveType_PowerFit, + CurveType_Spline, + CurveType_ParaSpline, + CurveType_Extended, + END_CurveType_e, + CurveType_Invalid = BadEnumValue, + CurveType_CurvFit = CurveType_PolynomialFit +} CurveType_e; + +typedef enum +{ + Script_None, + Script_Super, + Script_Sub, + END_Script_e, + Script_Invalid = BadEnumValue +} Script_e; + + +typedef enum +{ + Font_Helvetica, + Font_HelveticaBold, + Font_Greek, + Font_Math, + Font_UserDefined, + Font_Times, + Font_TimesItalic, + Font_TimesBold, + Font_TimesItalicBold, + Font_Courier, + Font_CourierBold, + END_Font_e, + Font_Invalid = BadEnumValue +} Font_e; + +typedef enum +{ + TwoDDrawOrder_ByZone, + TwoDDrawOrder_ByLayer, + END_TwoDDrawOrder_e, + TwoDDrawOrder_Invalid = BadEnumValue +} TwoDDrawOrder_e; + +typedef enum +{ + DrawOrder_AfterData, + DrawOrder_BeforeData, + END_DrawOrder_e, + DrawOrder_Invalid = BadEnumValue +} DrawOrder_e; + +/* + * + * NOTE: Streamtrace_TwoDLine is new. All 2D + * streamtraces are assigned this value. + */ +typedef enum +{ + Streamtrace_SurfaceLine, + Streamtrace_SurfaceRibbon, + Streamtrace_VolumeLine, + Streamtrace_VolumeRibbon, + Streamtrace_VolumeRod, + Streamtrace_TwoDLine, + END_Streamtrace_e, + Streamtrace_Invalid = BadEnumValue +} Streamtrace_e; + + + +typedef enum +{ + StreamDir_Forward, + StreamDir_Reverse, + StreamDir_Both, + END_StreamDir_e, + StreamDir_Invalid = BadEnumValue +} StreamDir_e; + +typedef enum +{ + IsoSurfaceSelection_AllContourLevels, + IsoSurfaceSelection_OneSpecificValue, + IsoSurfaceSelection_TwoSpecificValues, + IsoSurfaceSelection_ThreeSpecificValues, + END_IsoSurfaceSelection_e, + IsoSurfaceSelection_Invalid = BadEnumValue +} IsoSurfaceSelection_e; + + +typedef enum +{ + ValueLocation_CellCentered, + ValueLocation_Nodal, + END_ValueLocation_e, + ValueLocation_Invalid = BadEnumValue +} ValueLocation_e; + +typedef enum +{ + FieldDataType_Reserved, /* never use */ + FieldDataType_Float, + FieldDataType_Double, + FieldDataType_Int32, + FieldDataType_Int16, + FieldDataType_Byte, + FieldDataType_Bit, + END_FieldDataType_e, + FieldDataType_IJKFunction, /* Not used yet */ + FieldDataType_Int64, /* Not used yet */ +#if defined EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY + FieldDataType_LongInt = FieldDataType_Int32, + FieldDataType_ShortInt = FieldDataType_Int16, +#endif + FieldDataType_Invalid = BadEnumValue +} FieldDataType_e; + +#define VALID_FIELD_DATA_TYPE(FieldDataType) (VALID_ENUM((FieldDataType),FieldDataType_e) && \ + (FieldDataType)!=FieldDataType_Reserved) + +#if defined EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY +/** + * @deprecated + * Please use \ref MeshType_e instead. + */ +typedef enum +{ + Mesh_Wireframe, /* deprecated: use MeshType_Wireframe */ + Mesh_Overlay, /* deprecated: use MeshType_Overlay */ + Mesh_HiddenLine, /* deprecated: use MeshType_HiddenLine */ + END_MeshPlotType_e, + Mesh_Invalid = BadEnumValue +} MeshPlotType_e; +#endif + +typedef enum +{ + MeshType_Wireframe, /* Mesh_Wireframe */ + MeshType_Overlay, /* Mesh_Overlay */ + MeshType_HiddenLine, /* Mesh_HiddenLine */ + END_MeshType_e, + MeshType_Invalid = BadEnumValue +} MeshType_e; + + + + +#if defined EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY +/** + * @deprecated + * Please use \ref ContourType_e instead. + */ +typedef enum +{ + Contour_Lines, /* deprecated: use ContourType_Lines */ + Contour_Flood, /* deprecated: use ContourType_Flood */ + Contour_Overlay, /* deprecated: use ContourType_Overlay */ + Contour_AverageCell, /* deprecated: use ContourType_AverageCell */ + Contour_CornerCell, /* deprecated: use ContourType_PrimaryValue */ + END_ContourPlotType_e, + Contour_Invalid = BadEnumValue +} ContourPlotType_e; +#endif + + +typedef enum +{ + ContourType_Lines, /* Contour_Lines */ + ContourType_Flood, /* Contour_Flood */ + ContourType_Overlay, /* Contour_Overlay */ + ContourType_AverageCell, /* Contour_AverageCell */ + ContourType_PrimaryValue, /* Contour_CornerCell */ + END_ContourType_e, + ContourType_Invalid = BadEnumValue +} ContourType_e; + +typedef enum +{ + ContourColoring_RGB, + ContourColoring_Group1, + ContourColoring_Group2, + ContourColoring_Group3, + ContourColoring_Group4, + ContourColoring_Group5, + ContourColoring_Group6, + ContourColoring_Group7, + ContourColoring_Group8, + END_ContourColoring_e, + ContourColoring_Invalid = BadEnumValue +} ContourColoring_e; + +#if defined EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY +/** + * @deprecated + * Please use \ref VectorType_e instead. + */ +typedef enum +{ + Vector_TailAtPoint, /* deprecated: use VectorType_TailAtPoint */ + Vector_HeadAtPoint, /* deprecated: use VectorType_HeadAtPoint */ + Vector_MidAtPoint, /* deprecated: use VectorType_MidAtPoint */ + Vector_HeadOnly, /* deprecated: use VectorType_HeadOnly */ + END_VectorPlotType_e, + Vector_Invalid = BadEnumValue +} VectorPlotType_e; +#endif + + +typedef enum +{ + VectorType_TailAtPoint, /* Vector_TailAtPoint */ + VectorType_HeadAtPoint, /* Vector_HeadAtPoint */ + VectorType_MidAtPoint, /* Vector_MidAtPoint */ + VectorType_HeadOnly, /* Vector_HeadOnly */ + END_VectorType_e, + VectorType_Invalid = BadEnumValue +} VectorType_e; + + +/* + * NOTE: ShadePlotType_e is deprecated. It must be retained to maintain + * backward compatibility with the TecUtil layer however. + * This has been replaced by LightingEffect_e. + */ +typedef enum +{ + Shade_SolidColor, + Shade_Paneled, + Shade_Gouraud, + Shade_ColoredPaneled, + Shade_ColoredGouraud, + END_ShadePlotType_e, + Shade_Invalid = BadEnumValue +} ShadePlotType_e; + +/* + * NOTE: LightingEffect_None is deprecated. It must remain + * in the list to allow macro processing of older + * (i.e. early v9) macros. + */ +typedef enum +{ + LightingEffect_Paneled, + LightingEffect_Gouraud, + LightingEffect_None, + END_LightingEffect_e, + LightingEffect_Invalid = BadEnumValue +} LightingEffect_e; + +typedef enum +{ + IJKLines_I, + IJKLines_J, + IJKLines_K, + END_IJKLines_e, + IJKLines_Invalid = BadEnumValue, + /* deprecated values */ + Lines_I = IJKLines_I, /* deprecated */ + Lines_J = IJKLines_J, /* deprecated */ + Lines_K = IJKLines_K, /* deprecated */ + Lines_Invalid = IJKLines_Invalid /* deprecated */ +} IJKLines_e; + +typedef enum +{ + IJKCellType_Planes, + IJKCellType_FacePlanes, + IJKCellType_Volume, + END_IJKCellType_e, + IJKCellType_Invalid = BadEnumValue +} IJKCellType_e; + + +/* + * Ver 6 used PlaneSet. Ver 7 uses CellType and Planes variables. + * + * "PlaneSet" in version 6 vs. IJKPlanes in v7: + * + * 'A' = AllPlanes CellType = IJKCellType_Volume + * 'd','e','f','C' = ComboPlanes CellType = IJKCellType_Planes, IJKPlanes = depends on defC + * 'F' = Faces Planes Only CellType = IJKCellType_FacePlanes + * 'I' = I-Planes CellType = IJKCellType_Planes, IJKPlanes = IJKPlanes_I + * 'J' = J-Planes CellType = IJKCellType_Planes, IJKPlanes = IJKPlanes_J + * 'K' = K-Planes CellType = IJKCellType_Planes, IJKPlanes = IJKPlanes_K + * + * + * NOTE: IJKPlanes_e is still used internally in tecplot (and in the TecUtil layer). + * it has been relagated to communicating which planes of an IJK zone are in + * use. + * + */ + +typedef enum +{ + IJKPlanes_I, + IJKPlanes_J, + IJKPlanes_K, + IJKPlanes_Face, /* used on the panel heap */ + IJKPlanes_IJ, /* deprecated */ + IJKPlanes_JK, /* deprecated */ + IJKPlanes_IK, /* deprecated */ + IJKPlanes_IJK, /* deprecated */ + IJKPlanes_Volume, + IJKPlanes_Unused, + END_IJKPlanes_e, + IJKPlanes_Invalid = BadEnumValue, + /* deprecated values */ + Planes_I = IJKPlanes_I, /* deprecated */ + Planes_J = IJKPlanes_J, /* deprecated */ + Planes_K = IJKPlanes_K, /* deprecated */ + Planes_IJ = IJKPlanes_IJ, /* deprecated */ + Planes_JK = IJKPlanes_JK, /* deprecated */ + Planes_IK = IJKPlanes_IK, /* deprecated */ + Planes_IJK = IJKPlanes_IJK, /* deprecated */ + Planes_Face = IJKPlanes_Face, /* deprecated */ + Planes_Volume = IJKPlanes_Volume, /* deprecated */ + Planes_Unused = IJKPlanes_Unused, /* deprecated */ + Planes_Invalid = IJKPlanes_Invalid /* deprecated */ +} IJKPlanes_e; + + + +typedef enum +{ + SurfacesToPlot_BoundaryFaces, + SurfacesToPlot_ExposedCellFaces, + SurfacesToPlot_IPlanes, + SurfacesToPlot_JPlanes, + SurfacesToPlot_KPlanes, + SurfacesToPlot_IJPlanes, + SurfacesToPlot_JKPlanes, + SurfacesToPlot_IKPlanes, + SurfacesToPlot_IJKPlanes, + SurfacesToPlot_All, + SurfacesToPlot_None, + END_SurfacesToPlot_e, + SurfacesToPlot_Invalid = BadEnumValue +} SurfacesToPlot_e; + +typedef enum +{ + PointsToPlot_SurfaceNodes, /* was _SurfacesOnly */ + PointsToPlot_AllNodes, /* was _All */ + PointsToPlot_SurfaceCellCenters, + PointsToPlot_AllCellCenters, + PointsToPlot_AllConnected, + END_PointsToPlot_e, +#if defined EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY + PointsToPlot_SurfacesOnly = PointsToPlot_SurfaceNodes, /* deprecated */ + PointsToPlot_All = PointsToPlot_AllNodes, /* deprecated */ +#endif + PointsToPlot_Invalid = BadEnumValue +} PointsToPlot_e; + + +typedef enum +{ + SliceSurface_XPlanes, + SliceSurface_YPlanes, + SliceSurface_ZPlanes, + SliceSurface_IPlanes, + SliceSurface_JPlanes, + SliceSurface_KPlanes, + END_SliceSurface_e, + SliceSurface_Invalid = BadEnumValue +} SliceSurface_e; + + +typedef enum +{ + ClipPlane_None, + ClipPlane_BelowPrimarySlice, + ClipPlane_AbovePrimarySlice, + END_ClipPlane_e, + ClipPlane_Invalid = BadEnumValue +} ClipPlane_e; + +typedef enum +{ + Skip_ByIndex, + Skip_ByFrameUnits, + END_SkipMode_e, + Skip_Invalid = BadEnumValue +} SkipMode_e; + + +typedef enum +{ + EdgeType_Borders, + EdgeType_Creases, + EdgeType_BordersAndCreases, + END_EdgeType_e, + EdgeType_Invalid = BadEnumValue +} EdgeType_e; + +#if defined EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY +/** + * @deprecated + * Please use \ref BorderLocation_e instead. + */ +typedef enum +{ + Boundary_None, /* deprecated: use BoundaryType_None */ + Boundary_Min, /* deprecated: use BoundaryType_Min */ + Boundary_Max, /* deprecated: use BoundaryType_Max */ + Boundary_Both, /* deprecated: use BoundaryType_Both */ + END_BoundPlotType_e, + Boundary_Invalid = BadEnumValue +} BoundPlotType_e; +#endif + +typedef enum +{ + BoundaryType_None, /* Boundary_None */ + BoundaryType_Min, /* Boundary_Min */ + BoundaryType_Max, /* Boundary_Max */ + BoundaryType_Both, /* Boundary_Both */ + END_BoundaryType_e, + BoundaryType_Invalid = BadEnumValue +} BoundaryType_e; /* deprecated */ + +typedef enum +{ + BorderLocation_None, /* Boundary_None */ + BorderLocation_Min, /* Boundary_Min */ + BorderLocation_Max, /* Boundary_Max */ + BorderLocation_Both, /* Boundary_Both */ + END_BorderLocation_e, + BorderLocation_Invalid = BadEnumValue +} BorderLocation_e; + +typedef enum +{ + ContourColorMap_SmRainbow, + ContourColorMap_LgRainbow, + ContourColorMap_Modern, + ContourColorMap_GrayScale, + ContourColorMap_Wild, + ContourColorMap_UserDef, + ContourColorMap_TwoColor, + ContourColorMap_RawUserDef, + END_ContourColorMap_e, + ContourColorMap_Invalid = BadEnumValue, + /* deprecated values */ + ColorMap_SmRainbow = ContourColorMap_SmRainbow, /* deprecated */ + ColorMap_LgRainbow = ContourColorMap_LgRainbow, /* deprecated */ + ColorMap_Modern = ContourColorMap_Modern, /* deprecated */ + ColorMap_GrayScale = ContourColorMap_GrayScale, /* deprecated */ + ColorMap_Wild = ContourColorMap_Wild, /* deprecated */ + ColorMap_UserDef = ContourColorMap_UserDef, /* deprecated */ + ColorMap_TwoColor = ContourColorMap_TwoColor, /* deprecated */ + ColorMap_RawUserDef = ContourColorMap_RawUserDef, /* deprecated */ + ColorMap_Invalid = ContourColorMap_Invalid /* deprecated */ +} ContourColorMap_e; + + + +typedef enum +{ + ErrorBar_Up, + ErrorBar_Down, + ErrorBar_Left, + ErrorBar_Right, + ErrorBar_Horz, + ErrorBar_Vert, + ErrorBar_Cross, + END_ErrorBar_e, + ErrorBar_Invalid = BadEnumValue +} ErrorBar_e; + + + +typedef enum +{ + ContourLineMode_UseZoneLineType, + ContourLineMode_SkipToSolid, + ContourLineMode_DashNegative, + END_ContourLineMode_e, + ContourLineMode_Invalid = BadEnumValue +} ContourLineMode_e; + + +/* BEGINREMOVEFROMADDON */ +typedef enum +{ + Panel_Bad, + Panel_Cell, /* FieldZone */ + Panel_Vector, /* FieldZone */ + Panel_Scatter, /* FieldZone */ + Panel_IJKBorderLine, /* FieldZone IJK border lines */ + Panel_CellEdge, /* FieldZone border lines and creases */ + Panel_FEBoundaryCell, /* FieldZone */ + Panel_NodeLabel, /* FieldZone */ + Panel_CellLabel, /* FieldZone */ + Panel_StreamtraceCell, /* Streamtrace COB */ + Panel_StreamtraceMarker, /* StreamtraceMarker COB (Scatter Symbol) */ + Panel_StreamtraceArrowhead, /* StreamtraceArrowhead COB (Vector) */ + Panel_IsoSurfaceCell, /* IsoSurface COB */ + Panel_IsoSurfaceCellEdge, /* IsoSurface COB border lines and creases (border lines and creases not currently used) */ + Panel_SliceCell, /* Slice COB */ + Panel_SliceVector, /* Slice COB */ + Panel_SliceIJKBorderLine, /* Slice COB IJK border lines */ + Panel_SliceCellEdge, /* Slice COB border lines and creases (creases not currently used) */ + Panel_Geom, /* Misc */ + Panel_Text, /* Misc */ + END_Panel_e, + Panel_Invalid = BadEnumValue +} Panel_e; +/* ENDREMOVEFROMADDON */ + + +typedef enum +{ + MessageBoxType_Error, + MessageBoxType_Warning, + MessageBoxType_Information, + MessageBoxType_Question, /* Ok, Cancel buttons */ + MessageBoxType_YesNo, + MessageBoxType_YesNoCancel, + MessageBoxType_WarningOkCancel, + END_MessageBoxType_e, + MessageBoxType_Invalid = BadEnumValue, + /* deprecated values */ + MessageBox_Error = MessageBoxType_Error, /* deprecated */ + MessageBox_Warning = MessageBoxType_Warning, /* deprecated */ + MessageBox_Information = MessageBoxType_Information, /* deprecated */ + MessageBox_Question = MessageBoxType_Question, /* deprecated */ + MessageBox_YesNo = MessageBoxType_YesNo, /* deprecated */ + MessageBox_YesNoCancel = MessageBoxType_YesNoCancel, /* deprecated */ + MessageBox_WarningOkCancel = MessageBoxType_WarningOkCancel, /* deprecated */ + MessageBox_Invalid = MessageBoxType_Invalid /* deprecated */ +} MessageBoxType_e; + + +typedef enum +{ + MessageBoxReply_Yes, + MessageBoxReply_No, + MessageBoxReply_Cancel, + MessageBoxReply_Ok, + END_MessageBoxReply_e, + MessageBoxReply_Invalid = BadEnumValue +} MessageBoxReply_e; + +typedef enum +{ + NumberFormat_Integer, + NumberFormat_FixedFloat, + NumberFormat_Exponential, + NumberFormat_BestFloat, + NumberFormat_SuperScript, + NumberFormat_CustomLabel, + NumberFormat_LogSuperScript, + NumberFormat_RangeBestFloat, + NumberFormat_DynamicLabel, + NumberFormat_TimeDate, + END_NumberFormat_e, + NumberFormat_Invalid = BadEnumValue +} NumberFormat_e; + +/* For backward compatibility with v9- */ +typedef NumberFormat_e ValueFormat_e; + + +typedef enum +{ + BackingStoreMode_QuickAndDirty, + BackingStoreMode_RealTimeUpdate, + BackingStoreMode_PeriodicUpdate, + END_BackingStoreMode_e, + BackingStoreMode_Invalid = BadEnumValue +} BackingStoreMode_e; + + +typedef enum +{ + TickDirection_In, + TickDirection_Out, + TickDirection_Centered, + END_TickDirection_e, + TickDirection_Invalid = BadEnumValue +} TickDirection_e; + +/* This enumerated type is no longer used as of Tecplot V10. */ +typedef enum +{ + AxisTitlePosition_Left, + AxisTitlePosition_Center, + AxisTitlePosition_Right, + END_AxisTitlePosition_e, + AxisTitlePosition_Invalid = BadEnumValue +} AxisTitlePosition_e; + +typedef enum +{ + AxisTitleMode_NoTitle, + AxisTitleMode_UseVarName, + AxisTitleMode_UseText, + END_AxisTitleMode_e, + AxisTitleMode_Invalid = BadEnumValue +} AxisTitleMode_e; + +typedef enum +{ + AxisAlignment_WithViewport, + AxisAlignment_WithOpposingAxisValue, + AxisAlignment_WithGridMin, + AxisAlignment_WithGridMax, + AxisAlignment_WithSpecificAngle, + AxisAlignment_WithGridAreaTop, + AxisAlignment_WithGridAreaBottom, + AxisAlignment_WithGridAreaLeft, + AxisAlignment_WithGridAreaRight, + END_AxisAlignment_e, + AxisAlignment_Invalid = BadEnumValue +} AxisAlignment_e; + +typedef enum +{ + FunctionDependency_XIndependent, + FunctionDependency_YIndependent, + END_FunctionDependency_e, + FunctionDependency_Invalid = BadEnumValue, + FunctionDependency_ThetaIndependent = FunctionDependency_XIndependent, + FunctionDependency_RIndependent = FunctionDependency_YIndependent +} FunctionDependency_e; + +typedef enum +{ + LegendShow_Yes, + LegendShow_No, + LegendShow_Auto, + END_LegendShow_e, + LegendShow_Invalid = BadEnumValue +} LegendShow_e; + +typedef enum +{ + LineMapSort_None, + LineMapSort_IndependentVar, + LineMapSort_DependentVar, + LineMapSort_SpecificVar, + END_LineMapSort_e, + LineMapSort_Invalid = BadEnumValue +} LineMapSort_e; + +typedef enum +{ + ContLegendLabelLocation_ContourLevels, + ContLegendLabelLocation_Increment, + ContLegendLabelLocation_ColorMapDivisions, + END_ContLegendLabelLocation_e, + ContLegendLabelLocation_Invalid = BadEnumValue +} ContLegendLabelLocation_e; + +typedef enum +{ + ThetaMode_Degrees, + ThetaMode_Radians, + ThetaMode_Arbitrary, + END_ThetaMode_e, + ThetaMode_Invalid = BadEnumValue +} ThetaMode_e; + +typedef enum +{ + Transform_PolarToRect, + Transform_SphericalToRect, + Transform_RectToPolar, + Transform_RectToSpherical, + END_Transform_e, + Transform_Invalid = BadEnumValue +} Transform_e; + +typedef enum +{ + LaunchDialogMode_ModalSync, + LaunchDialogMode_Modeless, + LaunchDialogMode_ModalAsync, + END_LaunchDialogMode_e, + LaunchDialogMode_Invalid = BadEnumValue +} LaunchDialogMode_e; + + +typedef enum +{ + SelectFileOption_ReadSingleFile, + SelectFileOption_ReadMultiFile, + SelectFileOption_AllowMultiFileRead, + SelectFileOption_WriteFile, + SelectFileOption_SelectDirectory, + END_SelectFileOption_e, + SelectFileOption_Invalid = BadEnumValue +} SelectFileOption_e; + +typedef enum +{ + BinaryFileVersion_Tecplot2006, + BinaryFileVersion_Tecplot2008, + BinaryFileVersion_Tecplot2009, + BinaryFileVersion_Current, + END_BinaryFileVersion_e, + BinaryFileVersion_Invalid = BadEnumValue +} BinaryFileVersion_e; + +/* CURRENTLY NOT USED .... */ +typedef enum +{ + ViewActionDrawMode_NoDraw, + ViewActionDrawMode_DrawTrace, + ViewActionDrawMode_DrawFull, + END_ViewActionDrawMode_e, + ViewActionDrawMode_Invalid = BadEnumValue +} ViewActionDrawMode_e; + +typedef enum +{ + PageAction_Create, + PageAction_Delete, + PageAction_Clear, + PageAction_SetCurrentToNext, + PageAction_SetCurrentToPrev, + PageAction_SetCurrentByName, + PageAction_SetCurrentByUniqueID, + END_PageAction_e, + PageAction_Invalid = BadEnumValue +} PageAction_e; + +typedef enum +{ + FrameAction_PushTop, + FrameAction_PopByNumber, + FrameAction_PopAtPosition, + FrameAction_DeleteActive, + FrameAction_FitAllToPaper, + FrameAction_PushByName, + FrameAction_PopByName, + FrameAction_PushByNumber, + FrameAction_ActivateTop, + FrameAction_ActivateNext, + FrameAction_ActivatePrevious, + FrameAction_ActivateAtPosition, + FrameAction_ActivateByName, + FrameAction_ActivateByNumber, + FrameAction_MoveToTopActive, + FrameAction_MoveToTopByName, + FrameAction_MoveToTopByNumber, + FrameAction_MoveToBottomActive, + FrameAction_MoveToBottomByName, + FrameAction_MoveToBottomByNumber, + END_FrameAction_e, + FrameAction_Invalid = BadEnumValue, + FrameAction_Pop = FrameAction_PopByNumber, + FrameAction_Push = FrameAction_PushByNumber, + FrameAction_DeleteTop = FrameAction_DeleteActive +} FrameAction_e; + +typedef enum +{ + DoubleBufferAction_On, + DoubleBufferAction_Off, + DoubleBufferAction_Swap, + END_DoubleBufferAction_e, + DoubleBufferAction_Invalid = BadEnumValue +} DoubleBufferAction_e; + +/* + * PickAction_CheckToAdd had the side effects of popping a frame that was selected + * only if not collecting. Pick_AddAtPosition avoids this. + */ +typedef enum +{ + PickAction_CheckToAdd, /* deprecated: use Pick_AddAtPosition */ + PickAction_AddAll, + PickAction_AddAllInRegion, + PickAction_Edit, + PickAction_Cut, + PickAction_Copy, + PickAction_Clear, + PickAction_Paste, + PickAction_PasteAtPosition, + PickAction_Shift, + PickAction_Magnify, + PickAction_Push, + PickAction_Pop, + PickAction_SetMouseMode, + PickAction_DeselectAll, + PickAction_AddZones, + PickAction_AddXYMaps, /* deprecated: use PickAction_AddLineMaps */ + PickAction_AddLineMaps, + PickAction_AddAtPosition, + END_PickAction_e, + PickAction_Invalid = BadEnumValue +} PickAction_e; + + +typedef enum +{ + ContourLevelAction_Add, + ContourLevelAction_New, + ContourLevelAction_DeleteRange, + ContourLevelAction_Reset, + ContourLevelAction_ResetToNice, + ContourLevelAction_DeleteNearest, + END_ContourLevelAction_e, + ContourLevelAction_Invalid = BadEnumValue +} ContourLevelAction_e; + +typedef enum +{ + ContourLabelAction_Add, + ContourLabelAction_DeleteAll, + END_ContourLabelAction_e, + ContourLabelAction_Invalid = BadEnumValue +} ContourLabelAction_e; + +typedef enum +{ + StreamtraceAction_Add, + StreamtraceAction_DeleteAll, + StreamtraceAction_DeleteRange, + StreamtraceAction_SetTerminationLine, + StreamtraceAction_ResetDeltaTime, + END_StreamtraceAction_e, + StreamtraceAction_Invalid = BadEnumValue +} StreamtraceAction_e; + +typedef enum +{ + ColorMapControlAction_RedistributeControlPoints, + ColorMapControlAction_CopyCannedColorMap, + ColorMapControlAction_ResetToFactoryDefaults, + END_ColorMapControlAction_e, + ColorMapControlAction_Invalid = BadEnumValue +} ColorMapControlAction_e; + +typedef enum +{ + ColorMapDistribution_Continuous, + ColorMapDistribution_Banded, + END_ColorMapDistribution_e, + ColorMapDistribution_Invalid = BadEnumValue +} ColorMapDistribution_e; + +typedef enum +{ + RGBMode_SpecifyRGB, + RGBMode_SpecifyRG, + RGBMode_SpecifyRB, + RGBMode_SpecifyGB, + END_RGBMode_e, + RGBMode_Invalid = BadEnumValue +} RGBMode_e; + +typedef enum +{ + TecUtilErr_None, + TecUtilErr_Undetermined, + END_TecUtilErr_e, + TecUtilErr_Invalid = BadEnumValue +} TecUtilErr_e; + +/* BEGINREMOVEFROMADDON */ +/* deprecated type from alpha/beta v10 */ +typedef enum +{ + AxisShape_Ray, + AxisShape_LineTwoDirections, + AxisShape_LShape, + AxisShape_CrossOrBox, + END_AxisShape_e, + AxisShape_Invalid = BadEnumValue +} AxisShape_e; + +/* licensing enums : keep hidden */ +typedef enum +{ + RunMode_Demo, + RunMode_Eval, + RunMode_Full, + /**/ + END_RunMode_e, + /**/ + RunMode_Invalid = BadEnumValue +} RunMode_e; + +/* ENDREMOVEFROMADDON */ + +typedef enum /* Custom exporter error message */ +{ + ExportCustReturnCode_Ok, + ExportCustReturnCode_Failed, + ExportCustReturnCode_TecplotLocked, + ExportCustReturnCode_ExporterNotLoaded, + ExportCustReturnCode_ExportCallbackFailed, + ExportCustReturnCode_NotAnImageExporter, + ExportCustReturnCode_NotAFieldDataExporter, + END_ExportCustReturnCode_e, + ExportCustReturnCode_Invalid = BadEnumValue +} ExportCustReturnCode_e; + +/** + * COB/Zone types. + */ +typedef enum +{ + CZType_FieldDataZone, + CZType_FEBoundaryCOB, + CZType_IsoSurfaceCOB, + CZType_SliceCOB, + CZType_StreamtraceCOB, + CZType_StreamtraceMarkerCOB, + CZType_StreamtraceArrowheadCOB, + END_CZType_e, + CZType_Invalid = BadEnumValue +} CZType_e; + +/** + */ +typedef enum +{ + FaceNeighborMode_LocalOneToOne, + FaceNeighborMode_LocalOneToMany, + FaceNeighborMode_GlobalOneToOne, + FaceNeighborMode_GlobalOneToMany, + END_FaceNeighborMode_e, + FaceNeighborMode_Invalid = BadEnumValue +} FaceNeighborMode_e; + + +/** + * Page render destinations. + */ +typedef enum +{ + PageRenderDest_None, + PageRenderDest_OnScreen, + PageRenderDest_OffScreen, + END_PageRenderDest_e, + PageRenderDest_Invalid = BadEnumValue +} PageRenderDest_e; + +/* BEGINREMOVEFROMADDON */ +/* + * Destination for all internal rendering (VDI/Gr) functions. For external + * linkage we translate RenderDest_WorkArea to PageRenderDest_OnScreen, + * RenderDest_OffscreenBitmap to PageRenderDest_OffScreen and + * RenderDest_Invalid to PageRenderDest_None. + */ +typedef enum +{ + RenderDest_WorkArea, /* Do not move from start of screen entries */ + RenderDest_ExampleText, + RenderDest_ExampleLightSourcePosition, + RenderDest_ExampleColorMap, + RenderDest_ExampleBasicColor, /* Do not move from end of screen entries */ + RenderDest_OffscreenBitmap, + RenderDest_Hardcopy, + END_RenderDest_e, + RenderDest_Invalid = BadEnumValue, + /* + * These next two are optimizations to make the + * RDT_IsScreen() macro as efficient as possible. + */ + RenderDest_FirstScreenEntry = RenderDest_WorkArea, + RenderDest_LastScreenEntry = RenderDest_ExampleBasicColor +} RenderDest_e; +/* ENDREMOVEFROMADDON */ + +typedef enum +{ + Stipple_All, + Stipple_Critical, + Stipple_None, + END_Stipple_e, + Stipple_Invalid = BadEnumValue +} Stipple_e; + +typedef enum +{ + DataFileType_Full, + DataFileType_Grid, + DataFileType_Solution, + END_DataFileType_e, + DataFileType_Invalid = BadEnumValue +} DataFileType_e; + +typedef enum +{ + ConditionAwakeReason_Signaled, + ConditionAwakeReason_TimedOut, + END_ConditionAwakeReason_e, + ConditionAwakeReason_Invalid = BadEnumValue +} ConditionAwakeReason_e; + +/**************************************************************** + * * + * STRUCTURE TYPEDEFS * + * * + ****************************************************************/ + +/* + * These are defined to work with pthreads, more work for WINAPI needed + */ +typedef struct _Mutex_a* Mutex_pa; + +typedef void*(STDCALL *ThreadFunction_pf)(ArbParam_t ThreadData); + +typedef struct _Condition_a* Condition_pa; + +typedef struct _JobControl_s* JobControl_pa; + +typedef void (STDCALL *ThreadPoolJob_pf)(ArbParam_t JobData); + +/* BEGINREMOVEFROMADDON */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined USE_OOSTYLE +#endif +#endif /* TECPLOTKERNEL */ +/* ENDREMOVEFROMADDON */ + +typedef struct _StringList_s *StringList_pa; +typedef struct _Menu_s *Menu_pa; +/* BEGINREMOVEFROMADDON */ +typedef struct _ArrayList_s *ArrayList_pa; +/* ENDREMOVEFROMADDON */ + +typedef enum +{ + ImageResizeFilter_Texture, + ImageResizeFilter_Box, + ImageResizeFilter_Lanczos2, + ImageResizeFilter_Lanczos3, + ImageResizeFilter_Triangle, + ImageResizeFilter_Bell, + ImageResizeFilter_BSpline, + ImageResizeFilter_Cubic, + ImageResizeFilter_Mitchell, + ImageResizeFilter_Gaussian, + END_ImageResizeFilter_e, + ImageResizeFilter_Invalid = BadEnumValue +} ImageResizeFilter_e; + +typedef enum +{ + VarStatus_Passive, + VarStatus_Custom, + VarStatus_Map, + VarStatus_Heap, + VarStatus_NotLoaded, + END_VarStatus_e, + VarStatus_Invalid = BadEnumValue +} VarStatus_e; + + + +/* BEGINREMOVEFROMADDON */ + +/* here until GR and GRHW layer can be rearranged. */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# if !defined NO_ASSERTS +# endif +#endif /* TECPLOTKERNEL */ + +/* ENDREMOVEFROMADDON */ + +typedef struct _Set_a *Set_pa; + +typedef struct +{ + double X; + double Y; + double Z; +} XYZ_s; + +/* BEGINREMOVEFROMADDON */ + +typedef struct _Generic3Var_s +{ + double V1; + double V2; + double V3; +} Generic3Var_s; + +typedef struct _ThetaR_s +{ + double Theta; + double R; +} ThetaR_s; + +/* + * This union is designed to allow different plottypes + * to access the same values by different names. In + * C++ we could use member access functions, or we + * could have used macros, but instead we use this + * union. NOTE: This only works if all the structures + * have the same alignment. + */ +typedef union _AnchorPos_u +{ + Generic3Var_s Generic; + XYZ_s XYZ; + ThetaR_s ThetaR; +} AnchorPos_u; + +typedef struct _DataFileInfo_s +{ + char *PrimaryFName; + char *TempBinaryFName; + DataFileType_e FileType; + FileOffset_t DataFileOffset; + StringList_pa VarName; + EntIndex_t NumZones; + EntIndex_t NumVars; + double SolutionFileTime; + struct _DataFileInfo_s *NextFile; +} DataFileInfo_s; + +typedef struct _StylesheetIOFlags_s +{ + Boolean_t IncludePlotStyle; + Boolean_t IncludeFieldAndMapStyle; /* Only used for undo */ + Boolean_t IncludeUniqueIDs; /* Only used for undo */ + Boolean_t IncludeText; + Boolean_t IncludeGeom; + Boolean_t IncludeGeomImageData; + Boolean_t IncludeAuxData; + Boolean_t IncludeStreamPositions; + Boolean_t IncludeContourLevels; + Boolean_t IncludeFactoryDefaults; /* Only used when writing */ + Boolean_t CompressStyleCommands; /* Only used when writing */ + Boolean_t MergeStyle; /* Only used when reading */ + Boolean_t IncludeFrameSizeAndPosition; /* Only used when reading */ + Boolean_t UseRelativePaths; +} StylesheetIOFlags_s; + + +/** + */ +typedef struct +{ + Boolean_t Show; /* power switch */ + Boolean_t ShowMesh; + Boolean_t ShowContour; + Boolean_t ShowShade; + Boolean_t UseLightingEffect; + Boolean_t UseTranslucency; +} IsoSurfaceLayers_s; + +/** + */ +typedef struct +{ + Boolean_t Show; /* power switch */ + Boolean_t ShowMesh; + Boolean_t ShowContour; + Boolean_t ShowVector; + Boolean_t ShowShade; + Boolean_t ShowEdge; + Boolean_t UseLightingEffect; + Boolean_t UseTranslucency; +} SliceLayers_s; + +/** + */ +typedef struct +{ + Boolean_t Show; /* power switch */ + Boolean_t ShowPaths; + Boolean_t ShowDashes; + Boolean_t ShowArrowheads; + Boolean_t ShowMesh; + Boolean_t ShowContour; + Boolean_t ShowShade; + Boolean_t ShowMarkers; + Boolean_t UseLightingEffect; + Boolean_t UseTranslucency; +} StreamtraceLayers_s; + +/** + */ +typedef struct +{ +#if 0 /* in the future we may add a main power switch */ + Boolean_t Show; /* power switch */ +#endif + TwoDDrawOrder_e TwoDDrawOrder; + Boolean_t ShowMesh; + Boolean_t ShowContour; + Boolean_t ShowVector; + Boolean_t ShowScatter; + Boolean_t ShowShade; + Boolean_t ShowEdge; + Boolean_t UseLightingEffect; + Boolean_t UseTranslucency; +} FieldLayers_s; + +/** + * General purpose field layers structure used for low level drawing code only. + * SetupXxxx is responsible for populating this general field layers structure + * from the specific layer structures above for CZInfo. + */ +typedef struct +{ + Boolean_t ShowMesh; + Boolean_t ShowContour; + Boolean_t ShowVector; + Boolean_t ShowScatter; + Boolean_t ShowShade; + Boolean_t ShowEdge; + Boolean_t UseLightingEffect; + Boolean_t UseTranslucency; +} CZFieldLayers_s; + +/** + */ +typedef struct _LinePlotLayers_s +{ +#if 0 /* in the future we may add a main power switch */ + Boolean_t Show; /* power switch */ +#endif + Boolean_t ShowLines; + Boolean_t ShowSymbols; + Boolean_t ShowBarCharts; + Boolean_t ShowErrorBars; +} LinePlotLayers_s; + + +typedef union _InterfaceAdjust_u +{ + double ScaleFact; + LgIndex_t Shift; +} InterfaceAdjust_u; + +typedef Boolean_t (*SuffixModifier_pf)(TP_IN_OUT double* Value, + const char* Suffix); + +typedef struct _InputSpecs_s +{ + Input_e Type; + double Min; + double Max; + InterfaceAdjust_u InterfaceAdjust; + SuffixModifier_pf SuffixModifier; +} InputSpec_s; + + +typedef struct _RGB_s +{ + ColorIndex_t R; + ColorIndex_t G; + ColorIndex_t B; +} RGB_s; + + +typedef struct _ControlPoint_s +{ + double ColorMapFraction; + RGB_s LeadRGB; + RGB_s TrailRGB; +} ControlPoint_s; + + +typedef struct _ColorMapBand_s +{ + short NumControlPoints; + ControlPoint_s ControlPoint[MaxColorMapControlPoints]; +} ColorMapBand_s; + + +typedef struct _EventAction_s +{ + int I; + int J; + int LastI; + int LastJ; + int BaseI; + int BaseJ; + int ButtonOrKey; + Event_e Event; + Boolean_t IsShifted; + Boolean_t IsAlted; + Boolean_t IsControlled; + Boolean_t WasShiftedOnButtonPress; + Boolean_t WasAltedOnButtonPress; + Boolean_t WasControlledOnButtonPress; +} EventAction_s; + +typedef struct _MacroCmd_s +{ + LString_t MacroLine; + struct _MacroCmd_s *NextCmd; +} MacroCmd_s; + + +typedef struct _IntegerRect_s +{ + LgIndex_t X1; + LgIndex_t Y1; + LgIndex_t X2; + LgIndex_t Y2; +} IntegerRect_s; + + +typedef struct _Rect_s +{ + double X1; + double Y1; + double X2; + double Y2; +} Rect_s; + +typedef struct _XY_s +{ + double X; + double Y; +} XY_s; + +typedef struct _IJKSkip_s +{ + LgIndex_t I; + LgIndex_t J; + LgIndex_t K; +} IJKSkip_s; + + + +/* + * + * NOTE ON RANGES (Ent and Index) + * + * Min, Max and Skip all use the following assignment logic: + * + * 0 = First element + * -1 = mxindex value, (X[mxindex-1] in c) + * -n = mxindex-n+1 value (X[mxindex+n] in c) + * n = n+1 value (X[n] in c) + * + */ + +/* + * 2/28/95: NOTE: EntRange_s is no longer used but may be + * needed later. + */ + +typedef struct _EntRange_s +{ + EntIndex_t Min; + EntIndex_t Max; + EntIndex_t Skip; +} EntRange_s; + + +typedef struct _IndexRange_s +{ + LgIndex_t Min; + LgIndex_t Max; + LgIndex_t Skip; +} IndexRange_s; + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined (THREED) +#endif +#endif /* TECPLOTKERNEL */ + +typedef struct _TextShape_s +{ + Font_e Font; + double Height; + Units_e SizeUnits; +} TextShape_s; + +#define AsciiShapeFontIsGreek(S) (((S)->UseBaseFont == FALSE) && ((S)->FontOverride == Font_Greek)) +#define AsciiShapeFontIsMath(S) (((S)->UseBaseFont == FALSE) && ((S)->FontOverride == Font_Math)) +#define AsciiShapeFontIsUserDefined(S) (((S)->UseBaseFont == FALSE) && ((S)->FontOverride == Font_UserDefined)) + + +typedef struct +{ + Boolean_t UseBaseFont; /* (Default = TRUE) */ + Font_e FontOverride;/* (Default = Font_Math)*/ + SymbolChar_t Char; +} AsciiShape_s; + +typedef struct _SymbolShape_s +{ + GeomShape_e GeomShape; + Boolean_t IsAscii; + AsciiShape_s AsciiShape; +} SymbolShape_s; + +#ifdef NOT_USED +struct _AddOnList_a +{ + /* added temporarily so Windows makelibtec works */ + int dummy; +}; +#endif + +/* ENDREMOVEFROMADDON */ + +typedef struct _AddOnList_a *AddOn_pa; + +typedef struct _NodeMap_a *NodeMap_pa; + +/* BEGINREMOVEFROMADDON */ +typedef struct _StylePointState_a *StylePointState_pa; +typedef struct _DataElementState_a *DataElementState_pa; +typedef struct _StyleElementState_a *StyleElementState_pa; +typedef struct _NormalCache_a *NormalCache_pa; +/* ENDREMOVEFROMADDON */ + + +#define INVALID_INDEX (-1) + +/* used to indicate that no neighboring element or zone exists */ +#define NO_NEIGHBORING_ELEMENT (-1) +#define NO_NEIGHBORING_ZONE (-1) + +typedef struct _FaceNeighbor_a *FaceNeighbor_pa; + +/** + */ +typedef struct _FaceMap_a *FaceMap_pa; + +/** + */ +typedef struct _ElemToFaceMap_a *ElemToFaceMap_pa; + +/** + */ +typedef struct _NodeToElemMap_a *NodeToElemMap_pa; + +/* BEGINREMOVEFROMADDON */ + +/* + * Enumerates the face neighbor array members to make indexed members + * identifiable. + */ +typedef enum +{ + FaceNeighborMemberArray_CellFaceNbrs, + FaceNeighborMemberArray_BndryConnectNbrsCompObscure, + FaceNeighborMemberArray_BndryConnectFaceToCellsMap, + FaceNeighborMemberArray_BndryConnectIsPerfectNbr, + FaceNeighborMemberArray_BndryConnectCellList, + FaceNeighborMemberArray_BndryConnectZoneList, + END_FaceNeighborMemberArray_e, + FaceNeighborMemberArray_Invalid = BadEnumValue +} FaceNeighborMemberArray_e; + +int const FaceNeighborNumMemberArrays = (int)END_FaceNeighborMemberArray_e; + +/* + * Enumerates the face map's array members to make indexed members + * identifiable. + */ +typedef enum +{ + FaceMapMemberArray_FaceNodeOffsets, + FaceMapMemberArray_FaceNodes, + FaceMapMemberArray_FaceLeftElems, + FaceMapMemberArray_FaceRightElems, + FaceMapMemberArray_FaceBndryItemOffsets, + FaceMapMemberArray_FaceBndryItemElems, + FaceMapMemberArray_FaceBndryItemElemZones, + END_FaceMapMemberArray_e, + FaceMapMemberArray_Invalid = BadEnumValue +} FaceMapMemberArray_e; + +const int FaceMapNumMemberArrays = (int)END_FaceMapMemberArray_e; + +/* + * Enumerates the element to face map's array members to make indexed members + * identifiable. + */ +typedef enum +{ + ElemToFaceMapMemberArray_ElemFaceOffsets, + ElemToFaceMapMemberArray_ElemFaces, + END_ElemToFaceMapMemberArray_e, + ElemToFaceMapMemberArray_Invalid = BadEnumValue +} ElemToFaceMapMemberArray_e; + +const int ElemToFaceMapNumMemberArrays = (int)END_ElemToFaceMapMemberArray_e; + +/* + * Enumerates the element map's array members to make indexed members + * identifiable. + */ +typedef enum +{ + NodeToElemMapMemberArray_NodeElemOffsets, + NodeToElemMapMemberArray_NodeElems, + END_NodeToElemMapMemberArray_e, + NodeToElemMapMemberArray_Invalid = BadEnumValue +} NodeToElemMapMemberArray_e; + +const int NodeToElemMapNumMemberArrays = (int)END_NodeToElemMapMemberArray_e; + +/* ENDREMOVEFROMADDON */ + + +typedef struct _FieldData_a *FieldData_pa; + +/** + */ +typedef struct _AuxData_s *AuxData_pa; + + +/** + * Enumerates the data value structure of a variable in a data file. + * For all but ordered cell centered data the classic, classic padded and + * classic plus formats are identical. All values are laid out contiguously + * in the file. The number of values written depends upon the value location: + * + * - FE nodal:\n + * The number of values equals the number of data points. + * - FE cell centered:\n + * The number of values equals the number of elements. + * - Ordered nodal:\n + * The number of values equals the number of data points. + * - Ordered cell centered:\n + * There are three formats: + * -# Classic (binary version < 103):\n + * Classic is a compressed format of ordered cell centered data in + * that it does not include ghost cells. The cell index of each cell + * does not correspond to the lowest corner point index of each cell + * as it does internally in Tecplot.\n + * The number of values in the data file is calculated as follows: + * @code + * NumValues = MAX(IMax-1,1) * MAX(JMax-1,1) * MAX(KMax-1,1); + * @endcode + * Where IMax, JMax, and KMax are the maximum point dimensions of the + * zone. + * -# Classic padded (binary version < 104):\n + * Classic padded is an intermediary format that was available only + * within Tecplot, Inc. The cell centered data includes the ghost cells + * and each cell index corresponds to the lowest corner point index of + * each cell.\n + * The number of values in the data file (including ghost cells) is + * calculated as follows: + * @code + * NumValues = IMax * JMax * KMax; + * @endcode + * Where IMax, JMax, and KMax are the maximum point dimensions of the + * zone. The contents of the ghost cells is undefined and should not + * be used. + * -# Classic plus (binary version >= 104):\n + * Classic plus is similar to classic padded except that it does not + * include the ghost cells of the slowest moving index greater than + * one.\n + * The number of values in the data file (including ghost cells) is + * calculated as follows: + * @code + * FinalIMax = IMax; + * FinalJMax = JMax; + * FinalKMax = KMax; + * + * // decrement the max index of the slowest moving index greater than 1 + * if (KMax > 1) + * FinalKMax--; + * else if (JMax > 1) + * FinalJMax--; + * else if (IMax > 1) + * FinalIMax--; + * + * NumValues = FinalIMax * FinalJMax * FinalKMax; + * @endcode + * Where IMax, JMax, and KMax are the maximum point dimensions of the + * zone. The contents of the ghost cells is undefined and should not + * be used. + */ +typedef enum +{ + DataValueStructure_Classic, + DataValueStructure_ClassicPadded, + DataValueStructure_ClassicPlus, + END_DataValueStructure_e, + /* BEGINREMOVEFROMADDON */ + DataValueStructure_Latest = (END_DataValueStructure_e - 1), + /* ENDREMOVEFROMADDON */ + DataValueStructure_Invalid = BadEnumValue +} DataValueStructure_e; + +/** + * Enumerates the data node structure of a node map in a data file. The classic + * format uses 1 based nodes while the classic plus format uses zero based + * node. + */ +typedef enum +{ + DataNodeStructure_Classic, /* ones based node maps */ + DataNodeStructure_ClassicPlus, /* zero based node maps */ + END_DataNodeStructure_e, + DataNodeStructure_Invalid = BadEnumValue +} DataNodeStructure_e; + +/** + * Enumerates the variable locking modes. The \ref VarLockMode_ValueChange mode + * prevents modification of the values in a variable but permits deletion, and + * the \ref VarLockMode_Delete mode prevents deletion of a varaible but permits + * modification. + */ +typedef enum +{ + VarLockMode_ValueChange, + VarLockMode_Delete, + END_VarLockMode_e, + VarLockMode_Invalid = BadEnumValue +} VarLockMode_e; + +typedef enum +{ + FieldMapMode_UseStrandID, + FieldMapMode_UseZoneSet, + END_FieldMapMode_e, + FieldMapMode_Invalid = BadEnumValue +} FieldMapMode_e; + +typedef enum +{ + UnloadStrategy_Auto, + UnloadStrategy_NeverUnload, + UnloadStrategy_MinimizeMemoryUse, + END_UnloadStrategy_e, + UnloadStrategy_Invalid = BadEnumValue +} UnloadStrategy_e; + +/* BEGINREMOVEFROMADDON */ + + + +typedef struct +{ + ColorIndex_t PresetZoneColor; + Boolean_t IsInBlockFormat; +} ZoneLoadInfo_s; + +/* + * Note: For FE Data, NumPtsI = Number of data points. + * NumPtsJ = Number of elements. + * NumPtsK = Number of points per element. + */ + +typedef struct _ZoneSpec_s +{ + UniqueID_t UniqueID; + ZoneName_t Name; + EntIndex_t ParentZone; + Strand_t StrandID; + double SolutionTime; + LgIndex_t NumPtsI; // ...NumDataPts + LgIndex_t NumPtsJ; // ...NumElements + LgIndex_t NumPtsK; // ...NumPtsPerElem or NumFaces + LgIndex_t ICellDim; // ...currently not used + LgIndex_t JCellDim; // ...currently not used + LgIndex_t KCellDim; // ...currently not used + ZoneType_e Type; + ZoneLoadInfo_s ZoneLoadInfo; + AuxData_pa AuxData; + Boolean_t BuildZoneOptInfo; + + /* classic data only */ + FaceNeighborMode_e FNMode; + Boolean_t FNAreCellFaceNbrsSupplied; // ...meaning we don't need to update them + + /* polytope data only */ + LgIndex_t NumFaceNodes; + LgIndex_t NumFaceBndryFaces; + LgIndex_t NumFaceBndryItems; +} ZoneSpec_s; + + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + +typedef struct _GenericImage_a *GenericImage_pa; + +typedef struct _TextBox_s +{ + TextBox_e BoxType; /* Used to be textbox */ + double Margin; /* Used to be textboxmargin */ + double LineThickness; /* Used to be textboxmargin */ + ColorIndex_t BColor; /* Used to be textboxcolor */ + ColorIndex_t FillBColor; /* Used to be textboxfillcolor */ +} TextBox_s; + + +typedef struct _Text_s +{ + UniqueID_t UniqueID; /* Not used yet */ + AnchorPos_u AnchorPos; + CoordSys_e PositionCoordSys; + EntIndex_t Zone; + Boolean_t AttachToZone; /* New */ + ColorIndex_t BColor; /* Used to be TextColor */ + TextShape_s TextShape; + TextBox_s Box; /* Box items used to be here*/ + double Angle; /* NOTE: short in v6, now in rad */ + TextAnchor_e Anchor; /* New */ + double LineSpacing; /* New */ + Scope_e Scope; + char *MacroFunctionCommand; + Clipping_e Clipping; + char *Text; + struct _Text_s *NextText; + struct _Text_s *PrevText; +} Text_s; + + +typedef struct _GenericGeomData_s +{ + FieldData_pa V1Base; + FieldData_pa V2Base; + FieldData_pa V3Base; +} GenericGeomData_s; + +typedef struct _PolarGeomData_s +{ + FieldData_pa ThetaBase; + FieldData_pa RBase; +} PolarGeomData_s; + +typedef struct _CartesianGeomData_s +{ + FieldData_pa XBase; + FieldData_pa YBase; + FieldData_pa ZBase; +} CartesianGeomData_s; + +/* + * This union is designed to allow different plottypes + * to access the same values by different names. In + * C++ we could use member access functions, or we + * could have used macros, but instead we use this + * union. NOTE: This only works if all the structures + * have the same alignment. + */ +typedef union _GeomData_u +{ + GenericGeomData_s Generic; + CartesianGeomData_s XYZ; + PolarGeomData_s ThetaR; +} GeomData_u; + +typedef struct _Geom_s +{ + UniqueID_t UniqueID; + GeomType_e GeomType; + CoordSys_e PositionCoordSys; + AnchorPos_u AnchorPos; + Boolean_t AttachToZone; + EntIndex_t Zone; + ColorIndex_t BColor; + Boolean_t IsFilled; + ColorIndex_t FillBColor; + LinePattern_e LinePattern; + double PatternLength; + double LineThickness; + Scope_e Scope; + DrawOrder_e DrawOrder; + Clipping_e Clipping; + FieldDataType_e DataType; + char *MacroFunctionCommand; + ArrowheadStyle_e ArrowheadStyle; + ArrowheadAttachment_e ArrowheadAttachment; + double ArrowheadSize; + double ArrowheadAngle; + SmInteger_t NumEllipsePts; + char *ImageFileName; + LgIndex_t ImageNumber; /* used only to locate images within .lpk files */ + Boolean_t MaintainAspectRatio; + double PixelAspectRatio; /* VerticalPixelsPerHorizontalPixel */ + SmInteger_t NumSegments; + SegPtsArray_t NumSegPts; + GeomData_u GeomData; + ImageResizeFilter_e ImageResizeFilter; + /* Internal Scratch */ + GenericImage_pa _ImageData; + struct _Geom_s *_NextGeom; + struct _Geom_s *_PrevGeom; +} Geom_s; + + +typedef struct _Text_s *Text_pa; +typedef struct _Geom_s *Geom_pa; + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined USE_OOSTYLE +#endif +#if defined USE_OOSTYLE +#endif +#endif /* TECPLOTKERNEL */ + +/* ENDREMOVEFROMADDON */ +/* - NO DOXYGEN COMMENT GENERATION - + * Page creation callback is responsible for creating a RenderHandler for the page and + * calling @ref TecEngPageCreateNew(ArbParam_t RenderHandle) + * + * The RenderHandler type can be anything, for example,a pointer to a class instance that will + * be responsible for handling requests from the engine to perform operations on + * a page. + * + * @param PageConstructionHints a string list of construction hints that can be used for deciding + * how the page should be displayed in an application's UI. The construction hints could have been + * restored from a saved layout file or passed to @ref TecUtilPageCreateNew function. + * + * @param RegistrationClientData + * Client data that was registered with the callback. + * + * @return TRUE if page create request was handled and TecEngPageCreateNew() returned TRUE. + * + * @sa TecEngPageCreateRegisterCallback, TecEngPageCreateNew + * + * @since + * 11.0-5-014 + */ +typedef Boolean_t (STDCALL *PageCreateCallback_pf)(StringList_pa PageConstructionHints, + ArbParam_t RegistrationClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Page destruction callback responsible for destroying a page. + * + * @param PageClientData + * Data associated with a page that was returned from the PageCreateCallback_pf + * callback function. You will get a different value for each page. + * + * @param RegistrationClientData + * Data associated with the registration of this function. This will always return + * the value supplied in the original registration of this function. + * + * @sa TecEngPageDestroyRegisterCallback, PageCreateCallback_pf + * + * @since + * 11.0-5-014 + */ +typedef void (STDCALL *PageDestroyCallback_pf)(ArbParam_t PageClientData, + ArbParam_t RegistrationClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for informing the parent application of a new current page. + * Note that this could be done via a state change monitor but a more secure method + * is needed as state changes may be shut down from time to time. + * + * @param PageClientData + * Data associated with a page that was returned from the PageCreateCallback_pf + * callback function. You will get a different value for each page. + * + * @param RegistrationClientData + * Data associated with the registration of this function. This will always return + * the value supplied in the original registration of this function. + * + * @since + * 11.0-5-017 + */ +typedef void (STDCALL *PageNewCurrentCallback_pf)(ArbParam_t PageClientData, + ArbParam_t RegistrationClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for creation of an offscreen image. + * + * @param RegistrationClientData + * Data associated with the registration of this function. This will always return + * the value supplied in the original registration of this function. + * + * @param ImageHandle handle to a newly created image. This is an output parameter. + * + * @return TRUE if an offscreen image was created successfully. + * + * @since + * 11.2-0-054 + */ +typedef Boolean_t (STDCALL *OffscreenImageCreateCallback_pf)(ScreenDim_t Width, + ScreenDim_t Height, + ArbParam_t RegistrationClientData, + TP_OUT ArbParam_t* ImageHandle); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for destruction of an offscreen image. + * + * @param ImageHandle handle to an offscreen image to be destroyed. + * + * @param RegistrationClientData + * Data associated with the registration of this function. This will always return + * the value supplied in the original registration of this function. + * + * @since + * 11.2-0-054 + */ +typedef void (STDCALL *OffscreenImageDestroyCallback_pf)(ArbParam_t ImageHandle, + ArbParam_t RegistrationClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for returning RGB values for a row. + * + * @param ImageHandle + * Handle to an off-screen image from which RGB values to be retrieved. + * + * @param Row + * Row for which RGB values to be retrieved. + * + * @param RedArray + * Array to receive the red byte values for the specified Row. The number of values in + * the array must equal the width of the image. The array address is maintained by the + * Tecplot Engine until the image is destroyed however it is reused for each invocation + * of this callback. + * + * @param GreenArray + * Array to receive the green byte values for the specified Row. The number of values in + * the array must equal the width of the image. The array address is maintained by the + * Tecplot Engine until the image is destroyed however it is reused for each invocation + * of this callback. + * + * @param BlueArray + * Array to receive the blue byte values for the specified Row. The number of values in + * the array must equal the width of the image. The array address is maintained by the + * Tecplot Engine until the image is destroyed however it is reused for each invocation + * of this callback. + * + * @param RegistrationClientData + * Data associated with the registration of this function. This will always return + * the value supplied in the original registration of this function. + * + * @return TRUE if successful, FALSE otherwise. + * + * @since + * 11.2-0-054 + */ +typedef Boolean_t (STDCALL *OffscreenImageGetRGBRowCallback_pf)(ArbParam_t ImageHandle, + ScreenDim_t Row, + ArbParam_t RegistrationClientData, + TP_ARRAY_OUT Byte_t* RedArray, + TP_ARRAY_OUT Byte_t* GreenArray, + TP_ARRAY_OUT Byte_t* BlueArray); + +#if defined MSWIN +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for printing an image on the specified printer DC + * + * @param PrintDC a device context of a printer on which the printing should be performed. + * + * @param ImageHandle handle to an image to print. + * + * @param Palette specifies if an image should be printed as a color or monochrome image. + * + * @param RegistrationClientData + * Data associated with the registration of this function. This will always return + * the value supplied in the original registration of this function. + * + * @return TRUE if the printing operation was successfull. + * + * @since + * 11.2-0-463 + */ +typedef Boolean_t (STDCALL *WinPrintImageCallback_pf)(HDC PrintDC, + ArbParam_t ImageHandle, + Palette_e Palette, + ArbParam_t RegistrationClientData); + +#endif /* MSWIN */ + +#if defined MSWIN +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for providing a printer context. + * + * @param RegistrationClientData + * Data associated with the registration of this function. This will always return + * the value supplied in the original registration of this function. + * + * @return HDC context of the destination printer. + * + * @since + * 11.2-0-468 + */ +typedef HDC(STDCALL *WinPrinterGetContextCallback_pf)(ArbParam_t RegistrationClientData); + +#endif /* MSWIN */ + +/* - NO DOXYGEN COMMENT GENERATION - + * Render destination callback responsible for switching the render destination + * of the OpenGL drawing state when requested by the Tecplot engine. + * + * @since + * 11.0-0-397 + * + * @param PageRenderDest + * Enumeration of page render destination of interest. + * + * @param RenderDestClientData + * Data associated with a render destination, such as returned from the PageCreateCallback_pf or + * OffscreenImageCreate_pf callback functions. + * + * @param RegistrationClientData + * Data associated with the registration of this function. This will always return + * the value supplied in the original registration of this function. + * + * @return + * TRUE if render destination was set successfully. FALSE, otherwise. + * + * @sa TecEngRenderDestRegisterCallback + */ +typedef Boolean_t (STDCALL *RenderDestCallback_pf)(PageRenderDest_e PageRenderDest, + ArbParam_t RenderDestClientData, + ArbParam_t RegistrationClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Render query callback responsible for informing Tecplot if the page + * associated with the PageClientData should be rendered into. + * + * @since + * 11.0-5-018 + * + * @param PageClientData + * Data associated with a page that was returned from the + * PageCreateCallback_pf callback function. + * @param RegistrationClientData + * Data associated with the registration of this function. This will always + * return the value supplied in the original registration of this function. + * + * + * @return + * TRUE if Tecplot should render to the page identified by the + * PageClientData, FALSE otherwise. + * + * @sa TecEngRenderQueryRegisterCallback + */ +typedef Boolean_t (STDCALL *RenderQueryCallback_pf)(ArbParam_t PageClientData, + ArbParam_t RegistrationClientData); +/* - NO DOXYGEN COMMENT GENERATION - + * Render destination size callback responsible for returning the size of the + * specified render destination when requested by the Tecplot engine. + * + * @since + * 11.0-0-397 + * + * @param PageClientData + * Data associated with a page that was returned from the + * PageCreateCallback_pf callback function. + * @param RegistrationClientData + * Client data that was registered with the callback. + * @param Width + * Pointer who's contents should receive the width of the current render + * destination. + * @param Height + * Pointer who's contents should receive the height of the current render + * destination. + * + * @sa TecEngRenderDestSizeRegisterCallback + */ +typedef void (STDCALL *RenderDestSizeCallback_pf)(ArbParam_t PageClientData, + ArbParam_t RegistrationClientData, + TP_OUT LgIndex_t* Width, + TP_OUT LgIndex_t* Height); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for swapping the front and back buffers for the current + * OpenGL drawing state's render destination when requested by the Tecplot + * engine. + * + * @since + * 11.0-0-397 + * + * @param RegistrationClientData + * Client data that was registered with the callback. + * + * @sa TecUtilpBuffersRegisterCallback + */ +typedef void (STDCALL *SwapBuffersCallback_pf)(ArbParam_t RegistrationClientData); + + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for querying of key states. + * + * @since + * 11.0-0-399 + * + * @param RegistrationClientData + * Client data that was registered with the callback. + * @param IsShiftKeyDown + * Boolean pointer. If non-NULL, set the boolean to TRUE if the Shift key is + * down or FALSE if it is up. + * @param IsAltKeyDown + * Boolean pointer. If non-NULL, set the boolean to TRUE if the Alt key is + * down or FALSE if it is up. + * @param IsCntrlKeyDown + * Boolean pointer. If non-NULL, set the boolean to TRUE if the Cntrl key is + * down or FALSE if it is up. + * + * @sa TecEngKeyStateRegisterCallback + */ +typedef void (STDCALL *KeyStateCallback_pf)(ArbParam_t RegistrationClientData, + TP_OUT Boolean_t* IsShiftKeyDown, + TP_OUT Boolean_t* IsAltKeyDown, + TP_OUT Boolean_t* IsCntrlKeyDown); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for querying of a mouse button state. + * + * @since + * 11.0-0-424 + * + * @param Button + * Mouse button number to query. Button numbers start at one. + * @param RegistrationClientData + * Client data that was registered with the callback. + * + * @return + * TRUE if the specified mouse button is down, FALSE otherwise. + * + * @sa TecEngMouseButtonStateRegisterCallback + */ +typedef Boolean_t (STDCALL *MouseButtonStateCallback_pf)(int Button, + ArbParam_t RegistrationClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for setting wait cursor when requested by the kernel + * + * @since + * 11.2-0-302 + * + * @param Activate + * TRUE if the kernel is requesting that the wait cursor be activated. + * FALSE if the kernel is requesting that the wait cursor be deactivated. + * @param RegistractionClientData + * Client data that was registered with the callback. + * + * @sa TecEngWaitCursorStateRegisterCallback + */ +typedef void (STDCALL *WaitCursorStateCallback_pf)(Boolean_t Activate, + ArbParam_t RegistrationClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for setting cursor style when requested by the kernel + * + * @since + * 11.2-0-302 + * + * @param CursorStyle + * The cursor style which the kernel is requesting. + * @param RenderHandle + * Handle to page where new cursor shape is being set. + * @param RegistractionClientData + * Client data that was registered with the callback. + * + * @sa TecEngBaseCursorStyleRegisterCallback + */ +typedef void (STDCALL *BaseCursorStyleCallback_pf)(CursorStyle_e CursorStyle, + ArbParam_t RenderHandle, + ArbParam_t RegistrationClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for processing events when the Tecplot engine is busy + * peforming a requested operation. This callback will be called at regular + * intervals to repair the interface and if required check for interrupts. Very + * little work should be done by this function. + * + * @since + * 11.0-0-415 + * + * @param RegistrationClientData + * Client data that was registered with the callback. + * + * @sa TecEngProcessBusyEventsRegisterCallback, TecUtilInterrupt + */ +typedef void (STDCALL *ProcessBusyEventsCallback_pf)(ArbParam_t RegistrationClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for launching a dialog. + * + * @since + * 11.0-0-415 + * + * @param RegistrationClientData + * Client data that was registered with this launch dialog callback. + * + * @return + * TRUE if the dialog was launched, FALSE if it could not be launched + * programmatically. + * + * @sa TecUtilDialogLaunch, TecUtilDialogDrop + */ +typedef Boolean_t (STDCALL *DialogLaunchCallback_pf)(ArbParam_t RegistrationClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for dropping a dialog. + * + * @since + * 11.0-0-407 + * + * @param RegistrationClientData + * Client data that was registered with this drop dialog callback. + * + * @sa TecUtilDialogLaunch, TecUtilDialogDrop + */ +typedef void (STDCALL *DialogDropCallback_pf)(ArbParam_t RegistrationClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for querying of the physical display's horizontal and + * vertical dot pitch. + * + * @since + * 11.0-0-407 + * + * @param RegistrationClientData + * Client data that was registered with the callback. + * @param IDotsPerCm + * Pointer who's contents should receive the physical display's horizontal + * dot pitch in terms of the number of dots per centimeter. + * @param JDotsPerCm + * Pointer who's contents should receive the physical display's vertical + * dot pitch in terms of the number of dots per centimeter. + * + * @sa TecEngDotPitchRegisterCallback + */ +typedef void (STDCALL *DotPitchCallback_pf)(ArbParam_t RegistrationClientData, + TP_OUT double* IDotsPerCm, + TP_OUT double* JDotsPerCm); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for querying of the physical display's width and + * height in pixels. + * + * @since + * 11.2-0-471 + * + * @param RegistrationClientData + * Client data that was registered with the callback. + * @param WidthInPixels + * Pointer who's contents should receive the physical display's width + * in pixels. NULL may be passed. + * @param HeightInPixels + * Pointer who's contents should receive the physical display's height + * in pixels. NULL may be passed. + * + * @sa TecEngScreenSizeRegisterCallback + */ +typedef void (STDCALL *ScreenSizeCallback_pf)(ArbParam_t RegistrationClientData, + TP_OUT int* WidthInPixels, + TP_OUT int* HeightInPixels); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for displaying a message box dialog and returning the + * user's response. + * + * @since + * 11.0-0-415 + * + * @param MessageString + * Message string to display in the dialog. + * @param MessageBoxType + * Type of message box to display. + * @param RegistrationClientData + * Client data that was registered with the callback. + * + * @return + * Result of user's response to the dialog. + * + * @sa TecEngDialogMessageBoxRegisterCallback + */ +typedef MessageBoxReply_e(STDCALL *DialogMessageBoxCallback_pf)(const char* MessageString, + MessageBoxType_e MessageBoxType, + ArbParam_t RegistrationClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for displaying a status line + * + * @since + * 11.2-0-085 + * + * @param StatusString + * Message string to display in the dialog. + * + * @param RegistrationClientData + * Client data that was registered with the callback. + * + * @sa TecEngStatusLineRegisterCallback + */ +typedef void (STDCALL *StatusLineCallback_pf)(const char* StatusString, + ArbParam_t RegistrationClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback that will be called with the updated progress status. + * + * @since 11.2-0-098 + * + * + * @param ProgressStatus + * Percentage of the progress. + * + * @param RegistrationClientData + * Client data that was registered with the callback. + * + * @sa TecEngProgressMonitorRegisterCallback + */ +typedef void (STDCALL *ProgressMonitorCallback_pf)(int ProgressStatus, + ArbParam_t RegistrationClientData); +/* - NO DOXYGEN COMMENT GENERATION - + * Callback that will be called with Tecplot Engine is about to perform a lengthy operation. + * The client that registers such the callback may present a user with a progress bar, + * if the ShowProgressBar argument is TRUE, and a stop button that would interrupt the operation by + * calling TecUtilInterrupt(). + * + * @since 11.2-0-098 + * + * @param ShowProgressBar + * Boolean indicating if the progress steps can be monitored for an operation. If TRUE, Tecplot Engine will be calling + * the registered ProgressMonitorCallback_pf function with the updated progress status. + * + * @param IsInterruptible + * Boolean indicating if the operation can be interrupted before completion. + * + * @param RegistrationClientData + * Client data that was registered with the callback. + * + * @sa TecEngProgressMonitorRegisterCallback + */ +typedef void (STDCALL *ProgressMonitorStartCallback_pf)(Boolean_t ShowProgressBar, + Boolean_t IsInterruptible, + ArbParam_t RegistrationClientData); +/* - NO DOXYGEN COMMENT GENERATION - + * Callback tht will be called with Tecplot Engine has finished performing a lengthy operation. + * At this point, client may hide progress bar that was shown during handling of ProgressMonitorStartCallback callback and + * disable or hide the stop button. + * + * @since 11.2-0-098 + * + * @param RegistrationClientData + * Client data that was registered with the callback. + * + * @sa TecEngProgressMonitorRegisterCallback + */ +typedef void (STDCALL *ProgressMonitorFinishCallback_pf)(ArbParam_t RegistrationClientData); + +/********************************************************* + * Add-on Timers + *********************************************************/ +/** + * This is called when a registered timer fires. + * + * @par Limitation: + * Unix and Linux versions of Tecplot currently do not fire timer events when + * Tecplot is running in batch mode (with the -b flag). This behavior + * limitation is subject to change. + * + * @param ClientData + * Arbitrary client data. + * + * @return + * Return TRUE if the timer should be reinstated. Return FALSE + * to stop subsequent callbacks. + * + * + * <FortranSyntax> + * INTEGER*4 FUNCTION MyAddOnTimerCallback( + * & ClientDataPtr) + * POINTER (ClientDataPtr,DummyClientData) + * </FortranSyntax> + */ +typedef Boolean_t (STDCALL *AddOnTimerCallback_pf)(ArbParam_t ClientData); + +/* - NO DOXYGEN COMMENT GENERATION - + * Callback that will be called when Tecplot Engine has requested an event timer to be created. + * + * @since 12.0.1.5642 + * + * @param ClientData + * ClientData that should be sent in the callback. + * + * @param TimerCallback + * Callback to fire when the timer interval has expired. + * + * @param Interval + * The time (in milliseconds) after which the timer callback should be called. + * + * @param RegistrationClientData + * Client data that was registered via TecEngTimerRegisterCallback. + * + * @return + * Return TRUE if the timer was successfully created, FALSE if not. + */ +typedef Boolean_t (STDCALL *TimerCallback_pf)(AddOnTimerCallback_pf TimerCallback, + ArbParam_t ClientData, + UInt32_t Interval, + ArbParam_t RegistrationClientData); + +/** + * This function is called when the user activates a menu item + * added via TecUtilMenuInsertOption or TecUtilMenuInsertToggle. + * + * @param RegistrationClientData + * Arbitrary client data. + */ +typedef void (STDCALL *MenuActivateCallback_pf)(ArbParam_t RegistrationClientData); + +/** + * This function is called when the a menu is deleted. + * + * @param RegistrationClientData + * Arbitrary client data. + */ +typedef void (STDCALL *MenuDeleteCallback_pf)(ArbParam_t RegistrationClientData); + +/** + * This function is called to determine the sensitivity for a menu item (option, + * toggle or submenu). + * + * @param RegistrationClientData + * Arbitrary client data. + * + * @return + * Return TRUE if the menu item should be sensitive to user input, + * or FALSE if it should be insensitive to user input (gray). + */ +typedef Boolean_t (STDCALL *MenuGetSensitivityCallback_pf)(ArbParam_t RegistrationClientData); + +/** + * This function is called to determine the checked state for a toggle menu item. + * + * @param RegistrationClientData + * Arbitrary client data. + * + * @return + * Return TRUE if the toggle should be checked, + * or FALSE if it should be unchecked. + */ +typedef Boolean_t (STDCALL *MenuGetToggleStateCallback_pf)(ArbParam_t RegistrationClientData); + + +/** + * This function is called when the user performs a probe event. + * + * @param IsNearestPoint + * This is TRUE if the previous probe event was a nearest point probe. + * This is FALSE if it was an interpolated probe. + * + * <FortranSyntax> + * SUBROUTINE MyProbeDestinationCallback( + * IsNearestPoint) + * INTEGER*4 IsNearestPoint + * </FortranSyntax> + */ +typedef void (STDCALL *ProbeDestination_pf)(Boolean_t IsNearestPoint); + + +/** + * This function type called when a probe callback is installed via + * TecUtilProbeInstallCallbackX. + * + * @param WasSuccessful + * This is TRUE if the previous probe event was successful. + * This is FALSE if it was the probe failed. Probe events may fail if the + * user probes in a region of the plot that contains no data. + * + * @param IsNearestPoint + * This is TRUE if the previous probe event was a nearest point probe. + * This is FALSE if it was an interpolated probe. + * + * @param ClientData + * Arbitrary client data. + * + */ +typedef void (STDCALL *ProbeDestinationX_pf)(Boolean_t WasSuccessful, + Boolean_t IsNearestPoint, + ArbParam_t ClientData); + + +/** + * DynamicMenu Functions are called upon a user selecting + * a menu item added via TecUtilMenuAddOption. + * + * <FortranSyntax> + * SUBROUTINE MyDynamicMenuCallback() + * </FortranSyntax> + */ +typedef void (STDCALL *DynamicMenuCallback_pf)(void); + +/** + * This callback signature is used to perform redraw events. + * + * @since + * 11.0-0-363 + * + * @param RedrawReason + * An enumerated value describing the reason for the re-draw event. + * @param ClientData + * Client data that was registered with the callback. + * + * @return + * TRUE if successfull, FALSE otherwise. + * + * <FortranSyntax> + * INTEGER*4 FUNCTION DrawEventCallback( + * & RedrawReason, + * & ClientDataPtr) + * INTEGER*4 RedrawReason + * POINTER (ClientDataPtr,ClientData) + * </FortranSyntax> + * + * @sa TecUtilEventAddPreDrawCallback(), TecUtilEventAddPostDrawCallback() + */ +typedef Boolean_t (STDCALL *DrawEventCallback_pf)(RedrawReason_e RedrawReason, + ArbParam_t ClientData); + + +/** + * Compares two strings from a list string. Note that either string may be NULL + * as StringLists allow for NULL elements. + * + * @param String1 + * String to compare against String2. + * @param String2 + * String to compare against String1. + * @param ClientData + * Contextual information that was passed to the 'StringListSort' function. + * + * @return + * - A value less than zero if String1 is less than String2. + * - A value of zero if String1 is equal to String2. + * - A value greater than zero if String1 is greater than String2. + */ +typedef int (STDCALL *StringListStringComparator_pf)(const char* String1, + const char* String2, + ArbParam_t ClientData); + +/** + * Gets a value at the specified point index using, if necessary, the private + * client data retrieved from the field data handle. + * + * @par Note: + * This callback is called asynchronously. This callback should NOT + * lock/unlock Tecplot. + * + * @since + * 10.0-3-128 + * + * @param FD + * Field data handle for which to set the value. This + * FieldValueGetFunction_pf must have been retrieved from this field data + * handle via TecUtilDataValueRefGetGetFunc. + * + * @param pt + * Zero-based index into the field data. + * + * @return + * Value for that index, always passed as a double precision floating-point + * value regardless of the data type of the field data handle. + * + * @sa TecUtilDataValueCustomLOD(), TecUtilDataValueGetClientData() + */ +typedef double(STDCALL *FieldValueGetFunction_pf)(const FieldData_pa FD, + LgIndex_t pt); + +/** + * Sets a value at the specified index using the private client data retrieved + * from the field data handle. + * + * @par Note: + * This callback is called asynchronously. This callback should NOT + * lock/unlock Tecplot. + * + * @since + * 10.0-3-128 + * + * @param FD + * Field data handle for which to set the value. This + * FieldValueSetFunction_pf must have been retrieved from this field data + * handle via TecUtilDataValueRefGetSetFunc. + * + * @param pt + * Zero-based index into the field data. + * + * @param val + * New value for that index, always passed as a double precision + * floating-point value regardless of the data type of the field data handle. + * + * @sa TecUtilDataValueCustomLOD(), TecUtilDataValueGetClientData() + */ +typedef void (STDCALL *FieldValueSetFunction_pf)(FieldData_pa FD, + LgIndex_t pt, + double val); + +/** + * Callback responsible for loading the specified variable for Tecplot using + * the private client data retrieved from the field data handle. + * + * @par Note: + * This callback is called asynchronously. With the exception of calls to + * modify the field data all calls back to Tecplot through the TecUtil layer + * should be limited to queries. + * + * @since + * 11.0-0-001 + * + * @param FieldData + * Field data handle of the variable load. + * + * @result + * TRUE if the variable was loaded, FALSE if unable to do so. + * + * @code + * typedef struct + * { + * char *DataFileName; + * long SeekOffset; + * LgIndex_t NumValues; + * ... other information needed to load variable data + * } MyVariableClientData_s; + * + * Boolean_t STDCALL MyVariableLoader(FieldData_pa FieldData) + * { + * REQUIRE(VALID_REF(FieldData)); + * + * MyVariableClientData_s *MyClientData = (MyVariableClientData_s *)TecUtilDataValueGetClientData(FieldData); + * + * // open the data file + * FILE *MyDataFile = fopen(MyClientData->DataFileName, "rb"); + * Boolean_t IsOk = (MyDataFile != NULL); + * + * // seek to the place in the file where the variable data is located + * IsOk = IsOk && (fseek(MyDataFile, MyClientData->SeekOffset, SEEK_SET) == 0); + * if (IsOk) + * { + * // load the data into the variable's field data + * IsOk = ReadMyDataInfoVariable(MyDataFile, MyClientData, FieldData); + * } + * + * // cleanup + * if (MyDataFile != NULL) + * fclose(MyDataFile); + * + * ENSURE(VALID_BOOLEAN(IsOk)); + * return IsOk; + * } + * @endcode + * + * @sa TecUtilDataValueCustomLOD(), TecUtilDataValueGetClientData() + */ +typedef Boolean_t (STDCALL *LoadOnDemandVarLoad_pf)(FieldData_pa FieldData); + +/** + * Callback responsible for performing private actions associated with a + * variable being unloaded using the private client data retrieved from the + * field data handle. Whenever possible the callback should honor Tecplot's + * request to unload the variable by returning TRUE. This callback is + * responsible for performing private actions associated with a variable being + * unloaded. + * + * Most add-ons should simply supply NULL for this callback thereby instructing + * Tecplot to handle the unloading (and subsequent reloading) of the variable + * without the intervention of the add-on. + * + * @par Note: + * This callback is called asynchronously. All calls back to Tecplot through + * the TecUtil layer should be limited to queries. + * + * @since + * 11.0-0-001 + * + * @param FieldData + * Field data handle of the variable Tecplot wants to unload. + * + * @code + * typedef struct + * { + * char *DataFileName; + * long SeekOffset; + * LgIndex_t NumValues; + * ... other information needed to load variable data + * } MyVariableClientData_s; + * + * Boolean_t STDCALL MyVariableUnload(FieldData_pa FieldData) + * { + * REQUIRE(VALID_REF(FieldData)); + * + * // We don't have any private data to cleanup (i.e in addition to the + * // private client data which we don't cleanup here) so all we have to do + * // is return TRUE or FALSE letting Tecplot know that it can or can not + * // unload the variable. + * Boolean_t Result = TRUE; // ...tell Tecplot to go ahead and unload the variable + * + * ENSURE(VALID_BOOLEAN(Result)); + * return Result; + * } + * @endcode + * + * @result + * TRUE if the variable can be unloaded, FALSE otherwise. The add-on should + * if at all possible honor the request to unload the variable. Most add-ons + * should return TRUE. + * + * @sa TecUtilDataValueCustomLOD(), TecUtilDataValueGetClientData() + */ +typedef Boolean_t (STDCALL *LoadOnDemandVarUnload_pf)(FieldData_pa FieldData); + +/** + * Callback responsible for performing private actions associated with a + * variable being cleaned up using the private client data retrieved from the + * field data handle. Most add-ons will need to register this callback in order + * to cleanup privately allocated client data. + * + * @par Note: + * This callback is called asynchronously. All calls back to Tecplot through + * the TecUtil layer should be limited to queries. + * + * @since + * 11.0-0-001 + * + * @param FieldData + * Field data handle of the variable being cleaned up. + * + * @code + * typedef struct + * { + * char *DataFileName; + * long SeekOffset; + * LgIndex_t NumValues; + * ... other information needed to load variable data + * } MyVariableClientData_s; + * + * void STDCALL MyVariableCleanup(FieldData_pa FieldData) + * { + * REQUIRE(VALID_REF(FieldData)); + * + * MyVariableClientData_s *MyClientData = (MyVariableClientData_s *)TecUtilDataValueGetClientData(FieldData); + * + * // cleanup privately allocated resources + * free(MyClientData->DataFileName); + * free(MyClientData); + * } + * @endcode + * + * @sa TecUtilDataValueCustomLOD(), TecUtilDataValueGetClientData() + */ +typedef void (STDCALL *LoadOnDemandVarCleanup_pf)(FieldData_pa FieldData); + +/** + * Callback responsible for loading the specified node mapping for Tecplot + * using the private client data retrieved from the node mapping handle. + * + * @par Note: + * This callback is called asynchronously. With the exception of calls to + * modify the node mapping, all calls back to Tecplot through the TecUtil + * layer should be limited to queries. + * + * @since + * 11.3-0-010 + * + * @param NodeMap + * Handle of the node mapping. + * + * @result + * TRUE if the node mapping was loaded, FALSE if unable to do so. + * + * @code + * typedef struct + * { + * char *DataFileName; + * long SeekOffset; + * ... other information needed to load node map data + * } MyNodeMapClientData_s; + * + * Boolean_t STDCALL MyNodeMapLoader(NodeMap_pa NodeMap) + * { + * REQUIRE(VALID_REF(NodeMap)); + * + * MyNodeMapClientData_s *MyClientData = + * (MyNodeMapClientData_s *)TecUtilDataNodeGetClientData(NodeMap); + * + * // open the data file + * FILE *MyDataFile = fopen(MyClientData->DataFileName, "rb"); + * Boolean_t IsOk = (MyDataFile != NULL); + * + * // seek to the place in the file where the node map data is located + * IsOk = IsOk && (fseek(MyDataFile, MyClientData->SeekOffset, SEEK_SET) == 0); + * if (IsOk) + * { + * // load the data into the zone's node map + * IsOk = ReadMyNodeMapDataIntoZone(MyDataFile, MyClientData, NodeMap); + * } + * + * // cleanup + * if (MyDataFile != NULL) + * fclose(MyDataFile); + * + * ENSURE(VALID_BOOLEAN(IsOk)); + * return IsOk; + * } + * @endcode + * + * @sa TecUtilDataNodeCustomLOD(), TecUtilDataNodeGetClientData() + */ +typedef Boolean_t (STDCALL *LoadOnDemandNodeMapLoad_pf)(NodeMap_pa NodeMap); + +/** + * Callback responsible for performing private actions associated with a + * node mapping being unloaded using the private client data retrieved from the + * node mapping handle. Whenever possible the callback should honor Tecplot's + * request to unload the node mapping by returning TRUE. + * + * Most add-ons should simply supply NULL for this callback thereby instructing + * Tecplot to handle the unloading (and subsequent reloading) of the node mapping + * without the intervention of the add-on. + * + * @par Note: + * This callback is called asynchronously. All calls back to Tecplot through + * the TecUtil layer should be limited to queries. + * + * @since + * 11.3-0-010 + * + * @param NodeMap + * Node mapping handle of the node mapping Tecplot wants to unload. + * + * @code + * Boolean_t STDCALL MyNodeMapUnload(NodeMap_pa NodeMap) + * { + * REQUIRE(VALID_REF(NodeMap)); + * + * // We don't have any private data to cleanup (i.e in addition to the + * // private client data which we don't cleanup here) so all we have to do + * // is return TRUE or FALSE letting Tecplot know that it can or can not + * // unload the variable. + * Boolean_t Result = TRUE; // ...tell Tecplot to go ahead and unload the node mapping + * + * ENSURE(VALID_BOOLEAN(Result)); + * return Result; + * } + * @endcode + * + * @result + * TRUE if the node mapping can be unloaded, FALSE otherwise. The add-on should + * if at all possible honor the request to unload the node mapping. Most add-ons + * should return TRUE. + * + * @sa TecUtilDataNodeCustomLOD(), TecUtilDataNodeGetClientData() + */ +typedef Boolean_t (STDCALL *LoadOnDemandNodeMapUnload_pf)(NodeMap_pa NodeMap); + +/** + * Callback responsible for performing private actions associated with a + * node mapping being cleaned up using the private client data retrieved from the + * node mapping handle. Most add-ons will need to register this callback in order + * to cleanup privately allocated client data. + * + * @par Note: + * This callback is called asynchronously. All calls back to Tecplot through + * the TecUtil layer should be limited to queries. + * + * @since + * 11.3-0-010 + * + * @param NodeMap + * Node Mapping data handle of the node mapping being cleaned up. + * + * @code + * typedef struct + * { + * char *DataFileName; + * long SeekOffset; + * ... other information needed to load node map data + * } MyNodeMapClientData_s; + * + * void STDCALL MyNodeMapCleanup(NodeMap_pa NodeMap) + * { + * REQUIRE(VALID_REF(NodeMap)); + * + * MyNodeMapClientData_s *MyClientData = (MyNodeMapClientData_s *)TecUtilDataNodeGetClientData(NodeMap); + * + * // cleanup privately allocated resources + * free(MyClientData->DataFileName); + * free(MyClientData); + * } + * @endcode + * + * @sa TecUtilDataNodeCustomLOD(), TecUtilDataNodeGetClientData() + */ +typedef void (STDCALL *LoadOnDemandNodeMapCleanup_pf)(NodeMap_pa NodeMap); + +/** + * Callback responsible for loading the specified face neighbor for Tecplot + * using the private client data retrieved from the face neighbor handle. + * + * @par Note: + * This callback is called asynchronously. With the exception of calls to + * modify the face neighbors, all calls back to Tecplot through the TecUtil + * layer should be limited to queries. + * + * @since + * 11.3-0-010 + * + * @param FaceNeighbor + * Handle of the face neighbors. + * + * @result + * TRUE if the face neighbors was loaded, FALSE if unable to do so. + * + * @code + * typedef struct + * { + * char *DataFileName; + * long SeekOffset; + * ...other information needed to load face neighbor data + * } MyFaceNeighborClientData_s; + * + * Boolean_t STDCALL MyFaceNeighborLoader(FaceNeighbor_pa FaceNeighbor) + * { + * REQUIRE(VALID_REF(FaceNeighbor)); + * + * MyFaceNeighborClientData_s *MyClientData = + * (MyFaceNeighborClientData_s*)TecUtilDataFaceNbrGetClientData(FaceNeighbor); + * + * // open the data file + * FILE *MyDataFile = fopen(MyClientData->DataFileName, "rb"); + * Boolean_t IsOk = (MyDataFile != NULL); + * + * // seek to the place in the file where the face neighbor data is located + * IsOk = IsOk && (fseek(MyDataFile, MyClientData->SeekOffset, SEEK_SET) == 0); + * if (IsOk) + * { + * // load the data into the zone's face neighbor + * IsOk = ReadMyFaceNeighborDataIntoZone(MyDataFile, MyClientData, FaceNeighbor); + * } + * + * // cleanup + * if (MyDataFile != NULL) + * fclose(MyDataFile); + * + * ENSURE(VALID_BOOLEAN(IsOk)); + * return IsOk; + * } + * @endcode + * + * @sa TecUtilDataFaceNbrCustomLOD(), TecUtilDataFaceNbrGetClientData() + */ +typedef Boolean_t (STDCALL *LoadOnDemandFaceNeighborLoad_pf)(FaceNeighbor_pa FaceNeighbor); + +/** + * Callback responsible for performing private actions associated with a + * face neighbors being unloaded using the private client data retrieved from + * the face neighbor handle. Whenever possible the callback should honor + * Tecplot's request to unload the face neighbors by returning TRUE. + * + * Most add-ons should simply supply NULL for this callback thereby instructing + * Tecplot to handle the unloading (and subsequent reloading) of the face + * neighbors without the intervention of the add-on. + * + * @par Note: + * This callback is called asynchronously. All calls back to Tecplot through + * the TecUtil layer should be limited to queries. + * + * @since + * 11.3-0-010 + * + * @param FaceNeighbor + * Face neighbor handle of the face neighbors Tecplot wants to unload. + * + * @code + * Boolean_t STDCALL MyFaceNeighborUnload(FaceNeighbor_pa FaceNeighbor) + * { + * REQUIRE(VALID_REF(FaceNeighbor)); + * + * // We don't have any private data to cleanup (i.e in addition to the + * // private client data which we don't cleanup here) so all we have to do + * // is return TRUE or FALSE letting Tecplot know that it can or can not + * // unload the variable. + * Boolean_t Result = TRUE; // ...tell Tecplot to go ahead and unload the face neighbors + * + * ENSURE(VALID_BOOLEAN(Result)); + * return Result; + * } + * @endcode + * + * @result + * TRUE if the face neighbors can be unloaded, FALSE otherwise. The add-on + * should if at all possible honor the request to unload the face neighbors. + * Most add-ons should return TRUE. + * + * @sa TecUtilDataFaceNbrCustomLOD(), TecUtilDataFaceNbrGetClientData() + */ +typedef Boolean_t (STDCALL *LoadOnDemandFaceNeighborUnload_pf)(FaceNeighbor_pa FaceNeighbor); + +/** + * Callback responsible for performing private actions associated with a face + * neighbors being cleaned up using the private client data retrieved from the + * face neighbor handle. Most add-ons will need to register this callback in + * order to cleanup privately allocated client data. + * + * @par Note: + * This callback is called asynchronously. All calls back to Tecplot through + * the TecUtil layer should be limited to queries. + * + * @since + * 11.3-0-010 + * + * @param FaceNeighbor + * Face neighbor data handle of the Face neighbors being cleaned up. + * + * @code + * typedef struct + * { + * char *DataFileName; + * long SeekOffset; + * ... other information needed to load face neighbor data + * } MyFaceNeighborClientData_s; + * + * void STDCALL MyFaceNeighborCleanup(FaceNeighbor_pa FaceNeighbor) + * { + * REQUIRE(VALID_REF(FaceNeighbor)); + * + * MyFaceNeighborClientData_s *MyClientData = (MyFaceNeighborClientData_s *)TecUtilDataFaceNbrGetClientData(FaceNeighbor); + * + * // cleanup privately allocated resources + * free(MyClientData->DataFileName); + * free(MyClientData); + * } + * @endcode + * + * @sa TecUtilDataFaceNbrCustomLOD(), TecUtilDataFaceNbrGetClientData() + */ +typedef void (STDCALL *LoadOnDemandFaceNeighborCleanup_pf)(FaceNeighbor_pa FaceNeighbor); + +/** + * Callback responsible for loading the specified face mapping for Tecplot + * using the private client data retrieved from the face mapping handle. + * + * @par Note: + * This callback is called asynchronously. With the exception of calls to + * modify the face mapping, all calls back to Tecplot through the TecUtil + * layer should be limited to queries. + * + * @since + * 11.2-1-0 + * + * @param FaceMap + * Handle of the face mapping. + * + * @result + * TRUE if the face mapping was loaded, FALSE if unable to do so. + * + * @code + * typedef struct + * { + * char *DataFileName; + * long SeekOffset; + * ... other information needed to load face map data + * } MyFaceMapClientData_s; + * + * Boolean_t STDCALL MyFaceMapLoader(FaceMap_pa FaceMap) + * { + * REQUIRE(VALID_REF(FaceMap)); + * + * MyFaceMapClientData_s *MyClientData = + * (MyFaceMapClientData_s *)TecUtilDataFaceMapGetClientData(FaceMap); + * + * // open the data file + * FILE *MyDataFile = fopen(MyClientData->DataFileName, "rb"); + * Boolean_t IsOk = (MyDataFile != NULL); + * + * // seek to the place in the file where the face map data is located + * IsOk = IsOk && (fseek(MyDataFile, MyClientData->SeekOffset, SEEK_SET) == 0); + * if (IsOk) + * { + * // load the data into the zone's face map + * IsOk = ReadMyFaceMapDataIntoZone(MyDataFile, MyClientData, FaceMap); + * } + * + * // cleanup + * if (MyDataFile != NULL) + * fclose(MyDataFile); + * + * ENSURE(VALID_BOOLEAN(IsOk)); + * return IsOk; + * } + * @endcode + * + * @sa TecUtilDataFaceMapCustomLOD(), TecUtilDataFaceMapGetClientData() + */ +typedef Boolean_t (STDCALL *LoadOnDemandFaceMapLoad_pf)(FaceMap_pa FaceMap); + +/** + * Callback responsible for performing private actions associated with a + * face mapping being unloaded using the private client data retrieved from the + * face mapping handle. Whenever possible the callback should honor Tecplot's + * request to unload the face mapping by returning TRUE. + * + * Most add-ons should simply supply NULL for this callback thereby instructing + * Tecplot to handle the unloading (and subsequent reloading) of the face mapping + * without the intervention of the add-on. + * + * @par Note: + * This callback is called asynchronously. All calls back to Tecplot through + * the TecUtil layer should be limited to queries. + * + * @since + * 11.2-1-0 + * + * @param FaceMap + * Face mapping handle of the face mapping Tecplot wants to unload. + * + * @code + * Boolean_t STDCALL MyFaceMapUnload(FaceMap_pa FaceMap) + * { + * REQUIRE(VALID_REF(FaceMap)); + * + * // We don't have any private data to cleanup (i.e in addition to the + * // private client data which we don't cleanup here) so all we have to do + * // is return TRUE or FALSE letting Tecplot know that it can or can not + * // unload the variable. + * Boolean_t Result = TRUE; // ...tell Tecplot to go ahead and unload the face mapping + * + * ENSURE(VALID_BOOLEAN(Result)); + * return Result; + * } + * @endcode + * + * @result + * TRUE if the face mapping can be unloaded, FALSE otherwise. The add-on should + * if at all possible honor the request to unload the face mapping. Most add-ons + * should return TRUE. + * + * @sa TecUtilDataFaceMapCustomLOD(), TecUtilDataFaceMapGetClientData() + */ +typedef Boolean_t (STDCALL *LoadOnDemandFaceMapUnload_pf)(FaceMap_pa FaceMap); + +/** + * Callback responsible for performing private actions associated with a + * face mapping being cleaned up using the private client data retrieved from the + * face mapping handle. Most add-ons will need to register this callback in order + * to cleanup privately allocated client data. + * + * @par Note: + * This callback is called asynchronously. All calls back to Tecplot through + * the TecUtil layer should be limited to queries. + * + * @since + * 11.2-1-0 + * + * @param FaceMap + * Face Mapping data handle of the face mapping being cleaned up. + * + * @code + * typedef struct + * { + * char *DataFileName; + * long SeekOffset; + * ... other information needed to load face map data + * } MyFaceMapClientData_s; + * + * void STDCALL MyFaceMapCleanup(FaceMap_pa FaceMap) + * { + * REQUIRE(VALID_REF(FaceMap)); + * + * MyFaceMapClientData_s *MyClientData = (MyFaceMapClientData_s *)TecUtilDataFaceMapGetClientData(FaceMap); + * + * // cleanup privately allocated resources + * free(MyClientData->DataFileName); + * free(MyClientData); + * } + * @endcode + * + * @sa TecUtilDataFaceMapCustomLOD(), TecUtilDataFaceMapGetClientData() + */ +typedef void (STDCALL *LoadOnDemandFaceMapCleanup_pf)(FaceMap_pa FaceMap); + + +/** + * ExtractDestination functions are called upon successful completion of an + * extract polyline or extract discrete points operation. + * + * @param NumPts + * Number of points extracted. + * + * @param XValues + * Double precision array of X-Coordinates of the extracted polyline. + * + * @param YValues + * Double precision array of Y-Coordinates of the extracted polyline. + * + * <FortranSyntax> + * INTEGER*4 FUNCTION MyExtractDestinationCallback( + * & NumPts, + * & XValues, + * & YValues) + * INTEGER*4 NumPts + * REAL*8 XValues + * REAL*8 YValues + * </FortranSyntax> + */ +typedef void (STDCALL *ExtractDestination_pf)(LgIndex_t NumPts, + double* XValues, + double* YValues); + + + +/** + * SelectFileOptionsCallback Functions are called when the + * "Options" button is pressed in the modal file selection + * dialog. + * + * <FortranSyntax> + * SUBROUTINE MySelectFileOptionsCallback() + * </FortranSyntax> + */ +typedef void (STDCALL *SelectFileOptionsCallback_pf)(void); + + + + +/** + * Post data load instruction callback for "Converter-Plus" addons. + * + * @param PreviousInstructions + * The previous set of instructions used by the converter. + * + * @param PreviousRawData + * The previous raw data associated with the instructions. + * + * @param PreviousZones + * Set of zones loaded with the previous instructions. + * + * <FortranSyntax> + * SUBROUTINE MyConverterPostReadCallback( + * & PreviousInstructions, + * & PreviousRawData, + * & PreviousZones) + * CHARACTER*(*) CommandString + * CHARACTER*(*) ErrMsgString + * POINTER (PreviousZones,DummyPreviousZonesData) + * </FortranSyntax> + * + */ +typedef void (STDCALL *ConverterPostReadCallback_pf)(const char* PreviousInstructions, + const char* PreviousRawData, + const Set_pa PreviousZones); + + +/** + * Callback registered by your addon to convert a foreign datafile into a + * Tecplot Binary datafile format. + * + * @return + * Return TRUE if the conversion is successful. Otherwise return FALSE. + * If FALSE is returned then *MessageString is assumed to contain an error + * message. + * + * @param DataFName + * Name of the original foreign data file to be converted. + * + * @param TempBinFName + * Name of the temporary binary datafile that is created (by your converter). + * + * @param MessageString + * Reference to a string. If an error occurs during conversion allocate space + * for an error message and copy the message string into that allocated + * space otherwise be sure to assign *MessageString to NULL. If + * *MessageString is non NULL Tecplot will release the allocated memory when + * finished. + * + * <FortranSyntax> + * INTEGER*4 FUNCTION MyDataSetConverterCallback( + * & DataFName, + * & TempBinFName, + * & MessageString) + * CHARACTER*(*) DataFName + * CHARACTER*(*) TempBinFName + * CHARACTER*(*) MessageString + * </FortranSyntax> + * + */ +typedef Boolean_t (STDCALL *DataSetConverter_pf)(char* DataFName, + char* TempBinFName, + TP_GIVES char** MessageString); + + + + + + + +/** + * Callback registered by your addon to process foreign loader instructions. + * When called, it must parse the supplied instructions and load the data into Tecplot. + * + * @return + * Return TRUE if the data is loaded successfully. Otherwise, FALSE. + * + * @param Instructions + * This contains all of the instructions needed to load the data. + * + * + * <FortranSyntax> + * INTEGER*4 FUNCTION MyDataSetLoaderCallback( + * & Instructions) + * POINTER (Instructions,DummyInstructionsData) + * </FortranSyntax> + */ +typedef Boolean_t (STDCALL *DataSetLoader_pf)(StringList_pa Instructions); + + + + + +/** + * Callback used to provide the ability to override data loader instructions + * while processing a layout. + * + * @return + * Return TRUE if the instructions are successfully replaced or left alone. + * Return FALSE if the user cancels the operation. + * + * @param Instructions + * The original instructions needed to load the data. + * + * <FortranSyntax> + * INTEGER*4 FUNCTION MyDataSetLoaderInstOverCallback( + * & Instructions) + * POINTER (Instructions,DummyInstructionsData) + * </FortranSyntax> + * + */ +typedef Boolean_t (STDCALL *DataSetLoaderInstructionOverride_pf)(StringList_pa Instructions); + + + +/** + * Callback used to assign extended curve settings. + * This is called when the user presses the "Curve Settings" + * button in the mapping style dialog. + * + * @param LineMapSet + * Set of line maps currently selected. + * @param SelectedLineMapSettings + * A string list of the curve settings for the Line-maps that are selected in the + * Line mappings dialog. + * + * <FortranSyntax> + * SUBROUTINE MyGetCurveSettingsCallback( + * & LineMapSet, + * & SelectedLineMapSettings) + * POINTER (LineMapSet,DummyLineMapData) + * POINTER (SelectedLineMapSettings,DummyLineMapSettings) + * </FortranSyntax> + */ +typedef void (STDCALL *GetCurveSettingsCallback_pf)(Set_pa LineMapSet, + StringList_pa SelectedLineMapSettings); + + + + +/** + * Callback function that returns an abbreviated version of the curve settings + * for a particular Line Map for display in the Line Mappings dialog. + * + * @param LineMap + * The map number that is currently being operated on. + * @param CurveSettings + * The string that Tecplot maintains which contains the extended curve fit + * settings for the current Line-map. This argument may be NULL indicating + * that defaults should be used. + * @param AbbreviatedSettings + * The short form of the CurveSettings that is allocated and returned from + * your function and used by Tecplot. This must be allocated by the addon + * using TecUtilStringAlloc(). + * + * <FortranSyntax> + * SUBROUTINE MyGetAbrevSettingsStringCallback( + * & LineMap, + * & CurveSettings, + * & AbbreviatedSettings), + * INTEGER*4 LineMap + * CHARACTER*(*) CurveSettings + * CHARACTER*(*) AbbreviatedSettings + * </FortranSyntax> + */ +typedef void (STDCALL *GetAbbreviatedSettingsStringCallback_pf)(EntIndex_t LineMap, + char* CurveSettings, + TP_GIVES char** AbbreviatedSettings); + + + + +/** + * This function returns a string (CurveInfoString) for Tecplot to display + * information about a particular curve in the curve info dialog. + * + * @param RawIndV + * The handle to the raw field data of the independent variable. + * @param RawDepV + * The handle to the raw field data of the dependent variable. + * @param IndVCoordScale + * An enumerated variable whose values are Scale_linear when the independent variable + * axis has a linear scale and Scale_log when it has a log scale. + * @param DepVCoordScale + * An enumerated variable whose values are Scale_linear when the dependent variable axis + * has a linear scale and Scale_log when it has a log scale. + * @param NumRawPts + * number of raw field data values. + * @param LineMap + * The map number that is currently being operated on. + * @param CurveSettings + * The curve settings string for the current Line-map. This argument may be + * NULL indicating that defaults should be used. + * @param CurveInfoString + * The string that is allocated and returned by your function and be + * presented in the Data/XY-Plot Curve Info dialog. The CurveInfoString must + * be allocated by the addon using TecUtilStringAlloc(). + * + * @return + * Return TRUE if the curve info string can be generated, otherwise FALSE. + * + * <FortranSyntax> + * INTEGER*4 FUNCTION MyGetCurveInfoStringCallback( + * & RawIndV, + * & RawDepV, + * & IndVCoordScale, + * & DepVCoordScale, + * & NumRawPts, + * & LineMap, + * & CurveSettings, + * & CurveInfoString) + * POINTER (RawIndV,DummyRawIndVData) + * POINTER (RawDepV,DummyRawDepVData) + * INTEGER*4 IndVCoordScale + * INTEGER*4 DepVCoordScale + * INTEGER*4 NumRawPts + * INTEGER*4 LineMap + * CHARACTER*(*) CurveSettings + * CHARACTER*(*) CurveInfoString + * </FortranSyntax> + */ +typedef Boolean_t (STDCALL *GetCurveInfoStringCallback_pf)(FieldData_pa RawIndV, + FieldData_pa RawDepV, + CoordScale_e IndVCoordScale, + CoordScale_e DepVCoordScale, + LgIndex_t NumRawPts, + EntIndex_t LineMap, + char* CurveSettings, + TP_GIVES char** CurveInfoString); + +/** + * Callback function used to calculate data points for an extended curve fit. + * + * @return + * Return TRUE if the curve can be calculated, otherwise FALSE. + * + * @param RawIndV + * The handle to the raw field data of the independent variable. + * @param RawDepV + * The handle to the raw field data of the dependent variable. + * @param IndVCoordScale + * An enumerated variable whose values are Scale_linear when the independent variable + * axis has a linear scale and Scale_log when it has a log scale. + * @param DepVCoordScale + * An enumerated variable whose values are Scale_linear when the dependent variable axis + * has a linear scale and Scale_log when it has a log scale. + * @param NumRawPts + * number of raw field data values. + * @param NumCurvePts + * The number of points that will construct the curve fit. + * @param LineMap + * The line map to operated on. + * @param CurveSettings + * The curve settings string for the current Line-map. This argument may be + * NULL indicating that defaults should be used. + * @param IndCurveValues + * A pre-allocated array of size NumCurvePts which the addon will populate with + * the independent values for the curve fit + * @param DepCurveValues. + * A pre-allocated array of size NumCurvePts which the add-on will populate + * with the dependent values for the curve fit. + * + * <FortranSyntax> + * INTEGER*4 FUNCTION MyGetLinePlotDataPointsCallback( + * & RawIndV, + * & RawDepV, + * & IndVCoordScale, + * & DepVCoordScale, + * & NumRawPts, + * & NumCurvePts, + * & LineMap, + * & CurveSettings, + * & IndCurveValues, + * & DepCurveValues) + * POINTER (RawIndV,DummyRawIndVData) + * POINTER (RawDepV,DummyRawDepVData) + * INTEGER*4 IndVCoordScale + * INTEGER*4 DepVCoordScale + * INTEGER*4 NumRawPts + * INTEGER*4 NumCurvePts + * INTEGER*4 LineMap + * CHARACTER*(*) CurveSettings + * REAL*8 IndCurveValues() + * REAL*8 DepCurveValues() + * </FortranSyntax> + */ +typedef Boolean_t (STDCALL *GetLinePlotDataPointsCallback_pf)(FieldData_pa RawIndV, + FieldData_pa RawDepV, + CoordScale_e IndVCoordScale, + CoordScale_e DepVCoordScale, + LgIndex_t NumRawPts, + LgIndex_t NumCurvePts, + EntIndex_t LineMap, + char* CurveSettings, + TP_OUT double* IndCurveValues, + TP_OUT double* DepCurveValues); +#if defined EXPORT_DEPRECATED_INTERFACES_TO_ADK_ONLY +/** + * @deprecated + * Please use \ref GetLinePlotDataPointsCallback_pf instead. + */ +typedef GetLinePlotDataPointsCallback_pf GetXYDataPointsCallback_pf; +#endif + + + + +/** + * A Callback function used to obtain an interpolated dependent value for an + * extended curve fit given an independent value. + * + * @return + * Return TRUE if it is possible to obtain the interpolated value, otherwise FALSE. + * + * @param RawIndV + * handle to the raw field data of the independent variable. + * @param RawDepV + * The handle to the raw field data of the dependent variable. + * @param IndVCoordScale + * An enumerated variable whose values are Scale_linear when the independent variable + * axis has a linear scale and Scale_log when it has a log scale. + * @param DepVCoordScale + * An enumerated variable whose values are Scale_linear when the dependent variable axis + * has a linear scale and Scale_log when it has a log scale. + * @param NumRawPts + * The number of field data values. + * @param NumCurvePts + * The number of points used to construct the curve fit. + * @param LineMapNum + * The line map number currently being operated on. + * @param CurveSettings + * The curve settings string for the current Line-map. This argument may be + * NULL indicating that defaults should be used. + * @param ProbeIndValue + * The independent value location of the probe (supplied). + * @param ProbeDepValue + * Reference to the calculated dependent value location of the probe. + * + * <FortranSyntax> + * INTEGER*4 FUNCTION MyGetProbeValueCallback( + * & RawIndV, + * & RawDepV, + * & IndVCoordScale, + * & DepVCoordScale, + * & NumRawPts, + * & NumCurvePts, + * & LineMapNum, + * & CurveSettings, + * & CurveInfoString, + * & ProbeIndValue, + * & ProbeDepValue) + * POINTER (RawIndV,DummyRawIndVData) + * POINTER (RawDepV,DummyRawDepVData) + * INTEGER*4 IndVCoordScale + * INTEGER*4 DepVCoordScale + * INTEGER*4 NumRawPts + * INTEGER*4 NumCurvePts + * INTEGER*4 LineMapNum + * CHARACTER*(*) CurveSettings + * REAL*8 ProbeIndValue + * REAL*8 ProbeDepValue + * </FortranSyntax> + * + */ +typedef Boolean_t (STDCALL *GetProbeValueCallback_pf)(FieldData_pa RawIndV, + FieldData_pa RawDepV, + CoordScale_e IndVCoordScale, + CoordScale_e DepVCoordScale, + LgIndex_t NumRawPts, + LgIndex_t NumCurvePts, + EntIndex_t LineMapNum, + char* CurveSettings, + double ProbeIndValue, + TP_OUT double* ProbeDepValue); + + + +#if defined MSWIN +typedef Boolean_t (STDCALL *PreTranslateMessage_pf)(MSG *pMsg); +#endif + + +/** + * Callback function pointer for providing a Dynamic Axis labels. + * @since + * 10.0-6-015 + * @param Value + * Value that corresponds to a tick label that will be drwan. + * + * @param ClientData + * Convenience storage of user client data. + * + * @param LabelString + * Output label for the tick mark. + * This must be allocated by the addon using TecUtilStringAlloc(). + * + * @return + * Returns TRUE if the LabelString has been successfully allocated. + * Otherwise, FALSE is returned. + */ +typedef Boolean_t (STDCALL *DynamicLabelCallback_pf)(double Value, + ArbParam_t ClientData, + TP_GIVES char** LabelString); + +/** + * This is called when Tecplot is idle. + * + * @par Note: + * Tecplot is never idle when running in batch mode (with the -b flag). + * + * @param ClientData + * Arbitrary client data. + * + * <FortranSyntax> + * INTEGER*4 FUNCTION MyOnIdleCallback( + * & ClientDataPtr) + * POINTER (ClientDataPtr,DummyClientData) + * </FortranSyntax> + * + */ +typedef void (STDCALL *OnIdleCallback_pf)(ArbParam_t ClientData); + +/** + * Callback responsible for executing the specified script file. + * + * @since + * 11.0-2-005 + * + * @param ScriptFileName + * Relative or absolute file name of the script to execute. If the path + * is relative it is relative to the current working directory. + * @param ClientData + * Client data registered with the callback. + * + * @return + * TRUE if the script executed successfully, FALSE otherwise. + * + * @sa TecUtilScriptExecRegisterCallback + */ +typedef Boolean_t (STDCALL *ScriptExecCallback_pf)(const char *ScriptFileName, + ArbParam_t ClientData); + +/* BEGINREMOVEFROMADDON */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if 0 /* NOTUSED */ +#endif +#if !defined NO_ASSERTS +#endif +#if defined MSWIN +#endif /* MSWIN */ +#if !defined (MSWIN) +#endif +#if defined Q_MAINMODULE +#else +#endif +#if 0 /* NOTUSED */ +#endif +#endif /* TECPLOTKERNEL */ + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + + +/* ENDREMOVEFROMADDON */ +struct _ViewState_a; +typedef struct _ViewState_a *SavedView_pa, *ViewState_pa; + + +#endif /* _GLOBAL_H */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/INPUT.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/INPUT.h new file mode 100644 index 0000000000000000000000000000000000000000..d778ee598460e9f56cc51b2fbcc81fbcc91db49b --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/INPUT.h @@ -0,0 +1,196 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +***************************************************************** +***************************************************************** +******* ******** +****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +***************************************************************** +***************************************************************** +*/ +#if defined EXTERN +#undef EXTERN +#endif +#if defined INITMODULE +#define EXTERN +#else +#define EXTERN extern +#endif + +/* Input Specification limits */ + +/* General */ +EXTERN InputSpec_s /*X*/ GridCoordInputSpec; +EXTERN InputSpec_s /*X*/ GridCoordFloatInputSpec; +EXTERN InputSpec_s /*X*/ XFrameCoordInputSpec; +EXTERN InputSpec_s /*X*/ YFrameCoordInputSpec; +EXTERN InputSpec_s /*X*/ XFrameCoordFloatInputSpec; +EXTERN InputSpec_s /*X*/ YFrameCoordFloatInputSpec; +EXTERN InputSpec_s /*X*/ XFrameCoordDeltaInputSpec; +EXTERN InputSpec_s /*X*/ YFrameCoordDeltaInputSpec; +EXTERN InputSpec_s /*X*/ XFrameCoordFloatDeltaInputSpec; +EXTERN InputSpec_s /*X*/ YFrameCoordFloatDeltaInputSpec; +EXTERN InputSpec_s /*X*/ FrameOffsetCoordInputSpec; +EXTERN InputSpec_s /*X*/ XPaperCoordInputSpec; +EXTERN InputSpec_s /*X*/ YPaperCoordInputSpec; +EXTERN InputSpec_s /*X*/ AxisPercentageInputSpec; +EXTERN InputSpec_s /*X*/ AngleInputSpec; +EXTERN InputSpec_s /*X*/ AngleToApproxInputSpec; +EXTERN InputSpec_s /*X*/ FieldOfViewInputSpec; +EXTERN InputSpec_s /*X*/ ZeroAndAboveLgIndexInputSpec; +EXTERN InputSpec_s /*X*/ ZeroAndAboveSmIntegerInputSpec; +EXTERN InputSpec_s /*X*/ ZeroAndAboveDoubleInputSpec; +EXTERN InputSpec_s /*X*/ AboveZeroLgIndexInputSpec; +EXTERN InputSpec_s /*X*/ AboveZeroDoubleInputSpec; +EXTERN InputSpec_s /*X*/ DoubleInputSpec; +EXTERN InputSpec_s /*X*/ EntIndexInputSpec; +EXTERN InputSpec_s /*X*/ EntRangeInputSpec; +EXTERN InputSpec_s /*X*/ IndexRangeInputSpec; +EXTERN InputSpec_s /*X*/ AboveZeroIndexRangeInputSpec; +EXTERN InputSpec_s /*X*/ ZeroToOneInputSpec; +EXTERN InputSpec_s /*X*/ PercentageInputSpec; +EXTERN InputSpec_s /*X*/ AboveZeroPercentageInputSpec; +EXTERN InputSpec_s /*X*/ SignedPercentageInputSpec; +EXTERN InputSpec_s /*X*/ RadiansInputSpec; +EXTERN InputSpec_s /*X*/ AboveZeroRadiansInputSpec; +EXTERN InputSpec_s /*X*/ TimeDateDoubleInputSpec; +EXTERN InputSpec_s /*X*/ AboveZeroTimeDateDoubleInputSpec; +EXTERN InputSpec_s /*X*/ AboveZeroElapsedTimeInputSpec; + + +/* Specific */ +#define MIN_VIEWPORT_SIZE 0.05 +EXTERN InputSpec_s /*X*/ SurfaceTranslucencyInputSpec; +EXTERN InputSpec_s /*X*/ MaxDepthBufferSizeInputSpec; +EXTERN InputSpec_s /*X*/ MaxMultiSamplesInputSpec; +EXTERN InputSpec_s /*X*/ MinBitsPerRGBPlaneInputSpec; +EXTERN InputSpec_s /*X*/ AnimationSpeedInputSpec; +EXTERN InputSpec_s /*X*/ AnimationNumStepsInputSpec; +EXTERN InputSpec_s /*X*/ MaxCustomColorsInInterfaceInputSpec; +EXTERN InputSpec_s /*X*/ MaxReducedPointsInputSpec; +EXTERN InputSpec_s /*X*/ MaxStripLengthInputSpec; +EXTERN InputSpec_s /*X*/ MaxPrimativesPerBlockInputSpec; +EXTERN InputSpec_s /*X*/ MaxTextureSizeInputSpec; +EXTERN InputSpec_s /*X*/ SuperSampleFactorInputSpec; +EXTERN InputSpec_s /*X*/ TickLengthInputSpec; +EXTERN InputSpec_s /*X*/ BorrowLicenseInputSpec; + + + + +/* I/O Related */ +EXTERN InputSpec_s /*X*/ HardcopyPaperSizeInputSpec; +EXTERN InputSpec_s /*X*/ HardcopyNumCopiesInputSpec; +EXTERN InputSpec_s /*X*/ HardcopyPrecisionInputSpec; +EXTERN InputSpec_s /*X*/ HardcopyPenSpeedInputSpec; +EXTERN InputSpec_s /*X*/ PenPlotterPenNumberInputSpec; +EXTERN InputSpec_s /*X*/ BitDumpDepthInputSpec; + + +/* Widths, physical lengths, etc. */ +EXTERN InputSpec_s /*X*/ XFrameDimensionInputSpec; +EXTERN InputSpec_s /*X*/ YFrameDimensionInputSpec; +EXTERN InputSpec_s /*X*/ LineThicknessInputSpec; +EXTERN InputSpec_s /*X*/ PatternLengthInputSpec; +EXTERN InputSpec_s /*X*/ AxisPercentageTextSizeInputSpec; +EXTERN InputSpec_s /*X*/ FrameTextSizeInputSpec; +EXTERN InputSpec_s /*X*/ GridTextSizeInputSpec; +EXTERN InputSpec_s /*X*/ PointTextSizeInputSpec; +EXTERN InputSpec_s /*X*/ TextBoxMarginInputSpec; +EXTERN InputSpec_s /*X*/ TextLineSpacingInputSpec; +EXTERN InputSpec_s /*X*/ ArrowheadSizeInputSpec; +EXTERN InputSpec_s /*X*/ AxisLabelOffsetInputSpec; +EXTERN InputSpec_s /*X*/ LegendLineSpacingInputSpec; +EXTERN InputSpec_s /*X*/ StreamStepSizeInputSpec; +EXTERN InputSpec_s /*X*/ StreamMaxStepsInputSpec; +EXTERN InputSpec_s /*X*/ ArrowheadSpacingInputSpec; +EXTERN InputSpec_s /*X*/ RulerPaddingInputSpec; +EXTERN InputSpec_s /*X*/ RulerThicknessInputSpec; +EXTERN InputSpec_s /*X*/ PickHandleWidthInputSpec; +EXTERN InputSpec_s /*X*/ ImageDimensionInputSpec; +EXTERN InputSpec_s /*X*/ ZoomScalePerFrameUnitInputSpec; +EXTERN InputSpec_s /*X*/ RGBLegendHeightInputSpec; + + + +/* Limit the number of objects or limit which object can be selected*/ +EXTERN InputSpec_s /*X*/ ColorMapGroupInputSpec; +EXTERN InputSpec_s /*X*/ SliceGroupInputSpec; +EXTERN InputSpec_s /*X*/ IsoSurfaceGroupInputSpec; +EXTERN InputSpec_s /*X*/ ContourGroupInputSpec; +EXTERN InputSpec_s /*X*/ ColorIndexInputSpec; +EXTERN InputSpec_s /*X*/ NumLightSourceShadesInputSpec; +EXTERN InputSpec_s /*X*/ NumberOfControlPointsInputSpec; +EXTERN InputSpec_s /*X*/ CustomLabelNumberInputSpec; +EXTERN InputSpec_s /*X*/ NumMinorTicksInputSpec; +EXTERN InputSpec_s /*X*/ AxisEdgeNumberInputSpec; +EXTERN InputSpec_s /*X*/ LineMapWhichXAxisInputSpec; +EXTERN InputSpec_s /*X*/ LineMapWhichYAxisInputSpec; +EXTERN InputSpec_s /*X*/ NumberOfCurvePointsInputSpec; +EXTERN InputSpec_s /*X*/ NumberOfContourLevelsInputSpec; +EXTERN InputSpec_s /*X*/ ColorMapOverrideLevelInputSpec; +EXTERN InputSpec_s /*X*/ ColorMapOverrideNumberInputSpec; +EXTERN InputSpec_s /*X*/ NumberOfColorMapCyclesInputSpec; +EXTERN InputSpec_s /*X*/ NumberOfRodPointsInputSpec; +EXTERN InputSpec_s /*X*/ NumberOfStreamtracesInputSpec; +EXTERN InputSpec_s /*X*/ NumberOfEllipsePointsInputSpec; +EXTERN InputSpec_s /*X*/ MaxPtsInALineInputSpec; +EXTERN InputSpec_s /*X*/ MaxChrsTextLabelsInputSpec; +EXTERN InputSpec_s /*X*/ MaxContourLevelsInputSpec; +EXTERN InputSpec_s /*X*/ MaxLinkGroupsInputSpec; + + +/* Ratios */ +EXTERN InputSpec_s /*X*/ DataAspectRatioLimitInputSpec; +EXTERN InputSpec_s /*X*/ DataAspectRatioResetInputSpec; +EXTERN InputSpec_s /*X*/ AxisBoxAspectRatioLimitInputSpec; +EXTERN InputSpec_s /*X*/ AxisBoxAspectRatioResetInputSpec; +EXTERN InputSpec_s /*X*/ AxisRatioInputSpec; +EXTERN InputSpec_s /*X*/ AxisBoxPaddingInputSpec; +EXTERN InputSpec_s /*X*/ ScreenDistanceRatioInputSpec; +EXTERN InputSpec_s /*X*/ LiftFractionInputSpec; +EXTERN InputSpec_s /*X*/ ZClipInputSpec; +EXTERN InputSpec_s /*X*/ VectorHeadSizeFractionInputSpec; + + +/* Misc */ +EXTERN InputSpec_s /*X*/ ValuePrecisionInputSpec; +EXTERN InputSpec_s /*X*/ PolynomialOrderInputSpec; +EXTERN InputSpec_s /*X*/ SplineSlopeInputSpec; +EXTERN InputSpec_s /*X*/ RotationStepSizeInputSpec; +EXTERN InputSpec_s /*X*/ SmoothRotationDegPerFrameUnitInputSpec; +EXTERN InputSpec_s /*X*/ TranslationStepSizeInputSpec; +EXTERN InputSpec_s /*X*/ ScaleStepSizeInputSpec; +EXTERN InputSpec_s /*X*/ SortLevelInputSpec; +EXTERN InputSpec_s /*X*/ AxisLabelSkipInputSpec; +EXTERN InputSpec_s /*X*/ TextAngleInputSpec; +EXTERN InputSpec_s /*X*/ ArrowheadAngleInputSpec; +EXTERN InputSpec_s /*X*/ MinCreaseAngleInputSpec; +EXTERN InputSpec_s /*X*/ ExponentInputSpec; +EXTERN InputSpec_s /*X*/ SmoothWeightInputSpec; +EXTERN InputSpec_s /*X*/ TriangleKeepFactorInputSpec; +EXTERN InputSpec_s /*X*/ PlotAttrColumnWidthInputSpec; +EXTERN InputSpec_s /*X*/ ImageQualityInputSpec; + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/MASTER.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/MASTER.h new file mode 100644 index 0000000000000000000000000000000000000000..38c495dcf8cd913fd00f81a73a488ea01b521a2a --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/MASTER.h @@ -0,0 +1,684 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/***************************************************************** + ***************************************************************** + ******* ******** + ****** Copyright (C) 1988-2008 Tecplot, Inc. ******* + ******* ******** + ***************************************************************** + *****************************************************************/ +/* BEGINREMOVEFROMADDON */ +/* NOTE: All code contained between comments that look like + * BEGINREMOVEFROMADDON + * ENDREMOVEFROMADDON + * are pulled out to create the MASTER.h file used in addons. + */ +/* ENDREMOVEFROMADDON */ + +#ifndef _MASTER_H_ +#define _MASTER_H_ + +/* + * Annotations that specify the life cycle of objects returned from functions + * and input and output parameters sent as function parameters. The following + * table specifies the meaning in their context. The annotations provide code + * generation tools with information for building language bindings to various + * Tecplot 360 and Tecplot SDK related libraries. + * + * For purposes of this table the client is one making the call and the service + * is the recipient. + * + * +==================+=========================+=================================================================+ + * | Function Context | Annotation | Meaning | + * | Result or | | | + * | Parameter | | | + * |==================+=========================+=================================================================| + * | Result | TP_OUT | Default for a function return value that does not transfer | + * | | | ownership. Because this is the most common scenario this | + * | | | annotation is implied and never explicitly used in this | + * | | | context. | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Scalar Result | TP_GIVES | Annotates a function scalar return value as one who's ownership | + * | | | is transfered to the client. The client is responsible for | + * | | | properly disposing the value. | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Array Result | TP_ARRAY_GIVES | Annotates a function array return value as one who's ownership | + * | | | is transfered to the client. The client is responsible for | + * | | | properly disposing the value. | + * |==================+=========================+=================================================================| + * | Parameter | TP_IN | Default for a function input parameter value sent to the | + * | | | service. Because this is the most common scenario this | + * | | | annotation is implied and never explicitly used. | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Parameter | TP_ACQUIRES | Annotates a function parameter as one that sends a value to | + * | | | the service through the parameter and acquires shared | + * | | | ownership of the input value with the client. The service is | + * | | | not responsible for disposing the value however it is | + * | | | expected that a symmetric API exists that "releases" the | + * | | | library of this shared ownership. For example: | + * | | | void addListener(TP_ACQUIRES Listener& listener); | + * | | | void removeListener(TP_RELEASES Listener& listener); | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Parameter | TP_RELEASES | Annotates a function parameter as one that sends a value to | + * | | | the service through the parameter and releases previously | + * | | | shared ownership of the | + * | | | input value with the client. The service is not responsible | + * | | | for disposing the value however it is expected that a | + * | | | symmetric API exists that "releases" the library of this | + * | | | shared ownership. For example: | + * | | | void addListener(TP_ACQUIRES Listener& listener); | + * | | | void removeListener(TP_RELEASES Listener& listener); | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Scalar Parameter | TP_OUT | Annotates a function scalar parameter as one that returns a | + * | | | value to the client through the parameter but does not | + * | | | transfer ownership of the output value to the client. | + * | | | The client is not responsible for disposing the value. | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Scalar Parameter | TP_IN_OUT | Annotates a function scalar parameter as one that both sends | + * | | | a value to the service and returns a value to the client | + * | | | through the parameter. Ownership of the input value is not | + * | | | transfered to the service nor is ownership of the output value | + * | | | transfered to the client. The service is not responsible for | + * | | | disposing the input value and the client is not responsible | + * | | | for disposing the output value. | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Array Parameter | TP_ARRAY_OUT | Annotates a function array parameter as one that returns a | + * | | | value to the client through the parameter but does not | + * | | | transfer ownership of the output value to the client. | + * | | | The client is not responsible for disposing the value. | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Array Parameter | TP_ARRAY_IN_OUT | Annotates a function array parameter as one that both sends | + * | | | a value to the service and returns a value to the client | + * | | | through the parameter. Ownership of the input value is not | + * | | | transfered to the service nor is ownership of the output value | + * | | | transfered to the client. The service is not responsible for | + * | | | disposing the input value and the client is not responsible | + * | | | for disposing the output value. | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Scalar Parameter | TP_GIVES | Annotates a function scalar parameter as one that returns a | + * | | | value to the client through the parameter and transfers | + * | | | ownership of the output value to the client. The client is | + * | | | responsible for properly disposing the value. | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Scalar Parameter | TP_RECEIVES | Annotates a function scalar parameter as one that sends a value | + * | | | to the service through the parameter and transfers ownership | + * | | | of the input value to the service. The service is responsible | + * | | | for properly disposing the value. | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Scalar Parameter | TP_RECEIVES_GIVES | Annotates a function scalar parameter as one that both sends | + * | | | a value to the service and returns a value to the client | + * | | | through the parameter. Ownership of the input value is | + * | | | transfered to the service and ownership of the output value is | + * | | | transfered to the client. The service is responsible for | + * | | | properly disposing the input value and the client is | + * | | | responsible for properly disposing the output value. | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Array Parameter | TP_ARRAY_GIVES | Annotates a function array parameter as one that returns a | + * | | | value to the client through the parameter and transfers | + * | | | ownership of the output value to the client. The client is | + * | | | responsible for properly disposing the value. | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Array Parameter | TP_ARRAY_RECEIVES | Annotates a function array parameter as one that sends a value | + * | | | to the service through the parameter and transfers ownership | + * | | | of the input value to the service. The service is responsible | + * | | | for properly disposing the value. | + * |------------------+-------------------------+-----------------------------------------------------------------| + * | Array Parameter | TP_ARRAY_RECEIVES_GIVES | Annotates a function array parameter as one that both sends | + * | | | a value to the service and returns a value to the client | + * | | | through the parameter. Ownership of the input value is | + * | | | transfered to the service and ownership of the output value is | + * | | | transfered to the client. The service is responsible for | + * | | | properly disposing the input value and the client is | + * | | | responsible for properly disposing the output value. | + * |==================+===================+=======================================================================| + */ + +/* + * First check to make sure that our life-cycle keywords are not in conflict with any system defines. + */ +#if defined TP_ACQUIRES || \ + defined TP_RELEASES || \ + defined TP_OUT || \ + defined TP_IN_OUT || \ + defined TP_ARRAY_OUT || \ + defined TP_ARRAY_IN_OUT || \ + defined TP_GIVES || \ + defined TP_RECEIVES || \ + defined TP_RECEIVES_GIVES || \ + defined TP_ARRAY_GIVES || \ + defined TP_ARRAY_RECEIVES || \ + defined TP_ARRAY_RECEIVES_GIVES + #error "Tecplot's parameter life-cycle keywords are in direct conflict with other meanings." +#endif + +#if defined INCLUDE_OBJECT_LIFECYCLE_ANNOTATIONS + #define TP_ACQUIRES __attribute((gccxml("acquires","in"))) + #define TP_RELEASES __attribute((gccxml("releases","in"))) + #define TP_OUT __attribute((gccxml("out"))) + #define TP_IN_OUT __attribute((gccxml("in","out"))) + #define TP_ARRAY_OUT __attribute((gccxml("array","out"))) + #define TP_ARRAY_IN_OUT __attribute((gccxml("array","in","out"))) + #define TP_GIVES __attribute((gccxml("gives","out"))) + #define TP_RECEIVES __attribute((gccxml("receives","in"))) + #define TP_RECEIVES_GIVES __attribute((gccxml("receives","in","gives","out"))) + #define TP_ARRAY_GIVES __attribute((gccxml("array","gives","out"))) + #define TP_ARRAY_RECEIVES __attribute((gccxml("array","receives","in"))) + #define TP_ARRAY_RECEIVES_GIVES __attribute((gccxml("array","receives","in","gives","out"))) +#else + #define TP_ACQUIRES + #define TP_RELEASES + #define TP_OUT + #define TP_IN_OUT + #define TP_ARRAY_OUT + #define TP_ARRAY_IN_OUT + #define TP_GIVES + #define TP_RECEIVES + #define TP_RECEIVES_GIVES + #define TP_ARRAY_GIVES + #define TP_ARRAY_RECEIVES + #define TP_ARRAY_RECEIVES_GIVES +#endif + +/* BEGINREMOVEFROMADDON */ +#ifdef NO_ASSERTS /* obfuscate names */ +#define ShutDownLicensing FreeAllExtraMapData +#define ProcessYMapInXDirection +#endif /* NO_ASSERTS */ + + +/************************************** + * LICENSING + **************************************/ +#if defined TECPLOTKERNEL && !defined ENGINE +/* CORE SOURCE CODE REMOVED */ +#if defined FLEXLM && defined RLM +#endif +#if !defined FLEXLM && !defined RLM +#endif +#endif + +#include "stdafx.h" + +#if defined MSWIN +#include "W__BASE.h" +#endif + +#include <string> +#include <map> +#include <vector> +#include <queue> + +#include "TranslatedString.h" + +/* + * The following is a temporary fix for figuring out which product is + * running. In the future when Focus and 360 use the same code base, + * we will have to do this dynamically (either with flags on the compiler + * or variables within Tecplot). + */ +/* ENDREMOVEFROMADDON */ + +#if defined _WIN32 + +#if !defined TECPLOTKERNEL + +#if !defined MSWIN +#define MSWIN +#endif /* !MSWIN */ + +/* For the sake of some older add-ons, + defined _WINDOWS, WINDOWS, and WIN32 + New code should always use MSWIN */ + +#if !defined WINDOWS +#define WINDOWS +#endif /* WINDOWS */ + +#if !defined _WINDOWS +#define _WINDOWS +#endif /* !_WINDOWS */ + +#if !defined WIN32 +#define WIN32 +#endif /* !WIN32 */ + +#if defined _DEBUG +#if !defined DEBUG +#define DEBUG +#endif +#elif defined CHECKED_BUILD +#if defined NO_ASSERTS +#undef NO_ASSERTS +#endif +#if defined NDEBUG +#undef NDEBUG +#endif +#else /* RELEASE */ +#if !defined NDEBUG +#define NDEBUG +#endif +#if !defined NO_ASSERTS +#define NO_ASSERTS +#endif +#endif /* _DEBUG */ +#endif /* TECPLOTKERNEL */ + +#if _MSC_VER >= 1400 +#define VS_2005 /* Using VS2005 Compiler */ +#endif + +#if !defined TECPLOTKERNEL && defined VS_2005 +/* Suppress the warnings about the + deprecated c runtime functions. */ + +#if !defined _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE +#endif +#endif /* !TECPLOTKERNEL && VS_2005 */ + +#endif /* MSWIN */ + +#ifdef NDEBUG +# ifdef _DEBUG +# error "Both NDEBUG and _DEBUG defined" +# endif +#elif defined TECPLOTKERNEL +# ifndef _DEBUG +# define _DEBUG +# endif +#endif + +/* Now a requirement */ +#define USE_3D_HARDWARE + +#ifndef THREED +# define THREED +#endif + +#include <stdio.h> +#include <ctype.h> +#include <math.h> + +#if defined QUICKDEMO +#define DEMO +#endif + +#if defined MicrosoftC +#define DOS +#endif + +#if defined CRAYX +#define CRAY +#endif + +#if defined IRISX +#define IRIS +#endif + +#if defined HPX +#define HPUX +#define HP +#endif + +#if defined IBMRS6000X +#define IBMRS6000 +#endif + +#if defined COMPAQALPHAX +#define COMPAQALPHA +#define COMPAQX +#define COMPAQ +#endif + +#if defined DECALPHAX +#define DECALPHA +#define DECX +#endif + +#if defined DECX +#define DEC +#endif + +#if defined SUNSOLARISX || defined SUNSOLARIS86X +#define SUNX +#endif + +#if defined SUNX +#define SUN +#endif + +#if defined IRISX || defined CRAYX || defined HPX || defined SUNX || defined CONVEXX +#define UNIXX +#define SYSV +#endif + +#if defined DECX || defined LINUX || defined IBMRS6000X || defined COMPAQX || defined DARWIN +#define UNIXX +#endif + +/* BEGINREMOVEFROMADDON */ +#include <stdarg.h> + + +/* A bit of OEM stuff */ +#define OEM_INVALID_CHECKSUM (LgIndex_t) -1 + +/* Hide the name of the checksum function */ +#if defined NDEBUG +# define DECRYPTTIMEDCODE FixupPlot +# define CHECKHASHEDCODE ExpandPlot +# define UPDATECLASSICOEMEHCKSUM ToggleQuadrants +# define UPDATEOEMCHECKSUM ComputeAngleFromQuatrant +# define InitOemSettings InitAngleQuatrantSettings +#endif + +#if defined MSWIN +#define USE_TRUETYPEFONTS +#endif +/* ENDREMOVEFROMADDON */ + +/* BEGINREMOVEFROMADDON */ + +#ifdef __cplusplus // STL + +#ifdef MSWIN + +#pragma warning(push, 1) /* warning disabling bellow doesn't actually have any effect on compiler warning. +* It appears that Microsft STL enables all the warning right back on. +* Therefore, the only way to hide them is to push existing warning level, +* lower the level for the time while STL headers are included and then restore + * previous warning level with a "pragma warning(pop)" + */ + +#pragma warning(disable: 4018) // signed/unsigned mismatch +#pragma warning(disable: 4100) // unreferenced formal parameter +#pragma warning(disable: 4146) // unary minus operator applied to unsigned type, + // result still unsigned +#pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', + // possible loss of data +#pragma warning(disable: 4245) // conversion from 'type1' to 'type2', signed/unsigned + // mismatch +#pragma warning(disable: 4511) // 'class' : copy constructor could not be generated +#pragma warning(disable: 4512) // 'class' : assignment operator could not be generated +#pragma warning(disable: 4663) // C++ language change: to explicitly specialize class + // template 'vector' +#pragma warning(disable: 4710) // 'function' : function not inlined +#pragma warning(disable: 4786) // identifier was truncated to 'number' characters + // in the debug information +#endif + +#ifdef MSWIN +#pragma warning(pop) //Restore old warning state. +#endif //MSWIN + +#endif //__cplusplus + + /* ENDREMOVEFROMADDON */ + +#ifdef MSWIN + /* BEGINREMOVEFROMADDON */ +#ifdef TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#ifdef _DEBUG +#endif +#endif /* TECPLOTKERNEL */ + /* ENDREMOVEFROMADDON */ + +#ifndef TECPLOTKERNEL +#if defined VS_2005 +#define Widget LONG_PTR /* correct for 32 & 64 bit builds */ +#else +#define Widget long +#endif +#endif + + + +#endif /* MSWIN */ + + +#if defined UNIXX && defined ENGINE + typedef void *Widget; +#endif + + +#include <string.h> + +#if !defined SYSV && !defined MSWIN +#include <strings.h> +#endif + +#if defined (MicrosoftC) +#include <stdlib.h> +#define EXECOS +#ifndef FAR +#define FAR +#endif +#define VOID void +#endif + +#include <sys/types.h> +#include <stdlib.h> + +#if defined UNIXX +#if !defined ENGINE +#define X11 +#define MOTIF +#endif +#define FAR +#define NEAR +#include <unistd.h> +#endif + +/* BEGINREMOVEFROMADDON */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined THREADS_BY_PTHREADS && !defined THREADS_BY_WINAPI +#endif +#if defined THREADS_BY_PTHREADS +#endif +#endif +/* ENDREMOVEFROMADDON */ + +/* BEGINREMOVEFROMADDON */ +/* OPENGL currently a must have */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# if !defined ENGINE +# if defined UNIXX +# endif +# endif +#endif +/* ENDREMOVEFROMADDON */ +/* + * If not building the tecplot kernel then at least + * include the X Instrinsics. This will make most + * development for addons etc work. + */ + +/* NOTE: MOTIF not defined if ENGINE is defined */ +#if defined MOTIF +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# if XmVERSION == 1 && XmREVISION == 0 +# endif +# else +# include <X11/Intrinsic.h> +# endif +#endif + +#if defined MOTIF +#define CREATE_DIALOG_PARAMS Widget W +typedef Widget ComboBoxWidget_t; +typedef Widget DropDownListWidget_t; +typedef Widget FileDialogWidget_t; +typedef Widget LabelWidget_t; +typedef Widget ListWidget_t; +typedef Widget OptionMenuWidget_t; +typedef Widget PullDownMenuWidget_t; +typedef Widget ScaleWidget_t; +typedef Widget TextFieldWidget_t; +typedef Widget ToggleWidget_t; +typedef Widget ButtonWidget_t; +typedef Widget GridWidget_t; +#endif +#if defined MSWIN +#include <windows.h> +#define CREATE_DIALOG_PARAMS CWnd *, LaunchDialogMode_e +typedef Widget ComboBoxWidget_t; +typedef Widget DropDownListWidget_t; +typedef Widget FileDialogWidget_t; +typedef Widget LabelWidget_t; +typedef Widget ListWidget_t; +typedef Widget OptionMenuWidget_t; +typedef Widget PullDownMenuWidget_t; +typedef Widget ScaleWidget_t; +typedef Widget TextFieldWidget_t; +typedef Widget ToggleWidget_t; +typedef Widget ButtonWidget_t; +typedef Widget GridWidget_t; +#endif + +/* BEGINREMOVEFROMADDON */ +#if defined MSWIN && defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined TRACE +#endif +#if defined TRACE0 +#endif +#if defined TRACE1 +#endif +#if defined TRACE2 +#endif +#if defined TRACE3 +#endif +#if defined NDEBUG +#else +#endif +#endif /* MSWIN */ + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ +/* ENDREMOVEFROMADDON */ + +/* Assume that if TRACE is not defined, then none of the TRACE macros are */ +#if !defined (TRACE) +/* TRACE is not used by non-debug builds */ +#if defined NDEBUG +#if defined MSWIN +#define TRACE __noop +#define TRACE0(s) __noop +#define TRACE1(S,a1) __noop +#define TRACE2(s,a1,a2) __noop +#define TRACE3(s,a1,a2,a3) __noop +#else +#define TRACE(str) ((void)0) +#define TRACE0(str) ((void)0) +#define TRACE1(str,a1) ((void)0) +#define TRACE2(str,a1,a2) ((void)0) +#define TRACE3(str,a1,a2,a3) ((void)0) +#endif /* MSWIN */ +#else /* DEBUG */ +#if defined MSWIN +/* If the add-on is running in debug mode but does not + * use MFC, then no TRACE macro is available. Thus, to make tracing available, + * map TRACE to the win32 OutpuDebugString() function. + */ +# define TRACE(str) do { OutputDebugStringA(str); } while (0) +# define TRACE1(str,a1) do { char s[5000]; sprintf(s,str,a1); OutputDebugStringA(s); } while (0) +# define TRACE2(str,a1,a2) do { char s[5000]; sprintf(s,str,a1,a2); OutputDebugStringA(s); } while (0) +# define TRACE3(str,a1,a2,a3) do { char s[5000]; sprintf(s,str,a1,a2,a3); OutputDebugStringA(s); } while (0) +# define TRACE0(str) TRACE(str) +#else +#define TRACE printf +#define TRACE0 printf +#define TRACE1 printf +#define TRACE2 printf +#define TRACE3 printf +#endif /* MSWIN */ +#endif /* NDEBUG */ +#endif /* !defined (TRACE) */ + + +/* + Platform independent way for add-ons to know how much space + to allocate for a filename. +*/ +#if !defined MAX_SIZEOFUTF8CHAR +#define MAX_SIZEOFUTF8CHAR 1 +#endif + +#if !defined (MaxCharsFilePath) +# if defined (MSWIN) +# define MaxCharsFilePath (_MAX_PATH*MAX_SIZEOFUTF8CHAR+1) /* Includes traling '\0' */ +# else +# define MaxCharsFilePath 2047 /* ...not really a hard limit for Linux/Unix */ +# endif /* MSWIN */ +#endif /* !MaxCharsFilePath */ + +/* BEGINREMOVEFROMADDON */ + +/* + * Under Windows, if we are doing a release build (NDEBUG) that is not a CHECKED_BUILD + * then NO_ASSERTS should be defined + */ +#if defined MSWIN && defined NDEBUG && !defined NO_ASSERTS && !defined CHECKED_BUILD +/* intentionally break the compile */ +# error "define NO_ASSERTS for release builds" +#endif + +/* + * Under Windows, if we are doing a CHECKED_BUILD then it should + * also be a release build (NDEBUG) + */ +#if defined MSWIN && defined CHECKED_BUILD && !defined NDEBUG +# error "CHECKED_BUILDS must also be release builds" +#endif + + +#if defined NO_ASSERTS +# define USE_MACROS_FOR_FUNCTIONS +#endif +/* ENDREMOVEFROMADDON */ + +/* BEGINREMOVEFROMADDON */ +/* + * Under Linux the definition of NULL has a cast that conflicts with our own + * casting causing warnings that make it tough to find real problems. + */ +#if defined LINUX && defined NULL +# undef NULL +# define NULL 0 +#endif + +/* + */ +#if !defined MSWIN && !defined ENGINE && !defined ISMESA +#define DISALLOW_OFFSCREEN_EXPORT_IN_BATCH +#endif + +/* ENDREMOVEFROMADDON */ + +#endif /* _MASTER_H_ */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Make/files b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..084478a07adbccaba833762d6eb736781b56cd17 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Make/files @@ -0,0 +1,21 @@ +alloc.cpp +arrlist.cpp +auxdata.cpp +dataio4.cpp +dataio.cpp +dataset0.cpp +dataset.cpp +datautil.cpp +filestream.cpp +geom2.cpp +q_msg.cpp +q_unicode.cpp +set.cpp +strlist.cpp +strutil.cpp +tassert.cpp +tecxxx.cpp +TranslatedString.cpp + +LIB = $(FOAM_LIBBIN)/libtecio + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Make/options b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..a355d90c5eee1f81e6784e993cc2b70acca5b431 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Make/options @@ -0,0 +1,7 @@ +#include "tecioOptions" + +EXE_INC = \ + $(TECIO_FLAGS) $(TECIO_INC) + +LIB_LIBS = \ + $(TECIO_LIBS) diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Make/tecioOptions b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Make/tecioOptions new file mode 100644 index 0000000000000000000000000000000000000000..f8dcf487594354360c5c7fb4094565f145b7c992 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Make/tecioOptions @@ -0,0 +1,20 @@ +#if defined(linux64) + + TECIO_FLAGS = -DMAKEARCHIVE -DLINUX -DLINUX64 -DUSEENUM -DTHREED -U_WIN32 + +#elif defined(linuxIA64) + + TECIO_FLAGS = -DMAKEARCHIVE -DLINUX -DLINUXI64 -DUSEENUM -DTHREED -U_WIN32 + +#elif defined(linux) + + TECIO_FLAGS = -DMAKEARCHIVE -DLINUX -DUSEENUM -DTHREED -U_WIN32 + +#else + +# error architecture not supported for compiling tecio. + +#endif + +TECIO_INC = +TECIO_LIBS = diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_MSG.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_MSG.h new file mode 100644 index 0000000000000000000000000000000000000000..84f1d1af76ed05ab6e794f8dcd6210dd7cea0d60 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_MSG.h @@ -0,0 +1,72 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#ifndef Q_MSG_H +#define Q_MSG_H +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ +#if defined EXTERN +#undef EXTERN +#endif +#if defined Q_MSGMODULE +#define EXTERN +#else +#define EXTERN extern +#endif + +#define MAX_STATUS_LINE_MSG_LEN 255 + +#include "TranslatedString.h" + +EXTERN Boolean_t WrapString(const char *OldString, + char **NewString); +EXTERN void Warning(tecplot::strutil::TranslatedString Format, + ...); /* zero or more arguments */ +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +EXTERN void ErrMsg(tecplot::strutil::TranslatedString Format, + ...); /* zero or more arguments */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined ENGINE +#endif +#if !defined ENGINE +#if defined MOTIF +#endif +#endif +#if !defined ENGINE +#endif +#if defined Q_MSGMODULE +#else +#endif +#endif // TECPLOTKERNEL + +#endif // Q_MSG_H diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_UNICODE.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_UNICODE.h new file mode 100644 index 0000000000000000000000000000000000000000..b91c2ca65ec21b810fc7022572b391f0f974ecab --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_UNICODE.h @@ -0,0 +1,93 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + + +#if !defined Q_UNICODE_H_ +# define Q_UNICODE_H_ + +#if defined EXTERN +#undef EXTERN +#endif +#if defined Q_UNICODEMODULE +#define EXTERN +#else +#define EXTERN extern +#endif + +namespace tecplot +{ +namespace strutil +{ + +// functions +Boolean_t IsValidUtf8LeadByte(Byte_t ch); +Boolean_t IsValidUtf8ContinuingByte(Byte_t ch); +Boolean_t IsValidUtf8Byte(Byte_t ch); + +Boolean_t IsValidUtf8String(const char *str); +Boolean_t ShouldConvertWideStringToUtf8String(const wchar_t *str); +void InitTranslatedStrings(); +void CleanUpTranslatedStrings(); + +Boolean_t IsNullOrZeroLengthString(const char *S); +Boolean_t IsNullOrZeroLengthString(tecplot::strutil::TranslatedString TS); + +Boolean_t IsEmptyString(const char *S); +Boolean_t IsEmptyString(tecplot::strutil::TranslatedString S); +Boolean_t IsEmptyString(const wchar_t* S); + +#if defined MSWIN + +std::string LookUpTranslation(std::string& strEnglish); +void MsWinInitTranslatedStrings(); + +std::string WStringToString(std::wstring str); +std::wstring StringToWString(std::string str); + +std::wstring MultiByteToWideChar(const char *Utf8Str, + unsigned int CodePage); + +std::string WideCharToMultiByte(const wchar_t *WideStr, + unsigned int CodePage); + +// Conversion +std::string WideCharToUtf8(const wchar_t* str); +std::wstring Utf8ToWideChar(const char *str); +char *getenv(const char *str); + +#endif + +} +} + +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SET.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SET.h new file mode 100644 index 0000000000000000000000000000000000000000..2ab99f64a03cf46447996b42e62fd29224c15c72 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SET.h @@ -0,0 +1,283 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#if defined EXTERN +#undef EXTERN +#endif +#if defined SETMODULE +#define EXTERN +#else +#define EXTERN extern +#endif + +#ifndef _SET_H_INCLUDED +#define _SET_H_INCLUDED + +/* +***************************************************************** +***************************************************************** +******* ******** +****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +***************************************************************** +***************************************************************** +*/ + +#define PadOut(X,Y) ((int)(((X)-1)/(Y)+1)*(Y)) +#define SetBitSize (8*sizeof(SetData_t)) +#define SetLastBit (((unsigned long)1)<<(SetBitSize-1)) + +#if defined _DEBUG +# define USE_FUNCTIONS_FOR_SETS +#endif + +/* * + * * NOTE: "Set_pa" is a pointer to an "abstract type", + * * hence the "_pa". Pointer here is akin to "handle". + * * Any routines dealing with the internals of Set_pa + * * or Set_a must be in the same file as these routines + * */ + +/* Set_a is intentionally not defined to further + * deter usage of this private structure */ +struct _Set_a +{ + /* * PRIVATE * */ + SetIndex_t size; + SetData_pt data; +}; + +/* + * Checks set for NULL. + */ +#define IsSetNull(Set) ((Set)==NULL) + +/** + * Indicates how many bytes are required to store the set data. + */ +inline size_t SetDataSizeInBytes(Set_pa Set) +{ + REQUIRE(VALID_REF(Set)); + return Set->size / SetBitSize * sizeof(SetData_t); +} + +/* + * Allocates a new empty set. Returns NULL if not enough memory. + */ +EXTERN Set_pa AllocSet(Boolean_t show_error_msg); + +/* + * Frees all memory associated with set "*set", and + * sets "*set" to NULL. + */ +EXTERN void DeallocSet(Set_pa *Set); + +/** + * This function adapts the DeallocSet function to work with the + * ArrayList's deallocation callback. + */ +EXTERN Boolean_t SetItemDestructor(void *ItemRef, + ArbParam_t ClientData); +/* + * Makes sure set "set" can hold at least "max_val" elements. + * Returns TRUE if successful, FALSE otherwise. A successful + * call to ExpandSet() guarentees that any calls to AddToSet() + * will be successful as long as the elements added are less + * than "max_val". + */ +EXTERN Boolean_t ExpandSet(Set_pa Set, + SetIndex_t max_val, + Boolean_t show_error_msg); + +/* + * Copies set "src" to set "dst". Returns TRUE if successful, + * FALSE if "src" contains elements it is unable to add to "dst". + */ +EXTERN Boolean_t CopySet(Set_pa dst, + Set_pa src, + Boolean_t show_error_msg); + +/* + * Appends set "src" to set "dst". Returns TRUE if successful, + * FALSE if "src" contains elements it is unable to add to "dst". + */ +EXTERN Boolean_t AppendSet(Set_pa dst, + Set_pa src, + Boolean_t show_error_msg); +/* + * Empties the set "set". + */ +EXTERN void ClearSet(Set_pa Set); + +/* + * Adds "member" to set "set". Returns TRUE if successful, + * FALSE otherwise. AddToSet() can only return FALSE if + * "member" is greater than any previous member of "set" and + * also greater that any "max_val" set with ExpandSet(). + */ +#if defined USE_FUNCTIONS_FOR_SETS +EXTERN Boolean_t AddToSet(Set_pa Set, + SetIndex_t member, + Boolean_t show_error_msg); +#else +# if defined __cplusplus +inline Boolean_t AddToSet(Set_pa Set, + SetIndex_t member, + Boolean_t show_error_msg) +{ + if (Set && + (member + 1 <= Set->size || + ExpandSet(Set, member + 1, show_error_msg))) + { + SetIndex_t word = member / SetBitSize; + SetData_t bit = (SetData_t)1 << (member % SetBitSize); + Set->data[word] |= bit; + return TRUE; + } + else + return FALSE; +} /* AddToSet() */ +# else +# define AddToSet(Set,member,show_error_msg) \ + (((Set) && \ + ((member)+1 <= (Set)->size || \ + ExpandSet((Set), (member)+1, (show_error_msg)))) \ + ? (((Set)->data[(member) / SetBitSize] |= (SetData_t)1 << ((member) % SetBitSize)), TRUE) \ + : FALSE) +# endif +#endif + +/* + * Removes "member" from set "set". + */ +EXTERN void RemoveFromSet(Set_pa Set, + SetIndex_t member); + +EXTERN void DeleteSetMember(Set_pa Set, + SetIndex_t Member); +EXTERN Boolean_t InsertSetMember(Set_pa Set, + SetIndex_t Member, + Boolean_t ShowErrMsg); +/* + * Test for membership of "member" in set "set". This is the only + * function worth making into a macro or inline function. + */ +#if defined USE_FUNCTIONS_FOR_SETS +EXTERN Boolean_t InSet(Set_pa Set, + SetIndex_t member); +#else +# if defined __cplusplus +inline Boolean_t InSet(Set_pa Set, + SetIndex_t member) +{ + if (Set && (0 <= member && member < Set->size)) + { + SetIndex_t word = member / SetBitSize; + SetData_t bit = (SetData_t)1 << (member % SetBitSize); + return (Set->data[word]&bit) != 0; + } + else + return FALSE; +} /* InSet() */ +# else +# define InSet(Set,member) ((Set && (0<=(member) && (member)<(Set)->size)) \ + ? ((Set)->data[(member)/SetBitSize]&((SetData_t)1<<((member)%SetBitSize)))!=0 \ + : FALSE) +# endif +#endif + +/* + * Returns TRUE if set "set" is empty. + */ +EXTERN Boolean_t IsEmpty(Set_pa Set); + +/* + * Returns TRUE if Set has voids. + */ +EXTERN Boolean_t HasVoids(Set_pa Set); + +/* + * Returns number of members in Set "Set". + */ +EXTERN SetIndex_t MemberCount(Set_pa Set); + +/* + * Returns the next member in set "set" after member "start_at". + * Use "start_at" of BAD_ZV_VALUE to find first member. + */ +EXTERN SetIndex_t GetNextMember(Set_pa Set, + SetIndex_t start_at); + +/* + * Returns the previous member in set "set" before member + * "start_at". Use "start_at" of BAD_ZV_VALUE to find last member. + */ +EXTERN SetIndex_t GetPrevMember(Set_pa Set, + SetIndex_t start_at); + +/* + * Returns TRUE if sets are equal (have same members). FALSE otherwise. + */ +EXTERN Boolean_t EqualSets(Set_pa set1, + Set_pa set2); + +/* + * Returns TRUE if all members of childset are contained in parentset. + */ +EXTERN Boolean_t IsSubSet(Set_pa childset, + Set_pa parentset); + +EXTERN SetIndex_t MemberOffset(Set_pa Set, + SetIndex_t Member); + +EXTERN SetIndex_t OffsetMember(Set_pa Set, + SetIndex_t Offset); + + +EXTERN Boolean_t CopySetMember(Set_pa DstSet, + SetIndex_t DstOffset, + Set_pa SrcSet, + SetIndex_t SrcOffset); + +EXTERN void ShiftSet(Set_pa Set, + SetIndex_t ShiftPos1, + SetIndex_t ShiftPos2, + SetIndex_t ShiftAmount); + + +/* + * Handy macros + */ +#define GetFirstSetMember(Set) (GetNextMember((Set), BAD_SET_VALUE)) +#define GetLastSetMember(Set) (GetPrevMember((Set), BAD_SET_VALUE)) + +#define ForAllMembersInSet(Member, Set) \ + for (Member = GetFirstSetMember((Set)); \ + Member != BAD_SET_VALUE; \ + Member = GetNextMember((Set), (Member))) +#define ForAllMembersInReversedSet(Member, Set) \ + for (Member = GetLastSetMember((Set)); \ + Member != BAD_SET_VALUE; \ + Member = GetPrevMember((Set), (Member))) + +#endif // _SET_H_INCLUDED diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/STRLIST.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/STRLIST.h new file mode 100644 index 0000000000000000000000000000000000000000..04d1673b11806d7588f483bb446d384fc4056232 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/STRLIST.h @@ -0,0 +1,122 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +***************************************************************** +***************************************************************** +******* ******** +****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +***************************************************************** +***************************************************************** +*/ +#if defined EXTERN +# undef EXTERN +#endif +#if defined STRLISTMODULE +# define EXTERN +#else +# define EXTERN extern +#endif + +#if !defined ARRLIST_h +# error "Include ARRLIST.h before including STRLIST.h" +#endif + +/* + * + * For building pltview.exe under Windows, we use + * tecio.dll (which is linked to pltview). + * Since pltview.exe uses a few of the + * functions here, they need to be exported into + * the tecio.dll, thus "TECXXX.h" is included for the + * LIBFUNCTION & LIBCALL keywords. They are not + * documented with the other TECXXX() functions, + * however. + * + * If pltview requires other string functions + * in the future, they can be added to the dll + * by adding LIBFUNCTION & LIBCALL as in + * StringListDealloc(), etc. below. + * + * When building the tecplot kernal, LIBFUNCTION + * and LIBCALL are nop's. + * + */ +#include "TECXXX.h" + +EXTERN Boolean_t StringListValid(StringList_pa StringList); +EXTERN void StringListClear(StringList_pa StringList); +EXTERN void StringListRemoveStrings(StringList_pa StringList, + LgIndex_t StringOffset, + LgIndex_t Count); +EXTERN void StringListRemoveString(StringList_pa StringList, + LgIndex_t StringOffset); +LIBFUNCTION void LIBCALL StringListDealloc(StringList_pa *StringList); +EXTERN StringList_pa StringListAlloc(void); +EXTERN Boolean_t StringListAppendString(StringList_pa StringList, + const char *String); +LIBFUNCTION LgIndex_t LIBCALL StringListCount(StringList_pa StringList); +LIBFUNCTION char * LIBCALL StringListGetString(StringList_pa StringList, + LgIndex_t StringOffset); + +#if defined USE_MACROS_FOR_FUNCTIONS +# define StringListGetStringRef StringListGetStringRef_MACRO +#else +# define StringListGetStringRef StringListGetStringRef_FUNC +#endif + +#if !defined USE_MACROS_FOR_FUNCTIONS +EXTERN const char * StringListGetStringRef_FUNC(StringList_pa StringList, + LgIndex_t StringOffset); +#endif +/** + * To maintain the string list's integrity the result is cast to a + * (const char *) to minimize the risk of users passing the result + * to FREE_ARRAY. + */ +#define StringListGetStringRef_MACRO(StringList, StringOffset) \ + ((const char *)ArrayListGetCharPtr((ArrayList_pa)(StringList), StringOffset)) + +EXTERN Boolean_t StringListSetString(StringList_pa StringList, + LgIndex_t StringOffset, + const char *String); +EXTERN Boolean_t StringListInsertString(StringList_pa StringList, + LgIndex_t StringOffset, + const char *String); +EXTERN StringList_pa StringListCopy(StringList_pa StringList); +EXTERN Boolean_t StringListAppend(StringList_pa Target, + StringList_pa Source); + +EXTERN char *StringListToNLString(StringList_pa StringList); +EXTERN StringList_pa StringListFromNLString(const char *String); +EXTERN char **StringListToArray(StringList_pa StringList); +EXTERN StringList_pa StringListFromArray(const char **StringArray, + LgIndex_t Count); +EXTERN StringList_pa StringListFromCompound(const char *String); +EXTERN char *StringListToCompound(StringList_pa StringList, + char GroupJoinCharacter, + const char *CharsToEscape); +EXTERN void StringListSort(StringList_pa StringList, + StringListStringComparator_pf Comparator, + ArbParam_t ClientData); diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/STRUTIL.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/STRUTIL.h new file mode 100644 index 0000000000000000000000000000000000000000..c8e0c2b5a33d75aaba1b3e58fc629424808b570b --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/STRUTIL.h @@ -0,0 +1,218 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +#if defined EXTERN +#undef EXTERN +#endif +#if defined STRUTILMODULE +#define EXTERN +#else +#define EXTERN extern +#endif + +#include <string> + +namespace tecplot +{ +namespace strutil +{ +class Scanner; +} +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + + +EXTERN void FormatStringBufferCleanup(void); + +/* + * This is a helper function for FormatString or any other functions that want + * to format a string based on a format string followed by a set of arguments. + * See FormatString or ErrMsg functions for example usage. + * + * @param Format + * C format string. + * @param Arguments + * Variable argument list already fetched using va_start(). + * + * @return + * Allocated string with the formatted string or NULL if it failed. + */ +EXTERN char *vFormatString(const char *Format, + va_list Arguments); + +/** + * Formats a string using the specified C format string. + * + * @param Format + * C format string. + * @param ... + * Any arguments needed by the C format string. + * + * @return + * Allocated string with the formatted string or NULL if it failed. The + * client is responsible for deallocating the resource. + */ +EXTERN char *FormatString(tecplot::strutil::TranslatedString Format, + ...); /* 0 or more variable arguments */ + +/** + * Formats a string using the specified C format string and places the result + * in the string buffer. + * + * @param Buffer + * String buffer to receive the formatted string. + * @param Format + * C format string. + * @param ... + * Any arguments needed by the C format string. + * + * @return + * Upon successful return, these functions return the number of characters + * printed, not including the trailing '\0' used to end output to strings. If + * unsuccessful -1 is returned. + */ +EXTERN int FormatString(std::string& Buffer, + tecplot::strutil::TranslatedString Format + ...); /* 0 or more variable arguments */ +EXTERN char *DupString(tecplot::strutil::TranslatedString String); +EXTERN void CopySubString(char *Target, + const char *Source, + int Index, + int Count); + +#if !defined MSWIN + +EXTERN void ReplaceCharInString(char *S, + short OldChar, + short NewChar); +#endif + +EXTERN void MakeStringLowerCase(char *str); +EXTERN void MakeStringUpperCase(char *str); +EXTERN char *TrimLeadAndTrailSpaces(char *String); +EXTERN char *StringFlushLeft(char *String); +EXTERN char *StringTruncate(char *String, + LgIndex_t MaxLength); +EXTERN char *StringTrimAndTruncate(char *String, + LgIndex_t MaxLength); + +#ifndef MSWIN +EXTERN StringList_pa LineBreakString(const char *String, + UInt32_t WrapMargin); +#endif + +EXTERN Boolean_t MatchKey(char *StringToMatch, + char *Key); +EXTERN void RemoveSeparator(const char **CPtr); +EXTERN void SkipWhiteSpace(const char **CPtr); +EXTERN void SkipNonWhiteSpace(char **CPtr); +EXTERN const char *ustrstr(const char *s1, + const char *s2); +EXTERN int ustrncmp(const char *s1, + const char *s2, + size_t Len); +EXTERN int ustrcmp(const char *s1, + const char *s2); +/* public access */ +/* InternalResetString should not be used directly (use ResetString macro) */ +#if !defined NO_ASSERTS +EXTERN Boolean_t InternalResetString(char **SBase, + const char *NewString, + Boolean_t IssueErrMsg, + const char *FileName, + int LineNumber); +# define ResetString(SBase, NewString, IssueErrMsg) InternalResetString( \ + SBase, \ + NewString, \ + IssueErrMsg, \ + __FILE__, __LINE__) +#else +EXTERN Boolean_t InternalResetString(char **SBase, + const char *NewString, + Boolean_t IssueErrMsg); +# define ResetString(SBase, NewString, IssueErrMsg) InternalResetString( \ + SBase, \ + NewString, \ + IssueErrMsg) +#endif + +EXTERN Boolean_t ScanForString(tecplot::strutil::Scanner &scanner, + std::string &DestString, + Boolean_t GrabEntireStringIncludingDelimiters); +EXTERN Boolean_t TackOnString(char **SBase, + const char *StringToAdd, + Boolean_t DeleteStringToAdd, + Boolean_t ConvertNewlineToAscii); +EXTERN Boolean_t TackOnConstString(char **SBase, + const char *StringToAdd, + Boolean_t ConvertNewlineToAscii); +EXTERN Boolean_t TackOnChar(char **SBase, + char CharToAdd); +EXTERN Boolean_t ReplaceNewlineWithBackslashN(char **String); +EXTERN Boolean_t ReplaceBackslashNWithNewline(char **S); + +EXTERN Boolean_t EscapeOutDelimitersInString(char **S, + char Delimiter); +EXTERN Boolean_t ScanForSymbol(tecplot::strutil::Scanner &scanner, + char Symbol, + Boolean_t OnlySkipWhiteSpace); + + +/* Newline Delimited Strings */ +EXTERN char *ConvertStringToNewlineDelimitedString(const char *OriginalString); +EXTERN char *ConvertNewlineDelimitedStringToQuotedString(const char *NewlineDelimitedString, + Boolean_t SeparateInstructionsWithPlus); + + + +EXTERN char *InsertNameAtPlaceHolder(char *BaseString, + char *NameToInsert); +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined NO_ASSERTS +#endif /* !NO_ASSERTS */ +#endif //TECPLOTKERNEL + +inline char* EndOfString(char* str) +{ + return str + strlen(str); +}; +inline char const* EndOfString(char const* str) +{ + return str + strlen(str); +}; diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SYSTEM.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SYSTEM.h new file mode 100644 index 0000000000000000000000000000000000000000..6e510359a5b7038510c775bd99c26fffc818665f --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SYSTEM.h @@ -0,0 +1,67 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +***************************************************************** +***************************************************************** +******* ******** +****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +***************************************************************** +***************************************************************** +*/ +#if defined EXTERN +#undef EXTERN +#endif +#if defined SYSTEMMODULE +#define EXTERN +#else +#define EXTERN extern +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +EXTERN int OpenFileListGetCount(void); +EXTERN char *GetLongFileName(const char *FileName); +EXTERN Boolean_t VerifyToOverwriteFile(const char *FName); +EXTERN Boolean_t IsValidDirectory(const char *FName); +EXTERN Boolean_t FileExists(const char *F, + Boolean_t ShowErr); +EXTERN Boolean_t IsOkFNameChar(unsigned char ch); +EXTERN void ErrFName(const char *FName); +EXTERN Boolean_t IsValidFileName(const char *FileName, + Boolean_t IsReading, + Boolean_t ShowError); +EXTERN Boolean_t ResizeFile(FILE *File, + Int64_t Length); +EXTERN Boolean_t Close_File(FILE **F, + Boolean_t ShowErr); +EXTERN Boolean_t Open_File(FILE **F, + const char *FName, + Boolean_t IsReading, + Boolean_t IsAppending, + Boolean_t ForceOpen, + Boolean_t ShowErr, + Boolean_t IsAscii); + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TASSERT.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TASSERT.h new file mode 100644 index 0000000000000000000000000000000000000000..78252294d340e4f149e2b4513f4915fdb70bfda3 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TASSERT.h @@ -0,0 +1,513 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ +/* + * Provide four levels of assertion control. Assertions provide a mechanism + * to enforce a contract between a client and service provider. The assertions + * are listed in order of highest to lowest priority. Assertions can be turned + * off individually by defining the appropriate name (see preprossessor + * definitions below), however, lower priority assertions should be turned + * off prior to higher ones. As confidence in the code increases all assertions + * can be turned off by defining NO_ASSERTS. + * + * The assertions defined below have the following meanings: + * + * INVARIANT - Asserts that a property's state is invariant throughout the + * life of the property's scope. Stating invariant properties + * of an application provides a deeper understanding of the + * application's state. These statements are usually + * positioned just ahead of the preconditions and just after + * the postconditions. + * + * REQUIRE - Asserts that a method's preconditions are within their + * valid domains. Preconditions are conditions placed upon + * any state information relied upon for the call. These + * statements should be as close to the top of the method + * as possible (except for assertions on invariant properties). + * + * ENSURE - Asserts that a method's postconditions are within their + * valid ranges. Postconditions are conditions placed upon + * any state information modified by the call. These + * statements should be as close to the bottom of the method + * (presumably there is only one exit point) as possible + * (except for assertions on invariant properties). + * + * CHECK - Any other assertion not covered by the above assertions. + * These are often added within a method body to specify + * something that may not be immediately obvious to the reader + * or to validate your assumptions about a call to a 3rd party + * method that does not use runtime assertions for its + * preconditions or postconditions. Obviously if the 3rd party + * method uses assertions then there is no need for the CHECK. + * + * Additionally a convenience macro is available to place in code that is + * pending implementation. + * + * NOT_IMPLEMENTED - Assertion that always fails during runtime for debug + * builds and always fails at compile time for release + * builds. + */ +#if !defined TASSERT_H +#define TASSERT_H + +#if defined (MSWIN) +# include <assert.h> +#endif /* MSWIN */ + +#if !defined TECPLOTKERNEL && !defined STD_ASSERTS +#define STD_ASSERTS +#endif + +#if !defined (MSWIN) +# include <assert.h> +# if !defined ASSERT +# define ASSERT assert +# endif +#endif + +#if defined MSWIN +/* MFC .NET defines ENSURE, so we undefine it here */ +#if defined ENSURE +#undef ENSURE +#endif /* ENSURE */ +#endif /* MSWIN */ + +/* BEGINREMOVEFROMADDON */ +#define INVALID_REF ((void *)0x0000FFFF) +/* + * Chances are low the address 0x11111111 will be used, so we'll risk asserting + * against it (see unitialized assignment in newmalloc). + */ +#define UNINITIALIZED_REF ((void *)0x11111111) +#define INVALID_FN_REF ((void *)NULL) +/* ENDREMOVEFROMADDON */ + +#ifdef UNIXX +/* BEGINREMOVEFROMADDON */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# if defined NO_ASSERTS +# else +# endif +#endif /* TECPLOTKERNAL */ +/* ENDREMOVEFROMADDON */ + +/* BEGINREMOVEFROMADDON */ +#if !defined TECPLOTKERNEL +/* For add-ons, there is a problem with VALID_REF, so just test for non-NULL */ +/* ENDREMOVEFROMADDON */ +# define VALID_REF(p) ( (p) != NULL ) +# define VALID_FN_REF(fp) ( (fp) != NULL ) +/* BEGINREMOVEFROMADDON */ +#endif /* !defined TECPLOTKERNAL */ +/* ENDREMOVEFROMADDON */ + +/* BEGINREMOVEFROMADDON */ +/* Widgets are pointers under Motif */ +# define VALID_WIDGET(widget) VALID_REF((widget)) +/* Menu widgets are pointers too */ +# define VALID_MENU_WIDGET(widget) VALID_REF((widget)) +/* ENDREMOVEFROMADDON */ +#endif /* UNIXX */ + +#ifdef MSWIN +/* BEGINREMOVEFROMADDON */ +/* Don't use AfxIsValidAddress()! See Bug <7245>. + 1/4/08, dto. */ +/* ENDREMOVEFROMADDON */ + +#if defined NO_ASSERTS +/* release build in TecUtil layer uses these for TUASSERT */ +# define VALID_REF(p) ((p) != NULL) +# define VALID_FN_REF(pf) ((pf) != NULL) +#else +# define VALID_REF(p) ((p) != NULL && !IsBadReadPtr((const void *)(p), 1)) +# define VALID_FN_REF(pf) ((pf) != NULL && !IsBadReadPtr((const void *)(pf),(UINT_PTR)sizeof(const void*))) +#endif + +/* BEGINREMOVEFROMADDON */ +/* Widgets are numbers under Windows, so we decode it with GetWindowFromWidget */ +# if defined ENGINE +# define VALID_WIDGET(widget) ((widget) != NULL) +# else +# define VALID_WIDGET(widget) ((widget) != NULL && GetWindowFromWidget((widget))!=NULL) +# endif // ENGINE + +/* Menu widgets are numbers too, so we just check against zero */ +# define VALID_MENU_WIDGET(widget) ((widget)!=NULL) +/* ENDREMOVEFROMADDON */ +#endif /* MSWIN */ +/* BEGINREMOVEFROMADDON */ +/* handles are not pointers to memory, so the only test we can */ +/* perform is to check for 0 */ +#define VALID_HANDLE(handle) ((handle)!=0) + +#if defined FLEXLM +#define VALID_FLEX_JOB_HANDLE(handle) ((handle) != NULL) +#define VALID_FLEX_ERROR_CODE(ErrorCode)(ErrorCode <= 0) +#endif /* FLEXLM */ + +/* ENDREMOVEFROMADDON */ +/* other useful validity checks */ +#define VALID_BOOLEAN(b) ((b) == TRUE || (b) == FALSE) +#define VALID_ENUM(value, type) (0 <= (value) && \ + (value) < END_##type) + +/* Test a parameter than can be NULL or a valid pointer */ +#define VALID_REF_OR_NULL(ptr) IMPLICATION((ptr) != NULL, VALID_REF(ptr)) +#define VALID_FN_REF_OR_NULL(ptr) IMPLICATION((ptr) != NULL, VALID_FN_REF(ptr)) + +/* BEGINREMOVEFROMADDON */ +#define VALID_TRANSLATED_STRING(ts) (!(ts).isNull()) + +/** + * These macros are a little complicated but it allows one to + * write a simple assertion regardless of the zone type or + * selected plane: + * + * REQUIRE(VALID_CELL_INDEX(CZData, CellIndex, Plane))); + * + * Prior to using the macros a call to SetupXxx, + * or at a minimum SetupCZData, must be called to setup + * the globals defining the dataset structure. + */ +#define VALID_FE_CELL_INDEX(CZData, CellIndex) \ + (/* CellIndex range test */ \ + 0 <= (CellIndex) && \ + (CellIndex) < (CZData)->NumElements) + +#define VALID_IPLANE_CELL_INDEX(CZData,CellIndex) \ + (/* CellIndex range test */ \ + (CellIndex) >= 0 && \ + IINDEX((CZData),CellIndex) <= MAX((CZData)->NumIPtsM1,1) && \ + JINDEX((CZData),CellIndex) < MAX((CZData)->NumJPtsM1,1) && \ + KINDEX((CZData),CellIndex) < MAX((CZData)->NumKPtsM1,1)) + +#define VALID_JPLANE_CELL_INDEX(CZData,CellIndex) \ + (/* CellIndex range test */ \ + (CellIndex) >= 0 && \ + IINDEX((CZData),CellIndex) < MAX((CZData)->NumIPtsM1,1) && \ + JINDEX((CZData),CellIndex) <= MAX((CZData)->NumJPtsM1,1) && \ + KINDEX((CZData),CellIndex) < MAX((CZData)->NumKPtsM1,1)) + +#define VALID_KPLANE_CELL_INDEX(CZData,CellIndex) \ + (/* CellIndex range test */ \ + (CellIndex) >= 0 && \ + IINDEX((CZData),CellIndex) < MAX((CZData)->NumIPtsM1,1) && \ + JINDEX((CZData),CellIndex) < MAX((CZData)->NumJPtsM1,1) && \ + KINDEX((CZData),CellIndex) <= MAX((CZData)->NumKPtsM1,1)) + +#define VALID_ORDERED_CELL_INDEX(CZData, CellIndex, Plane) \ + (/* macro preconditions */ \ + ((IJKPlanes_e)(Plane) == IJKPlanes_I || \ + (IJKPlanes_e)(Plane) == IJKPlanes_J || \ + (IJKPlanes_e)(Plane) == IJKPlanes_K || \ + (IJKPlanes_e)(Plane) == IJKPlanes_Volume) && \ +\ + /* CellIndex range test */ \ + (IMPLICATION(((IJKPlanes_e)(Plane) == IJKPlanes_I || \ + (IJKPlanes_e)(Plane) == IJKPlanes_Volume), \ + VALID_IPLANE_CELL_INDEX((CZData),CellIndex)) && \ + IMPLICATION(((IJKPlanes_e)(Plane) == IJKPlanes_J || \ + (IJKPlanes_e)(Plane) == IJKPlanes_Volume), \ + VALID_JPLANE_CELL_INDEX((CZData),CellIndex)) && \ + IMPLICATION(((IJKPlanes_e)(Plane) == IJKPlanes_K || \ + (IJKPlanes_e)(Plane) == IJKPlanes_Volume), \ + VALID_KPLANE_CELL_INDEX((CZData),CellIndex)))) + +#define VALID_CELL_INDEX(CZData, CellIndex, Plane) \ + (((CZData)->NM != NULL || (CZData)->FM != NULL) ? \ + VALID_FE_CELL_INDEX((CZData), (CellIndex)) : \ + VALID_ORDERED_CELL_INDEX((CZData), (CellIndex), (Plane))) + +#define VALID_DATASET(dataSet,checkNumZones) (((dataSet) != NULL) && \ + IMPLICATION((checkNumZones),(dataSet)->NumZones >= 1)) + + + +#ifdef MSWIN +/* Here is a more specific check in Windows for a valid + pointer to an MFC Window object. + Note that GetSafeHwnd() works even if pWnd is NULL, because + it checks the 'this' pointer first */ +# define VALID_WND(pWnd) (::IsWindow((pWnd)->GetSafeHwnd())) + +#else /* !MSWIN */ +# define VALID_WND(pWnd) /* Should not be used in Motif */ +#endif /* MSWIN */ +/* ENDREMOVEFROMADDON */ + +/* Check for a non-zero length string */ +#if defined MSWIN +# if defined NO_ASSERTS +# define VALID_NON_ZERO_LEN_STR(str) (VALID_REF(str) && !ISEMPTYSTRING(str)) +# else +# define VALID_NON_ZERO_LEN_STR(str) \ + (VALID_REF(str) && \ + !IsBadReadPtr((const void*)(str),(UINT_PTR)(1+strlen((const char*)(str)))) && \ + !ISEMPTYSTRING(str)) +# endif +#else +# define VALID_NON_ZERO_LEN_STR(str) (VALID_REF(str) && !ISEMPTYSTRING(str)) +#endif + +#define VALID_SET_INDEX(setIndex) (((SetIndex_t)setIndex)>=(SetIndex_t)1) + +/* Check for valid stdio file handle */ +#define VALID_FILE_HANDLE(stream) ((stream) != NULL) + +/* To check colors and pen numbers */ +/* BEGINREMOVEFROMADDON */ +#define VALID_BASIC_COLOR(BColor) \ + (FirstBasicColor<=(BColor) && (BColor)<=LastBasicColor) +#define VALID_CONTOUR_COLOR(Color) \ + (ContourColorOffset<=(Color) && \ + (Color)<ContourColorOffset+GeneralBase.Limits.MaxNumContourLevels+1) +#define VALID_PLOTTING_COLOR(Color) \ + (VALID_BASIC_COLOR(Color) || VALID_CONTOUR_COLOR(Color)) +#define VALID_INTERFACE_SPECIFIC_COLOR(BColor) \ + (FirstInterfaceColor<=(BColor) && (BColor)<=LastInterfaceColor) +#define VALID_INTERFACE_COLOR(Color) \ + (VALID_PLOTTING_COLOR(Color) || VALID_INTERFACE_SPECIFIC_COLOR(Color)) +#define VALID_MULTICOLOR_COLOR(Color) \ + (((Color) == MultiColor_C) || ((Color) == MultiColor2_C) || \ + ((Color) == MultiColor3_C) || ((Color) == MultiColor4_C) || \ + ((Color) == MultiColor5_C) || ((Color) == MultiColor6_C) || \ + ((Color) == MultiColor7_C) || ((Color) == MultiColor8_C)) +#define VALID_RGB_COLOR(Color) \ + ((Color) == RGBColor_C) +#define VALID_ASSIGNABLE_COLOR(C) \ + (VALID_BASIC_COLOR(C) || \ + VALID_MULTICOLOR_COLOR(C) || \ + VALID_RGB_COLOR(C)) +#define VALID_PEN_OFFSET(PenOffset) \ + (Black_C<=(PenOffset) && (PenOffset)<=NumPlotterPens) +#define VALID_PEN_OFFSET_FOR_OBJECT(PenOffset) \ + (FirstObjectPen<=(PenOffset) && (PenOffset)<=LastObjectPen) + + +/* to check FE cells */ +#define VALID_ELEMENT_TYPE(element_type) \ + ((element_type) == ZoneType_FETriangle || \ + (element_type) == ZoneType_FEQuad || \ + (element_type) == ZoneType_FETetra || \ + (element_type) == ZoneType_FEBrick || \ + (element_type) == ZoneType_FELineSeg) + + + +/* + * Test validity of zone and variable names. A valid name is one that has a + * valid reference, is not padded with spaces and is within the maximum + * specified length. + */ +#define VALID_NAME(Name, MaxLength) \ + (VALID_REF(Name) && \ + (ISEMPTYSTRING(Name) || \ + (!isspace((Name)[0]) && !isspace((Name)[strlen(Name)-1]))) && \ + strlen(Name) <= (MaxLength)) +#define VALID_ZONE_NAME(Name) VALID_NAME((Name), MaxChrsZnTitle) +#define VALID_VAR_NAME(Name) VALID_NAME((Name), MaxChrsVarName) + + +/* Special test for lighting effect (don't allow "none" in some cases) */ +#define VALID_LIGHTINGEFFECT(L) \ + (((L) == LightingEffect_Paneled) || ((L) == LightingEffect_Gouraud)) + + +/* type definition for assert failure notification function */ +typedef void (*TAssertFailureNotifyFunc)( + const char *expression, /* text representation of the assertion */ + const char *file_name, /* name of the file containing the assertion */ + int line); /* line number in the file of the assertion */ + +#if !defined STD_ASSERTS +/* external function prototypes */ +extern void TAssert( + const char *expression, /* text representation of the assertion */ + const char *file_name, /* name of the file containing the assertion */ + int line); /* line number in the file of the assertion */ + +extern TAssertFailureNotifyFunc InstallTAssertFailureNotify( + TAssertFailureNotifyFunc new_function); /* new notification function */ +#endif /* !STD_ASSERTS */ +/* ENDREMOVEFROMADDON */ + +#if defined NO_ASSERTS +/* BEGINREMOVEFROMADDON */ +# define TASSERT(EXPR) +/* ENDREMOVEFROMADDON */ +# define INVARIANT(EXPR) +# define REQUIRE(EXPR) +# define ENSURE(EXPR) +# define CHECK(EXPR) +# ifdef VERIFY +# undef VERIFY +# endif +# define VERIFY(EXPR) ((void)(EXPR)) +/* + * Only define IGNORENOTIMPLEMENTED if building a "test" release build + * that you are fully aware may contain unimplemented features. + */ +# if defined IGNORENOTIMPLEMENTED +# define NOT_IMPLEMENTED() CHECK(FALSE) +# else +# if defined MSWIN +/* + * NOT_IMPLEMENTED is defined using a parameter, but should be called with none, + * this will then throw a warning and not break the compile. Unix doesn't pick + * up this warning, so break the compile under Unix + */ +# define NOT_IMPLEMENTED(x) TAssert("Not Implemented", __FILE__, __LINE__) +# endif +# if defined UNIXX +# define NOT_IMPLEMENTED() not implemented /* intentionally break the compile */ +# endif +# endif +#elif defined STD_ASSERTS +/* BEGINREMOVEFROMADDON */ +# define TASSERT(EXPR) assert(EXPR) +/* ENDREMOVEFROMADDON */ +# define INVARIANT(EXPR) assert(EXPR) +# define REQUIRE(EXPR) assert(EXPR) +# define ENSURE(EXPR) assert(EXPR) +# define CHECK(EXPR) assert(EXPR) +# ifdef VERIFY +# undef VERIFY +# endif +# ifndef VERIFY +# if defined NDEBUG +# define VERIFY(EXPR) ((void)(EXPR)) +# else +# define VERIFY(EXPR) assert(EXPR) +# endif +# endif /* VERIFY */ +# define NOT_IMPLEMENTED() assert(!("Not Implemented")) +#else +/* BEGINREMOVEFROMADDON */ +#if defined (MSWIN) +#if defined CHECKED_BUILD +#include <string> +#include <vector> +#include <algorithm> + +class AssertionLog +{ +public: + static void initializeAssertLog(const std::string &fileName); + static bool isLoggingAssertions(); + static void addAssertion(const std::string &message); +private: + static void writeOutAssertion(const std::string &message); +private: + static bool logAssertions; + static std::string logFileName; + static std::vector<std::string> assertList; +}; + +extern void TWinCheckedFailedLine(const char *Expr, + const char *FileName, + int LineNum); + +#define TASSERT(EXPR)\ + do { if (!(EXPR)) { TWinCheckedFailedLine(#EXPR,__FILE__,__LINE__); } } while (0) +#else +#define TASSERT(EXPR) ASSERT(EXPR) /* MFC assert. +Works in both release & debug builds */ +#endif /* CHECKED_BUILD */ +#else +#define TASSERT(EXPR) (void)((EXPR) || (TAssert(#EXPR, __FILE__, __LINE__), 0)) +#endif + +# if defined NO_INVARIANTS +# define INVARIANT(EXPR) +# else +# define INVARIANT(EXPR) TASSERT(EXPR) +# endif + +# if defined NO_PRECONDITIONS +# define REQUIRE(EXPR) +# else +# define REQUIRE(EXPR) TASSERT(EXPR) +# endif + +# if defined NO_POSTCONDITIONS +# define ENSURE(EXPR) +# else +# define ENSURE(EXPR) TASSERT(EXPR) +# endif + +# if defined VERIFY +# undef VERIFY +# endif + +# if defined NO_CHECKS +# define CHECK(EXPR) +# define VERIFY(EXPR) ((void)(EXPR)) +# else +# define CHECK(EXPR) TASSERT(EXPR) +# if defined NDEBUG +# define VERIFY(EXPR) ((void)(EXPR)) +# else +# define VERIFY(EXPR) TASSERT(EXPR) +# endif +# endif + +# if defined NICE_NOT_IMPLEMENTED +# define NOT_IMPLEMENTED() NiceNotImplemented() +# else +# define NOT_IMPLEMENTED() TASSERT(!("Not Implemented")) +# endif +/* ENDREMOVEFROMADDON */ +#endif +/* BEGINREMOVEFROMADDON */ +#if !defined STD_ASSERTS +extern void TecplotMopupOnAssert(void); +#endif /* !STD_ASSERTS */ + +#if defined NICE_NOT_IMPLEMENTED +extern void NiceNotImplemented(void); +#endif +/* ENDREMOVEFROMADDON */ + +/* convenience macros for implication, P -> Q, and equivalence, P <-> Q. */ +#define IMPLICATION(P,Q) (!(P) || (Q)) +#define EQUIVALENCE(P,Q) ((P) == (Q)) + +/* BEGINREMOVEFROMADDON */ +#if defined RLM +#define VALID_RLM_HANDLE(h) ((h) != NULL) +#endif /* RLM */ +/* ENDREMOVEFROMADDON */ + + +#endif /* TASSERT_H */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TECIO.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TECIO.h new file mode 100644 index 0000000000000000000000000000000000000000..fabb1344b0b0d0e3d348b30c5c1c14d52ce29b68 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TECIO.h @@ -0,0 +1,24 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "TECXXX.h" diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TECXXX.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TECXXX.h new file mode 100644 index 0000000000000000000000000000000000000000..a61539e90bcd1c8a1650cc281f7962b290a0cbb1 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TECXXX.h @@ -0,0 +1,698 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* + * TECXXX.h: Copyright (C) 1988-2008 Tecplot, Inc. + */ + +#if !defined TECXXX_H_ +#define TECXXX_H_ + +#if !defined CRAY +# define TECFOREIGN112 tecforeign112 +# define TECINI112 tecini112 +# define TECZNE112 teczne112 +# define TECDAT112 tecdat112 +# define TECNOD112 tecnod112 +# define TECGEO112 tecgeo112 +# define TECTXT112 tectxt112 +# define TECLAB112 teclab112 +# define TECFIL112 tecfil112 +# define TECEND112 tecend112 +# define TECUSR112 tecusr112 +# define TECAUXSTR112 tecauxstr112 +# define TECZAUXSTR112 teczauxstr112 +# define TECVAUXSTR112 tecvauxstr112 +# define TECFACE112 tecface112 +# define TECPOLY112 tecpoly112 + +# define TECFOREIGN111 tecforeign111 +# define TECINI111 tecini111 +# define TECZNE111 teczne111 +# define TECDAT111 tecdat111 +# define TECNOD111 tecnod111 +# define TECGEO111 tecgeo111 +# define TECTXT111 tectxt111 +# define TECLAB111 teclab111 +# define TECFIL111 tecfil111 +# define TECEND111 tecend111 +# define TECUSR111 tecusr111 +# define TECAUXSTR111 tecauxstr111 +# define TECZAUXSTR111 teczauxstr111 +# define TECVAUXSTR111 tecvauxstr111 +# define TECFACE111 tecface111 +# define TECPOLY111 tecpoly111 + +# define TECFOREIGN110 tecforeign110 +# define TECINI110 tecini110 +# define TECZNE110 teczne110 +# define TECDAT110 tecdat110 +# define TECNOD110 tecnod110 +# define TECGEO110 tecgeo110 +# define TECTXT110 tectxt110 +# define TECLAB110 teclab110 +# define TECFIL110 tecfil110 +# define TECEND110 tecend110 +# define TECUSR110 tecusr110 +# define TECAUXSTR110 tecauxstr110 +# define TECZAUXSTR110 teczauxstr110 +# define TECVAUXSTR110 tecvauxstr110 +# define TECFACE110 tecface110 + +# define TECFOREIGN100 tecforeign100 +# define TECINI100 tecini100 +# define TECZNE100 teczne100 +# define TECDAT100 tecdat100 +# define TECNOD100 tecnod100 +# define TECGEO100 tecgeo100 +# define TECTXT100 tectxt100 +# define TECLAB100 teclab100 +# define TECFIL100 tecfil100 +# define TECEND100 tecend100 +# define TECUSR100 tecusr100 +# define TECAUXSTR100 tecauxstr100 +# define TECZAUXSTR100 teczauxstr100 +# define TECVAUXSTR100 tecvauxstr100 +# define TECFACE100 tecface100 + +# define TECINI tecini +# define TECZNE teczne +# define TECDAT tecdat +# define TECNOD tecnod +# define TECGEO tecgeo +# define TECTXT tectxt +# define TECLAB teclab +# define TECFIL tecfil +# define TECEND tecend +# define TECUSR tecusr +#endif + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else +#define INTEGER4 int +#define INTEGER2 short +#endif + +#if defined _WIN32 +#if !defined MSWIN +#define MSWIN /* MSWIN */ +#endif +#endif /* _WIN32 */ + +#if !defined (EXTERNC) +# if defined (__cplusplus) +# define EXTERNC extern "C" +# else +# define EXTERNC +# endif /* __cplusplus */ +#endif /* EXTERN_C */ + +#if !defined (STDCALL) +# if defined MSWIN +# define STDCALL __stdcall +# else /* !MSWIN */ +# define STDCALL +# endif /* MSWIN */ +#endif /* STDCALL */ + +#if !defined (DLLEXPORT) +# if defined (MSWIN) +# define DLLEXPORT _declspec (dllexport) +# else +# define DLLEXPORT +# endif /* MSWIN */ +#endif /* DLLEXPORT */ + +#if !defined (DLLIMPORT) +# if defined (MSWIN) +# define DLLIMPORT _declspec (dllimport) +# else +# define DLLIMPORT +# endif /* MSWIN */ +#endif /* DLLIMPORT */ + + +#if defined (TECPLOTKERNEL) +/* CORE SOURCE CODE REMOVED */ +#else /* !TECPLOTKERNAL && !MAKEARCHIVE */ +# define LIBCALL STDCALL +# define LIBFUNCTION EXTERNC DLLIMPORT +#endif + +/* + * V11.3 tecio functions + */ + +LIBFUNCTION void LIBCALL TECFOREIGN112(INTEGER4 *OutputForeignByteOrder); + +LIBFUNCTION INTEGER4 LIBCALL TECINI112(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *FileType, + INTEGER4 *Debug, + INTEGER4 *VIsDouble); + +LIBFUNCTION INTEGER4 LIBCALL TECZNE112(char *ZoneTitle, + INTEGER4 *ZoneType, + INTEGER4 *IMxOrNumPts, + INTEGER4 *JMxOrNumElements, + INTEGER4 *KMxOrNumFaces, + INTEGER4 *ICellMx, + INTEGER4 *JCellMx, + INTEGER4 *KCellMx, + double *SolutionTime, + INTEGER4 *StrandID, + INTEGER4 *ParentZone, + INTEGER4 *IsBlock, + INTEGER4 *NumFaceConnections, + INTEGER4 *FaceNeighborMode, + INTEGER4 *TotalNumFaceNodes, + INTEGER4 *NumConnectedBoundaryFaces, + INTEGER4 *TotalNumBoundaryConnections, + INTEGER4 *PassiveVarList, + INTEGER4 *ValueLocation, + INTEGER4 *ShareVarFromZone, + INTEGER4 *ShareConnectivityFromZone); + +LIBFUNCTION INTEGER4 LIBCALL TECDAT112(INTEGER4 *N, + void *FieldData, + INTEGER4 *IsDouble); + +LIBFUNCTION INTEGER4 LIBCALL TECNOD112(INTEGER4 *NData); + +LIBFUNCTION INTEGER4 LIBCALL TECEND112(void); + +LIBFUNCTION INTEGER4 LIBCALL TECLAB112(char *S); + +LIBFUNCTION INTEGER4 LIBCALL TECUSR112(char *S); + +LIBFUNCTION INTEGER4 LIBCALL TECGEO112(double *XPos, + double *YPos, + double *ZPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *Clipping, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XGeomData, + float *YGeomData, + float *ZGeomData, + char *mfc); + +LIBFUNCTION INTEGER4 LIBCALL TECTXT112(double *XOrThetaPos, + double *YOrRPos, + double *ZOrUnusedPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + INTEGER4 *Clipping, + char *String, + char *mfc); + +LIBFUNCTION INTEGER4 LIBCALL TECFIL112(INTEGER4 *F); + +LIBFUNCTION INTEGER4 LIBCALL TECAUXSTR112(char *Name, + char *Value); + +LIBFUNCTION INTEGER4 LIBCALL TECZAUXSTR112(char *Name, + char *Value); + +LIBFUNCTION INTEGER4 LIBCALL TECVAUXSTR112(INTEGER4 *Var, + char *Name, + char *Value); + +LIBFUNCTION INTEGER4 LIBCALL TECFACE112(INTEGER4 *FaceConnections); + +LIBFUNCTION INTEGER4 LIBCALL TECPOLY112(INTEGER4 *FaceNodeCounts, + INTEGER4 *FaceNodes, + INTEGER4 *FaceLeftElems, + INTEGER4 *FaceRightElems, + INTEGER4 *FaceBndryConnectionCounts, + INTEGER4 *FaceBndryConnectionElems, + INTEGER4 *FaceBndryConnectionZones); + +/* + * V11.1 tecio functions TODO (JN): Tecplot's version is still in flux so the .1 may change + */ + +LIBFUNCTION void LIBCALL TECFOREIGN111(INTEGER4 *OutputForeignByteOrder); + +LIBFUNCTION INTEGER4 LIBCALL TECINI111(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *FileType, + INTEGER4 *Debug, + INTEGER4 *VIsDouble); + +LIBFUNCTION INTEGER4 LIBCALL TECZNE111(char *ZoneTitle, + INTEGER4 *ZoneType, + INTEGER4 *IMxOrNumPts, + INTEGER4 *JMxOrNumElements, + INTEGER4 *KMxOrNumFaces, + INTEGER4 *ICellMx, + INTEGER4 *JCellMx, + INTEGER4 *KCellMx, + double *SolutionTime, + INTEGER4 *StrandID, + INTEGER4 *ParentZone, + INTEGER4 *IsBlock, + INTEGER4 *NumFaceConnections, + INTEGER4 *FaceNeighborMode, + INTEGER4 *TotalNumFaceNodes, + INTEGER4 *NumConnectedBoundaryFaces, + INTEGER4 *TotalNumBoundaryConnections, + INTEGER4 *PassiveVarList, + INTEGER4 *ValueLocation, + INTEGER4 *ShareVarFromZone, + INTEGER4 *ShareConnectivityFromZone); + +LIBFUNCTION INTEGER4 LIBCALL TECDAT111(INTEGER4 *N, + void *FieldData, + INTEGER4 *IsDouble); + +LIBFUNCTION INTEGER4 LIBCALL TECNOD111(INTEGER4 *NData); + +LIBFUNCTION INTEGER4 LIBCALL TECEND111(void); + +LIBFUNCTION INTEGER4 LIBCALL TECLAB111(char *S); + +LIBFUNCTION INTEGER4 LIBCALL TECUSR111(char *S); + +LIBFUNCTION INTEGER4 LIBCALL TECGEO111(double *XPos, + double *YPos, + double *ZPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *Clipping, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XGeomData, + float *YGeomData, + float *ZGeomData, + char *mfc); + +LIBFUNCTION INTEGER4 LIBCALL TECTXT111(double *XOrThetaPos, + double *YOrRPos, + double *ZOrUnusedPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + INTEGER4 *Clipping, + char *String, + char *mfc); + +LIBFUNCTION INTEGER4 LIBCALL TECFIL111(INTEGER4 *F); + +LIBFUNCTION INTEGER4 LIBCALL TECAUXSTR111(char *Name, + char *Value); + +LIBFUNCTION INTEGER4 LIBCALL TECZAUXSTR111(char *Name, + char *Value); + +LIBFUNCTION INTEGER4 LIBCALL TECVAUXSTR111(INTEGER4 *Var, + char *Name, + char *Value); + +LIBFUNCTION INTEGER4 LIBCALL TECFACE111(INTEGER4 *FaceConnections); + +LIBFUNCTION INTEGER4 LIBCALL TECPOLY111(INTEGER4 *FaceNodeCounts, + INTEGER4 *FaceNodes, + INTEGER4 *FaceLeftElems, + INTEGER4 *FaceRightElems, + INTEGER4 *FaceBndryConnectionCounts, + INTEGER4 *FaceBndryConnectionElems, + INTEGER2 *FaceBndryConnectionZones); + + +/* + * V11 tecio functions + */ + +LIBFUNCTION void LIBCALL TECFOREIGN110(INTEGER4 *OutputForeignByteOrder); + +LIBFUNCTION INTEGER4 LIBCALL TECINI110(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *Debug, + INTEGER4 *VIsDouble); + +LIBFUNCTION INTEGER4 LIBCALL TECZNE110(char *ZoneTitle, + INTEGER4 *ZoneType, + INTEGER4 *IMxOrNumPts, + INTEGER4 *JMxOrNumElements, + INTEGER4 *KMxOrNumFaces, + INTEGER4 *ICellMx, + INTEGER4 *JCellMx, + INTEGER4 *KCellMx, + double *SolutionTime, + INTEGER4 *StrandID, + INTEGER4 *ParentZone, + INTEGER4 *IsBlock, + INTEGER4 *NumFaceConnections, + INTEGER4 *FaceNeighborMode, + INTEGER4 *PassiveVarList, + INTEGER4 *ValueLocation, + INTEGER4 *ShareVarFromZone, + INTEGER4 *ShareConnectivityFromZone); + +LIBFUNCTION INTEGER4 LIBCALL TECDAT110(INTEGER4 *N, + void *FieldData, + INTEGER4 *IsDouble); + +LIBFUNCTION INTEGER4 LIBCALL TECNOD110(INTEGER4 *NData); + +LIBFUNCTION INTEGER4 LIBCALL TECEND110(void); + +LIBFUNCTION INTEGER4 LIBCALL TECLAB110(char *S); + +LIBFUNCTION INTEGER4 LIBCALL TECUSR110(char *S); + +LIBFUNCTION INTEGER4 LIBCALL TECGEO110(double *XPos, + double *YPos, + double *ZPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *Clipping, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XGeomData, + float *YGeomData, + float *ZGeomData, + char *mfc); + +LIBFUNCTION INTEGER4 LIBCALL TECTXT110(double *XOrThetaPos, + double *YOrRPos, + double *ZOrUnusedPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + INTEGER4 *Clipping, + char *String, + char *mfc); + +LIBFUNCTION INTEGER4 LIBCALL TECFIL110(INTEGER4 *F); + +LIBFUNCTION INTEGER4 LIBCALL TECAUXSTR110(char *Name, + char *Value); + +LIBFUNCTION INTEGER4 LIBCALL TECZAUXSTR110(char *Name, + char *Value); + +LIBFUNCTION INTEGER4 LIBCALL TECVAUXSTR110(INTEGER4 *Var, + char *Name, + char *Value); + +LIBFUNCTION INTEGER4 LIBCALL TECFACE110(INTEGER4 *FaceConnections); + + +/* + * V10 tecio functions kept for backward compatability. + */ + +LIBFUNCTION void LIBCALL TECFOREIGN100(INTEGER4 *OutputForeignByteOrder); + +LIBFUNCTION INTEGER4 LIBCALL TECINI100(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *Debug, + INTEGER4 *VIsDouble); + +LIBFUNCTION INTEGER4 LIBCALL TECZNE100(char *ZoneTitle, + INTEGER4 *ZoneType, + INTEGER4 *IMxOrNumPts, + INTEGER4 *JMxOrNumElements, + INTEGER4 *KMxOrNumFaces, + INTEGER4 *ICellMx, + INTEGER4 *JCellMx, + INTEGER4 *KCellMx, + INTEGER4 *IsBlock, + INTEGER4 *NumFaceConnections, + INTEGER4 *FaceNeighborMode, + INTEGER4 *ValueLocation, + INTEGER4 *ShareVarFromZone, + INTEGER4 *ShareConnectivityFromZone); + +LIBFUNCTION INTEGER4 LIBCALL TECDAT100(INTEGER4 *N, + void *FieldData, + INTEGER4 *IsDouble); + +LIBFUNCTION INTEGER4 LIBCALL TECNOD100(INTEGER4 *NData); + +LIBFUNCTION INTEGER4 LIBCALL TECEND100(void); + +LIBFUNCTION INTEGER4 LIBCALL TECLAB100(char *S); + +LIBFUNCTION INTEGER4 LIBCALL TECUSR100(char *S); + +LIBFUNCTION INTEGER4 LIBCALL TECGEO100(double *XPos, + double *YPos, + double *ZPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *Clipping, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XGeomData, + float *YGeomData, + float *ZGeomData, + char *mfc); + +LIBFUNCTION INTEGER4 LIBCALL TECTXT100(double *XOrThetaPos, + double *YOrRPos, + double *ZOrUnusedPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + INTEGER4 *Clipping, + char *String, + char *mfc); + +LIBFUNCTION INTEGER4 LIBCALL TECFIL100(INTEGER4 *F); + +LIBFUNCTION INTEGER4 LIBCALL TECAUXSTR100(char *Name, + char *Value); + +LIBFUNCTION INTEGER4 LIBCALL TECZAUXSTR100(char *Name, + char *Value); + +LIBFUNCTION INTEGER4 LIBCALL TECVAUXSTR100(INTEGER4 *Var, + char *Name, + char *Value); + +LIBFUNCTION INTEGER4 LIBCALL TECFACE100(INTEGER4 *FaceConnections); + +/* Old V9 functions retained for backward compatibility */ + +LIBFUNCTION INTEGER4 LIBCALL TECINI(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *Debug, + INTEGER4 *VIsDouble); + +LIBFUNCTION INTEGER4 LIBCALL TECZNE(char *ZoneTitle, + INTEGER4 *IMx, + INTEGER4 *JMx, + INTEGER4 *KMx, + char *ZFormat, + char *DupList); + +LIBFUNCTION INTEGER4 LIBCALL TECDAT(INTEGER4 *N, + void *FieldData, + INTEGER4 *IsDouble); + +LIBFUNCTION INTEGER4 LIBCALL TECNOD(INTEGER4 *NData); + +LIBFUNCTION INTEGER4 LIBCALL TECEND(void); + +LIBFUNCTION INTEGER4 LIBCALL TECLAB(char *S); + +LIBFUNCTION INTEGER4 LIBCALL TECUSR(char *S); + +LIBFUNCTION INTEGER4 LIBCALL TECGEO(double *XPos, + double *YPos, + double *ZPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XGeomData, + float *YGeomData, + float *ZGeomData, + char *mfc); + +LIBFUNCTION INTEGER4 LIBCALL TECTXT(double *XPos, + double *YPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + char *Text, + char *mfc); + +LIBFUNCTION INTEGER4 LIBCALL TECFIL(INTEGER4 *F); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +#endif /* TECXXX_H_ */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TEXT.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TEXT.h new file mode 100644 index 0000000000000000000000000000000000000000..06887c923bf30059daaf4204e5d76698166c1cb5 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TEXT.h @@ -0,0 +1,62 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +#if defined EXTERN +#undef EXTERN +#endif +#if defined TEXTMODULE +#define EXTERN +#else +#define EXTERN extern +#endif + +#define _TEXT_H_INCLUDED + +/* These macros for checking CoordSys_e and Units of text objects (i.e., those associated with the text tool). */ +#define VALID_TEXT_COORDSYS(sys) (((sys)==CoordSys_Frame)||((sys)==CoordSys_Grid)||((sys)==CoordSys_Grid3D)) +#define VALID_TEXT_UNITS(units) (((units)==Units_Grid)||((units)==Units_Frame)||((units)==Units_Point)) +#define VALID_TEXT_COORDSYS_AND_UNITS(pos_sys, size_units) \ + ( VALID_TEXT_COORDSYS((pos_sys)) && \ + VALID_TEXT_UNITS((size_units)) && \ + ! ((pos_sys) == CoordSys_Frame && (size_units) == Units_Grid) ) + +/* This is for any type of font in Tecplot. */ +#define VALID_FONT_SIZEUNITS(units) (((units)==Units_Grid)||((units)==Units_Frame)||((units)==Units_Point)||(units)==Units_AxisPercentage) + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if 0 /* contract template */ +#endif +#if 0 /* contract template */ +#endif +#endif /* TECPLOTKERNEL */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5ae0cb73a0aec49e7b36ac4b709c08d4e1202f89 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.cpp @@ -0,0 +1,362 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE +/* +***************************************************************** +***************************************************************** +******* ******** +****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +***************************************************************** +***************************************************************** +*/ + +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" + + +using namespace std; + +namespace tecplot +{ +namespace strutil +{ + +#if defined MSWIN && !defined TECPLOTKERNEL +/** + * Stub function for non-TECPLOTKERNEL + */ +string LookUpTranslation(string& str) +{ + return string(str); +} +#endif + +/** + * Convenience function for creating Utf8 string translations. + * + * @param str + * String to translate. + * + * @return + * A new Utf8 translated string. + */ +static inline string* createUtf8StringTranslation(string& str) +{ +#if defined MSWIN + string *result = new string(LookUpTranslation(str)); +#else + string *result = new string(str); +#endif + ENSURE(VALID_REF(result)); + return result; +} + +#if defined MSWIN +/** + * Convenience function for creating wide string translations. + * + * @param str + * String to translate. + * + * @return + * A new wide translated string. + */ +static inline wstring* createWideStringTranslation(string& str) +{ + wstring *result = new wstring; + *result = StringToWString(LookUpTranslation(str)); + + ENSURE(VALID_REF(result)); + return result; +} +#endif + +#if defined MSWIN +/** + * Convenience function for creating wide string with the given mode. + * + * @param mode + * Indicates if this string is to be translated or not. + * @param str + * String to translate. + * + * @return + * A new wide translated string. + */ +static inline wstring* createWideString(TranslatedString::Mode mode, + string& str) +{ + REQUIRE(mode == TranslatedString::DoTranslate || mode == TranslatedString::DontTranslate); + + wstring* result; + if (mode == TranslatedString::DoTranslate) + result = createWideStringTranslation(str); + else + result = new wstring(StringToWString(str)); + + return result; +} +#endif + +/** + */ +void TranslatedString::init(TranslatedString::Mode mode, + const char* str, + const char* translatorNotes) +{ + REQUIRE(mode == DoTranslate || mode == DontTranslate); + REQUIRE(VALID_REF_OR_NULL(str)); + REQUIRE(VALID_REF_OR_NULL(translatorNotes)); + + m_mode = mode; + m_isNull = (str == NULL); + if (!m_isNull) + m_string = str; + m_utf8String = NULL; // ...on demand resource +#if defined MSWIN + m_wideString = NULL; // ...on demand resource +#endif +} + +/** + */ +TranslatedString::TranslatedString() +{ + init(DontTranslate, (const char*)NULL, (const char*)NULL); + ENSURE(this->isValid()); +} + +/** + */ +TranslatedString TranslatedString::null() +{ + return dontTranslate(NULL); +} + +/** + */ +TranslatedString::TranslatedString(TranslatedString::Mode mode, + const char* str, + const char* translatorNotes) +{ + + REQUIRE(mode == DoTranslate || mode == DontTranslate); + REQUIRE(VALID_REF_OR_NULL(str)); + REQUIRE(VALID_REF_OR_NULL(translatorNotes)); + + init(mode, str, translatorNotes); + ENSURE(this->isValid()); +} + +/** + */ +TranslatedString::~TranslatedString() +{ + delete m_utf8String; +#if defined MSWIN + delete m_wideString; +#endif +} + +#if !defined NO_ASSERTS +/** + */ +bool TranslatedString::isValid() const +{ + CHECK(IMPLICATION(m_isNull, m_string.length() == 0)); +#if 0 + /* TODO(DTO/RMS/CAM): 11/2/2007 + * Code currently exists in Tecplot where we call translate() on a + * variable. This seems wrong and at times (PleaseWait() in + * particular) the variable passed is a NULL pointer which causes + * this assertion to fail. There is not enough time before v11.2 + * release to remove all translate() calls to non-literal strings so + * we'll have to do this as a post release cleanup. For now just + * deactivate this assertion. + */ + CHECK(IMPLICATION(m_isNull, m_mode == DontTranslate)); +#endif + + return true; +} +#endif + +/** + */ +bool TranslatedString::isNull() const +{ + INVARIANT(this->isValid()); + return m_isNull; +} + +/** + */ +bool TranslatedString::isNullOrZeroLength() const +{ + INVARIANT(this->isValid()); + return m_isNull || m_string.length() == 0; +} + +/** + */ +const char* TranslatedString::c_str() +{ + INVARIANT(this->isValid()); + + const char* result = NULL; + if (!isNull()) + { + if (m_mode == DoTranslate) + { + if (m_utf8String == NULL) + m_utf8String = createUtf8StringTranslation(m_string); + result = m_utf8String->c_str(); + } + else // ...if we aren't translating don't bother creating another Utf8 copy just use m_string + result = m_string.c_str(); + } + + ENSURE(result == NULL || VALID_REF(result)); + return result; +} + +#if defined MSWIN +/** + */ +const wchar_t *TranslatedString::c_wstr() +{ + INVARIANT(this->isValid()); + + const wchar_t *result = NULL; + if (!isNull()) + { + if (m_wideString == NULL) + m_wideString = createWideString(m_mode, m_string); + result = m_wideString->c_str(); + } + + ENSURE(result == NULL || VALID_REF(result)); + return result; +} +#endif + +/** + */ +TranslatedString::operator string() +{ + INVARIANT(this->isValid()); + REQUIRE(!isNull()); + + string* result; + if (m_mode == DoTranslate) + { + if (m_utf8String == NULL) + m_utf8String = createUtf8StringTranslation(m_string); + result = m_utf8String; + } + else // ...if we aren't translating don't bother creating another Utf8 copy just use m_string + result = &m_string; + + return *result; +} + +#if defined MSWIN +/** + */ +TranslatedString::operator wstring() +{ + INVARIANT(this->isValid()); + REQUIRE(!isNull()); + + if (m_wideString == NULL) + m_wideString = createWideString(m_mode, m_string); + + return *m_wideString; +} +#endif + +/** + */ +TranslatedString& TranslatedString::operator =(const TranslatedString& other) +{ + REQUIRE(other.isValid()); + + if (this != &other) // ...only perform if not self assignment + { + m_mode = other.m_mode; + m_isNull = other.m_isNull; + m_string = other.m_string; + m_utf8String = (other.m_utf8String != NULL ? new string(*other.m_utf8String) : NULL); +#if defined MSWIN + m_wideString = (other.m_wideString != NULL ? new wstring(*other.m_wideString) : NULL); +#endif + } + + ENSURE(this->isValid()); + return *this; +} + +/** + */ +TranslatedString::TranslatedString(const TranslatedString& other) +{ + REQUIRE(other.isValid()); + + m_mode = other.m_mode; + m_isNull = other.m_isNull; + m_string = other.m_string; + m_utf8String = (other.m_utf8String != NULL ? new string(*other.m_utf8String) : NULL); +#if defined MSWIN + m_wideString = (other.m_wideString != NULL ? new wstring(*other.m_wideString) : NULL); +#endif + + ENSURE(this->isValid()); +} + +/** + */ +TranslatedString TranslatedString::translate(const char* str, + const char* translatorNotes) +{ + REQUIRE(VALID_REF_OR_NULL(str)); + REQUIRE(VALID_REF_OR_NULL(translatorNotes)); + + return TranslatedString(DoTranslate, str, translatorNotes); +} + +/** + */ +TranslatedString TranslatedString::dontTranslate(const char* str) +{ + REQUIRE(VALID_REF_OR_NULL(str)); + + return TranslatedString(DontTranslate, str, NULL); +} + +} +} diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.h new file mode 100644 index 0000000000000000000000000000000000000000..9e3311a2e365cd8b42754d72421fde5775e8dfdb --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.h @@ -0,0 +1,293 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +/* +***************************************************************** +***************************************************************** +******* ******** +****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +***************************************************************** +***************************************************************** +*/ + +#ifndef TECPLOT_STRUTIL_TRANSLATEDSTRING +#define TECPLOT_STRUTIL_TRANSLATEDSTRING + +#if defined MSWIN +#pragma warning(disable : 4181) +#endif + +namespace tecplot +{ +namespace strutil +{ + +/** + * Class responsible for translating strings for internationalization. This + * class is used both to perform the translation and to identify which strings + * are/aren't in need of translation. + * + * With the exception of the empty constructor all translated strings are + * created via static methods or inline helper functions named translate() and + * dontTranslate(). Translated strings created with a call to translate() are + * flagged as needing human translation and return the translated value at + * runtime. Translated strings created with a call to dontTranslate() are + * flagged as not needing human translation and return the non-translated value + * at runtime. Examples: + * + * ErrMsg(translate("Can I have %d cookies?", numCookies); + * ErrMsg(dontTranslate("%s"), errMsgString); + * + * Conversion methods exists for std::string so that they operate well + * together. Therefore you can pass translated strings to methods or functions + * that receive std::string or std::string references. Additionally you can + * perform std::string operations by casting the translated string to a + * std::string. For example: + * + * if (string(dialogTitle).size() != 0) + * ...do something useful + * + * We have intentionally not provided conversion methods for "const char*" (an + * internal representation of the object's string) because of the risk of the + * client using the pointer after the translated string object goes out of + * scope. + * + * @author David Ossorio + */ +class TranslatedString +{ +public: + /** + * Enumeration describing available translation modes. + */ + typedef enum { DontTranslate, DoTranslate } Mode; + + /** + * Constructs an empty translated string. It is equivalent to calling + * TranslatedString::null(). + */ + TranslatedString(); + + /** + * Convenience function for creating a NULL translated string. + * + * @return + * NULL translated string. + */ + static TranslatedString null(); + + /** + * Creates a translated string object and marks it as a string needing + * translation. + * + * @param str + * Character string to translate. + * @param translatorNotes + * Optional notes for the human translator describing the meaning + * of the string. + */ + static TranslatedString translate(const char* str, + const char* translatorNotes = NULL); + + /** + * Creates a translated string object and marks it as a string not needing + * translation. + * + * @param str + * Character string to translate. The str parameter can be a NULL + * pointer. + */ + static TranslatedString dontTranslate(const char* str); + + /** + * Destructor. + */ + virtual ~TranslatedString(); + + /** + * Indicates if the object's string is NULL. + * + * @return + * true if the object's string is NULL, false otherwise. + */ + virtual bool isNull() const; + + /** + * Indicates if the object's string is NULL or zero length. + * + * @return + * true if the object's string is NULL or zero length, false otherwise. + */ + virtual bool isNullOrZeroLength() const; + + /** + * Returns the internal representation of the object's string. Use this + * result carefully. When this object goes out of scope so does this + * references. + * + * @return + * Pointer to the internal representation of the object's string. + */ + virtual const char* c_str(); + +#if defined MSWIN + /** + * Returns the internal representation of the wide character version of the + * object's string. Use this result carefully. When this object goes out of + * scope so does this references. + * + * @return + * Pointer to the internal representation of the object's string. + */ + virtual const wchar_t* c_wstr(); +#endif + + /** + * Returns a copy of the object's string by this object. The result is + * translated or not depending on the platform and how it was created. + * + * @return + * Copy of the object's string. + */ + virtual operator std::string(); + +#if defined MSWIN + /** + * Returns a copy of the wide character version of the object's string. + * The result is translated or not depending on the platform and how it was + * created. + * + * @return + * Copy of the wide character version of the object's string. + */ + virtual operator std::wstring(); +#endif + + /** + * Assignment operator. + */ + virtual TranslatedString& operator =(const TranslatedString& other); + + /** + * Copy constructor. + */ + TranslatedString(const TranslatedString& other); + +#if !defined NO_ASSERTS + /** + * Used only for assertions. + */ + virtual bool isValid() const; +#endif /* !NO_ASSERTS */ + +private: + /** + * Constructs a translated string. This is declared private to make sure + * clients use translate() or dontTranslate() so that Tecplot's translation + * parser can easily extract strings from the source code. + * + * @param mode + * Indicates if this string is to be translated or not at runtime. + * @param str + * Character string to translate. + * @param translatorNotes + * Optional notes for the human translator describing the meaning + * of the string. + */ + TranslatedString(TranslatedString::Mode mode, + const char* str, + const char* translatorNotes); + + /** + * Convenience method for initialize a translated string. + * + * @param mode + * Indicates if this string is to be translated or not at runtime. + * @param str + * Character string to translate. + * @param translatorNotes + * Optional notes for the human translator describing the meaning + * of the string. + */ + void init(TranslatedString::Mode mode, + const char* str, + const char* translatorNotes); + + /** + * Private instance data. + */ + TranslatedString::Mode m_mode; + bool m_isNull; + std::string m_string; + std::string *m_utf8String; +#if defined MSWIN + std::wstring *m_wideString; +#endif +}; + +/** + * Convenience function for creating a translated string object and marking it + * as a string needing translation. + * + * @param str + * Character string to translate. + * @param translatorNotes + * Optional notes for the human translator describing the meaning + * of the string. + */ +inline TranslatedString translate(const char* str, + const char* translatorNotes = NULL) +{ + return TranslatedString::translate(str, translatorNotes); +} + +/** + * Convenience function for creating a translated string object and marking it + * as a string not needing translation. + * + * @param str + * Character string to translate. The str parameter can be a NULL + * pointer. + */ +inline TranslatedString dontTranslate(const char* str) +{ + return TranslatedString::dontTranslate(str); +} + +/** + * Convenience function for creating a translated string object and marks it as + * a string not needing translation. + * + * @param str + * String to translate. + */ +inline TranslatedString dontTranslate(const std::string& str) +{ + return TranslatedString::dontTranslate(str.c_str()); +} + +} +} + +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/VERSION.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/VERSION.h new file mode 100644 index 0000000000000000000000000000000000000000..a6528cf9deaee92e075984c0c4e59dc1e37fd158 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/VERSION.h @@ -0,0 +1,23 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/alloc.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/alloc.cpp new file mode 100644 index 0000000000000000000000000000000000000000..be5a0b0127ac9b40cc17dc25b3ebd71ba4420315 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/alloc.cpp @@ -0,0 +1,161 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" + +#define TECPLOTENGINEMODULE + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +#define ALLOCMODULE +#include "GLOBAL.h" +#include "ALLOC.h" +#include "TASSERT.h" +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TRACK_MEMORY_USAGE +static size_t memInUse = 0; +static size_t memTotalHighMark = 0; +static size_t memCurrentHighMark = 0; +static size_t memSavedHighMark = 0; +Mutex_pa memMutex; + +void initMemoryUsageTracking(void) +{ + REQUIRE(!Thread_ThreadingIsInitialized()); + Thread_InitMutex(&memMutex); +} + +void cleanUpMemoryUsageTracking(void) +{ + REQUIRE(!Thread_ThreadingIsInitialized()); + Thread_FreeMutex(&memMutex); +} + +void trackMemoryClearHighMark(void) +{ + memCurrentHighMark = memInUse; +} + +void trackMemorySaveHighMark(void) +{ + memSavedHighMark = memCurrentHighMark; +} + +void trackMemoryAlloc(size_t size) +{ + REQUIRE(memInUse >= 0); + + if (Thread_ThreadingIsInitialized()) + Thread_LockMutex(memMutex); + + memInUse += size; + if (memInUse > memTotalHighMark) + memTotalHighMark = memInUse; + if (memInUse > memCurrentHighMark) + memCurrentHighMark = memInUse; + + if (Thread_ThreadingIsInitialized()) + Thread_UnlockMutex(memMutex); +} + +void trackMemoryFree(size_t size) +{ + if (Thread_ThreadingIsInitialized()) + Thread_LockMutex(memMutex); + + memInUse -= size; + + if (Thread_ThreadingIsInitialized()) + Thread_UnlockMutex(memMutex); + + ENSURE(memInUse >= 0); +} + +void getMemoryUsage(size_t* memoryInUse, + size_t* memoryCurrentHighMark, + size_t* memorySavedHighMark, + size_t* memoryTotalHighMark) +{ + REQUIRE(VALID_REF_OR_NULL(memoryInUse)); + REQUIRE(VALID_REF_OR_NULL(memoryCurrentHighMark)); + REQUIRE(VALID_REF_OR_NULL(memorySavedHighMark)); + REQUIRE(VALID_REF_OR_NULL(memoryTotalHighMark)); + if (memoryInUse != NULL) + *memoryInUse = memInUse; + if (memoryCurrentHighMark != NULL) + *memoryCurrentHighMark = memCurrentHighMark; + if (memorySavedHighMark != NULL) + *memorySavedHighMark = memSavedHighMark; + if (memoryTotalHighMark != NULL) + *memoryTotalHighMark = memTotalHighMark; +} +#endif + +#if defined MSWIN && defined ALLOC_HEAP +#define HEAPMIN 512 +#endif + +#if defined MSWIN && defined ALLOC_HEAP +/** + */ +void *MSWinAlloc(DWORD nSize) +{ + long *pMem = NULL; + if (nSize < HEAPMIN) + pMem = (long *)malloc(sizeof(long) + nSize); + else + pMem = (long *)HeapAlloc(GetProcessHeap(), NULL, sizeof(long) + nSize); + if (pMem) + pMem[0] = nSize; + return (void *)&(pMem[1]); +} +#endif + +#if defined MSWIN && defined ALLOC_HEAP +/** + */ +void MSWinFree(void *pMem) +{ + REQUIRE(VALID_REF(pMem)); + if (pMem) + { + long *pMemLong = &(((long *)pMem)[-1]); + if (pMemLong[0] < HEAPMIN) + free((void *)pMemLong); + else + HeapFree(GetProcessHeap(), NULL, (void *)pMemLong); + } +} +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/arrlist.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/arrlist.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c4955817eeda7aa202f00045874afd301ccaf495 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/arrlist.cpp @@ -0,0 +1,1671 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE + +/* + ***************************************************************** + ***************************************************************** + ******* ******** + ****** Copyright (C) 1988-2008 Tecplot, Inc. ******** + ******* All Rights Reserved. ******** + ******* ******** + ***************************************************************** + ***************************************************************** + */ + +#define ARRLISTMODULE +#include "GLOBAL.h" +#include "TASSERT.h" +#include "ALLOC.h" +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +#include "ARRLIST.h" + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +/* + * ABSTRACT: + * + * This general purpose list uses an array implementation. The high use member + * functions have macro covers to make the implementation both efficient with + * respect to speed without compromising the internal representation. The + * internal array is allocated to fit the requested type's item size. Most + * intrinsic 'C' and Tecplot types are available. + */ + + +/** + * Copies the private array items from the specified source to the target + * location. The buffers may overlap. + * + * note + * Originally this function was a macro that called memmove + * directly: + * + * #define CopyArrayItems(TargetArray, TargetOffset, \ + * SourceArray, SourceOffset, \ + * Count, ItemSize) \ + * (memmove(&((TargetArray)[(TargetOffset)*ItemSize]), \ + * &((SourceArray)[(SourceOffset)*ItemSize]), \ + * Count*ItemSize)) + * + * This however proved troublesome as some machines replaced the memmove + * with a call to memcpy in the linker. The memcpy function does not support + * overlapping moves so I could not use it. This function should be just + * about as fast however so it is no big deal. + * + * param TargetArray + * Base address of the target array to receive the items. + * param TargetOffset + * Target offset of the first item. + * param SourceArray + * Base address of the source array supplying the items. + * param SourceOffset + * Source offset of the first item. + * param Count + * Number of items to copy. + * param ItemSize + * Item size in bytes. + */ +static void CopyArrayItems(char *TargetArray, + LgIndex_t TargetOffset, + char *SourceArray, + LgIndex_t SourceOffset, + LgIndex_t Count, + SmInteger_t ItemSize) +{ + REQUIRE(VALID_REF(TargetArray)); + REQUIRE(TargetOffset >= 0); + REQUIRE(VALID_REF(SourceArray)); + REQUIRE(SourceOffset >= 0); + REQUIRE(&TargetArray[TargetOffset] != &SourceArray[SourceOffset]); + REQUIRE(Count >= 1); + REQUIRE(1 <= ItemSize && ItemSize <= (SmInteger_t)sizeof(ArrayListItem_u)); + + void* TargetPtr = &TargetArray[TargetOffset * ItemSize]; + void* SourcePtr = &SourceArray[SourceOffset * ItemSize]; + memmove(TargetPtr, SourcePtr, ((size_t)Count) * ItemSize); +} + + +/** + * Adjusts the capacity request as necessary to minimize memory reallocations + * for large lists. Unless the request exceeds the maximum the adjusted + * capacity will be at least as big as requested however it may be larger if it + * is determined that the space requirement is growing faster. If the maximum + * is exceeded zero should be returned. + * + * param ArrayList + * Array list requesting the change in capacity. + * param CurrentCapacity + * Current capacity of the array list. + * param RequestedCapacity + * Capacity request or zero for default size. + * param ClientData + * Any client data needed for the adjustment. + * + * return + * Adjusted capacity that is at least as large as the request or zero if + * unable to satisfy the requested capacity. + */ +static LgIndex_t AdjustCapacityRequest(ArrayList_pa ArrayList, + LgIndex_t CurrentCapacity, + LgIndex_t RequestedCapacity, + ArbParam_t ClientData) +{ + LgIndex_t Result; + + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE((RequestedCapacity == 0 && CurrentCapacity == 0) || + RequestedCapacity > CurrentCapacity); + + if (RequestedCapacity != 0 && CurrentCapacity == 0) + { + /* first allocation; assume the request is the desired capacityy */ + Result = RequestedCapacity; + } + else + { + const LgIndex_t DEFAULT_CAPACITY = 32; + LgIndex_t BlockSize = MAX(DEFAULT_CAPACITY, CurrentCapacity / 2); + if (RequestedCapacity == 0) + Result = DEFAULT_CAPACITY; + else + Result = ((RequestedCapacity - 1) / BlockSize + 1) * BlockSize; + } + + ENSURE(Result == 0 || Result >= RequestedCapacity); + return Result; +} + + +/** + * Gets the size of an individual element. + * + * param Type + * Array list element type. + * + * return + * Element size corresponding to the type. + */ +static SmInteger_t GetElementSize(ArrayListType_e Type) +{ + SmInteger_t Result; + + REQUIRE(VALID_ENUM(Type, ArrayListType_e)); + + switch (Type) + { + case ArrayListType_UnsignedChar: + Result = (SmInteger_t)sizeof(unsigned char); + break; + case ArrayListType_UnsignedShort: + Result = (SmInteger_t)sizeof(unsigned short); + break; + case ArrayListType_UnsignedInt: + Result = (SmInteger_t)sizeof(unsigned int); + break; + case ArrayListType_UnsignedLong: + Result = (SmInteger_t)sizeof(unsigned long); + break; + case ArrayListType_Int64: + Result = (SmInteger_t)sizeof(Int64_t); + break; + case ArrayListType_Char: + Result = (SmInteger_t)sizeof(char); + break; + case ArrayListType_Short: + Result = (SmInteger_t)sizeof(short); + break; + case ArrayListType_Int: + Result = (SmInteger_t)sizeof(int); + break; + case ArrayListType_Long: + Result = (SmInteger_t)sizeof(long); + break; + case ArrayListType_Float: + Result = (SmInteger_t)sizeof(float); + break; + case ArrayListType_Double: + Result = (SmInteger_t)sizeof(double); + break; + case ArrayListType_LgIndex: + Result = (SmInteger_t)sizeof(LgIndex_t); + break; + case ArrayListType_EntIndex: + Result = (SmInteger_t)sizeof(EntIndex_t); + break; + case ArrayListType_SmInteger: + Result = (SmInteger_t)sizeof(SmInteger_t); + break; + case ArrayListType_Boolean: + Result = (SmInteger_t)sizeof(Boolean_t); + break; + case ArrayListType_ArbParam: + Result = (SmInteger_t)sizeof(ArbParam_t); + break; + + case ArrayListType_UnsignedCharPtr: + Result = (SmInteger_t)sizeof(unsigned char *); + break; + case ArrayListType_UnsignedShortPtr: + Result = (SmInteger_t)sizeof(unsigned short *); + break; + case ArrayListType_UnsignedIntPtr: + Result = (SmInteger_t)sizeof(unsigned int *); + break; + case ArrayListType_UnsignedLongPtr: + Result = (SmInteger_t)sizeof(unsigned long *); + break; + case ArrayListType_Int64Ptr: + Result = (SmInteger_t)sizeof(Int64_t *); + break; + case ArrayListType_CharPtr: + Result = (SmInteger_t)sizeof(char *); + break; + case ArrayListType_ShortPtr: + Result = (SmInteger_t)sizeof(short *); + break; + case ArrayListType_IntPtr: + Result = (SmInteger_t)sizeof(int *); + break; + case ArrayListType_LongPtr: + Result = (SmInteger_t)sizeof(long *); + break; + case ArrayListType_FloatPtr: + Result = (SmInteger_t)sizeof(float *); + break; + case ArrayListType_DoublePtr: + Result = (SmInteger_t)sizeof(double *); + break; + case ArrayListType_LgIndexPtr: + Result = (SmInteger_t)sizeof(LgIndex_t *); + break; + case ArrayListType_EntIndexPtr: + Result = (SmInteger_t)sizeof(EntIndex_t *); + break; + case ArrayListType_SmIntegerPtr: + Result = (SmInteger_t)sizeof(SmInteger_t *); + break; + case ArrayListType_BooleanPtr: + Result = (SmInteger_t)sizeof(Boolean_t *); + break; + case ArrayListType_ArbParamPtr: + Result = (SmInteger_t)sizeof(ArbParam_t *); + break; + + case ArrayListType_VoidPtr: + Result = (SmInteger_t)sizeof(void *); + break; + case ArrayListType_FunctionPtr: + Result = (SmInteger_t)sizeof(void (*)()); + break; + case ArrayListType_Any: /* allows a mixed bag of items */ + Result = (SmInteger_t)sizeof(ArrayListItem_u); + break; + + default: + Result = 0; /* make some compilers happy. */ + CHECK(FALSE); + break; + } + + ENSURE(1 <= Result && Result <= (SmInteger_t)sizeof(ArrayListItem_u)); + return Result; +} + + +/** + * Calls the item destructor for each item specified. + * + * param ArrayList + * Array list needing its items destroyed. + * param ItemOffset + * Offset to the first item to destroy in the list. + * param ItemSize + * Size of each array list item. + * param Count + * Number of items to destroy. + * param ItemDestructor + * Function called for each array list item. + * param CientData + * Any client data needed for the destructor. + */ +static void DestroyItems(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + SmInteger_t ItemSize, + LgIndex_t Count, + ArrayListItemDestructor_pf ItemDestructor, + ArbParam_t ClientData) +{ + LgIndex_t Index; + + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1); + REQUIRE(1 <= Count && ItemOffset + Count <= ArrayList->Count); + REQUIRE(VALID_FN_REF(ItemDestructor)); + + for (Index = 0; + Index < Count; + Index++) + { + LgIndex_t ItemIndex = (Index + ItemOffset) * ItemSize; +#if !defined NO_ASSERTS + Boolean_t DoContinue = ItemDestructor((void *) & ArrayList->Array[ItemIndex], ClientData); + CHECK(DoContinue); /* this is a requirement of ArrayListItemDestructor_pf */ +#else + ItemDestructor((void *)&ArrayList->Array[ItemIndex], ClientData); +#endif + } +} + + +/** + * Calls the item duplicator for each item specified. + * + * param TargetArray + * Target array needing its items duplicated. + * param TargetItemOffset + * Target offset to the first duplicated item. + * param SourceArray + * Source array needing its items duplicated. + * param SourceItemOffset + * Source offset to the first item to duplicate in the list. + * param ItemSize + * Size of each array list item. + * param Count + * Number of items to duplicate. + * param ItemDuplicator + * Function called for each array list item. + * param CientData + * Any client data needed for the destructor. + * + * return + * TRUE if the duplication was a success + * FALSE otherwise + */ +static Boolean_t DuplicateItems(char *TargetArray, + LgIndex_t TargetItemOffset, + char *SourceArray, + LgIndex_t SourceItemOffset, + SmInteger_t ItemSize, + LgIndex_t Count, + ArrayListItemDuplicator_pf ItemDuplicator, + ArbParam_t ClientData) +{ + Boolean_t IsOk = TRUE; + LgIndex_t Index; + + REQUIRE(VALID_REF(TargetArray)); + REQUIRE(TargetItemOffset >= 0); + REQUIRE(VALID_REF(SourceArray)); + REQUIRE(SourceItemOffset >= 0); + REQUIRE(1 <= ItemSize && + ItemSize <= (SmInteger_t)sizeof(ArrayListItem_u)); + REQUIRE(Count >= 1); + REQUIRE(VALID_FN_REF(ItemDuplicator)); + + for (Index = 0; + Index < Count && IsOk; + Index++) + { + LgIndex_t TargetItemIndex = (Index + TargetItemOffset) * ItemSize; + LgIndex_t SourceItemIndex = (Index + SourceItemOffset) * ItemSize; + IsOk = ItemDuplicator((void *) & TargetArray[TargetItemIndex], + (void *) & SourceArray[SourceItemIndex], + ClientData); + } + + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +/** + * Determine if the list handle is sane. + * + * param ArrayList + * Array list in question. + * + * return + * TRUE if the array list is valid, otherwise FALSE. + */ +Boolean_t ArrayListIsValid(ArrayList_pa ArrayList) +{ + Boolean_t IsValid; + + /* this just makes sure that the NULL item global was initialized */ + INVARIANT(ArrayListNullItem.Double == 0.0); + + IsValid = (VALID_REF(ArrayList) && + VALID_ENUM(ArrayList->Type, ArrayListType_e) && + (1 <= ArrayList->ItemSize && + ArrayList->ItemSize <= (SmInteger_t)sizeof(ArrayListItem_u)) && + (0 <= ArrayList->Count && + ArrayList->Count <= ArrayList->Capacity)); + + ENSURE(VALID_BOOLEAN(IsValid)); + return IsValid; +} + + +/** + * Gets the specified array list's type. + * + * param ArrayList + * Array list of which the type is desired. + * + * return + * Array list type. + */ +ArrayListType_e ArrayListGetType(ArrayList_pa ArrayList) +{ + ArrayListType_e Result; + + REQUIRE(ArrayListIsValid(ArrayList)); + + Result = ArrayList->Type; + + ENSURE(VALID_ENUM(Result, ArrayListType_e)); + return Result; +} + + +/** + * Enlarge the list capacity to accommodate, at a minimum, the requested + * capacity (number of items). The enlarged section is initialized with zeros. + * This function can be called by clients who want to ensure that calls to + * the ArrayListSetXxx class of functions will never fail for offsets within + * the RequestedCapacity. + * + * param ArrayList + * Current capacity used as a helpful hint for the adjustment algorythm. + * param RequestedCapacity + * Capacity (number ot items) request or zero for default size. + * + * return + * TRUE if the list could be enlarged (or was large enough), + * otherwise FALSE. + */ +Boolean_t ArrayListEnlargeCapacity(ArrayList_pa ArrayList, + LgIndex_t RequestedCapacity) +{ + Boolean_t IsOk; + LgIndex_t AdjustedCapacity; + char *EnlargedArray; + + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(IMPLICATION(RequestedCapacity == 0, ArrayList->Capacity == 0)); + + if (RequestedCapacity == 0 || + RequestedCapacity > ArrayList->Capacity) + { + AdjustedCapacity = + ArrayList->CapacityRequestAdjuster(ArrayList, + ArrayList->Capacity, + RequestedCapacity, + ArrayList->CapacityRequestAdjusterClientData); + CHECK(AdjustedCapacity == 0 || + AdjustedCapacity >= RequestedCapacity); + + IsOk = (AdjustedCapacity != 0); /* ...were we able to meet the request? */ + if (IsOk) + { + EnlargedArray = ALLOC_ARRAY(AdjustedCapacity * ArrayList->ItemSize, + char, "array list"); + if (EnlargedArray == NULL) + { + /* try again with minimum capacity request */ + if (RequestedCapacity != 0) + AdjustedCapacity = RequestedCapacity; + else + AdjustedCapacity = 1; /* can't get smaller than this */ + EnlargedArray = ALLOC_ARRAY(AdjustedCapacity * ArrayList->ItemSize, + char, "array list"); + } + IsOk = (EnlargedArray != NULL); + } + + if (IsOk) + { + /* + * Initialize the expanded section of the array with zeros. This default + * value of zero is necessary for many other array list operations. + */ + memset(&EnlargedArray[ArrayList->Count*ArrayList->ItemSize], 0, + (AdjustedCapacity - ArrayList->Count)*ArrayList->ItemSize); + + if (ArrayList->Array != NULL) + { + if (ArrayList->Count != 0) + CopyArrayItems(EnlargedArray, 0, + ArrayList->Array, 0, + ArrayList->Count, + ArrayList->ItemSize); + FREE_ARRAY(ArrayList->Array, "array list"); + } + + ArrayList->Array = EnlargedArray; + ArrayList->Capacity = AdjustedCapacity; + } + } + else + { + IsOk = TRUE; + } + + ENSURE(ArrayListIsValid(ArrayList)); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +/** + * Allocates an array list handle with the estimated capacity + * or a suitable default if an estimate is unavailable. + * + * param EstimatedCapacity + * Clients best guess at the estimated capacity (number of items) needed. + * If an estimate is not available zero the zero should be used to get the + * default capacity. + * param Type + * Type of array list being allocated. + * param CapacityRequestAdjuster + * Function to use to adjust any capacity change requests or + * NULL if the default adjuster is good enough. + * param CapacityRequestAdjusterClientData + * Any client data needed for the capacity adjustment. + * + * return + * Array list handle if sufficient memory was available, + * otherwise a handle to NULL. + */ +ArrayList_pa ArrayListAlloc(LgIndex_t EstimatedCapacity, + ArrayListType_e Type, + ArrayListCapacityRequestAdjuster_pf CapacityRequestAdjuster, + ArbParam_t CapacityRequestAdjusterClientData) +{ + ArrayList_pa Result; + + REQUIRE(EstimatedCapacity >= 0); + REQUIRE(VALID_ENUM(Type, ArrayListType_e)); + + Result = ALLOC_ITEM(ArrayList_s, "ArrayList structure"); + if (Result != NULL) + { + Result->Array = NULL; + Result->Type = Type; + Result->ItemSize = GetElementSize(Type); + Result->Count = 0; + Result->Capacity = 0; + Result->IsVisitingItems = FALSE; + if (CapacityRequestAdjuster != NULL) + { + /* install the client's capacity request adjuster */ + Result->CapacityRequestAdjuster = CapacityRequestAdjuster; + Result->CapacityRequestAdjusterClientData = CapacityRequestAdjusterClientData; + } + else + { + /* install the default capacity request adjuster */ + Result->CapacityRequestAdjuster = AdjustCapacityRequest; + Result->CapacityRequestAdjusterClientData = 0; + } + + /* enalarge the list to the estimated capacity */ + if (!ArrayListEnlargeCapacity(Result, EstimatedCapacity)) + ArrayListDealloc(&Result, NULL, 0); + } + + ENSURE(ArrayListIsValid(Result) || Result == NULL); + ENSURE(IMPLICATION(Result != NULL, Result->Capacity >= EstimatedCapacity)); + return Result; +} + + +/** + * Deallocates the list handle and set the handle to NULL. + * + * param ArrayList + * Reference to an array list handle. + * param ItemDestructor + * Destructor responsible for array list item cleanup or + * NULL if no item cleanup is desired. + * param ClientData + * Any client data needed for cleanup. + */ +void ArrayListDealloc(ArrayList_pa *ArrayList, + ArrayListItemDestructor_pf ItemDestructor, + ArbParam_t ClientData) +{ + REQUIRE(VALID_REF(ArrayList)); + REQUIRE(ArrayListIsValid(*ArrayList) || *ArrayList == NULL); + REQUIRE(VALID_FN_REF(ItemDestructor) || ItemDestructor == NULL); + + if (*ArrayList != NULL) + { + /* request item cleanup if a destructor was supplied */ + if (ItemDestructor != NULL && (*ArrayList)->Count != 0) + DestroyItems(*ArrayList, 0, (*ArrayList)->ItemSize, (*ArrayList)->Count, + ItemDestructor, ClientData); + + /* release the list */ + if ((*ArrayList)->Capacity != 0) + FREE_ARRAY((*ArrayList)->Array, "array list"); + + /* release the list structure itself */ + FREE_ITEM(*ArrayList, "ArrayList structure"); + *ArrayList = NULL; + } + + ENSURE(*ArrayList == NULL); +} + + +#if !defined USE_MACROS_FOR_FUNCTIONS +/** + * Gets the number of items currently maintained by the list. + * + * param + * Array list in question. + * + * return + * Number of items maintained by the list. + */ +LgIndex_t ArrayListGetCount_FUNC(ArrayList_pa ArrayList) +{ + LgIndex_t Result; + + REQUIRE(ArrayListIsValid(ArrayList)); + + Result = ArrayListGetCount_MACRO(ArrayList); + + ENSURE(Result >= 0); + return Result; +} +#endif + + +/** + * Empties the array list of all items. + * + * param ArrayList + * Array list from which to delete all items. + * param ItemDestructor + * Destructor responsible for array list item cleanup or + * NULL if no item cleanup is desired. + * param ClientData + * Any client data needed for cleanup. + */ +void ArrayListDeleteAllItems(ArrayList_pa ArrayList, + ArrayListItemDestructor_pf ItemDestructor, + ArbParam_t ClientData) +{ + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(VALID_FN_REF(ItemDestructor) || ItemDestructor == NULL); + REQUIRE(!ArrayList->IsVisitingItems); + + /* request item cleanup if a destructor was supplied */ + if (ItemDestructor != NULL && ArrayList->Count != 0) + DestroyItems(ArrayList, 0, ArrayList->ItemSize, ArrayList->Count, + ItemDestructor, ClientData); + + /* + * Fill the vacated items with zeros. This default value of zero is necessary + * for many other array list operations. + */ + if (ArrayList->Count != 0) + memset(&ArrayList->Array[0], 0, ArrayList->Count*ArrayList->ItemSize); + + ArrayList->Count = 0; + + ENSURE(ArrayListIsValid(ArrayList) && ArrayList->Count == 0); +} + + +/** + * Deletes 'Count' items from the array list. The members following the + * items deleted are shifted down accordingly to fill the vacated space. + * + * param ArrayList + * Array list containing the items to delete. + * param ItemOffset + * Offset to the first item to delete in the list. + * param Count + * Number of items to delete. + * param ItemDestructor + * Destructor responsible for array list item cleanup or + * NULL if no item cleanup is desired. + * param ClientData + * Any client data needed for cleanup. + */ +void ArrayListDeleteItems(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + LgIndex_t Count, + ArrayListItemDestructor_pf ItemDestructor, + ArbParam_t ClientData) +{ + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1); + REQUIRE(1 <= Count && ItemOffset + Count <= ArrayList->Count); + REQUIRE(VALID_FN_REF(ItemDestructor) || ItemDestructor == NULL); + REQUIRE(!ArrayList->IsVisitingItems); + + /* release the items if a destructor is installed */ + if (ItemDestructor != NULL) + DestroyItems(ArrayList, ItemOffset, ArrayList->ItemSize, Count, + ItemDestructor, ClientData); + + /* if we deleted the items from the middle of the array then */ + /* shift the end items down by 'Count' to fill the vacated space */ + if (ItemOffset + Count < ArrayList->Count) + CopyArrayItems(ArrayList->Array, ItemOffset, + ArrayList->Array, ItemOffset + Count, + ArrayList->Count - (ItemOffset + Count), + ArrayList->ItemSize); + /* + * Fill the vacated items with zeros. This default value of zero is necessary + * for many other array list operations. + */ + memset(&ArrayList->Array[(ArrayList->Count - Count)*ArrayList->ItemSize], + 0, Count*ArrayList->ItemSize); + + /* update the count but leave the capacity alone */ + ArrayList->Count -= Count; + + ENSURE(ArrayListIsValid(ArrayList)); +} + + +/** + * Deletes an item from the array list. The members following the item + * deleted are shifted down accordingly to fill the vacated space. + * + * param ArrayList + * Array list containing the item to delete. + * param ItemOffset + * Offset to the item in the list. + * param ItemDestructor + * Destructor responsible for array list item cleanup or + * NULL if no item cleanup is desired. + * param ClientData + * Any client data needed for cleanup. + */ +void ArrayListDeleteItem(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + ArrayListItemDestructor_pf ItemDestructor, + ArbParam_t ClientData) +{ + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1); + REQUIRE(VALID_FN_REF(ItemDestructor) || ItemDestructor == NULL); + + ArrayListDeleteItems(ArrayList, ItemOffset, 1, ItemDestructor, ClientData); + + ENSURE(ArrayListIsValid(ArrayList)); +} + + +/** + * Removes 'Count' items from the array list beginning at the specified + * item offset. The members following the items removed are shifted down + * accordingly to fill the vacated space. + * + * param ArrayList + * Array list containing the items to remove. + * param ItemOffset + * Offset to the first item to remove in the list. + * param Count + * Number of items to remove. + * + * return + * Array list handle referring to the removed items if sufficient + * memory was available, otherwise a handle to NULL. + */ +ArrayList_pa ArrayListRemoveItems(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + LgIndex_t Count) +{ + ArrayList_pa Result; + + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1); + REQUIRE(1 <= Count && ItemOffset + Count <= ArrayList->Count); + REQUIRE(!ArrayList->IsVisitingItems); + + /* get a copy of the items and delete them from the source */ + Result = ArrayListGetItems(ArrayList, ItemOffset, Count); + if (Result != NULL) + ArrayListDeleteItems(ArrayList, ItemOffset, Count, NULL, 0); + + ENSURE(ArrayListIsValid(ArrayList)); + ENSURE(ArrayListIsValid(Result) || Result == NULL); + return Result; +} + + +/** + * Removes an item from the array list. The members following the item + * removed are shifted down accordingly to fill the vacated space. + * + * param ArrayList + * Array list containing the item to remove. + * param ItemOffset + * Offset to the item in the list. + * + * return + * Item removed from the array list. + */ +ArrayListItem_u ArrayListRemoveItem(ArrayList_pa ArrayList, + LgIndex_t ItemOffset) +{ + ArrayListItem_u Result; + + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1); + REQUIRE(!ArrayList->IsVisitingItems); + + /* record the original item */ + CopyArrayItems((char *)&Result, 0, + ArrayList->Array, ItemOffset, + 1, ArrayList->ItemSize); + + /* delete the item from the array */ + ArrayListDeleteItems(ArrayList, ItemOffset, 1, NULL, 0); + + ENSURE(ArrayListIsValid(ArrayList)); + return Result; +} + + +/** + * Inserts copies of the items from the source list to the target list at + * the specified offset. The target list will expand to accommodate the + * additional items. The source list remains unchanged. + * + * param Target + * Array list receiving the source items. + * param ItemOffset + * Offset at which to insert the source list items. + * param Source + * Array list supplying the source items. + * + * return + * TRUE if sufficient memory permitted the operation, otherwise FALSE. + */ +Boolean_t ArrayListInsert(ArrayList_pa Target, + LgIndex_t ItemOffset, + ArrayList_pa Source) +{ + Boolean_t IsOk = TRUE; + + REQUIRE(ArrayListIsValid(Target)); + REQUIRE(ItemOffset >= 0); + REQUIRE(ArrayListIsValid(Source)); + REQUIRE(Target != Source); + REQUIRE(Target->Type == Source->Type); + REQUIRE(!Target->IsVisitingItems); + + if (Source->Count != 0) + { + LgIndex_t NeededCapacity; + + /* if necessary enlarge the target list to accommodate the request */ + if (ItemOffset > Target->Count) + NeededCapacity = ItemOffset + Source->Count; + else + NeededCapacity = Target->Count + Source->Count; + if (NeededCapacity > Target->Capacity) + IsOk = ArrayListEnlargeCapacity(Target, NeededCapacity); + + if (IsOk) + { + if (ItemOffset < Target->Count) + { + /* shift all items in the target list ahead of the */ + /* insert position up by the number of items in the */ + /* source list to make room for the new items */ + CopyArrayItems(Target->Array, ItemOffset + Source->Count, + Target->Array, ItemOffset, + Target->Count - ItemOffset, + Target->ItemSize); + Target->Count += Source->Count; + } + else + { + /* no shifting to do, just update the count */ + if (ItemOffset > Target->Count) + Target->Count = ItemOffset + Source->Count; + else + Target->Count += Source->Count; + } + + /* insert the items and update the count */ + CopyArrayItems(Target->Array, ItemOffset, + Source->Array, 0, + Source->Count, Source->ItemSize); + } + } + + ENSURE(ArrayListIsValid(Target)); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +/** + * Inserts the item into the array list at the specified offset. The list will + * be expanded to accommodate the additional item. If the offset is beyond the + * end of the list it is sized accordingly and the intervening items between + * the last item of the original state and the last item of the new state are + * guaranteed to be 0. + * + * param ArrayList + * Array list target in which to insert the item. + * param ItemOffset + * Offset at which to insert the item. + * param Item + * Item to insert at the specified offset. + * + * return + * TRUE if sufficient memory permitted the operation, otherwise FALSE. + */ +Boolean_t ArrayListInsertItem(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + ArrayListItem_u Item) +{ + Boolean_t IsOk = TRUE; + LgIndex_t NeededCapacity; + + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(ItemOffset >= 0); + REQUIRE(!ArrayList->IsVisitingItems); + + /* if necessary enlarge the list to accommodate the request */ + if (ItemOffset > ArrayList->Count) + NeededCapacity = ItemOffset + 1; + else + NeededCapacity = ArrayList->Count + 1; + if (NeededCapacity > ArrayList->Capacity) + IsOk = ArrayListEnlargeCapacity(ArrayList, NeededCapacity); + + if (IsOk) + { + if (ItemOffset < ArrayList->Count) + { + /* shift all items in the target list ahead of the insert */ + /* position up by one to make room for the new item */ + CopyArrayItems(ArrayList->Array, ItemOffset + 1, + ArrayList->Array, ItemOffset, + ArrayList->Count - ItemOffset, + ArrayList->ItemSize); + ArrayList->Count++; + } + else + { + /* no shifting to do, just update the count */ + if (ItemOffset > ArrayList->Count) + ArrayList->Count = ItemOffset + 1; + else + ArrayList->Count++; + } + + /* insert the item */ + CopyArrayItems(ArrayList->Array, ItemOffset, + (char *)&Item, 0, + 1, ArrayList->ItemSize); + } + + ENSURE(ArrayListIsValid(ArrayList)); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +/** + * Visits array list items calling the item visitor for each item. + * + * param ArrayList + * Array list needing its items destroyed. + * param ItemOffset + * Offset to the first item to visit from the list. + * param Count + * Number of items to visit. + * param ItemVisitor + * Function called for each array list item. + * param CientData + * Any client data needed for the visitor. + * + * return + * TRUE if the all element were visited, otherwise + * FALSE if the visitation was terminated early + */ +Boolean_t ArrayListVisitItems(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + LgIndex_t Count, + ArrayListItemVisitor_pf ItemVisitor, + ArbParam_t ClientData) +{ + Boolean_t DoContinue = TRUE; + Boolean_t IsVisitingItems; + SmInteger_t ItemSize; + LgIndex_t Index; + + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(VALID_FN_REF(ItemVisitor)); + + IsVisitingItems = ArrayList->IsVisitingItems; + ArrayList->IsVisitingItems = TRUE; /* guards against structure changes */ + + for (Index = 0, ItemSize = ArrayList->ItemSize; + Index < Count && DoContinue; + Index++) + { + LgIndex_t ItemIndex = (Index + ItemOffset) * ItemSize; + DoContinue = ItemVisitor((void *) & ArrayList->Array[ItemIndex], ClientData); + } + + ArrayList->IsVisitingItems = IsVisitingItems; + + ENSURE(ArrayList->IsVisitingItems == IsVisitingItems); + ENSURE(VALID_BOOLEAN(DoContinue)); + return DoContinue; +} + + +/** + * Gets copies of 'Count' items from the array list beginning at the + * specified item offset. Note that if the items are pointer types + * the copies are of the pointers and not the pointees. + * + * param ArrayList + * Array list containing the items to copy. + * param ItemOffset + * Offset to the first item to copy from the list. + * param Count + * Number of items to copy. + * + * return + * Array list handle referring to the copied items if sufficient + * memory was available, otherwise a handle to NULL. + */ +ArrayList_pa ArrayListGetItems(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + LgIndex_t Count) +{ + ArrayList_pa Result; + + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1); + REQUIRE(1 <= Count && ItemOffset + Count <= ArrayList->Count); + + Result = ArrayListAlloc(Count, ArrayList->Type, + ArrayList->CapacityRequestAdjuster, + ArrayList->CapacityRequestAdjusterClientData); + if (Result != NULL) + { + /* copy the original items into the result */ + CopyArrayItems(Result->Array, 0, + ArrayList->Array, ItemOffset, + Count, ArrayList->ItemSize); + Result->Count = Count; + } + + ENSURE(ArrayListIsValid(ArrayList)); + ENSURE(ArrayListIsValid(Result) || Result == NULL); + return Result; +} + + +/** + * Gets the item at the specified offset in the list. + * + * param ArrayList + * Array list containing the desired item. + * param ItemOffset + * Offset to the item in the list. + * + * return + * The requested item. + */ +ArrayListItem_u ArrayListGetItem(ArrayList_pa ArrayList, + LgIndex_t ItemOffset) +{ + ArrayListItem_u Result; + + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1); + + CopyArrayItems((char *)&Result, 0, + ArrayList->Array, ItemOffset, + 1, ArrayList->ItemSize); + + return Result; +} + + +#if !defined USE_MACROS_FOR_FUNCTIONS +/** + * Gets the item's internal reference at the specified offset in the list. + * + * WARNING: + * Some array list functions modify the internal buffer. + * This will invalidate this reference however it is + * the client's responsibility not to make further use + * of it. In addition, this reference should never be + * deallocated directly as the array list assumes the + * responsible for the cleanup. + * + * param ArrayList + * Array list containing the desired item. + * param ItemOffset + * Offset to the item in the list. + * + * return + * The internal reference to the requested item. + */ +const void *ArrayListGetItemInternalRef_FUNC(ArrayList_pa ArrayList, + LgIndex_t ItemOffset) +{ + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1); + + const void *Result = ArrayListGetItemInternalRef_MACRO(ArrayList, ItemOffset); + ENSURE(Result == NULL || VALID_REF(Result)); + return Result; +} +#endif + + +/** + * Places the item at the specified offset. If the offset is beyond the + * end of the list it is sized accordingly and the intervening items + * between the last item of the original state and the last item of the + * new state are guaranteed to be 0. + * + * param ArrayList + * Array list target in which to set the item. + * param ItemOffset + * Offset of the item. + * param Item + * Item to set at the specified offset. + * param ItemDestructor + * Destructor responsible for array list item cleanup or + * NULL if no item cleanup is desired. + * param ClientData + * Any client data needed for cleanup. + * + * return + * TRUE if sufficient memory permitted the operation, otherwise FALSE. + */ +Boolean_t ArrayListSetItem(ArrayList_pa ArrayList, + LgIndex_t ItemOffset, + ArrayListItem_u Item, + ArrayListItemDestructor_pf ItemDestructor, + ArbParam_t ClientData) +{ + Boolean_t IsOk = TRUE; + + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(ItemOffset >= 0); + REQUIRE(VALID_FN_REF(ItemDestructor) || ItemDestructor == NULL); + REQUIRE(IMPLICATION(ItemOffset + 1 > ArrayList->Count, + !ArrayList->IsVisitingItems)); + + /* release the item if a destructor is installed */ + if (ItemDestructor != NULL && ItemOffset < ArrayList->Count) + DestroyItems(ArrayList, ItemOffset, ArrayList->ItemSize, 1, + ItemDestructor, ClientData); + + /* if necessary enlarge the list to accommodate the request */ + if (ItemOffset + 1 > ArrayList->Capacity) + IsOk = ArrayListEnlargeCapacity(ArrayList, ItemOffset + 1); + + if (IsOk) + { + if (ItemOffset + 1 > ArrayList->Count) + ArrayList->Count = ItemOffset + 1; + CopyArrayItems(ArrayList->Array, ItemOffset, + (char *)&Item, 0, + 1, ArrayList->ItemSize); + } + + ENSURE(ArrayListIsValid(ArrayList)); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +/** + * Appends the item to the list. The list will be expanded + * to accommodate the additional item. + * + * param ArrayList + * Array list target to which the item is to be appended. + * param Item + * Item to append to the array list. + * + * return + * TRUE if sufficient memory permitted the operation, otherwise FALSE. + */ +Boolean_t ArrayListAppendItem(ArrayList_pa ArrayList, + ArrayListItem_u Item) +{ + Boolean_t IsOk; + + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(!ArrayList->IsVisitingItems); + + IsOk = ArrayListInsertItem(ArrayList, ArrayList->Count, Item); + + ENSURE(ArrayListIsValid(ArrayList)); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +/** + * Appends copies of the items from the source list to the target list. + * The source list remains unchanged. + * + * param Target + * Array list receiving the source items. + * param Source + * Array list supplying the source items. + * + * return + * TRUE if sufficient memory permitted the operation, otherwise FALSE. + */ +Boolean_t ArrayListAppend(ArrayList_pa Target, + ArrayList_pa Source) +{ + Boolean_t IsOk; + + REQUIRE(ArrayListIsValid(Target)); + REQUIRE(ArrayListIsValid(Source)); + REQUIRE(Target != Source); + REQUIRE(Target->Type == Source->Type); + REQUIRE(!Target->IsVisitingItems); + + IsOk = ArrayListInsert(Target, Target->Count, Source); + + ENSURE(ArrayListIsValid(Target)); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +/** + * Copies the items of the array list. + * + * param ArrayList + * Array list to copy. + * param ItemDuplicator + * Duplicator responsible for array list item duplication or + * NULL if an exact item copy is desired. In other words for + * pointer types the effect is copy by reference. + * param ClientData + * Any client data needed for duplication. + * + * return + * Handle to a duplicate of the specified array list if sufficient + * memory permitted the operation, otherwise NULL. + */ +ArrayList_pa ArrayListCopy(ArrayList_pa ArrayList, + ArrayListItemDuplicator_pf ItemDuplicator, + ArbParam_t ClientData) +{ + ArrayList_pa Result; + + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(VALID_FN_REF(ItemDuplicator) || ItemDuplicator == NULL); + + Result = ArrayListAlloc(ArrayList->Count, ArrayList->Type, + ArrayList->CapacityRequestAdjuster, + ArrayList->CapacityRequestAdjusterClientData); + if (Result != NULL && ArrayList->Count != 0) + { + Boolean_t IsOk = TRUE; + if (ItemDuplicator != NULL) + /* client defines how the item duplication is performed */ + IsOk = DuplicateItems(Result->Array, 0, + ArrayList->Array, 0, + ArrayList->ItemSize, ArrayList->Count, + ItemDuplicator, ClientData); + else + /* copy the original items into the result */ + CopyArrayItems(Result->Array, 0, + ArrayList->Array, 0, + ArrayList->Count, + ArrayList->ItemSize); + if (IsOk) + Result->Count = ArrayList->Count; + else + ArrayListDealloc(&Result, NULL, 0); + } + + ENSURE(Result == NULL || + (ArrayListIsValid(Result) && Result->Count == ArrayList->Count)); + return Result; +} + + +/** + * Creates a native 'C' array containing copies of the items held in the + * source array list. + * + * param Source + * Array list containing the items of interest. + * param ItemDuplicator + * Duplicator responsible for array list item duplication or + * NULL if an exact item copy is desired. In other words for + * pointer types the effect is copy by reference. + * param ClientData + * Any client data needed for duplication. + * + * return + * Allocated array populated with copies of the members of the array list + * or NULL if there are no items in the list or if the allocation was + * not successful. The caller is responsible for deallocation of the + * array (but not the individual members unless a item duplication function + * was supplied) when it is no longer needed. + */ +void *ArrayListToArray(ArrayList_pa Source, + ArrayListItemDuplicator_pf ItemDuplicator, + ArbParam_t ClientData) +{ + void *Result; + + REQUIRE(ArrayListIsValid(Source)); + REQUIRE(VALID_FN_REF(ItemDuplicator) || ItemDuplicator == NULL); + + if (Source->Count != 0) + Result = (void *)ALLOC_ARRAY(Source->Count * Source->ItemSize, + char, "native array"); + else + Result = NULL; + + if (Result != NULL) + { + Boolean_t IsOk = TRUE; + if (ItemDuplicator != NULL) + /* client defines how the item duplication is performed */ + IsOk = DuplicateItems((char*)Result, 0, + Source->Array, 0, + Source->ItemSize, Source->Count, + ItemDuplicator, ClientData); + else + /* copy the original items into the result */ + CopyArrayItems((char *)Result, 0, + Source->Array, 0, + Source->Count, + Source->ItemSize); + if (!IsOk) + { + /* Hack to remove delete warning... */ + char *Tmp = (char *)Result; + FREE_ARRAY(Tmp, "native array"); + } + } + + ENSURE(VALID_REF(Result) || Result == NULL); + return Result; +} + + +/** + * Creates an array list containing copies of the items held in the + * native 'C' array. + * + * param Source + * Native 'C' array containing the items of interest. + * param Count + * Number of items contained in the native 'C' array. + * param Type + * Type of items contained in the native 'C' array. + * param ItemDuplicator + * Duplicator responsible for array list item duplication or + * NULL if an exact item copy is desired. In other words for + * pointer types the effect is copy by reference. + * param ClientData + * Any client data needed for duplication. + * + * return + * Array list handle containing copies of the items held in the + * native 'C' array if sufficient memory was available, otherwise + * a handle to NULL. + */ +ArrayList_pa ArrayListFromArray(void *Source, + LgIndex_t Count, + ArrayListType_e Type, + ArrayListItemDuplicator_pf ItemDuplicator, + ArbParam_t ClientData) +{ + ArrayList_pa Result; + + REQUIRE(VALID_REF(Source)); + REQUIRE(Count >= 0); + REQUIRE(VALID_ENUM(Type, ArrayListType_e)); + REQUIRE(VALID_FN_REF(ItemDuplicator) || ItemDuplicator == NULL); + + Result = ArrayListAlloc(Count, Type, NULL, 0); + if (Result != NULL && Count != 0) + { + Boolean_t IsOk = TRUE; + if (ItemDuplicator != NULL) + /* client defines how the item duplication is performed */ + IsOk = DuplicateItems(Result->Array, 0, + (char*)Source, 0, + Result->ItemSize, Count, + ItemDuplicator, ClientData); + else + /* copy the original items into the result */ + CopyArrayItems(Result->Array, 0, + (char *)Source, 0, + Count, Result->ItemSize); + if (IsOk) + Result->Count = Count; + else + ArrayListDealloc(&Result, NULL, 0); + } + + ENSURE(ArrayListIsValid(Result) || Result == NULL); + return Result; +} + + +/** + * Holds the comparator function pointer for sorting. + */ +static ArrayListItemComparator_pf ComparatorFunction = NULL; + + +/** + * Holds the context for comparisons. This information is forwarded to + * the item comparator function for sorting. + */ +static ArbParam_t ComparatorClientData = 0; + + +/** + * Holds the item size of the individual array components for sorting. + */ +static SmInteger_t ComparatorItemSize = 0; + + +/** + * Forwards the comparison test to the 'Comparator' supplied to the + * 'ArrayListQSort' function. + * + * param Item1Ref + * Reference to base address of Item1. + * param Item2Ref + * Reference to base address of Item2. + * + * return + * - A value less than zero if Item1 is less than Item2. + * - A value of zero if Item1 is equal to Item2. + * - A value greater than zero if Item1 is greater than Item2. + */ +static int QSortCompareItemsAdapter(const void *Item1Ref, + const void *Item2Ref) +{ + int Result; + ArrayListItem_u Item1; + ArrayListItem_u Item2; + + REQUIRE(Item1Ref != NULL); + REQUIRE(Item2Ref != NULL); + + /* collect up the items */ + CopyArrayItems((char *)&Item1, 0, + (char *)Item1Ref, 0, + 1, ComparatorItemSize); + CopyArrayItems((char *)&Item2, 0, + (char *)Item2Ref, 0, + 1, ComparatorItemSize); + + /* forward the call */ + Result = ComparatorFunction(Item1, Item2, ComparatorClientData); + + ENSURE(Result == -1 || Result == 0 || Result == 1); + return Result; +} + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +/** + * Sorts the array list using the qsort algorithm. + * + * param ArrayList + * Array list to sort. + * param Comparator + * Function called to compare two array list elements. + * param ClientData + * Contextual information that is passed along to the comparator function. + */ +void ArrayListQSort(ArrayList_pa ArrayList, + ArrayListItemComparator_pf Comparator, + ArbParam_t ClientData) +{ + ArrayListItemComparator_pf CurComparatorFunction; + ArbParam_t CurComparatorClientData; + SmInteger_t CurComparatorItemSize; + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(VALID_FN_REF(Comparator)); + + /* to support sort recursion we need to save off the current values */ + CurComparatorFunction = ComparatorFunction; + CurComparatorClientData = ComparatorClientData; + CurComparatorItemSize = ComparatorItemSize; + + /* set up for comparison proxy */ + ComparatorFunction = Comparator; + ComparatorClientData = ClientData; + ComparatorItemSize = ArrayList->ItemSize; + + /* sort the array */ + qsort(ArrayList->Array, ArrayList->Count, + ArrayList->ItemSize, QSortCompareItemsAdapter); + + /* cleanup */ + ComparatorFunction = CurComparatorFunction; + ComparatorClientData = CurComparatorClientData; + ComparatorItemSize = CurComparatorItemSize; + + ENSURE(ArrayListIsValid(ArrayList)); +} + +/** + * Binary searches a sorted array looking for a match using the supplied + * comparator function. If a match is found the resulting item index refers to + * the location otherwise it refers to the location where the item could be + * inserted in sorted order. + * + * param ArrayList + * Array list to sort. + * param Item + * The item for which to search. + * param Comparator + * Function called to compare the Item to the array list elements. + * param ClientData + * Contextual information that is passed along to the comparator function. + * param ItemIndex + * Pointer to the resulting position where the item was found or where the + * item could be inserted in sorted order. If the pointer is NULL the + * result position is not returned. + * + * result + * TRUE if the item was found in the list, FALSE otherwise. + */ +Boolean_t ArrayListBSearch(ArrayList_pa ArrayList, + ArrayListItem_u Item, + ArrayListItemComparator_pf Comparator, + ArbParam_t ClientData, + LgIndex_t *ItemIndex) +{ + REQUIRE(ArrayListIsValid(ArrayList)); + REQUIRE(VALID_FN_REF(Comparator)); + REQUIRE(ItemIndex == NULL || VALID_REF(ItemIndex)); + + LgIndex_t MiddleItemIndex = 0; + LgIndex_t FirstItemIndex = 0; + LgIndex_t NumItems = ArrayListGetCount(ArrayList); + LgIndex_t LastItemIndex = NumItems - 1; + Boolean_t Found = FALSE; + while (FirstItemIndex <= LastItemIndex && !Found) + { + /* calculate the middle item index for current sub-range */ + MiddleItemIndex = (FirstItemIndex + LastItemIndex) / 2; + + int CompareResult = Comparator(ArrayListGetItem(ArrayList, MiddleItemIndex), Item, ClientData); + if (CompareResult > 0) + LastItemIndex = MiddleItemIndex - 1; + else if (CompareResult < 0) + FirstItemIndex = MiddleItemIndex + 1; + else + Found = TRUE; + } + + if (ItemIndex != NULL) + { + if (Found || NumItems == 0 || FirstItemIndex < NumItems) + *ItemIndex = MiddleItemIndex; + else + *ItemIndex = NumItems; /* ...in other words it goes on the end */ + } + + ENSURE(IMPLICATION(ItemIndex != NULL, + 0 <= *ItemIndex && *ItemIndex <= ArrayListGetCount(ArrayList))); + ENSURE(VALID_BOOLEAN(Found)); + return Found; +} + +#if !defined USE_MACROS_FOR_FUNCTIONS +/** + * Gets the array list's internal buffer representation. + * + * WARNING: + * Some array list functions modify the internal buffer. + * This will invalidate this reference however it is + * the client's responsibility not to make further use + * of it. In addition, this reference should never be + * deallocated directly as the array list assumes the + * responsible for the cleanup. + * + * param ArrayList + * Array list for which a reference to the internal + * buffer is desired. + * + * return + * Reference to the array list's internal buffer. + */ +const void *ArrayListGetInternalRef_FUNC(ArrayList_pa ArrayList) +{ + REQUIRE(ArrayListIsValid(ArrayList)); + + const void *Result = ArrayListGetInternalRef_MACRO(ArrayList); + ENSURE(Result == NULL || VALID_REF(Result)); + return Result; +} +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/auxdata.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/auxdata.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c42b2220461b2fea7dc6c5d7aa44ae16be239684 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/auxdata.cpp @@ -0,0 +1,809 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE + +/* + ***************************************************************** + ***************************************************************** + ******* ******** + ****** Copyright (C) 1988-2008 Tecplot, Inc. ******** + ******* All Rights Reserved. ******** + ******* ******** + ***************************************************************** + ***************************************************************** + */ + +#define AUXDATAMODULE +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" +#include "ALLOC.h" +#include "STRUTIL.h" +#include "ARRLIST.h" +#include "DATASET.h" +#include "STRLIST.h" +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +#include "SET.h" +#include "AUXDATA.h" + +using namespace tecplot::strutil; + +/** + * Private auxiliary data item structure. + */ +typedef struct +{ + const char *Name; + ArbParam_t Value; + AuxDataType_e Type; + Boolean_t Retain; +} AuxDataItem_s; + +/** + * Private auxiliary data item container structure. + */ +typedef struct _AuxData_s +{ + /* invariant: ItemList is case-insensitive sorted by AuxDataItem->Name */ + ArrayList_pa ItemList; /* <AuxDataItem_s *>[dynamic] */ +} AuxData_s; + +static Mutex_pa AuxDataMutex = NULL; + + +/** + * A valid auxiliary data name character must begin with a '_' or alpha + * character and may be followed by one or more '_', '.', alpha or digit + * characters. + */ +Boolean_t AuxDataIsValidNameChar(char Char, + Boolean_t IsLeadChar) +{ + Boolean_t IsValidNameChar; + + REQUIRE("Char can be any value"); + REQUIRE(VALID_BOOLEAN(IsLeadChar)); + + IsValidNameChar = (Char == '_' || + isalpha(Char)); + if (!IsLeadChar) + IsValidNameChar = (IsValidNameChar || + Char == '.' || + isdigit(Char)); + + ENSURE(VALID_BOOLEAN(IsValidNameChar)); + return IsValidNameChar; +} + +/** + * Indicates if the auxiliary data name is valid. A valid auxiliary data name + * must begin with a '_' or alpha character and may be followed by one or + * more '_', '.', alpha or digit characters. + */ +Boolean_t AuxDataIsValidName(const char *Name) +{ + Boolean_t IsValidName; + const char *NPtr; + REQUIRE(VALID_REF(Name)); + + for (NPtr = Name, IsValidName = AuxDataIsValidNameChar(*NPtr, TRUE); + IsValidName && *NPtr != '\0'; + NPtr++) + { + IsValidName = AuxDataIsValidNameChar(*NPtr, FALSE); + } + + ENSURE(VALID_BOOLEAN(IsValidName)); + return IsValidName; +} + +/** + * Deallocates an auxiliary data item and its contents and sets the target to + * NULL. + * + * param AuxDataItem + * Reference to an auxiliary data item. + */ +static void AuxDataItemDealloc(AuxDataItem_s **AuxDataItem) +{ + REQUIRE(VALID_REF(AuxDataItem)); + REQUIRE(VALID_REF(*AuxDataItem) || *AuxDataItem == NULL); + + if (*AuxDataItem != NULL) + { + char *Name = (char *)(*AuxDataItem)->Name; + if (Name != NULL) + FREE_ARRAY(Name, "auxiliary name"); + + if ((*AuxDataItem)->Type == AuxDataType_String) + { + char *Value = (char *)(*AuxDataItem)->Value; + if (Value != NULL) + FREE_ARRAY(Value, "auxiliary value"); + } + else + CHECK(FALSE); + + FREE_ITEM(*AuxDataItem, "auxiliary data item"); + *AuxDataItem = NULL; + } + + ENSURE(*AuxDataItem == NULL); +} + +/** + * Allocates an auxiliary data item. + * + * NOTE: Copies are made of the name and value. + * + * param Name + * Auxiliary data item's name (case insenstive). + * param Value + * Auxiliary data item's value. + * param Type + * Auxiliary data item's value type. + * param Retain + * Indicates if the auxiliary data item should persist. In other words + * copied, saved, etc. + * + * return + * A new auxiliary data item or NULL if sufficient memory was not + * available. + */ +static AuxDataItem_s *AuxDataItemAlloc(const char *Name, + ArbParam_t Value, + AuxDataType_e Type, + Boolean_t Retain) +{ + AuxDataItem_s *Result; + + REQUIRE(VALID_REF(Name) && AuxDataIsValidName(Name)); + REQUIRE(IMPLICATION(Type == AuxDataType_String, + (VALID_REF((char *)Value) || + (char *)Value == NULL))); + REQUIRE(VALID_ENUM(Type, AuxDataType_e)); + REQUIRE(VALID_BOOLEAN(Retain)); + + Result = ALLOC_ITEM(AuxDataItem_s, "auxiliary data item"); + if (Result != NULL) + { + Boolean_t IsOk; + Result->Type = Type; + Result->Retain = Retain; + Result->Name = DupString(dontTranslate(Name)); + IsOk = (Result->Name != NULL); + Result->Value = 0; /* to satisfy some compilers' uninitialized warnings */ + if (IsOk && Type == AuxDataType_String) + { + char *strValue = (char *)Value; + if (strValue != NULL) + { + char *strCopy = DupString(dontTranslate(strValue)); + Result->Value = (ArbParam_t)strCopy; + IsOk = (strCopy != NULL); + } + else + Result->Value = (ArbParam_t)NULL; + } + else + CHECK(FALSE); + + if (!IsOk) + AuxDataItemDealloc(&Result); + } + + ENSURE(VALID_REF(Result) || Result == NULL); + return Result; +} + +/** + * Destroys an auxiliary data item list item. This is an item destructor + * callback for ArrayList's private data. + * + * param ItemRef + * Reference to the auxiliary data item to cleanup. + * param ClientData + * Not used. + * + * return + * TRUE is a requirement + */ +static Boolean_t AuxDataItemListItemDestructor(void *ItemRef, + ArbParam_t ClientData) +{ + AuxDataItem_s **AuxDataItemRef = (AuxDataItem_s **)ItemRef; + + REQUIRE(VALID_REF(AuxDataItemRef)); + REQUIRE(VALID_REF(*AuxDataItemRef) || *AuxDataItemRef == NULL); + + if (*AuxDataItemRef != NULL) + AuxDataItemDealloc(AuxDataItemRef); + + ENSURE(*AuxDataItemRef == NULL); + return TRUE; +} + +/** + * Destroys an auxiliary data item. This is an item destructor + * callback for ArrayList's private data. + * + * param ItemRef + * Reference to the auxiliary data to cleanup. + * param ClientData + * Not used. + * + * return + * TRUE is a requirement + */ +Boolean_t AuxDataItemDestructor(void *ItemRef, + ArbParam_t ClientData) +{ + AuxData_pa *AuxDataRef = (AuxData_pa *)ItemRef; + + REQUIRE(VALID_REF(AuxDataRef)); + REQUIRE(VALID_REF(*AuxDataRef) || *AuxDataRef == NULL); + + if (*AuxDataRef != NULL) + AuxDataDealloc(AuxDataRef); + + ENSURE(*AuxDataRef == NULL); + return TRUE; +} + + +/** + * Duplicates an auxiliary data item if its Retain flag is TRUE or if directed + * by the callback data. This is an item duplicator callback for ArrayList. + * + * param TargetItemRef + * Reference to the auxiliary data item to receive duplicate. + * param SourceItemRef + * Reference to the auxiliary data item to duplicate. + * param ClientData + * Boolean indicating if the Retain flag should be considered. + * + * return + * TRUE if the duplication was a success + * FALSE otherwise. + */ +static Boolean_t AuxDataItemDuplicator(void *TargetItemRef, + void *SourceItemRef, + ArbParam_t ClientData) +{ + Boolean_t IsOk = TRUE; + AuxDataItem_s **TargetAuxDataItemRef = (AuxDataItem_s **)TargetItemRef; + AuxDataItem_s **SourceAuxDataItemRef = (AuxDataItem_s **)SourceItemRef; + Boolean_t ConsiderRetain; + + REQUIRE(VALID_REF(TargetAuxDataItemRef)); + REQUIRE(VALID_REF(SourceAuxDataItemRef)); + REQUIRE(VALID_REF(*SourceAuxDataItemRef) || *SourceAuxDataItemRef == NULL); + REQUIRE(VALID_BOOLEAN((Boolean_t)ClientData)); + + ConsiderRetain = (Boolean_t)ClientData; + + /* duplicate the item */ + if (*SourceAuxDataItemRef != NULL && + (!ConsiderRetain || (*SourceAuxDataItemRef)->Retain)) + { + *TargetAuxDataItemRef = AuxDataItemAlloc((*SourceAuxDataItemRef)->Name, + (*SourceAuxDataItemRef)->Value, + (*SourceAuxDataItemRef)->Type, + (*SourceAuxDataItemRef)->Retain); + IsOk = (*TargetAuxDataItemRef != NULL); + } + else + *TargetAuxDataItemRef = NULL; + + ENSURE(VALID_REF(*TargetAuxDataItemRef) || *TargetAuxDataItemRef == NULL); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + +/** + * Deallocates an auxiliary data handle and sets the handle to NULL. + * + * param AuxData + * Reference to an auxiliary data handle or reference to NULL. + */ +void AuxDataDealloc(AuxData_pa *AuxData) +{ + REQUIRE(VALID_REF(AuxData)); + REQUIRE(VALID_REF(*AuxData) || *AuxData == NULL); + + if (*AuxData != NULL) + { + ArrayListDealloc(&(*AuxData)->ItemList, AuxDataItemListItemDestructor, 0); + FREE_ITEM(*AuxData, "auxiliary data container"); + *AuxData = NULL; + } + + ENSURE(*AuxData == NULL); +} + +/** + * Allocates an auxiliary data handle. + * + * return + * Auxiliary data handle or NULL if sufficient memory was not available. + */ +AuxData_pa AuxDataAlloc(void) +{ + AuxData_pa Result = ALLOC_ITEM(AuxData_s, "auxiliary data container"); + if (Result != NULL) + { + Result->ItemList = ArrayListAlloc(0, ArrayListType_VoidPtr, NULL, 0); + if (Result->ItemList == NULL) + AuxDataDealloc(&Result); + } + + ENSURE(VALID_REF(Result) || Result == NULL); + return Result; +} + +/** + * Copies the auxiliary data and all its members who's Retain flag is TRUE + * if the ConsiderRetain flag is TRUE otherwise it copies everything. + */ +AuxData_pa AuxDataCopy(AuxData_pa AuxData, + Boolean_t ConsiderRetain) +{ + AuxData_pa Result; + + REQUIRE(VALID_REF(AuxData)); + REQUIRE(VALID_BOOLEAN(ConsiderRetain)); + + Result = ALLOC_ITEM(AuxData_s, "auxiliary data container"); + if (Result != NULL) + { + Result->ItemList = ArrayListCopy(AuxData->ItemList, + AuxDataItemDuplicator, + ConsiderRetain); + if (Result->ItemList != NULL) + { + if (ConsiderRetain) + { + /* + * Now pass through the array cleaning up the holes left by those + * auxiliary data item member who's Retain flag was FALSE and + * therefore left a VOID pointer because it was not copied. + */ + LgIndex_t ItemOffset = 0; + LgIndex_t ItemCount = ArrayListGetCount(Result->ItemList); + while (ItemOffset < ItemCount) + { + /* if there is more than one in a row remove them all at once */ + if (ArrayListGetVoidPtr(Result->ItemList, ItemOffset) == NULL) + { + LgIndex_t BaseOffsetToRemove = ItemOffset; + LgIndex_t NumItemsToRemove = 1; + while (BaseOffsetToRemove + NumItemsToRemove < ItemCount && + ArrayListGetVoidPtr(Result->ItemList, + BaseOffsetToRemove + NumItemsToRemove) == NULL) + NumItemsToRemove++; + + /* delete the NULL items */ + ArrayListDeleteItems(Result->ItemList, + BaseOffsetToRemove, + NumItemsToRemove, + NULL, 0); + + /* + * Update ItemCount but leave ItemOffset alone as it is now + * indexing the next item to examine. + */ + ItemCount = ArrayListGetCount(Result->ItemList); + } + else + ItemOffset++; + } + } + } + else + AuxDataDealloc(&Result); + } + + ENSURE(VALID_REF(Result) || Result == NULL); + return Result; +} + +/** + * Gets the current number of auxiliary data items maintained by the auxiliary. + * + * param AuxData + * Handle to auxiliary data. + * + * return + * Number of items maintained by the auxiliary data. + */ +LgIndex_t AuxDataGetNumItems(AuxData_pa AuxData) +{ + LgIndex_t NumItems; + + REQUIRE(VALID_REF(AuxData)); + + NumItems = ArrayListGetCount(AuxData->ItemList); + + ENSURE(NumItems >= 0); + return NumItems; +} + +/** + * Gets the item index of the name if found or if not found the index where an + * auxiliary data item could be inserted. + * + * param AuxData + * Handle to auxiliary data. + * param Name + * Name used for the search (case insensitive). + * param ItemIndex + * Address to hold the index of the found item or the index where an + * auxiliary data item could be inserted. + * + * return + * TRUE if the named item was found, + * FALSE otherwise. + */ +Boolean_t AuxDataGetItemIndex(AuxData_pa AuxData, + const char *Name, + LgIndex_t *ItemIndex) +{ + Boolean_t FoundItem = FALSE; + LgIndex_t Index; + LgIndex_t NumItems; + + REQUIRE(VALID_REF(AuxData)); + INVARIANT("AuxData->ItemList is case-insensitive sorted by AuxDataItem->Name"); + REQUIRE(VALID_REF(Name) && AuxDataIsValidName(Name)); + REQUIRE(VALID_REF(ItemIndex)); + + /* + * Note that the current implementation just does a linear search + * though the array looking for the index of the item or if not + * found the index of the insertion point. This should be replaced + * with a binary search. + */ + NumItems = AuxDataGetNumItems(AuxData); + +# if defined DO_LINEAR_SEARCH + { + for (Index = 0; Index < NumItems; Index++) + { + AuxDataItem_s *AuxDataItem = + (AuxDataItem_s *)ArrayListGetVoidPtr(AuxData->ItemList, Index); + int CompareResult = ustrcmp(AuxDataItem->Name, Name); + if (CompareResult >= 0) + { + FoundItem = (CompareResult == 0); + break; + } + } + } +# else + { + int low, high; + low = 0; + high = NumItems - 1; + Index = 0; + while (low <= high) + { + AuxDataItem_s *AuxDataItem; + int CompareResult; + Index = (low + high) / 2; + AuxDataItem = (AuxDataItem_s *)ArrayListGetVoidPtr(AuxData->ItemList, Index); + CompareResult = ustrcmp(Name, AuxDataItem->Name); + if (CompareResult < 0) + high = Index - 1; /* If the new name is "less" than the one we're comparing to, + don't change Index since Index is already in the right spot */ + else if (CompareResult > 0) + low = ++Index; /* If the new name it "greater" than the one we're comparing + against, we want to make sure its Index is greater than + the current name's index as well, that's why we increment Index here. */ + else + { + FoundItem = TRUE; + break; + } + } + } +# endif + + *ItemIndex = Index; + + ENSURE(VALID_BOOLEAN(FoundItem)); + ENSURE(0 <= *ItemIndex && + ((FoundItem && *ItemIndex < NumItems) || + (!FoundItem && *ItemIndex <= NumItems))); + return FoundItem; +} + +/** + * Gets the auxiliary data item at the specified index. + * + * NOTE: The name and value are a references, NOT copies. + * + * param AuxData + * Handle to auxiliary data. + * param Index + * Index of the auxiliary data item of interest. + * param Name + * Address to hold the auxiliary data item name. + * param Value + * Address to hold the auxiliary data item value. + * param Type + * Address to hold the auxiliary data item type. + * param Retain + * Address to hold the auxiliary data item retain flag. + */ +void AuxDataGetItemByIndex(AuxData_pa AuxData, + LgIndex_t Index, + const char **Name, + ArbParam_t *Value, + AuxDataType_e *Type, + Boolean_t *Retain) +{ + AuxDataItem_s *AuxDataItem; + + REQUIRE(VALID_REF(AuxData)); + INVARIANT("AuxData->ItemList is case-insensitive sorted by AuxDataItem->Name"); + REQUIRE(0 <= Index && Index < ArrayListGetCount(AuxData->ItemList)); + REQUIRE(VALID_REF(Name)); + REQUIRE(VALID_REF(Value)); + REQUIRE(VALID_REF(Type)); + REQUIRE(VALID_REF(Retain)); + + AuxDataItem = (AuxDataItem_s *)ArrayListGetVoidPtr(AuxData->ItemList, Index); + *Name = AuxDataItem->Name; + *Value = AuxDataItem->Value; + *Type = AuxDataItem->Type; + *Retain = AuxDataItem->Retain; + + ENSURE(VALID_REF(*Name) && AuxDataIsValidName(*Name)); + ENSURE(IMPLICATION(*Type == AuxDataType_String, + (VALID_REF((char *)(*Value)) || + (char *)(*Value) == NULL))); + ENSURE(VALID_ENUM(*Type, AuxDataType_e)); + ENSURE(VALID_BOOLEAN(*Retain)); +} + +/** + * Gets the auxiliary data item by the specified name if it exists. + * + * NOTE: The name and value are a references, NOT copies. + * + * param AuxData + * Handle to auxiliary data. + * param Name + * Name used for the search (case insensitive). + * param Value + * Address to hold the auxiliary data item value. + * param Type + * Address to hold the auxiliary data item type. + * param Retain + * Address to hold the auxiliary data item retain flag. + * + * return + * TRUE if the an auxilary data item by the specified name was found, + * FALSE otherwise. + */ +Boolean_t AuxDataGetItemByName(AuxData_pa AuxData, + const char *Name, + ArbParam_t *Value, + AuxDataType_e *Type, + Boolean_t *Retain) +{ + Boolean_t FoundItem; + LgIndex_t ItemIndex; + + REQUIRE(VALID_REF(AuxData)); + INVARIANT("AuxData->ItemList is case-insensitive sorted by AuxDataItem->Name"); + REQUIRE(VALID_REF(Name) && AuxDataIsValidName(Name)); + REQUIRE(VALID_REF(Value)); + REQUIRE(VALID_REF(Type)); + REQUIRE(VALID_REF(Retain)); + + FoundItem = AuxDataGetItemIndex(AuxData, Name, &ItemIndex); + if (FoundItem) + { + const char *SameName; + AuxDataGetItemByIndex(AuxData, ItemIndex, &SameName, + Value, Type, Retain); + CHECK(ustrcmp(Name, SameName) == 0); + } + + ENSURE(VALID_BOOLEAN(FoundItem)); + ENSURE(IMPLICATION(FoundItem, + IMPLICATION(*Type == AuxDataType_String, + (VALID_REF((char *)(*Value)) || + (char *)(*Value) == NULL)))); + ENSURE(IMPLICATION(FoundItem, + VALID_ENUM(*Type, AuxDataType_e))); + ENSURE(IMPLICATION(FoundItem, + VALID_BOOLEAN(*Retain))); + return FoundItem; +} + + +/** + * Get a string value from AuxData and convert it to a boolean. + */ +Boolean_t AuxDataGetBooleanItemByName(AuxData_pa AuxData, /* IN */ + const char *Name, /* IN */ + Boolean_t *Value, /* OUT */ + AuxDataType_e *Type, /* OUT */ + Boolean_t *Retain) /* OUT */ +{ + Boolean_t FoundItem; + + REQUIRE(VALID_REF(AuxData)); + INVARIANT("AuxData->ItemList is case-insensitive sorted by AuxDataItem->Name"); + REQUIRE(VALID_REF(Name) && AuxDataIsValidName(Name)); + REQUIRE(VALID_REF(Value)); + REQUIRE(VALID_REF(Type)); + REQUIRE(VALID_REF(Retain)); + + ArbParam_t strValue; + FoundItem = AuxDataGetItemByName(AuxData, + Name, + &strValue, + Type, + Retain); + + if (FoundItem && + (ustrcmp((char *)strValue, "YES") == 0 || + ustrcmp((char *)strValue, "YEP") == 0 || + ustrcmp((char *)strValue, "Y") == 0 || + ustrcmp((char *)strValue, "TRUE") == 0 || + ustrcmp((char *)strValue, "T") == 0 || + ustrcmp((char *)strValue, "ON") == 0 || + ustrcmp((char *)strValue, "1") == 0)) + { + *Value = TRUE; + } + else + { + *Value = FALSE; + } + + ENSURE(VALID_BOOLEAN(FoundItem)); + ENSURE(VALID_BOOLEAN(*Value)); + return FoundItem; +} + + +/** + * Adds the auxiliary data item to the auxiliary data or replaces it if one + * already exists by the same name. + * + * NOTE: The auxiliary data makes copies of the name and value. + * + * param AuxData + * Auxiliary data handle. + * param Name + * Auxiliary data item's name (case insenstive). + * param Value + * Auxiliary data item's value. + * param Type + * Auxiliary data item's value type. + * param Retain + * Indicates if the auxiliary data item should persist. + * + * return + * TRUE if the item was added to the auxiliary data. + */ +Boolean_t AuxDataSetItem(AuxData_pa AuxData, + const char *Name, + ArbParam_t Value, + AuxDataType_e Type, + Boolean_t Retain) +{ + Boolean_t IsOk; + AuxDataItem_s *AuxDataItem; + + REQUIRE(VALID_REF(AuxData)); + INVARIANT("AuxData->ItemList is case-insensitive sorted by AuxDataItem->Name"); + REQUIRE(VALID_REF(Name) && AuxDataIsValidName(Name)); + REQUIRE(IMPLICATION(Type == AuxDataType_String, + (VALID_REF((char *)Value) || + (char *)Value == NULL))); + REQUIRE(VALID_ENUM(Type, AuxDataType_e)); + REQUIRE(VALID_BOOLEAN(Retain)); + + AuxDataItem = AuxDataItemAlloc(Name, Value, Type, Retain); + IsOk = (AuxDataItem != NULL); + if (IsOk) + { + LgIndex_t ItemIndex; + ArrayListItem_u ListItem; + + /* add or replace the item to the list */ + ListItem.VoidPtr = (void *)AuxDataItem; + if (!AuxDataGetItemIndex(AuxData, Name, &ItemIndex)) + IsOk = ArrayListInsertItem(AuxData->ItemList, ItemIndex, ListItem); + else + IsOk = ArrayListSetItem(AuxData->ItemList, ItemIndex, ListItem, + AuxDataItemListItemDestructor, 0); + + if (!IsOk) + AuxDataItemDealloc(&AuxDataItem); + } + + ENSURE(VALID_BOOLEAN(IsOk)); + INVARIANT("AuxData->ItemList is case-insensitive sorted by AuxDataItem->Name"); + return IsOk; +} + +/** + * Deletes the auxiliary data item at the specified index. + * + * param AuxData + * Auxiliary data handle. + * param Index + * Index of the auxiliary data item of interest. + */ +void AuxDataDeleteItemByIndex(AuxData_pa AuxData, + LgIndex_t Index) +{ + REQUIRE(VALID_REF(AuxData)); + REQUIRE(0 <= Index && Index < ArrayListGetCount(AuxData->ItemList)); + + ArrayListDeleteItem(AuxData->ItemList, Index, AuxDataItemListItemDestructor, 0); +} + +/** + * Deletes the auxiliary data item by the specified name if it exists. + * + * param AuxData + * Auxiliary data handle. + * param Name + * Name used for the search (case insensitive). + * + * return + * TRUE if the an auxilary data item by the specified name was found, + * FALSE otherwise. + */ +Boolean_t AuxDataDeleteItemByName(AuxData_pa AuxData, + const char *Name) +{ + Boolean_t FoundItem; + LgIndex_t ItemIndex; + + REQUIRE(VALID_REF(AuxData)); + REQUIRE(VALID_REF(Name) && AuxDataIsValidName(Name)); + + FoundItem = AuxDataGetItemIndex(AuxData, Name, &ItemIndex); + if (FoundItem) + AuxDataDeleteItemByIndex(AuxData, ItemIndex); + + ENSURE(VALID_BOOLEAN(FoundItem)); + return FoundItem; +} + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a88c7c1f43206df6cf82964f035df35a9bf611ac --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio.cpp @@ -0,0 +1,695 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +#define DATAIOMODULE +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" +#include "TranslatedString.h" + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else +#ifdef MSWIN +/* Disable warning about conversion from long to short. + Even if we have disabled it in stdafx.h, + we still need to disable here also for + tecio, which includes this cpp file. */ + +#pragma warning (disable : 4244) +#endif +/* + * Temp text and geom buffers. + */ +static Geom_s TempGeom; +static Text_s TempText; +#endif + +#include "DATASET0.h" +#include "SET.h" +#include "FILESTREAM.h" +#include "DATAIO.h" +#include "DATAIO4.h" +#include "STRUTIL.h" +#include "AUXDATA.h" +#include "ARRLIST.h" +#include "STRLIST.h" +#include "ALLOC.h" +#include "DATASET.h" +#include "SYSTEM.h" +#include "Q_MSG.h" + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +using namespace tecplot::strutil; + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined ENGINE +#endif +#if !defined ENGINE /* TODO(RMS)-M 12/13/2005: ENGINE-P2 - no status feedback */ +#endif +#endif /* TECPLOTKERNEL */ + + +/* + * Multi-Purpose datafile header reader. This is designed so that + * not all parts of the header is loaded and so that the task of loading + * the header information is separated out from installing of that + * information into a dataset. + * + */ + +Boolean_t ReadDataFileHeader(FileStream_s *FileStream, + short IVersion, + Boolean_t ShowDataIOStatus, + EntIndex_t *NumZones, + EntIndex_t *NumVars, + SmInteger_t *NumCustomLabelSets, + char **DataSetTitle, + Text_s **BaseText, + Geom_s **BaseGeom, + StringList_pa **CustomLabelBase, + StringList_pa *UserRec, + AuxData_pa *DataSetAuxData, + Set_pa **IsVarCellCentered, /* Create an Array dim by zones */ + Boolean_t *HasText, + Boolean_t *HasGeoms, + ArrayList_pa *ZoneSpecList, + StringList_pa *VarNames, + ArrayList_pa *VarAuxDataList, /*<AuxData_pa>[NumVars]*/ + Set_pa *IsRawFNAvailable, /* classic data only */ + LgIndex_t **FNNumBndryConns, /* classic data only */ + DataFileType_e *FileType) +{ + Boolean_t IsOk = TRUE; + Boolean_t SentError = FALSE; + double X1; + int Pass; + FileOffset_t InitialFilePosition; + + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(IVersion > 0); + REQUIRE(VALID_BOOLEAN(ShowDataIOStatus)); + REQUIRE(VALID_REF(NumZones)); + REQUIRE(VALID_REF(NumVars)); + REQUIRE(VALID_REF(DataSetTitle) || (DataSetTitle == NULL)); + REQUIRE(VALID_REF(BaseText) || (BaseText == NULL)); + REQUIRE(VALID_REF(BaseGeom) || (BaseGeom == NULL)); + REQUIRE(VALID_REF(HasText) || (HasText == NULL)); + REQUIRE(VALID_REF(HasGeoms) || (HasGeoms == NULL)); + REQUIRE(VALID_REF(ZoneSpecList) || (ZoneSpecList == NULL)); + REQUIRE(VALID_REF(VarNames) || (VarNames == NULL)); + REQUIRE(VALID_REF(NumCustomLabelSets) || (NumCustomLabelSets == NULL)); + REQUIRE(VALID_REF(UserRec) || (UserRec == NULL)); + REQUIRE((VALID_REF(DataSetAuxData) && + (VALID_REF(*DataSetAuxData) || *DataSetAuxData == NULL)) || + DataSetAuxData == NULL); + REQUIRE((VALID_REF(VarAuxDataList) && + (VALID_REF(*VarAuxDataList) || *VarAuxDataList == NULL)) || + VarAuxDataList == NULL); + REQUIRE(VALID_REF(IsVarCellCentered) || (IsVarCellCentered == NULL)); + REQUIRE((VALID_REF(CustomLabelBase) && VALID_REF(NumCustomLabelSets)) || (CustomLabelBase == NULL)); + REQUIRE(VALID_REF(IsRawFNAvailable) || (IsRawFNAvailable == NULL)); + REQUIRE(VALID_REF(FNNumBndryConns) || (FNNumBndryConns == NULL)); + REQUIRE(VALID_REF(FileType) || (FileType == NULL)); + + if (DataSetTitle) + *DataSetTitle = NULL; + if (BaseText) + *BaseText = NULL; + if (BaseGeom) + *BaseGeom = NULL; + if (HasText) + *HasText = FALSE; + if (HasGeoms) + *HasGeoms = FALSE; + if (ZoneSpecList) + *ZoneSpecList = NULL; + if (VarNames) + *VarNames = NULL; + if (NumCustomLabelSets) + *NumCustomLabelSets = 0; + if (CustomLabelBase) + *CustomLabelBase = NULL; + if (DataSetAuxData != NULL) + { + /* + * Note unlike most of the other output only parameters that we nullify, + * DataSetAuxData is both an input and output parameter therefore we do + * not nullify it. The CHECK is here for clarity. + */ + CHECK(VALID_REF(*DataSetAuxData) || *DataSetAuxData == NULL); + } + if (VarAuxDataList != NULL) + { + /* + * Note unlike most of the other output only parameters that we nullify, + * VarAuxDataList is both an input and output parameter therefore we do + * not nullify it. The CHECK is here for clarity. + */ + CHECK(VALID_REF(*VarAuxDataList) || *VarAuxDataList == NULL); + } + if (UserRec) + *UserRec = NULL; + if (IsVarCellCentered) + *IsVarCellCentered = NULL; + + if (IsRawFNAvailable) + *IsRawFNAvailable = NULL; + + if (FNNumBndryConns) + *FNNumBndryConns = NULL; + + if (FileType) + *FileType = DataFileType_Full; + + /* + * Pass 1 is used only to count up the number of zones and custom label sets, + * Also determine if there are any preset zone colors. + */ + + InitialFilePosition = TP_FTELL(FileStream->File); + + for (Pass = 1; IsOk && (Pass <= 2); Pass++) + { + if (Pass == 2) + { + if (TP_FSEEK(FileStream->File, InitialFilePosition, SEEK_SET) != 0) + IsOk = FALSE; + + if (IsOk && (*NumZones > 0 && ZoneSpecList != NULL && *ZoneSpecList == NULL)) + { + *ZoneSpecList = ArrayListAlloc(*NumZones, ArrayListType_VoidPtr, + ZoneOrVarListAdjustCapacityRequest, 0); + IsOk = (*ZoneSpecList != NULL); + } + if (IsOk && (CustomLabelBase != NULL && + *CustomLabelBase == NULL && + *NumCustomLabelSets > 0)) + { + *CustomLabelBase = ALLOC_ARRAY(*NumCustomLabelSets, StringList_pa, "CustomLabel Sets"); + IsOk = (*CustomLabelBase != NULL); + if (IsOk) + { + SmInteger_t N; + for (N = 0; N < *NumCustomLabelSets; N++) + (*CustomLabelBase)[N] = NULL; + } + } + if (IsOk && (UserRec != NULL && *UserRec == NULL)) + { + *UserRec = StringListAlloc(); + IsOk = (Boolean_t)(*UserRec != NULL); + } + if (IsOk && (DataSetAuxData != NULL && *DataSetAuxData == NULL)) + { + *DataSetAuxData = AuxDataAlloc(); + IsOk = (Boolean_t)(*DataSetAuxData != NULL); + } + if (IsOk && (VarAuxDataList != NULL && *VarAuxDataList == NULL) && *NumVars > 0) + { + *VarAuxDataList = ArrayListAlloc(0, ArrayListType_VoidPtr, + ZoneOrVarListAdjustCapacityRequest, 0); + IsOk = (*VarAuxDataList != NULL && + ArrayListSetVoidPtr(*VarAuxDataList, *NumVars - 1, NULL)); + } + if (IsOk && + (*NumZones > 0) && + (IsVarCellCentered != NULL) && + (*IsVarCellCentered == NULL)) + { + /* + * First construct the array of sets... + */ + *IsVarCellCentered = ALLOC_ARRAY(*NumZones, Set_pa, "Array of IsVarCellCentered sets"); + if (*IsVarCellCentered) + { + EntIndex_t Z; + for (Z = 0; IsOk && (Z < *NumZones); Z++) + { + /* + * Now allocate a set for each zone + */ + (*IsVarCellCentered)[Z] = AllocSet(FALSE); + IsOk = (Boolean_t)((*IsVarCellCentered)[Z] != NULL); + } + } + else + IsOk = FALSE; + } + if (IsOk && *NumZones > 0 && IsRawFNAvailable != NULL) + { + *IsRawFNAvailable = AllocSet(FALSE); + IsOk = (*IsRawFNAvailable != NULL); + } + if (IsOk && *NumZones > 0 && FNNumBndryConns != NULL) + { + *FNNumBndryConns = ALLOC_ARRAY(*NumZones, LgIndex_t, "Array of FNNumBndryConns"); + IsOk = (*FNNumBndryConns != NULL); + if (IsOk) + for (LgIndex_t i = 0; i < *NumZones; i++) + (*FNNumBndryConns)[i] = 0; + } + } + + if (NumCustomLabelSets != NULL) + *NumCustomLabelSets = 0; + + EntIndex_t TotalNumZones = *NumZones; /* ...only meaningful for pass 2 */ + + *NumZones = 0; + *NumVars = 0; + + if (IsOk) + { + char *S = NULL; + int INumVars; + + IsOk = ReadInDataFileTypeTitleAndVarNames(FileStream, + IVersion, + ((Pass == 2) ? &S : (char **)NULL), + ((Pass == 2) ? FileType : (DataFileType_e *)NULL), + &INumVars, + ((Pass == 2) ? VarNames : (StringList_pa *)NULL)); + + if (IsOk) + *NumVars = (EntIndex_t)INumVars; + + if ((Pass == 2) && S && IsOk && DataSetTitle) + *DataSetTitle = S; + else if (S != NULL) + FREE_ARRAY(S, "data set title"); + } + + if (IsOk) + { +#if !defined ENGINE /* TODO(RMS)-M 12/13/2005: ENGINE-P2 - no dialog feedback */ + LgIndex_t NumGeoms = 0; + LgIndex_t NumTexts = 0; +#endif + + if (IsOk) + X1 = GetNextValue(FileStream, FieldDataType_Float, 0.0, 1000.0, &IsOk); + + while (IsOk && (X1 != EndHeaderMarker)) + { + if (X1 == ZoneMarker) + { + ZoneSpec_s *ZoneSpec = ZoneSpecAlloc(); + Boolean_t OkToLoad = (Pass == 2 && + IsVarCellCentered != NULL); + IsOk = (ZoneSpec != NULL); + if (IsOk) + { + Boolean_t LocalIsRawFNAvailable; + LgIndex_t LocalFNNumBndryConns; + IsOk = ReadInZoneHeader(FileStream, IVersion, ZoneSpec, + OkToLoad ? (*IsVarCellCentered)[*NumZones] : NULL, + *NumVars, &LocalIsRawFNAvailable, + &LocalFNNumBndryConns); + if (IsOk && OkToLoad && IsRawFNAvailable != NULL) + { + if (LocalIsRawFNAvailable) + IsOk = AddToSet(*IsRawFNAvailable, *NumZones, FALSE); + } + if (IsOk && OkToLoad && FNNumBndryConns != NULL) + (*FNNumBndryConns)[*NumZones] = LocalFNNumBndryConns; + } + + if (IsOk && + ZoneSpecList != NULL && + Pass == 2) + { + IsOk = (ZoneSpec->ParentZone == BAD_SET_VALUE || + (ZoneSpec->ParentZone != *NumZones && + (0 <= ZoneSpec->ParentZone && ZoneSpec->ParentZone < TotalNumZones))); + if (IsOk) + { + ArrayListItem_u CurZoneSpecItem; + CurZoneSpecItem.VoidPtr = (void *)ZoneSpec; + ArrayListSetItem(*ZoneSpecList, *NumZones, + CurZoneSpecItem, + ZoneSpecItemDestructor, 0); + } + else + { + if (ZoneSpec->ParentZone == *NumZones) + ErrMsg(translate("Parent zone assignment for zone %d " + "may not be self referencing."), + *NumZones + 1); + else + ErrMsg(translate("Parent zone assignment for zone %d " + "must be to an existing zone within the datafile."), + *NumZones + 1); + ZoneSpecDealloc(&ZoneSpec); + SentError = TRUE; + } + } + else + ZoneSpecDealloc(&ZoneSpec); + + if (IsOk) + (*NumZones)++; + if (*NumZones > MaxNumZonesOrVars) + { + ErrMsg(translate("Exceeding Tecplot's current zone limit of %d. " + "Reduce the number of zones being loaded."), MaxNumZonesOrVars); + IsOk = FALSE; + SentError = TRUE; + } + } + else if (X1 == GeomMarker) + { +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else + IsOk = ReadInGeometry(FileStream, + IVersion, + FALSE, + &TempGeom, + 5000); +#endif + if (IsOk) + { + if (Pass == 1) + { + if (HasGeoms) + *HasGeoms = TRUE; + } +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + } +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined ENGINE /* TODO(RMS)-M 12/13/2005: ENGINE-P2 - no status feedback */ +#endif +#endif + } + else if (X1 == TextMarker) + { +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else + IsOk = ReadInText(FileStream, + IVersion, + FALSE, + &TempText, + 200); +#endif + if (IsOk) + { + if (Pass == 1) + { + if (HasText) + *HasText = TRUE; + } +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + } +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined ENGINE /* TODO(RMS)-M 12/13/2005: ENGINE-P2 - no status feedback */ +#endif +#endif + } + else if (X1 == CustomLabelMarker) + { + Boolean_t OkToLoad; + + OkToLoad = (Pass == 2) && + NumCustomLabelSets && + (*NumCustomLabelSets < MaxCustomLabelSets) && + CustomLabelBase; + + IsOk = ReadInCustomLabels(FileStream, + IVersion, + OkToLoad, + (OkToLoad ? &(*CustomLabelBase)[*NumCustomLabelSets] : NULL)); + if (IsOk && NumCustomLabelSets) + (*NumCustomLabelSets)++; + } + else if (X1 == UserRecMarker) + { + Boolean_t OkToLoad; + char *CurUserRec = NULL; + + OkToLoad = (Boolean_t)((Pass == 2) && UserRec); + + IsOk = ReadInUserRec(FileStream, + IVersion, + 500, + OkToLoad ? &CurUserRec : (char **)NULL); + if (IsOk && OkToLoad) + IsOk = StringListAppendString(*UserRec, CurUserRec); + if (CurUserRec) + FREE_ARRAY(CurUserRec, "temp user rec"); + CurUserRec = NULL; + } + else if (X1 == DataSetAuxMarker) + { + Boolean_t OkToLoad; + CHECK(IVersion >= 101); + OkToLoad = (Pass == 2 && + DataSetAuxData != NULL); + IsOk = ReadInAuxData(FileStream, IVersion, + OkToLoad ? *DataSetAuxData : NULL); + if (!IsOk) + { + ErrMsg(translate("Invalid DATASETAUXDATA record in binary datafile")); + SentError = TRUE; + } + } + else if (X1 == VarAuxMarker) + { + Boolean_t OkToLoad; + LgIndex_t VarNum; + CHECK(IVersion >= 102); + OkToLoad = (Pass == 2 && + VarAuxDataList != NULL); + VarNum = GetIoFileInt(FileStream, IVersion, 0, *NumVars - 1, &IsOk); + if (IsOk) + { + AuxData_pa VarAuxData; + if (OkToLoad) + { + VarAuxData = (AuxData_pa)ArrayListGetVoidPtr(*VarAuxDataList, VarNum); + if (VarAuxData == NULL) + { + VarAuxData = AuxDataAlloc(); + IsOk = (VarAuxData != NULL && + ArrayListSetVoidPtr(*VarAuxDataList, VarNum, VarAuxData)); + } + } + else + VarAuxData = NULL; + + IsOk = IsOk && ReadInAuxData(FileStream, IVersion, VarAuxData); + if (!IsOk) + { + ErrMsg(translate("Invalid VARAUXDATA record in binary datafile")); + SentError = TRUE; + } + } + else + { + ErrMsg(translate("Invalid VARAUXDATA variable number association")); + SentError = TRUE; + } + } + else + IsOk = FALSE; + if (IsOk) + X1 = GetNextValue(FileStream, FieldDataType_Float, 0.0, 1000.0, &IsOk); + } + } + } + + /* + * Old plt files that did not contain data still contained variable name + * definitions in the header. This is no longer necessary and in fact can + * cause confusion in the data read options dialog. If the number of zones + * in the datafile is zero set the number of variables to 0 and dealloc the + * variable name list. + */ + + if (IsOk && (*NumZones == 0) && (*NumVars > 0)) + { + *NumVars = 0; + if (VarNames && *VarNames) + { + StringListDealloc(VarNames); + } + } + + + if (!IsOk) + { + if (ZoneSpecList && *ZoneSpecList) + ArrayListDealloc(ZoneSpecList, ZoneSpecItemDestructor, 0); + if (DataSetTitle && *DataSetTitle) + { + FREE_ARRAY(*DataSetTitle, "DataSetTitle"); + *DataSetTitle = NULL; + } +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + if (VarNames && *VarNames) + { + StringListDealloc(VarNames); + } +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + if (UserRec && *UserRec) + StringListDealloc(UserRec); + } + + /* If there was an error, get rid of the auxiliary data list. */ + if ((DataSetAuxData != NULL && *DataSetAuxData != NULL) && + (!IsOk)) + AuxDataDealloc(DataSetAuxData); + + if (!IsOk && !SentError) + ErrMsg(translate("Invalid header in binary datafile")); + + /* + * NOTE: Do not close the file. Some calling functions will continue + * to read from this point on. + */ + + ENSURE((VarNames == NULL) || (*VarNames == NULL) || StringListValid(*VarNames)); + ENSURE(IMPLICATION(UserRec != NULL, + (*UserRec == NULL || + StringListValid(*UserRec)))); + ENSURE(IMPLICATION(DataSetAuxData != NULL, + (*DataSetAuxData == NULL || + VALID_REF(*DataSetAuxData)))); + return (IsOk); +} + + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + + +Boolean_t OpenBinaryFileAndCheckMagicNumber(FileStream_s **FileStream, + char *FName, + FileOffset_t StartOffset, + short *IVersion) +{ + Boolean_t Result = TRUE; + REQUIRE(VALID_REF(FileStream)); + REQUIRE(*FileStream == NULL); + REQUIRE(VALID_REF(FName)); + REQUIRE(StartOffset >= 0); + REQUIRE(VALID_REF(IVersion)); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else + FILE *File = TP_FOPEN(FName, "rb"); + if (File == NULL) + Result = FALSE; +#endif + if (Result) + { + *FileStream = FileStreamAlloc(File, TRUE); + Result = (*FileStream != NULL); + } + Result = Result && (TP_FSEEK((*FileStream)->File, StartOffset, SEEK_SET) == 0); + if (Result) + { + *IVersion = GetInputVersion(*FileStream); + /* + * After version 71 we started listing individual valid + * versions. Before that time we just listed ranges. Also, + * note that versions 72, 73, and 74 were invalid. + */ + Result = (/* past valid plt file version ranges follow: */ + (40 <= *IVersion && *IVersion <= 71) || + (*IVersion == 75) || + (100 <= *IVersion && *IVersion <= TecplotBinaryFileVersion)); + + /* + * This check is put here to make sure that the above code gets visited + * when the TecplotBinaryFileVersion number changes. When the version + * changes the "past valid plt file version ranges" above and the number + * compared to the TecplotBinaryFileVersion below may need to be + * adjusted such as when we skip a consecutive number as we did between + * version 71 and 75, and between 75 and 100. + */ + CHECK(TecplotBinaryFileVersion == 112); + } + + ENSURE(VALID_BOOLEAN(Result)); + return (Result); +} + + + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ + #if !defined NO_ASSERTS + #endif + #if !defined NO_ASSERTS + #endif +#if !defined ENGINE /* TODO(RMS)-M 12/13/2005: ENGINE-P2 - no status feedback */ +#endif +#if !defined ENGINE /* TODO(RMS)-M 12/13/2005: ENGINE-P2 - no status feedback */ +#endif +#if !defined ENGINE /* TODO(RMS)-M 12/13/2005: ENGINE-P2 - no status feedback */ +#endif +#if !defined ENGINE /* TODO(RMS)-M 12/13/2005: ENGINE-P2 - no status feedback */ +#endif +#if !defined ENGINE /* TODO(RMS)-M 12/13/2005: ENGINE-P2 - no status feedback */ +#endif +#if !defined ENGINE /* TODO(RMS)-M 12/13/2005: ENGINE-P2 - no status feedback */ +#endif +#if !defined ENGINE /* TODO(RMS)-H 12/12/2005: ENGINE: refactor to use just the Interrupted flag as-is */ +#else +#endif +#if 0 /* we changed this behavior... not sure when */ +#endif +#endif /* TECPLOTKERNEL */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio4.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio4.cpp new file mode 100644 index 0000000000000000000000000000000000000000..18374dfe7b0392a91053711db2b247180e453772 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio4.cpp @@ -0,0 +1,3357 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +#define DATAIO4MODULE +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" +#include "ALLOC.h" + +#include "AUXDATA.h" +#include "DATASET.h" +#include "FILESTREAM.h" + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#include "GEOM2.h" +#include "GEOM.h" +#include "INPUT.h" +#include "SET.h" +#include "TEXT.h" +#include "DATAIO4.h" +#include "DATASET0.h" + +#include "STRUTIL.h" +#include "ARRLIST.h" +#include "STRLIST.h" +#include "Q_MSG.h" + +#if defined IRIS +#include <ieeefp.h> +#endif + +using namespace tecplot::strutil; + +#if !defined(TECPLOTKERNEL) && defined(MSWIN) +# pragma warning(disable : 4244) +#endif + +/*END HEADER*/ + +/* + * This module contains mostly low level i/o functions. + */ + +#if defined DECALPHA || defined COMPAQALPHA +#define _IEEE_FP_INEXACT +#define _IEEE_FP +#endif + +#if defined SUN41 +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +/********************************************************************** + ********************************************************************** + ********************** INPUT ************************** + ********************************************************************** + **********************************************************************/ + +static char FilterFloatChar(float X) +{ + char C; + if (((X >= 32.0) && (X <= 127.0)) || + ((X >= 160.0) && (X <= 255.0)) || + (X == 0.0)) + C = (char)X; + else + C = '?'; + return (C); +} + + +double GetNextValue(FileStream_s *FileStream, + FieldDataType_e FieldDataType, + double VMin, + double VMax, + Boolean_t *IsOk) +{ + double X = 0.0; + + REQUIRE(VALID_REF(IsOk) && VALID_BOOLEAN(*IsOk)); + REQUIRE(!(*IsOk) || VALID_FIELD_DATA_TYPE(FieldDataType)); + REQUIRE(!(*IsOk) || VALID_REF(FileStream)); + + if (*IsOk) + { + switch (FieldDataType) + { + case FieldDataType_Float : + { + float XX; + + *IsOk = (TP_FREAD(&XX, 4, 1, FileStream->File) == 1); + + if (!FileStream->IsByteOrderNative) + REVERSE_4_BYTES(&XX); + + if (*IsOk) + X = XX; + else + X = 0.0; + } break; + case FieldDataType_Double : + { + double XX; + + *IsOk = (TP_FREAD(&XX, sizeof(double), 1, FileStream->File) == 1); + if (!FileStream->IsByteOrderNative) + REVERSE_8_BYTES(&XX); + + if (*IsOk) + X = XX; + else + X = 0.0; + } break; + case FieldDataType_Int32 : + { + Int32_t L; + *IsOk = (TP_FREAD(&L, sizeof(Int32_t), 1, FileStream->File) == 1); + if (!FileStream->IsByteOrderNative) + REVERSE_4_BYTES(&L); + if (*IsOk) + X = (double)L; + } break; + case FieldDataType_Int16 : + { + Int16_t S; + *IsOk = (TP_FREAD(&S, sizeof(Int16_t), 1, FileStream->File) == 1); + if (!FileStream->IsByteOrderNative) + REVERSE_2_BYTES(&S); + if (*IsOk) + X = (double)S; + } break; + case FieldDataType_Byte : + { + Byte_t B; + *IsOk = (TP_FREAD(&B, sizeof(Byte_t), 1, FileStream->File) == 1); + if (*IsOk) + X = (double)B; + } break; + case FieldDataType_Bit : + { + /* + * Important note: + * Reading bit data a value at a time is only valid for a + * single bit value. If the file contains a block of more than + * one bit value and you attempt to read it a bit at a time it + * will not work as Tecplot does not buffer the read. In order + * to read a block of bits you must perform a block read. + */ + Byte_t B; + *IsOk = (TP_FREAD(&B, sizeof(Byte_t), 1, FileStream->File) == 1); + if (*IsOk) + X = (double)(B & (Byte_t)01); + } break; + default: CHECK(FALSE); break; + } + + if (*IsOk) + { + if ((X < VMin) || (X > VMax)) + { + *IsOk = FALSE; + } + } + } + + return X; +} + + +LgIndex_t GetNextI(FileStream_s *FileStream, + Boolean_t *IsOk) +{ + LgIndex_t I = 0; + + REQUIRE(VALID_REF(IsOk) && VALID_BOOLEAN(*IsOk)); + REQUIRE(!(*IsOk) || (VALID_REF(FileStream) && VALID_REF(FileStream->File))); + + if (*IsOk) + { + Int32_t Int32Val; + *IsOk = (TP_FREAD((void *) & Int32Val, 4, 1, FileStream->File) == 1); + if (!FileStream->IsByteOrderNative) + REVERSE_4_BYTES(&Int32Val); + + I = Int32Val; + } + return I; +} + + +LgIndex_t GetIoFileInt(FileStream_s *FileStream, + short Version, + LgIndex_t IMin, + LgIndex_t IMax, + Boolean_t *IsOk) +{ + LgIndex_t I = 0; + + REQUIRE(VALID_REF(IsOk) && VALID_BOOLEAN(*IsOk)); + REQUIRE(!(*IsOk) || (0 < Version && Version <= TecplotBinaryFileVersion)); + REQUIRE(!(*IsOk) || (VALID_REF(FileStream) && VALID_REF(FileStream->File))); + REQUIRE(!(*IsOk) || IMin <= IMax); + + if (!(*IsOk)) + return (0); + + if (Version <= 63) + { + float X; + if (*IsOk) + { + X = (float)GetNextValue(FileStream, FieldDataType_Float, + (double)IMin - 1.0e-10, + (double)IMax + 1.0e-10, IsOk); + if (*IsOk) + { + if (ABS(X) < (float)MAXINDEX) + I = (LgIndex_t)X; + else + *IsOk = FALSE; + } + else + *IsOk = FALSE; + } + } + else + { + I = GetNextI(FileStream, IsOk); + } + + if ((I < IMin) || (I > IMax)) + *IsOk = FALSE; + + return (I); +} + +/** + * Basically this is "realloc" but apparently "realloc" doesn't behave reliably + * on all platforms. + */ +static Boolean_t ReallocString(char **String, + LgIndex_t NewLength) +{ + Boolean_t IsOk; + char *NewString; + + REQUIRE(VALID_REF(String)); + REQUIRE(*String == NULL || VALID_REF(*String)); + REQUIRE((*String != NULL && NewLength >= (LgIndex_t)strlen(*String)) || + (*String == NULL && NewLength >= 0)); + + NewString = ALLOC_ARRAY(NewLength + 1, char, "reallocated string"); + IsOk = (NewString != NULL); + if (IsOk) + { + if (*String == NULL) + { + NewString[0] = '\0'; + } + else + { + strcpy(NewString, *String); + FREE_ARRAY(*String, "old string"); + } + *String = NewString; + } + + ENSURE(VALID_BOOLEAN(IsOk)); + ENSURE(IMPLICATION(IsOk, VALID_REF(*String))); + return IsOk; +} + + +/** + * Reads a string from all versions of a binary plt file. + * + * param FileStream + * Open file stream positioned at the string to read. + * param IVersion + * Binary file version number. + * param MaxCharacters + * IVersion < 63 + * This value is exactly the number of characters (actually floats, each + * one representing a character's ordinal value) to read from the file. + * IVersion >= 63 and ProcessData == TRUE + * If non-zero, this value represents the largest string to be returned. + * In other words, larger strings are read from the file but an allocated + * string of up to MaxCharacters is returned. A zero value indicates that + * the string size is unlimited and determined only by the actual length + * of the string in the file. + * param TargetStr + * Pointer to hold the allocated string if ProcessData == TRUE. + * param ProcessData + * Indicates if the read string should be retrieved. + * + * return + * TRUE if the read was successful with an allocated string *TargetStr + * containing the string read (no larger than requested or necessary), + * FALSE otherwise. + */ +Boolean_t ReadInString(FileStream_s *FileStream, + short IVersion, + int MaxCharacters, + char **TargetStr, + Boolean_t ProcessData) +{ + Boolean_t IsOk = TRUE; + + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(0 < IVersion && IVersion <= TecplotBinaryFileVersion); + REQUIRE(IMPLICATION(IVersion < 63 || ProcessData, MaxCharacters >= 0)); + REQUIRE(IMPLICATION(ProcessData, VALID_REF(TargetStr))); + REQUIRE(VALID_BOOLEAN(ProcessData)); + + if (IVersion < 63) + { + /* + * One word per character. Read Exactly "MaxCharacters" number of words. + */ + float X; + + if (ProcessData) + { + *TargetStr = ALLOC_ARRAY(MaxCharacters + 1, char, "target string"); + IsOk = (*TargetStr != NULL); + } + + if (IsOk) + { + LgIndex_t I; + for (I = 0; IsOk && I < MaxCharacters; I++) + { + X = (float)GetNextValue(FileStream, FieldDataType_Float, 0.0, 127.0, &IsOk); + if (!IsOk) + break; + if (ProcessData) + (*TargetStr)[I] = FilterFloatChar(X); + } + if (ProcessData) + (*TargetStr)[I] = '\0'; + } + else + { + ErrMsg(translate("Cannot allocate memory for string during read", + "'string' meaning the computer science data type")); + } + } + else + { +#define MAX_STRBUFFER_LEN 4095 + static char StrBuffer[MAX_STRBUFFER_LEN+1]; + LgIndex_t StrBufferLen = 0; + LgIndex_t TargetStrLen = 0; + LgIndex_t I = 0; + LgIndex_t CharValue = 0; + + if (ProcessData) + *TargetStr = NULL; + + do + { + CharValue = GetIoFileInt(FileStream, IVersion, 0, 255, &IsOk); + if (IsOk && ProcessData) + { + /* massage the character if necessary */ + if ((CharValue < 32 && CharValue != '\0' && CharValue != '\n') || + (CharValue >= 128 && CharValue < 160)) + CharValue = ' '; + + /* + * if the limit is not exceded, stuff the + * character into the buffer + */ + if (CharValue != '\0' && + (I < MaxCharacters || MaxCharacters == 0)) + { + StrBuffer[StrBufferLen] = (char)CharValue; + StrBufferLen++; + } + + if (CharValue == '\0' || + StrBufferLen == MAX_STRBUFFER_LEN) + { + if (StrBufferLen != 0 || *TargetStr == NULL) + { + StrBuffer[StrBufferLen] = '\0'; + TargetStrLen += StrBufferLen; + IsOk = ReallocString(TargetStr, TargetStrLen); + if (IsOk) + strcat(*TargetStr, StrBuffer); + StrBufferLen = 0; /* reset the string buffer */ + } + } + } + + I++; + } + while (IsOk && (char)CharValue != '\0'); + + /* if we failed cleanup if necessary */ + if (!IsOk && + ProcessData && + *TargetStr != NULL) + { + FREE_ARRAY(*TargetStr, "failed read string"); + *TargetStr = NULL; + } + } + + ENSURE(IMPLICATION(ProcessData, + (VALID_REF(*TargetStr) || *TargetStr == NULL))); + ENSURE(VALID_BOOLEAN(IsOk)); + return (IsOk); +} + +/** + */ +static void ReadDoubleBlock(FileStream_s *FileStream, + Boolean_t DoRead, + double *Buffer, + LgIndex_t StartIndex, + LgIndex_t NumValues, + Boolean_t *IsOk) +{ + if (DoRead) + { + double *DPtr = Buffer + StartIndex; + *IsOk = (TP_FREAD(DPtr, sizeof(double), NumValues, FileStream->File) == (size_t)NumValues); + if (!FileStream->IsByteOrderNative && *IsOk) + { + LgIndex_t N; + for (N = 0; N < NumValues; N++) + REVERSE_8_BYTES(&DPtr[N]); + } + } + else + *IsOk = (TP_FSEEK(FileStream->File, NumValues * sizeof(double), SEEK_CUR) == 0); +} + +/** + */ +static void ReadFloatBlock(FileStream_s *FileStream, + Boolean_t DoRead, + float *Buffer, + LgIndex_t StartIndex, + LgIndex_t NumValues, + Boolean_t *IsOk) +{ + if (DoRead) + { + float *FPtr = Buffer + StartIndex; + *IsOk = (TP_FREAD(FPtr, sizeof(float), NumValues, FileStream->File) == (size_t)NumValues); + if (!FileStream->IsByteOrderNative && *IsOk) + { + LgIndex_t N; + for (N = 0; N < NumValues; N++) + REVERSE_4_BYTES(&FPtr[N]); + } + } + else + *IsOk = (TP_FSEEK(FileStream->File, NumValues * sizeof(float), SEEK_CUR) == 0); +} + + +/** + */ +static void ReadBitBlock(FileStream_s *FileStream, + Boolean_t DoRead, + Byte_t *Buffer, + LgIndex_t NumValues, + Boolean_t *IsOk) +{ + /* + * Do not allow reading of bit values if startindex is not 0. + * (This means geometries cannot use bit data. + */ + LgIndex_t NumBytes = (NumValues + 7) / 8; + if (DoRead) + { + *IsOk = (TP_FREAD(Buffer, + sizeof(Byte_t), + NumBytes, + FileStream->File) == (size_t)NumBytes); + } + else + *IsOk = (TP_FSEEK(FileStream->File, NumBytes * sizeof(Byte_t), SEEK_CUR) == 0); +} + +/** + */ +void ReadByteBlock(FileStream_s *FileStream, + Boolean_t DoRead, + Byte_t *Buffer, + HgIndex_t StartIndex, + HgIndex_t NumValues, + Boolean_t *IsOk) +{ + if (DoRead) + { + *IsOk = (TP_FREAD(Buffer + StartIndex, + sizeof(Byte_t), + NumValues, + FileStream->File) == (size_t)NumValues); + } + else + *IsOk = (TP_FSEEK(FileStream->File, NumValues * sizeof(Byte_t), SEEK_CUR) == 0); +} + + +/** + */ +void ReadInt16Block(FileStream_s *FileStream, + Boolean_t DoRead, + Int16_t *Buffer, + HgIndex_t StartIndex, + HgIndex_t NumValues, + Boolean_t *IsOk) +{ + if (DoRead) + { + Int16_t *IntPtr = Buffer + StartIndex; + *IsOk = (TP_FREAD(IntPtr, + sizeof(Int16_t), + NumValues, + FileStream->File) == (size_t)NumValues); + + if (!FileStream->IsByteOrderNative && *IsOk) + { + LgIndex_t N; + for (N = 0; N < NumValues; N++) + REVERSE_2_BYTES(&IntPtr[N]); + } + } + else + *IsOk = (TP_FSEEK(FileStream->File, NumValues * sizeof(Int16_t), SEEK_CUR) == 0); +} + +/** + */ +void ReadInt16BlockToInt32(FileStream_s *FileStream, + Boolean_t DoRead, + Int32_t *Buffer, + HgIndex_t StartIndex, + HgIndex_t NumValues, + Boolean_t *IsOk) +{ + REQUIRE(VALID_REF(FileStream)); + REQUIRE(VALID_BOOLEAN(DoRead)); + REQUIRE(VALID_REF(Buffer)); + REQUIRE(StartIndex >= 0); + REQUIRE(NumValues >= 0); + REQUIRE(VALID_REF(IsOk) && VALID_BOOLEAN(*IsOk)); + + if (DoRead) + { + HgIndex_t EndIndex = StartIndex + NumValues; + for (HgIndex_t ValueIndex = StartIndex; *IsOk && ValueIndex < EndIndex; ValueIndex++) + { + Int16_t Value; + *IsOk = (TP_FREAD(&Value, sizeof(Int16_t), 1, FileStream->File) == 1); + if (!FileStream->IsByteOrderNative && *IsOk) + REVERSE_2_BYTES(&Value); + Buffer[ValueIndex] = (Int32_t)Value; + } + } + else + *IsOk = (TP_FSEEK(FileStream->File, NumValues * sizeof(Int16_t), SEEK_CUR) == 0); +} + +/** + */ +void ReadInt32Block(FileStream_s *FileStream, + Boolean_t DoRead, + Int32_t *Buffer, + HgIndex_t StartIndex, + HgIndex_t NumValues, + Boolean_t *IsOk) +{ + if (DoRead) + { + Int32_t *IntPtr = Buffer + StartIndex; + *IsOk = (TP_FREAD(IntPtr, + sizeof(Int32_t), + NumValues, + FileStream->File) == (size_t)NumValues); + + if (!FileStream->IsByteOrderNative && *IsOk) + { + LgIndex_t N; + for (N = 0; N < NumValues; N++) + REVERSE_4_BYTES(&IntPtr[N]); + } + } + else + *IsOk = (TP_FSEEK(FileStream->File, NumValues * sizeof(Int32_t), SEEK_CUR) == 0); +} + +/** + */ +void ReadPureBlock(FileStream_s *FileStream, + Boolean_t DoRead, + void *Buffer, + FieldDataType_e FieldDataType, + HgIndex_t StartIndex, + HgIndex_t NumValues, + Boolean_t *IsOk) +{ + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(VALID_BOOLEAN(DoRead)); + REQUIRE(!DoRead || VALID_REF(Buffer)); + REQUIRE(VALID_FIELD_DATA_TYPE(FieldDataType)); + REQUIRE(StartIndex >= 0); + REQUIRE(NumValues >= 0); + REQUIRE(VALID_REF(IsOk) && VALID_BOOLEAN(*IsOk)); + + switch (FieldDataType) + { + case FieldDataType_Float : + { + ReadFloatBlock(FileStream, + DoRead, + (float *)Buffer, + StartIndex, + NumValues, + IsOk); + } break; + case FieldDataType_Double : + { + ReadDoubleBlock(FileStream, + DoRead, + (double *)Buffer, + StartIndex, + NumValues, + IsOk); + } break; + case FieldDataType_Bit : + { + if (StartIndex != 0) + { + ErrMsg(translate("Internal Error: Attempt to read bit data at non-zero offset", + "see Tecplot User's manual for a definition of 'bit' data")); + *IsOk = FALSE; + } + else + ReadBitBlock(FileStream, + DoRead, + (Byte_t *)Buffer, + NumValues, + IsOk); + } break; + case FieldDataType_Byte : + { + ReadByteBlock(FileStream, + DoRead, + (Byte_t *)Buffer, + StartIndex, + NumValues, + IsOk); + } break; + case FieldDataType_Int16 : + { + ReadInt16Block(FileStream, + DoRead, + (Int16_t *)Buffer, + StartIndex, + NumValues, + IsOk); + } break; + case FieldDataType_Int32 : + { + ReadInt32Block(FileStream, + DoRead, + (Int32_t *)Buffer, + StartIndex, + NumValues, + IsOk); + } break; + case FieldDataType_IJKFunction : /* Not used yet */ + case FieldDataType_Int64 : /* Not used yet */ + default: CHECK(FALSE); break; + } + ENSURE(VALID_BOOLEAN(*IsOk)); +} + +/** + */ +void ReadBlock(FileStream_s *FileStream, + FieldData_pa FieldData, + Boolean_t DoRead, + FieldDataType_e FieldDataTypeInFile, + HgIndex_t StartIndex, + HgIndex_t EndIndex, + Boolean_t *IsOk) +{ + REQUIRE(VALID_REF(IsOk) && VALID_BOOLEAN(*IsOk)); + REQUIRE(IMPLICATION(IsOk, VALID_REF(FileStream))); + REQUIRE(IMPLICATION(IsOk, VALID_FIELD_DATA_TYPE(FieldDataTypeInFile))); + REQUIRE(VALID_BOOLEAN(DoRead)); + REQUIRE(IMPLICATION(DoRead, VALID_REF(FieldData))); + + /* + * Bit data is packed into bytes. Since Tecplot doesn't buffer reads it can + * not perform bit by bit value reads and therefore must only perform block + * reads of bit data. + */ + Boolean_t ReadByBlock = IMPLICATION(DoRead, GetFieldDataType(FieldData) == FieldDataTypeInFile); + REQUIRE(ReadByBlock || (FieldDataTypeInFile != FieldDataType_Bit)); + + if (*IsOk) + { + LgIndex_t NumValues = EndIndex - StartIndex + 1; + if (ReadByBlock) + { + void *data_array; + if (DoRead) + data_array = GetFieldDataVoidPtr(FieldData); + else + data_array = NULL; + ReadPureBlock(FileStream, + DoRead, + data_array, + FieldDataTypeInFile, + StartIndex, + NumValues, + IsOk); + } + else + { + LgIndex_t N; + for (N = 0; *IsOk && (N < NumValues); N++) + { + double D = GetNextValue(FileStream, FieldDataTypeInFile, -LARGEDOUBLE, LARGEDOUBLE, IsOk); + if (DoRead) + SetFieldValue(FieldData, N + StartIndex, D); + } + } + } +} + +/** + */ +void ReadClassicOrderedCCBlock(FileStream_s *DataFileStream, + FieldData_pa FieldData, + FieldDataType_e FieldDataTypeInFile, + LgIndex_t NumIPtsInFile, + LgIndex_t NumJPtsInFile, + LgIndex_t NumKPtsInFile, + Boolean_t *IsOk) +{ + REQUIRE(IMPLICATION(*IsOk, VALID_REF(DataFileStream))); + REQUIRE(IMPLICATION(*IsOk, VALID_FIELD_DATA_TYPE(FieldDataTypeInFile))); + REQUIRE(VALID_REF(FieldData)); + REQUIRE(NumIPtsInFile >= 0); + REQUIRE(NumJPtsInFile >= 0); + REQUIRE(NumKPtsInFile >= 0); + REQUIRE(VALID_REF(IsOk) && VALID_BOOLEAN(*IsOk)); + + if (*IsOk) + { + LgIndex_t J, K; + LgIndex_t NumIJPts = NumIPtsInFile * NumJPtsInFile; + LgIndex_t IEnd = MAX(NumIPtsInFile - 1, 1); + LgIndex_t JEnd = MAX(NumJPtsInFile - 1, 1); + LgIndex_t KEnd = MAX(NumKPtsInFile - 1, 1); + LgIndex_t NumValues = (IEnd * JEnd * KEnd); + Boolean_t IsLinear = ((NumJPtsInFile == 1 && NumKPtsInFile == 1) || + (NumIPtsInFile == 1 && NumKPtsInFile == 1) || + (NumIPtsInFile == 1 && NumJPtsInFile == 1)); + if (IsLinear) + ReadBlock(DataFileStream, FieldData, TRUE, FieldDataTypeInFile, + 0, NumValues - 1, IsOk); + else + for (K = 0; K < KEnd && IsOk; K++) + for (J = 0; J < JEnd && IsOk; J++) + { + LgIndex_t CellIndex = 0 + (J * NumIPtsInFile) + (K * NumIJPts); + ReadBlock(DataFileStream, FieldData, TRUE, FieldDataTypeInFile, + CellIndex, CellIndex + IEnd - 1, IsOk); + } + } + + ENSURE(VALID_BOOLEAN(*IsOk)); +} + +/** + */ +static void AdjustCustomColor(short IVersion, + ColorIndex_t *BColor) +{ + REQUIRE(0 < IVersion && IVersion <= TecplotBinaryFileVersion); + REQUIRE(VALID_REF(BColor)); + + if ((IVersion < 70) && (*BColor >= 15) && (*BColor <= 22)) + *BColor -= 7; +} + + +/* + * ReadInDataFileTypeTitleAndVarNames replaces ReadInDataFileTitleAndVarNames + * and reads in the filetype as well in files with version >= 109. + */ +Boolean_t ReadInDataFileTypeTitleAndVarNames(FileStream_s *FileStream, + short IVersion, + char **DataSetTitle, + DataFileType_e *FileType, + int *NumVars, + StringList_pa *VarNames) +{ + EntIndex_t CurVar; + Boolean_t IsOk = TRUE; + + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(0 < IVersion && IVersion <= TecplotBinaryFileVersion); + REQUIRE(VALID_REF(DataSetTitle) || (DataSetTitle == NULL)); + REQUIRE(VALID_REF(FileType) || (FileType == NULL)); + REQUIRE(VALID_REF(NumVars)); + REQUIRE(VALID_REF(VarNames) || (VarNames == NULL)); + + *NumVars = 0; + if (DataSetTitle) + *DataSetTitle = NULL; + if (IVersion >= 109) + { + if (FileType) + *FileType = (DataFileType_e)GetIoFileInt(FileStream, + IVersion, + 0, + DataFileType_Solution, + &IsOk); + else + GetIoFileInt(FileStream, + IVersion, + 0, + DataFileType_Solution, + &IsOk); + } + if (ReadInString(FileStream, + IVersion, + ((IVersion < 63) ? 80 : MaxChrsDatasetTitle), + DataSetTitle, + (Boolean_t)(DataSetTitle != NULL))) + { + if (DataSetTitle) + TrimLeadAndTrailSpaces(*DataSetTitle); + *NumVars = GetIoFileInt(FileStream, IVersion, 0, MAXZONEMAP, &IsOk); + } + else + IsOk = FALSE; + + if (IsOk && (*NumVars > MaxNumZonesOrVars)) + { + ErrMsg(translate("Too many variables")); + IsOk = FALSE; + } + + if (IsOk && VarNames) + { + if (*NumVars > 0) + { + /* allocate a string list filled with NULL's */ + *VarNames = StringListAlloc(); + IsOk = (*VarNames != NULL); + if (IsOk) + IsOk = StringListSetString(*VarNames, *NumVars - 1, NULL); + + if (!IsOk) + { + if (*VarNames != NULL) + StringListDealloc(VarNames); + ErrMsg(translate("Out of space while allocating var names")); + } + } + } + + for (CurVar = 0; IsOk && (CurVar < *NumVars); CurVar++) + { + char *VName = NULL; + + IsOk = ReadInString(FileStream, + IVersion, + ((IVersion < 63) ? 5 : MaxChrsVarName), + VarNames ? &VName : NULL, + (Boolean_t)(VarNames != NULL)); + if (IsOk && VarNames) + { + if (VName == NULL) + { + /* NULL variable names are converted to empty names */ + VName = ALLOC_ARRAY(1, char, "empty variable name"); + strcpy(VName, ""); + } + TrimLeadAndTrailSpaces(VName); + + /* + * variables are not allowed to have litteral new line characters + * within them but they can sneek in from ASCII data files so + * convert any to their appropriate two character representation + */ + IsOk = ReplaceNewlineWithBackslashN(&VName); + + IsOk = IsOk && StringListSetString(*VarNames, CurVar, VName); + if (VName != NULL) + FREE_ARRAY(VName, "variable name"); + } + + if (!IsOk) + { + if (VarNames && *VarNames) + StringListDealloc(VarNames); + ErrMsg(translate("Out of space while allocating variable names")); + } + } + ENSURE(VALID_BOOLEAN(IsOk)); + return (IsOk); +} + + + + +/** + */ +static Boolean_t ReadInPresetZoneColor(FileStream_s *FileStream, + short IVersion, + ZoneSpec_s *ZoneSpec) +{ + Boolean_t IsOk = TRUE; + LgIndex_t ZoneColor; + + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(0 < IVersion && IVersion <= TecplotBinaryFileVersion); + REQUIRE(VALID_REF(ZoneSpec)); + + ZoneColor = GetIoFileInt(FileStream, IVersion, -1, LastBasicColor, &IsOk); + if (IsOk) + { + if (VALID_BASIC_COLOR(ZoneColor)) + { + ZoneSpec->ZoneLoadInfo.PresetZoneColor = (EntIndex_t)ZoneColor; + AdjustCustomColor(IVersion, &ZoneSpec->ZoneLoadInfo.PresetZoneColor); + } + else if (ZoneColor != -1) + IsOk = FALSE; + } + + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + +/** + */ +static void ConvertCommonTimeToSolutionTime(ZoneSpec_s *ZoneSpec) +{ + REQUIRE(VALID_REF(ZoneSpec)); + REQUIRE(ZoneSpec->AuxData == NULL || VALID_REF(ZoneSpec->AuxData)); + + LgIndex_t ItemIndex; + if (ZoneSpec->AuxData != NULL && + AuxDataGetItemIndex(ZoneSpec->AuxData, AuxData_Common_Time, &ItemIndex)) + { + const char *SameName; + ArbParam_t Value; + AuxDataType_e Type; + Boolean_t Retain; + + AuxDataGetItemByIndex(ZoneSpec->AuxData, ItemIndex, + &SameName, &Value, &Type, &Retain); + CHECK(ustrcmp(AuxData_Common_Time, SameName) == 0); + CHECK(Type == AuxDataType_String); + + char *EndPtr = NULL; + double SolutionTime = strtod((const char *)Value, &EndPtr); + if (EndPtr != (char *)Value) + { + /* we only allow white space to trail a value */ + while (isspace(*EndPtr)) + EndPtr++; + } + if (EndPtr != (char *)Value && *EndPtr == '\0') + { + ZoneSpec->SolutionTime = SolutionTime; + ZoneSpec->StrandID = STRAND_ID_PENDING; + AuxDataDeleteItemByIndex(ZoneSpec->AuxData, ItemIndex); + } + } +} + +/* + * Pass1 for a zone reads in and initializes the zone structures. + * These structures are released later if the user elects to not read them + * in. + */ +Boolean_t ReadInZoneHeader(FileStream_s *FileStream, + short IVersion, + ZoneSpec_s *ZoneSpec, + Set_pa IsVarCellCentered, + EntIndex_t NumVars, + Boolean_t *IsRawFNAvailable, + LgIndex_t *FNNumBndryConns) +{ + EntIndex_t Var; + Boolean_t IsOk = TRUE; + LgIndex_t I1; + + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(0 < IVersion && IVersion <= TecplotBinaryFileVersion); + REQUIRE(VALID_REF(ZoneSpec)); + REQUIRE(IsVarCellCentered == NULL || VALID_REF(IsVarCellCentered)); + REQUIRE(NumVars >= 0); + REQUIRE(VALID_REF(IsRawFNAvailable)); + REQUIRE(VALID_REF(FNNumBndryConns)); + + SetZoneSpecDefaults(ZoneSpec); + + if (IsVarCellCentered != NULL) + { + /* assign default variable value location: nodal */ + ClearSet(IsVarCellCentered); + IsOk = ExpandSet(IsVarCellCentered, NumVars, FALSE); + } + + if (IsOk) + IsOk = ReadInString(FileStream, IVersion, + ((IVersion < 63) ? 10 : MaxChrsZnTitle), + &ZoneSpec->Name, + TRUE); + + if (IsOk && ZoneSpec->Name == NULL) + { + /* NULL zone names are converted to empty names */ + ZoneSpec->Name = ALLOC_ARRAY(1, char, "empty zone name"); + IsOk = (ZoneSpec->Name != NULL); + if (IsOk) + strcpy(ZoneSpec->Name, ""); + } + + if (IsOk) + TrimLeadAndTrailSpaces(ZoneSpec->Name); + + if (IVersion < 101) + { + Boolean_t IsZoneFinite; + DataFormat_e ZoneDataFormat; + + I1 = GetIoFileInt(FileStream, IVersion, 0, 3, &IsOk); + + if ((I1 < 0) || (I1 > 3)) + { + return (FALSE); + } + + ZoneDataFormat = (DataFormat_e)I1; + + IsZoneFinite = (ZoneDataFormat == DataFormat_FEPoint || + ZoneDataFormat == DataFormat_FEBlock); + + ZoneSpec->ZoneLoadInfo.IsInBlockFormat = (ZoneDataFormat == DataFormat_IJKBlock || + ZoneDataFormat == DataFormat_FEBlock); + + if (IVersion > 62) + IsOk = ReadInPresetZoneColor(FileStream, IVersion, ZoneSpec); + + if (IVersion < 60) + GetNextValue(FileStream, FieldDataType_Float, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); /* Old ZPlane Value */ + + if (IsOk) + { + ZoneSpec->NumPtsI = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + ZoneSpec->NumPtsJ = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + if (IVersion >= 60) + ZoneSpec->NumPtsK = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + else + ZoneSpec->NumPtsK = 1; + } + + if (IsOk) + { + /* If IMax,JMax, & KMax are all zero then this zone was "zombied" by + a partial read to make layout files align. */ + + if (!((ZoneSpec->NumPtsI == 0) && + (ZoneSpec->NumPtsJ == 0) && + (ZoneSpec->NumPtsK == 0)) && + ((ZoneSpec->NumPtsI <= 0) || + (ZoneSpec->NumPtsJ <= 0) || + (ZoneSpec->NumPtsK < 0) || + ((!IsZoneFinite && (ZoneSpec->NumPtsK == 0))))) + { + ErrMsg(translate("Datafile is corrupted")); + IsOk = FALSE; + } + + if (IsZoneFinite) + { + if (IVersion >= 61) + { + ZoneSpec->Type = (ZoneType_e)(ZoneSpec->NumPtsK + 1); + switch (ZoneSpec->Type) + { + case ZoneType_FETriangle: ZoneSpec->NumPtsK = 3; break; + case ZoneType_FEQuad: ZoneSpec->NumPtsK = 4; break; + case ZoneType_FETetra: ZoneSpec->NumPtsK = 4; break; + case ZoneType_FEBrick: ZoneSpec->NumPtsK = 8; break; + case ZoneType_FELineSeg: ZoneSpec->NumPtsK = 2; break; + default: + { + ErrMsg(translate("Datafile corrupted: Invalid element type for FE DataSet")); + IsOk = FALSE; + } + } + } + else + { + ZoneSpec->Type = ZoneType_FEQuad; + ZoneSpec->NumPtsK = 4; + } + } + else + { + ZoneSpec->Type = ZoneType_Ordered; + + ZoneSpec->ICellDim = ZoneSpec->NumPtsI - 1; + ZoneSpec->JCellDim = ZoneSpec->NumPtsJ - 1; + ZoneSpec->KCellDim = ZoneSpec->NumPtsK - 1; + } + } + + /* + * Raw and user defined boundary face neighbors connections were not in + * this or previous versions of the binary data files. + */ + *IsRawFNAvailable = FALSE; + *FNNumBndryConns = 0; + } + else + { + if (IsOk && (IVersion >= 107)) + { + ZoneSpec->ParentZone = GetIoFileInt(FileStream, IVersion, -1, MAXZONEMAP - 1, &IsOk); + if (!IsOk) + ErrMsg(translate("Invalid datafile: parent zone assignment must be to an existing zone within the same datafile.")); + } + + if (IsOk && (IVersion >= 106)) + { + /* Strand ID and solution time. Strand ID's of STRAND_ID_PENDING, -2, instruct Tecplot to generate strand ID's */ + ZoneSpec->StrandID = GetIoFileInt(FileStream, IVersion, -2, MAXZONEMAP - 1, &IsOk); + ZoneSpec->SolutionTime = GetNextValue(FileStream, FieldDataType_Double, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + if (!IsOk) + ErrMsg(translate("Invalid datafile: bad StrandID or SolutionTime")); + } + + /* preset zone color */ + IsOk = IsOk && ReadInPresetZoneColor(FileStream, IVersion, ZoneSpec); + + /* ZoneType */ + I1 = (ZoneType_e)GetIoFileInt(FileStream, IVersion, 0, 7, &IsOk); + switch (I1) + { + case 0: ZoneSpec->Type = ZoneType_Ordered; break; + case 1: ZoneSpec->Type = ZoneType_FELineSeg; break; + case 2: ZoneSpec->Type = ZoneType_FETriangle; break; + case 3: ZoneSpec->Type = ZoneType_FEQuad; break; + case 4: ZoneSpec->Type = ZoneType_FETetra; break; + case 5: ZoneSpec->Type = ZoneType_FEBrick; break; + case 6: ZoneSpec->Type = ZoneType_FEPolygon; break; + case 7: ZoneSpec->Type = ZoneType_FEPolyhedron; break; + default: + { + ErrMsg(translate("Invalid datafile: unknown zone type.")); + IsOk = FALSE; + } break; + } + + /* DataPacking (Always BLOCK starting with file version 112 so removed from binary format) */ + if (IVersion < 112) + ZoneSpec->ZoneLoadInfo.IsInBlockFormat = + ((DataPacking_e)GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk) == DataPacking_Block); + else + ZoneSpec->ZoneLoadInfo.IsInBlockFormat = TRUE; + + /* is the variable value location specified? */ + if ((Boolean_t)GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk) && IsOk) + { + /* Variable Value Location foreach Var */ + for (Var = 0; Var < NumVars && IsOk; Var++) + { + if ((Boolean_t)GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk) && IsOk && + IsVarCellCentered != NULL) + { + IsOk = (ZoneSpec->ZoneLoadInfo.IsInBlockFormat); + if (IsOk) + IsOk = AddToSet(IsVarCellCentered, Var, FALSE); + else + ErrMsg(translate("Invalid datafile: cell centered " + "variable must be in block format.", + "See the Tecplot User's Manual for a definition of 'block format'")); + } + } + } + + /* are raw face neighbors supplied in the data section? */ + if (IVersion >= 108 && IsOk) + { + *IsRawFNAvailable = GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk); + if (*IsRawFNAvailable && + (ZoneSpec->Type == ZoneType_Ordered || + ZoneSpec->Type == ZoneType_FELineSeg)) + { + IsOk = FALSE; + ErrMsg(translate("Invalid datafile: raw face neighbors may not be " + "supplied for ordered or FE line segment zones.")); + } + } + else + *IsRawFNAvailable = FALSE; + + /* + * If raw face neighbors are available in the datafile then Tecplot + * should not auto-assign the neighbors after the load. + */ + ZoneSpec->FNAreCellFaceNbrsSupplied = *IsRawFNAvailable; + + /* miscellaneous face neighbor info */ + *FNNumBndryConns = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + if (*FNNumBndryConns != 0) + ZoneSpec->FNMode = (FaceNeighborMode_e)GetIoFileInt(FileStream, IVersion, 0, 3, &IsOk); + + if (IVersion >= 108 && IsOk) + { + Boolean_t FaceNeighborsComplete = FALSE; + if (*FNNumBndryConns != 0 && + ZoneSpec->Type != ZoneType_Ordered) + FaceNeighborsComplete = (Boolean_t)GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk); + + /* + * If the user defined face neighbors completely specify all the + * face neighbors then we don't want to auto-assign the cell face + * neighbors after loading. If they are not complete then leave the + * setting (as set above) dependent on the availability of the raw + * face neighbors. + * + * NOTE: + * This is a rather inefficient way to specify face neighbors. + */ + if (FaceNeighborsComplete) + ZoneSpec->FNAreCellFaceNbrsSupplied = TRUE; + } + + if (ZoneSpec->Type == ZoneType_Ordered) + { + /* IMax, JMax, KMax */ + ZoneSpec->NumPtsI = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + ZoneSpec->NumPtsJ = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + ZoneSpec->NumPtsK = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + /* + * if not a zombie zone (zombie zone: points in all dimensions are + * zero) then points in each direction must be specified + */ + if (IsOk && + !(ZoneSpec->NumPtsI == 0 && + ZoneSpec->NumPtsJ == 0 && + ZoneSpec->NumPtsK == 0) && + (ZoneSpec->NumPtsI == 0 || + ZoneSpec->NumPtsJ == 0 || + ZoneSpec->NumPtsK == 0)) + { + ErrMsg(translate("Invalid data file: incorrect specification of " + "I, J, or K points for ordered data set.")); + IsOk = FALSE; + } + } + else + { + ZoneSpec->NumPtsI = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + if (ZoneSpec->Type == ZoneType_FEPolygon || ZoneSpec->Type == ZoneType_FEPolyhedron) + { + ZoneSpec->NumPtsK = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); // ...NumFaces + if (IVersion >= 111) + { + ZoneSpec->NumFaceNodes = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + ZoneSpec->NumFaceBndryFaces = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + ZoneSpec->NumFaceBndryItems = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + } + } + else + { + switch (ZoneSpec->Type) + { + case ZoneType_FETriangle: ZoneSpec->NumPtsK = 3; break; + case ZoneType_FEQuad: ZoneSpec->NumPtsK = 4; break; + case ZoneType_FETetra: ZoneSpec->NumPtsK = 4; break; + case ZoneType_FEBrick: ZoneSpec->NumPtsK = 8; break; + case ZoneType_FELineSeg: ZoneSpec->NumPtsK = 2; break; + default : + { + ErrMsg(translate("Invalid data file: invalid element type for FE data set.")); + IsOk = FALSE; + } + } + } + ZoneSpec->NumPtsJ = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + + ZoneSpec->ICellDim = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + ZoneSpec->JCellDim = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + ZoneSpec->KCellDim = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); + } + + /* Zone Auxiliary Data indicator followed by Zone Auxiliary Data */ + for (I1 = GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk); + IsOk && I1 != 0; + I1 = GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk)) + { + if (ZoneSpec->AuxData == NULL) + ZoneSpec->AuxData = AuxDataAlloc(); + IsOk = (ZoneSpec->AuxData != NULL); + if (IsOk) + IsOk = ReadInAuxData(FileStream, IVersion, ZoneSpec->AuxData); + } + } + + /* + * Convert AuxZone's Common.Time from non-time aware data files to zone + * solution time if it exists. + */ + if (IVersion < 106 && IsOk) + ConvertCommonTimeToSolutionTime(ZoneSpec); + + ENSURE(VALID_BOOLEAN(IsOk)); + return (IsOk); +} + + + + +/* + * Pass1 for Custom labels simply acknowledges that a custom label was + * parsed and skips over the labels. + */ + +Boolean_t ReadInCustomLabels(FileStream_s *FileStream, + short IVersion, + Boolean_t OkToLoad, + StringList_pa *CustomLabelBase) +{ + LgIndex_t NumLabels; + short I; + Boolean_t IsOk = TRUE; + + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(IVersion > 0); + REQUIRE(VALID_BOOLEAN(OkToLoad)); + REQUIRE(!(OkToLoad) || VALID_REF(CustomLabelBase)); + + NumLabels = (short)GetIoFileInt(FileStream, IVersion, 1, MAXINDEX, &IsOk); + if (IsOk && NumLabels != 0 && OkToLoad) + { + *CustomLabelBase = StringListAlloc(); + IsOk = (*CustomLabelBase != NULL); + if (!IsOk) + ErrMsg(translate("Cannot allocate memory for Custom Labels.")); + } + + for (I = 0; IsOk && (I < NumLabels); I++) + { + char *TLabel = NULL; + + IsOk = ReadInString(FileStream, IVersion, + 1024, + &TLabel, + OkToLoad); + TrimLeadAndTrailSpaces(TLabel); + + if (IsOk && OkToLoad) + { +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + IsOk = StringListAppendString(*CustomLabelBase, TLabel); + if (TLabel != NULL) + FREE_ARRAY(TLabel, "custom label"); + if (!IsOk) + ErrMsg(translate("Cannot allocate memory for Custom Label.")); + } + } + if (!IsOk) + ErrMsg(translate("Invalid custom axis label record in binary datafile")); + + ENSURE(VALID_BOOLEAN(IsOk)); + ENSURE(!(IsOk && NumLabels != 0 && OkToLoad) || + StringListValid(*CustomLabelBase)); + return IsOk; +} + + +Boolean_t ReadInUserRec(FileStream_s *FileStream, + short IVersion, + int MaxCharactersAllowed, + char **UserRec) /* NULL if to ignore */ +{ + if (!ReadInString(FileStream, IVersion, + MaxCharactersAllowed, + UserRec, + (Boolean_t)(UserRec != NULL))) + { + ErrMsg(translate("Invalid USERREC record in binary datafile")); + return (FALSE); + } + return (TRUE); +} + + +/** + */ +Boolean_t ReadInAuxData(FileStream_s *FileStream, + short IVersion, + AuxData_pa AuxData) +{ + Boolean_t IsOk; + Boolean_t DoCollectData; + char *AuxName = NULL; + LgIndex_t AuxValueType; + char *AuxValue = NULL; + + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(0 < IVersion && IVersion <= TecplotBinaryFileVersion); + REQUIRE(AuxData == NULL || VALID_REF(AuxData)); + + DoCollectData = (AuxData != NULL); + IsOk = ReadInString(FileStream, + IVersion, + MaxChrsVarName, /* ... seems reasonable */ + &AuxName, + DoCollectData); + if (IsOk && DoCollectData && !AuxDataIsValidName(AuxName)) + { + ErrMsg(translate("Invalid auxiliary data name.")); + IsOk = FALSE; + } + + /* + * currently only one value type is supported + * 0: AuxiliaryValueFormat_String + */ + if (IsOk) + { + AuxValueType = GetIoFileInt(FileStream, IVersion, 0, 0, &IsOk); + if (IsOk && (AuxValueType != (LgIndex_t)AuxDataType_String)) + { + ErrMsg(translate("Unsupported auxiliary data type")); + IsOk = FALSE; + } + } + + if (IsOk) + IsOk = ReadInString(FileStream, + IVersion, + MaxChrsAuxValueString, + &AuxValue, + DoCollectData); + if (IsOk && DoCollectData) + IsOk = AuxDataSetItem(AuxData, + AuxName, (ArbParam_t)AuxValue, + AuxDataType_String, + TRUE); /* Retain */ + + /* cleanup: auxiliary data made a copy of the name and value */ + if (AuxName != NULL) + FREE_ARRAY(AuxName, "data set auxiliary data item name"); + if (AuxValue != NULL) + FREE_ARRAY(AuxValue, "data set auxiliary data item value"); + + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +static void GetZoneAttachment(FileStream_s *FileStream, + short IVersion, + EntIndex_t *Z, + Boolean_t *IsAttached, + Boolean_t *IsOk) +{ + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(VALID_REF(Z)); + REQUIRE(VALID_REF(IsAttached)); + REQUIRE(VALID_REF(IsOk) && VALID_BOOLEAN(*IsOk)); + + if (IVersion >= 47) + *Z = (EntIndex_t)GetIoFileInt(FileStream, IVersion, -1, MAXZONEMAP, IsOk); + else + *Z = 0; + + if (IVersion < 70) + (*Z)--; + + if (*Z == -1) + { + *Z = 0; + *IsAttached = FALSE; + } + else + *IsAttached = TRUE; + + ENSURE(VALID_BOOLEAN(*IsAttached)); + ENSURE(VALID_BOOLEAN(*IsOk)); + ENSURE(*Z >= 0); +} + + +static Boolean_t ReadMacroFunctionCommand(FileStream_s *FileStream, + short IVersion, + Boolean_t OkToLoad, + char **MacroFunctionCommand) +{ + Boolean_t Result = FALSE; + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(IVersion > 0); + REQUIRE(VALID_BOOLEAN(OkToLoad)); + REQUIRE(VALID_REF(MacroFunctionCommand)); + + Result = ReadInString(FileStream, IVersion, 0, MacroFunctionCommand, OkToLoad); + + ENSURE(VALID_BOOLEAN(Result)); + return (Result); +} + + +/* + * Pass1 for Geometries simply acknowledges that a geometry was + * parsed and skips over the geometry. + */ +Boolean_t ReadInGeometry(FileStream_s *FileStream, + short IVersion, + Boolean_t OkToLoad, + Geom_s *Geom, + LgIndex_t MaxDataPts) +{ + LgIndex_t I; + LgIndex_t S; + FieldDataType_e FFT; + Boolean_t IsOk = TRUE; + TranslatedString ErrMsgString = translate("Invalid geometry record"); + + REQUIRE(VALID_REF(Geom)); + + if (IVersion < 70) + FFT = FieldDataType_Float; + else + FFT = FieldDataType_Double; + + if (IVersion < 101) + I = GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk); + else + I = GetIoFileInt(FileStream, IVersion, 0, 4, &IsOk); + + if (I == 0) + Geom->PositionCoordSys = CoordSys_Grid; + else if (I == 1) + Geom->PositionCoordSys = CoordSys_Frame; + /* + * I == 2 is for CoordSys_FrameOffset and is not used currently + * + * I == 3 is for the old window coordinate system + */ + else if (I == 4) + Geom->PositionCoordSys = CoordSys_Grid3D; + else + { + ErrMsgString = translate("Invalid geometry coordinate system"); + IsOk = FALSE; + } + + Geom->Scope = (Scope_e)GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk); + if (IVersion >= 102) + Geom->DrawOrder = (DrawOrder_e)GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk); + Geom->AnchorPos.Generic.V1 = GetNextValue(FileStream, FFT, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + Geom->AnchorPos.Generic.V2 = GetNextValue(FileStream, FFT, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + if (IVersion >= 45) + Geom->AnchorPos.Generic.V3 = GetNextValue(FileStream, FFT, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + else + Geom->AnchorPos.Generic.V3 = 0.0; + + GetZoneAttachment(FileStream, IVersion, &Geom->Zone, &Geom->AttachToZone, &IsOk); + + Geom->BColor = (SmInteger_t)GetIoFileInt(FileStream, IVersion, 0, 255, &IsOk); + + AdjustCustomColor(IVersion, &Geom->BColor); + + if (IVersion > 47) + { + Geom->FillBColor = (SmInteger_t)GetIoFileInt(FileStream, IVersion, 0, 255, &IsOk); + Geom->IsFilled = (Boolean_t)GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk); + AdjustCustomColor(IVersion, &Geom->FillBColor); + } + else + { + Geom->FillBColor = Geom->BColor; + Geom->IsFilled = FALSE; + } + + if (IVersion < 101) + { + Geom->GeomType = (GeomType_e)GetIoFileInt(FileStream, IVersion, 0, 5, &IsOk); + if (Geom->GeomType == GeomType_LineSegs3D) + { + /* + * GeomType_LineSegs3D is deprecated, converter to GeomType_LineSegs + * with CoordSys_Grid3D instead + */ + Geom->GeomType = GeomType_LineSegs; + Geom->PositionCoordSys = CoordSys_Grid3D; /*...should have been anyway */ + } + } + else + { + Geom->GeomType = (GeomType_e)GetIoFileInt(FileStream, IVersion, 0, 4, &IsOk); + } + + /* + * Check geom coord sys versus geom type + */ + if (Geom->PositionCoordSys == CoordSys_Grid3D && + Geom->GeomType != GeomType_LineSegs) + { + ErrMsgString = translate("Mismatch between geometry coordinate system and geometry type"); + IsOk = FALSE; + } + + if (IVersion > 41) + { + Geom->LinePattern = (LinePattern_e)GetIoFileInt(FileStream, IVersion, 0, (LgIndex_t)LinePattern_DashDotDot, &IsOk); + } + else + { + Geom->LinePattern = (LinePattern_e)((int)Geom->GeomType % 2); + Geom->GeomType = (GeomType_e)((int)Geom->GeomType / 10); + } + + if ((IVersion < 49) && ((short)(Geom->GeomType) == 2)) + { + Geom->GeomType = GeomType_Rectangle; + Geom->IsFilled = TRUE; + } + + if ((IVersion < 70) && ((short)(Geom->GeomType) > 1)) + Geom->GeomType = (GeomType_e)((short)Geom->GeomType + 1); + + ResetString(&Geom->MacroFunctionCommand, NULL, TRUE); + + Geom->ImageResizeFilter = ImageResizeFilter_Texture; + + if (IVersion >= 70) + { + Geom->PatternLength = GetNextValue(FileStream, FFT, + PatternLengthInputSpec.Min, + PatternLengthInputSpec.Max, + &IsOk); + Geom->LineThickness = GetNextValue(FileStream, FFT, + LineThicknessInputSpec.Min, + LineThicknessInputSpec.Max, + &IsOk); + Geom->NumEllipsePts = (SmInteger_t)GetIoFileInt(FileStream, IVersion, 2, MaxPtsCircleOrEllipse, &IsOk); + Geom->ArrowheadStyle = (ArrowheadStyle_e)GetIoFileInt(FileStream, IVersion, 0, (LgIndex_t)ArrowheadStyle_Hollow, &IsOk); + Geom->ArrowheadAttachment = (ArrowheadAttachment_e)GetIoFileInt(FileStream, IVersion, + 0, + (LgIndex_t)ArrowheadAttachment_AtBothEnds, + &IsOk); + + Geom->ArrowheadSize = GetNextValue(FileStream, FFT, + ArrowheadSizeInputSpec.Min, + ArrowheadSizeInputSpec.Max, + &IsOk); + Geom->ArrowheadAngle = GetNextValue(FileStream, FFT, + ArrowheadAngleInputSpec.Min, + ArrowheadAngleInputSpec.Max, + &IsOk); + + if (IVersion >= 75) + { + IsOk = ReadMacroFunctionCommand(FileStream, + IVersion, + OkToLoad, + &Geom->MacroFunctionCommand); + } /* version >= 75 */ + } /* version >= 70 */ + else + { + Geom->LineThickness = 0.001; + Geom->PatternLength = 0.02; + Geom->ArrowheadStyle = ArrowheadStyle_Plain; + Geom->ArrowheadAttachment = ArrowheadAttachment_None; + Geom->ArrowheadSize = 0.05; + Geom->ArrowheadAngle = 12.0 / DEGPERRADIANS; + } + + if (IVersion < 41) + { + GetNextValue(FileStream, FieldDataType_Float, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + GetNextValue(FileStream, FieldDataType_Float, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + GetNextValue(FileStream, FieldDataType_Float, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + } + + if (IVersion < 70) + Geom->DataType = FieldDataType_Float; + else + Geom->DataType = (FieldDataType_e)GetIoFileInt(FileStream, IVersion, 1, 2, &IsOk); + CHECK(VALID_GEOM_FIELD_DATA_TYPE(Geom->DataType)); + + Geom->Clipping = Clipping_ClipToViewport; /* default value for pre 101 versions */ + if (IVersion >= 101) + { + Geom->Clipping = (Clipping_e)GetIoFileInt(FileStream, IVersion, 0, 2, &IsOk); + /* + * The second clipping value was deprecated during v10 development and thus removed. + * This moved Clipping_ClipToFrame to the 2nd position from the 3rd, so we convert + * value 2 to ClipToFrame to support files made during v10 developement. + */ + if (Geom->Clipping == (Clipping_e)2) + Geom->Clipping = Clipping_ClipToFrame; + } + + if (IVersion < 50 || + Geom->GeomType == GeomType_LineSegs) + { + Geom->NumSegments = (SmInteger_t)GetIoFileInt(FileStream, IVersion, 1, MaxGeoSegments, &IsOk); +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + S = -1; + I = 0; + while ((S + 1 < Geom->NumSegments) && + !feof(FileStream->File) && IsOk) + { + S++; + Geom->NumSegPts[S] = GetIoFileInt(FileStream, IVersion, 1, MAXINDEX, &IsOk); + if ((I + Geom->NumSegPts[S] > MaxDataPts) && OkToLoad) + { + ErrMsgString = translate("Geometry is too big"); + IsOk = FALSE; + } + else + { + ReadBlock(FileStream, Geom->GeomData.Generic.V1Base, OkToLoad, Geom->DataType, I, I + Geom->NumSegPts[S] - 1, &IsOk); + ReadBlock(FileStream, Geom->GeomData.Generic.V2Base, OkToLoad, Geom->DataType, I, I + Geom->NumSegPts[S] - 1, &IsOk); + if (Geom->PositionCoordSys == CoordSys_Grid3D) + ReadBlock(FileStream, Geom->GeomData.Generic.V3Base, OkToLoad, Geom->DataType, I, I + Geom->NumSegPts[S] - 1, &IsOk); + I += Geom->NumSegPts[S]; + } + } + if (IsOk && (Geom->GeomType == GeomType_Rectangle)) /* IVersion < 50 */ + { + if (OkToLoad) + { + CopyFieldValue(Geom->GeomData.Generic.V1Base, 0, Geom->GeomData.Generic.V1Base, 2); + CopyFieldValue(Geom->GeomData.Generic.V2Base, 0, Geom->GeomData.Generic.V2Base, 2); + } + } + } + else if (Geom->GeomType == GeomType_Rectangle || + Geom->GeomType == GeomType_Ellipse) + { + double XX, YY; + XX = GetNextValue(FileStream, Geom->DataType, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + YY = GetNextValue(FileStream, Geom->DataType, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + if (OkToLoad) + { + SetFieldValue(Geom->GeomData.XYZ.XBase, 0, XX); + SetFieldValue(Geom->GeomData.XYZ.YBase, 0, YY); + } + Geom->NumSegments = 1; + Geom->NumSegPts[0] = 1; + } + else + { + double XX; + CHECK((Geom->GeomType == GeomType_Square) || + (Geom->GeomType == GeomType_Circle)); + XX = GetNextValue(FileStream, Geom->DataType, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + if (OkToLoad) + { + SetFieldValue(Geom->GeomData.XYZ.XBase, 0, XX); + } + Geom->NumSegments = 1; + Geom->NumSegPts[0] = 1; + } + + if (!IsOk) + ErrMsg(ErrMsgString); + + return (IsOk); +} + +/* + * Pass1 for text simply acknowledges that a text was + * parsed and skips over the text. + */ +Boolean_t ReadInText(FileStream_s *FileStream, + short IVersion, + Boolean_t OkToLoad, + Text_s *Text, + LgIndex_t MaxTextLen) +{ + LgIndex_t I; + FieldDataType_e FFT; + SmInteger_t TextLength = 0; + Boolean_t IsOk = TRUE; + TranslatedString ErrMsgString = translate("Invalid text record"); + + REQUIRE(VALID_REF(Text)); + + if (IVersion < 70) + FFT = FieldDataType_Float; + else + FFT = FieldDataType_Double; + + if (IVersion < 101) + I = GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk); + else + I = GetIoFileInt(FileStream, IVersion, 0, 4, &IsOk); + + if (I == 0) + Text->PositionCoordSys = CoordSys_Grid; + else if (I == 1) + Text->PositionCoordSys = CoordSys_Frame; + /* + * I == 2 is for CoordSys_FrameOffset and is not used currently + * + * I == 3 is for the old window coordinate system + */ + else if (I == 4) + Text->PositionCoordSys = CoordSys_Grid3D; + else + { + ErrMsgString = translate("Invalid text coordinate system."); + IsOk = FALSE; + } + + Text->Scope = (Scope_e)GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk); + Text->AnchorPos.Generic.V1 = GetNextValue(FileStream, FFT, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + Text->AnchorPos.Generic.V2 = GetNextValue(FileStream, FFT, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + if (IVersion >= 101) + Text->AnchorPos.Generic.V3 = GetNextValue(FileStream, FFT, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + else + Text->AnchorPos.Generic.V3 = 0.0; /* default value for pre 101 versions */ + + if (IVersion > 40) + Text->TextShape.Font = (Font_e)GetIoFileInt(FileStream, IVersion, 0, (LgIndex_t)Font_CourierBold, &IsOk); + else + Text->TextShape.Font = Font_Helvetica; + if (IVersion < 43) + GetNextValue(FileStream, FFT, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + if (IVersion < 70) + { + if (Text->PositionCoordSys == CoordSys_Grid) + Text->TextShape.SizeUnits = Units_Grid; + else + Text->TextShape.SizeUnits = Units_Frame; + } + else + Text->TextShape.SizeUnits = (Units_e)GetIoFileInt(FileStream, IVersion, 0, (LgIndex_t)Units_Point, &IsOk); + + Text->TextShape.Height = GetNextValue(FileStream, FFT, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); + if (IVersion > 47) + { + Text->Box.BoxType = (TextBox_e)GetIoFileInt(FileStream, IVersion, 0, (LgIndex_t)TextBox_Hollow, &IsOk); + if (IVersion < 70) + { + if (Text->Box.BoxType == TextBox_Hollow) + Text->Box.BoxType = TextBox_Filled; + else if (Text->Box.BoxType == TextBox_Filled) + Text->Box.BoxType = TextBox_Hollow; + } + Text->Box.Margin = GetNextValue(FileStream, FFT, + TextBoxMarginInputSpec.Min, + TextBoxMarginInputSpec.Max, + &IsOk); + if (IVersion >= 70) + Text->Box.LineThickness = GetNextValue(FileStream, FFT, + LineThicknessInputSpec.Min, + LineThicknessInputSpec.Max, + &IsOk); + else + Text->Box.LineThickness = 0.01; + Text->Box.BColor = (ColorIndex_t)GetIoFileInt(FileStream, IVersion, 0, 255, &IsOk); + Text->Box.FillBColor = (ColorIndex_t)GetIoFileInt(FileStream, IVersion, 0, 255, &IsOk); + AdjustCustomColor(IVersion, &Text->Box.BColor); + AdjustCustomColor(IVersion, &Text->Box.FillBColor); + } + else + { + Text->Box.BoxType = TextBox_None; + Text->Box.Margin = 0.0; + Text->Box.BColor = White_C; + Text->Box.FillBColor = Black_C; + } + if (IVersion < 70) + { + Text->Angle = GetIoFileInt(FileStream, IVersion, -720, 720, &IsOk) / DEGPERRADIANS; + Text->LineSpacing = 1; + Text->Anchor = TextAnchor_Left; + } + else + { + Text->Angle = GetNextValue(FileStream, FFT, + TextAngleInputSpec.Min, + TextAngleInputSpec.Max, + &IsOk); + Text->LineSpacing = GetNextValue(FileStream, FFT, + TextLineSpacingInputSpec.Min, + TextLineSpacingInputSpec.Max, + &IsOk); + Text->Anchor = (TextAnchor_e)GetIoFileInt(FileStream, IVersion, 0, (LgIndex_t)TextAnchor_HeadRight, &IsOk); + } + + GetZoneAttachment(FileStream, IVersion, &Text->Zone, &Text->AttachToZone, &IsOk); + + Text->BColor = (ColorIndex_t)GetIoFileInt(FileStream, IVersion, 0, 255, &IsOk); + AdjustCustomColor(IVersion, &Text->BColor); + if (IVersion < 70) + TextLength = (short)GetIoFileInt(FileStream, IVersion, 0, 5000, &IsOk); + + ResetString(&Text->MacroFunctionCommand, NULL, TRUE); + + Text->Clipping = Clipping_ClipToViewport; /* default value for pre 101 versions */ + + if (IVersion < 70) + { + short I, S; + for (I = 0; I < TextLength; I++) + { + S = (short)GetIoFileInt(FileStream, IVersion, 0, 1000, &IsOk); + if (OkToLoad && (I <= MaxTextLen)) + Text->Text[I] = (char)S; + } + if (OkToLoad) + Text->Text[MIN(TextLength, MaxTextLen)] = '\0'; + } + else + { + char *S = NULL; + + if (IVersion >= 75) + { + IsOk = ReadMacroFunctionCommand(FileStream, + IVersion, + OkToLoad, + &Text->MacroFunctionCommand); + } /* IVersion >= 75 */ + + if (IVersion >= 101) + { + /* + * The second clipping value was deprecated during v10 development and thus removed. + * This moved Clipping_ClipToFrame to the 2nd position from the 3rd, so we convert + * value 2 to ClipToFrame to support files made during v10 developement. + */ + Text->Clipping = (Clipping_e)GetIoFileInt(FileStream, IVersion, 0, 2, &IsOk); + if (Text->Clipping == (Clipping_e)2) + Text->Clipping = Clipping_ClipToFrame; + } + + if (ReadInString(FileStream, + IVersion, + MaxTextLen, + &S, + OkToLoad)) + { + REQUIRE(!(S || OkToLoad) || VALID_REF(Text->Text)); + if (S) + { +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + if (IsOk) + { + strcpy(Text->Text, S); + } + FREE_ARRAY(S, "Release temp string for new text label"); + } + else if (OkToLoad) + Text->Text[0] = '\0'; + } + else + IsOk = FALSE; + } + + if (!IsOk) + ErrMsg(ErrMsgString); + + return (IsOk); +} + + +static Boolean_t CompareVersion(float Version, + char *VersionString, + Boolean_t IsByteOrderNative) +{ + char *VersionBuf = (char *) & Version; + + REQUIRE(VALID_REF(VersionString)); + + if (IsByteOrderNative) + return ((VersionString[0] == VersionBuf[0]) && + (VersionString[1] == VersionBuf[1]) && + (VersionString[2] == VersionBuf[2]) && + (VersionString[3] == VersionBuf[3])); + else + return ((VersionString[3] == VersionBuf[0]) && + (VersionString[2] == VersionBuf[1]) && + (VersionString[1] == VersionBuf[2]) && + (VersionString[0] == VersionBuf[3])); +} + +static float ValidVersions[] = {7.0F, + 6.3F, 6.2F, 6.1F, 6.0F, + 5.0F, + 4.7F, 4.6F, 4.5F, 4.4F, 4.3F, 4.2F, 4.1F, 4.0F + }; +#define NUMVALIDVERSIONS ((int)(sizeof(ValidVersions)/sizeof(ValidVersions[0]))) + + +/* + * Extra caution taken here in case value read is invalid float + */ +static Boolean_t GetDoubleVersion(char *VersionString, + float *FInputVersion, + Boolean_t IsByteOrderNative) +{ + int I; + REQUIRE(VALID_REF(FInputVersion)); + + for (I = 0; I < NUMVALIDVERSIONS; I++) + if (CompareVersion(ValidVersions[I], VersionString, IsByteOrderNative)) + { + *FInputVersion = ValidVersions[I]; + return (TRUE); + } + return (FALSE); +} + + +static short GetNewInputVersion(FileStream_s *FileStream) +{ + /* + * + */ + char Buf[4]; + short IVersion = 0; + short I; + LgIndex_t OneValue; + Boolean_t IsOk = TRUE; + + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(FileStream->IsByteOrderNative); + + if (TP_FREAD(Buf, 4, 1, FileStream->File) != 1) + return (0); + + if (strncmp(Buf, "#!TD", 4)) + return (0); + + if (TP_FREAD(Buf, 4, 1, FileStream->File) != 1) + return (0); + + if (Buf[0] != 'V') + return (0); + + I = 1; + while ((I < 4) && isdigit(Buf[I])) + IVersion = IVersion * 10 + Buf[I++] - '0'; + + if (IVersion < 70) + return (0); + else if (IVersion > TecplotBinaryFileVersion) + { + ErrMsg(translate("Binary file version newer than Tecplot version. " + "Upgrade Tecplot or use an older Preplot to produce " + "the datafile.")); + return (IVersion); + } + + /* + * Determine Byte Order. + */ + + OneValue = GetIoFileInt(FileStream, + IVersion, + -MAXINDEX, + MAXINDEX, + &IsOk); + + if (!IsOk) + return (0); + + FileStream->IsByteOrderNative = (OneValue == 1); + + return (IVersion); +} + +/** + * Return value of zero is to be considered as an invalid + * tecplot binary datafile header. Actually binary files + * older than version 4.0 (return value of 40) are not supported + * (See notes in preplot.c). + */ +short GetInputVersion(FileStream_s *FileStream) +{ + Boolean_t IsOk = TRUE; + float FInputVersion; + short IVersion; + char VersionString[4]; + FileOffset_t StartOffset = 0; + + /* + * First check to see if file uses new + * input version format. + */ + + /* keep track of our start offset */ + StartOffset = TP_FTELL(FileStream->File); + + IVersion = GetNewInputVersion(FileStream); + + if (IVersion > TecplotBinaryFileVersion) + return IVersion; /* unsupported version */ + else if (IVersion == 0) + { + /* rewind to clear any errors and seek to the start offset */ + rewind(FileStream->File); + IsOk = (TP_FSEEK(FileStream->File, StartOffset, SEEK_SET) == 0); + + if (IsOk && TP_FREAD(VersionString, 4, 1, FileStream->File) == 1) + { + /* try both native and foreign versions numbers */ + if (!GetDoubleVersion(VersionString, &FInputVersion, FileStream->IsByteOrderNative)) + { + FileStream->IsByteOrderNative = !FileStream->IsByteOrderNative; /* ...reverse the byte order */ + IsOk = GetDoubleVersion(VersionString, &FInputVersion, FileStream->IsByteOrderNative); + } + if (IsOk) + IVersion = ROUNDS(FInputVersion * 10); + } + } + + if (IsOk) + return (IVersion); + else + return ((short)0); +} + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined ENGINE /* TODO(RMS)-H 12/12/2005: ENGINE: refactor to use just the Interrupted flag as-is */ +#else +#endif +#endif + + + +/********************************************************************** + ********************************************************************** + ********************** OUTPUT ************************** + ********************************************************************** + **********************************************************************/ + + +/** + * Byte blocks cannot be unaligned or reversed in bytes + */ +Boolean_t WriteBinaryByteBlock(FileStream_s *FileStream, + const Byte_t *ByteValues, + const HgIndex_t NumValues) +{ + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(VALID_REF(ByteValues)); + REQUIRE(NumValues >= 0); + + Boolean_t IsOk = TP_FWRITE(ByteValues, + sizeof(Byte_t), + (size_t)NumValues, + FileStream->File) == (size_t)NumValues; + + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + +/** + * Type Byte_t cannot be unaligned or reversed in byte order + */ +static inline Boolean_t WriteBinaryByte(FileStream_s *FileStream, + Byte_t ByteValue) +{ + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + Boolean_t IsOk = WriteBinaryByteBlock(FileStream, &ByteValue, 1); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + +/** + */ +template <typename T> +void CopyAndReverseUnalignedBytes(T *DstBuffer, + const Byte_t *SrcBuffer) +{ + REQUIRE(VALID_REF(DstBuffer)); + REQUIRE(VALID_REF(SrcBuffer)); + size_t typeSize = sizeof(T); + for (size_t ii = 0; ii < typeSize; ii++) + ((Byte_t *)(DstBuffer))[ii] = ((Byte_t *)(SrcBuffer))[typeSize-1-ii]; +} + +/** + */ +template <typename T> +void CopyUnalignedBytes(T *DstBuffer, + const Byte_t *SrcBuffer) +{ + REQUIRE(VALID_REF(DstBuffer)); + REQUIRE(VALID_REF(SrcBuffer)); + for (size_t ii = 0; ii < sizeof(T); ii++) + ((Byte_t *)(DstBuffer))[ii] = ((Byte_t *)(SrcBuffer))[ii]; +} + +/** + */ +template <typename T> +Boolean_t WriteBinaryDataUnaligned(FileStream_s *FileStream, + const Byte_t *ValueBuffer, + const Boolean_t ValueInNativeOrder) +{ + REQUIRE(VALID_REF(FileStream) && VALID_FILE_HANDLE(FileStream->File)); + REQUIRE(VALID_REF(ValueBuffer)); + REQUIRE(VALID_BOOLEAN(ValueInNativeOrder)); + + T DataValue; + if (ValueInNativeOrder != FileStream->IsByteOrderNative) + CopyAndReverseUnalignedBytes<T>(&DataValue, ValueBuffer); + else + CopyUnalignedBytes<T>(&DataValue, ValueBuffer); + + Boolean_t IsOk = TP_FWRITE(&DataValue, sizeof(T), 1, FileStream->File) == 1; + + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +/** + * This is used in many places and requires the value be in proper order. + */ +Boolean_t WriteBinaryInt16(FileStream_s *FileStream, + Int16_t Value) +{ + Boolean_t IsOk; + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE("Value can be any Int16_t"); + IsOk = WriteBinaryDataUnaligned<Int16_t>(FileStream, (Byte_t *) & Value, TRUE/*ValueInNativeOrder*/); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + +/** + * This is used in many places and requires the value be in proper order. + */ +Boolean_t WriteBinaryInt32(FileStream_s *FileStream, + Int32_t Value) +{ + Boolean_t IsOk; + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE("Value can be any Int32_t"); + IsOk = WriteBinaryDataUnaligned<Int32_t>(FileStream, (Byte_t *) & Value, TRUE/*ValueInNativeOrder*/); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + +/** + */ +template <typename T> +Boolean_t WriteBinaryBlockUnaligned(FileStream_s *FileStream, + const Byte_t *Values, + const HgIndex_t NumValues, + const Boolean_t ValuesInNativeOrdering) +{ + Boolean_t IsOk = TRUE; + Boolean_t WriteEachValueSeparately; + + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(VALID_REF(Values)); + REQUIRE(NumValues >= 0); + REQUIRE(VALID_BOOLEAN(ValuesInNativeOrdering)); + + WriteEachValueSeparately = (ValuesInNativeOrdering != FileStream->IsByteOrderNative); + + if (WriteEachValueSeparately) + { + for (HgIndex_t NIndex = 0; IsOk && NIndex < NumValues; NIndex++) + { + IsOk = WriteBinaryDataUnaligned<T>(FileStream, Values + NIndex * sizeof(T), ValuesInNativeOrdering); + } + } + else + { +#if 1 + size_t NumBytesToWrite = NumValues * sizeof(T); + size_t NumBytesWritten = TP_FWRITE(Values, sizeof(Byte_t), NumBytesToWrite, FileStream->File); + IsOk = NumBytesToWrite == NumBytesWritten; +#else + IsOk = WriteBinaryByteBlock(FileStream, Values, NumValues * sizeof(T)); +#endif + } + + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +/** + * Use Byte_t instead of Int16_t to support unaligned values + */ +Boolean_t WriteBinaryInt16BlockUnaligned(FileStream_s *FileStream, + Byte_t *Int16Values, + HgIndex_t NumValues, + Boolean_t ValuesInNativeOrdering) +{ + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(VALID_REF(Int16Values)); + REQUIRE(NumValues >= 0); + REQUIRE(VALID_BOOLEAN(ValuesInNativeOrdering)); + + Boolean_t IsOk = WriteBinaryBlockUnaligned<Int16_t>(FileStream, + Int16Values, + NumValues, + ValuesInNativeOrdering); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +/** + * Use Byte_t instead of Int32_t to support unaligned values + */ +Boolean_t WriteBinaryInt32BlockUnaligned(FileStream_s *FileStream, + Byte_t *Int32Values, + HgIndex_t NumValues, + Boolean_t ValuesInNativeOrdering) +{ + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(VALID_REF(Int32Values)); + REQUIRE(NumValues >= 0); + REQUIRE(VALID_BOOLEAN(ValuesInNativeOrdering)); + + Boolean_t IsOk = WriteBinaryBlockUnaligned<Int32_t>(FileStream, + Int32Values, + NumValues, + ValuesInNativeOrdering); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + + +/** + */ +Boolean_t WriteBinaryReal(FileStream_s *FileStream, + double RR, + FieldDataType_e FieldDataType) +{ + Boolean_t IsOk = FALSE; /* ...quite compiler */ + + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE((FieldDataType == FieldDataType_Float) || + (FieldDataType == FieldDataType_Double) || + (FieldDataType == FieldDataType_Byte)); + + switch (FieldDataType) + { + case FieldDataType_Float : + { + float FloatVal = CONVERT_DOUBLE_TO_FLOAT(RR); + IsOk = WriteBinaryDataUnaligned<float>(FileStream, (Byte_t *) & FloatVal, TRUE/*NativeOrdering*/); + } break; + case FieldDataType_Double : + { + double DoubleVal = CLAMP_DOUBLE(RR); + IsOk = WriteBinaryDataUnaligned<double>(FileStream, (Byte_t *) & DoubleVal, TRUE/*NativeOrdering*/); + } break; + case FieldDataType_Byte : + { + /* Note: type Byte cannot be unaligned or reversed in bytes */ + Byte_t B; + if (RR > 255) + B = 255; + else if (RR < 0) + B = 0; + else + B = (Byte_t)RR; + IsOk = WriteBinaryByte(FileStream, B); + } break; + default: CHECK(FALSE); break; + } + + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +Boolean_t WriteFieldDataType(FileStream_s *FileStream, + FieldDataType_e FDT, + Boolean_t WriteBinary) +{ + if (WriteBinary) + return (WriteBinaryInt32(FileStream, (LgIndex_t)FDT)); + else + { + short S = 0; + switch (FDT) + { + case FieldDataType_Float : S = fprintf(FileStream->File, "SINGLE "); break; + case FieldDataType_Double : S = fprintf(FileStream->File, "DOUBLE "); break; + case FieldDataType_Int32 : S = fprintf(FileStream->File, "LONGINT "); break; + case FieldDataType_Int16 : S = fprintf(FileStream->File, "SHORTINT "); break; + case FieldDataType_Byte : S = fprintf(FileStream->File, "BYTE "); break; + case FieldDataType_Bit : S = fprintf(FileStream->File, "BIT "); break; + default: CHECK(FALSE); + } + return (FPRINTFOK(S)); + } +} + +/** + */ +template <typename T> +Boolean_t WriteBinaryChecksumByteValues(FileStream_s *FileStream, + const Byte_t *ByteValues, + const HgIndex_t NumValues) +{ + REQUIRE(VALID_REF(FileStream) && VALID_FILE_HANDLE(FileStream->File)); + REQUIRE(VALID_REF(ByteValues)); + REQUIRE(NumValues >= 1); + + Boolean_t IsOk; + if (NumValues == 1) + IsOk = WriteBinaryDataUnaligned<T>(FileStream, ByteValues, TRUE); + else + IsOk = WriteBinaryBlockUnaligned<T>(FileStream, ByteValues, NumValues, TRUE); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + +/** + * For FieldData of Type Bit, use WriteBinaryFieldDataBlockOfTypeBit instead. + */ +template <typename T> +Boolean_t WriteBinaryFieldDataBlockOfType(FileStream_s *FileStream, + const FieldData_pa FieldData, + const LgIndex_t StartOffset, + const LgIndex_t NumValues) +{ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + Boolean_t IsOk = FALSE; + if (IsFieldDataDirectAccessAllowed(FieldData)) + { + Byte_t *ByteArray = GetFieldDataBytePtr(FieldData) + StartOffset * sizeof(T); + IsOk = WriteBinaryChecksumByteValues<T>(FileStream, ByteArray, (HgIndex_t)NumValues); + } + else + { + for (LgIndex_t Offset = StartOffset; Offset < NumValues; Offset++) + { + T ValueBuffer = (T)GetFieldValue(FieldData, Offset); + Byte_t *ByteValue = (Byte_t *) & ValueBuffer; + IsOk = WriteBinaryChecksumByteValues<T>(FileStream, ByteValue, 1); + } + } + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + +static Boolean_t WriteBinaryFieldDataBlockOfTypeBit(FileStream_s *FileStream, + const FieldData_pa FieldData, + const LgIndex_t StartOffset, /* Not used */ + const LgIndex_t NumValues) +{ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + Boolean_t IsOk = FALSE; + size_t NumBytes = 1 + (NumValues - 1) / 8; + if (IsFieldDataDirectAccessAllowed(FieldData)) + { + Byte_t *ByteArray = GetFieldDataBytePtr(FieldData); + IsOk = WriteBinaryChecksumByteValues<Byte_t>(FileStream, ByteArray, (HgIndex_t)NumBytes); + } + else + { + // Bits are written out a Byte at a time and since we only come in here every 8th + // bit, make sure to assemble a Byte value from the next 8 bits. + for (LgIndex_t Offset = 0; Offset < NumValues; Offset += 8) + { + Byte_t ValueBuffer = 0; + for (int ii = 0; ii < 8; ii++) + { + Byte_t CurBit = (Byte_t)GetFieldValue(FieldData, Offset + ii); + ValueBuffer |= (CurBit << ii); + } + IsOk = WriteBinaryChecksumByteValues<Byte_t>(FileStream, &ValueBuffer, 1); + } + } + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + +/* + */ +Boolean_t WriteBinaryFieldDataBlock(FileStream_s *FileStream, + FieldData_pa FieldData, + LgIndex_t StartOffset, + LgIndex_t NumValues) +{ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + Boolean_t IsOk = FALSE; + switch (GetFieldDataType(FieldData)) + { + case FieldDataType_Float : IsOk = WriteBinaryFieldDataBlockOfType<float>(FileStream, FieldData, StartOffset, NumValues); break; + case FieldDataType_Double : IsOk = WriteBinaryFieldDataBlockOfType<double>(FileStream, FieldData, StartOffset, NumValues); break; + case FieldDataType_Int32 : IsOk = WriteBinaryFieldDataBlockOfType<Int32_t>(FileStream, FieldData, StartOffset, NumValues); break; + case FieldDataType_Int16 : IsOk = WriteBinaryFieldDataBlockOfType<Int16_t>(FileStream, FieldData, StartOffset, NumValues); break; + case FieldDataType_Byte : IsOk = WriteBinaryFieldDataBlockOfType<Byte_t>(FileStream, FieldData, StartOffset, NumValues); break; + case FieldDataType_Bit : IsOk = WriteBinaryFieldDataBlockOfTypeBit(FileStream, FieldData, StartOffset, NumValues); break; + default: CHECK(FALSE); break; + } + + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +static Boolean_t WriteASCIIFieldDataValue(FileStream_s *FileStream, + FieldData_pa FieldData, + LgIndex_t Offset, + SmInteger_t AsciiPrecision) +{ + Boolean_t IsOk = FALSE; /* ...quiet compiler */ + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + double V = 0.0; + char buffer[100*MAX_SIZEOFUTF8CHAR]; + char *AsciiValue = buffer; + +#ifdef TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + V = GetFieldValue(FieldData, Offset); + + switch (GetFieldDataType(FieldData)) + { + case FieldDataType_Float : + case FieldDataType_Double : + /*IsOk = FPRINTFOK(fprintf(FileStream->File," %.*E",(int)AsciiPrecision,V)); */ + sprintf(buffer, " %.*E", (int)AsciiPrecision, V); + break; + case FieldDataType_Int32 : + /* IsOk = FPRINTFOK(fprintf(FileStream->File," %*d",(int)AsciiPrecision,ROUNDL(V))); */ + sprintf(buffer, " %*d", (int)AsciiPrecision, ROUNDL(V)); + break; + case FieldDataType_Int16 : + /* IsOk = FPRINTFOK(fprintf(FileStream->File," %6d",ROUND2(V))); */ + sprintf(buffer, " %6d", ROUND2(V)); + break; + case FieldDataType_Byte : + /* IsOk = FPRINTFOK(fprintf(FileStream->File," %3d",ROUNDS(V))); */ + sprintf(buffer, " %3d", ROUNDS(V)); + break; + case FieldDataType_Bit : + /* IsOk = FPRINTFOK(fprintf(FileStream->File," %c",((V == 0) ? '0' : '1'))); */ + sprintf(buffer, " %c", ((V == 0) ? '0' : '1')); + break; + default: CHECK(FALSE); break; + } + IsOk = FPRINTFOK(fprintf(FileStream->File, buffer)); +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + ENSURE(VALID_BOOLEAN(IsOk)); + return (IsOk); +} + + +/** + */ +Boolean_t WriteCCFieldDataBlock(FileStream_s *FileStream, + FieldData_pa FieldData, + Boolean_t IsOrderedData, + LgIndex_t NumIPts, + LgIndex_t NumJPts, + LgIndex_t NumKPts, + Boolean_t WriteBinary, + SmInteger_t AsciiPrecision) +{ + Boolean_t IsOk = TRUE; + LgIndex_t NumValues; + LgIndex_t I, J, K; + LgIndex_t NumIJPts = -1; + LgIndex_t IEnd = -1; + LgIndex_t JEnd = -1; + LgIndex_t KEnd = -1; + Boolean_t IsLinear = -1; + + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(VALID_REF(FieldData)); + REQUIRE(VALID_BOOLEAN(IsOrderedData)); + REQUIRE(NumIPts >= 0); + REQUIRE(NumJPts >= 0); + REQUIRE(NumKPts >= 0); + REQUIRE(VALID_BOOLEAN(WriteBinary)); + REQUIRE(IMPLICATION(!WriteBinary, AsciiPrecision >= 0)); + + /* + * As of version 103 Tecplot writes binary data files so that ordered cell + * centered field data includes the ghost cells. This makes it much easier + * for Tecplot to map the data when reading by simply writing out + * FieldData->NumValues. As of version 104 the ghost cells of the slowest + * moving index are not included but that does effect the output as it is + * still FieldData->NumValues. + */ + if (IsOrderedData && !WriteBinary) + { + /* + * Ordered ASCII output is always layed out using + * DataValueStructure_Classic format. + */ + NumIJPts = NumIPts * NumJPts; + IEnd = MAX(NumIPts - 1, 1); + JEnd = MAX(NumJPts - 1, 1); + KEnd = MAX(NumKPts - 1, 1); + NumValues = (IEnd * JEnd * KEnd); + IsLinear = ((NumJPts == 1 && NumKPts == 1) || + (NumIPts == 1 && NumKPts == 1) || + (NumIPts == 1 && NumJPts == 1)); + } + else + { + NumValues = GetFieldDataNumValues(FieldData); + } + + if (WriteBinary) + { + IsOk = WriteBinaryFieldDataBlock(FileStream, FieldData, 0, NumValues); + } + else + { + LgIndex_t NumValuesPerLine = 80 / (AsciiPrecision + 5); + if (IsOrderedData && !IsLinear) + { + LgIndex_t ValueIndex = 0; + for (K = 0; K < KEnd && IsOk; K++) + for (J = 0; J < JEnd && IsOk; J++) + for (I = 0; I < IEnd && IsOk; I++) + { + LgIndex_t CellIndex = I + (J * NumIPts) + (K * NumIJPts); + IsOk = WriteASCIIFieldDataValue(FileStream, + FieldData, + CellIndex, + AsciiPrecision); + if ((ValueIndex + 1) % NumValuesPerLine == 0 || ValueIndex == NumValues - 1) + IsOk = (fputc('\n', FileStream->File) != EOF); + ValueIndex++; + } + } + else + { + for (I = 0; I < NumValues && IsOk; I++) + { + IsOk = WriteASCIIFieldDataValue(FileStream, + FieldData, + I, + AsciiPrecision); + if ((I + 1) % NumValuesPerLine == 0 || I == NumValues - 1) + IsOk = (fputc('\n', FileStream->File) != EOF); + } + } + } + + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +Boolean_t DumpDatafileString(FileStream_s *FileStream, + const char *S, + Boolean_t WriteBinary) +{ + Boolean_t IsOk = TRUE; + const char *CPtr = S; + if (WriteBinary) + { + const char *CPtr = S; + while (IsOk && CPtr && *CPtr) + IsOk = WriteBinaryInt32(FileStream, (LgIndex_t)(unsigned char) * CPtr++); + if (IsOk) + IsOk = WriteBinaryInt32(FileStream, 0); + } + else + { + fputc('"', FileStream->File); + while (CPtr && *CPtr) + { + if (*CPtr == '\n') + { + CPtr++; + fputc('\\', FileStream->File); + fputc('\\', FileStream->File); + fputc('n', FileStream->File); + } + else + { + if ((*CPtr == '"') || (*CPtr == '\\')) + fputc('\\', FileStream->File); + fputc(*CPtr++, FileStream->File); + } + } + fputc('"', FileStream->File); + IsOk = (fputc('\n', FileStream->File) != EOF); + } + return (IsOk); +} + + +static void WriteAsciiColor(FILE *File, + ColorIndex_t Color) +{ + if (Color >= FirstCustomColor && Color <= LastCustomColor) + fprintf(File, "CUST%1d ", Color - FirstCustomColor + 1); + else + { + switch (Color) + { + case Black_C : fprintf(File, "BLACK "); break; + case Red_C : fprintf(File, "RED "); break; + case Green_C : fprintf(File, "GREEN "); break; + case Blue_C : fprintf(File, "BLUE "); break; + case Cyan_C : fprintf(File, "CYAN "); break; + case Yellow_C : fprintf(File, "YELLOW "); break; + case Purple_C : fprintf(File, "PURPLE "); break; + case White_C : fprintf(File, "WHITE "); break; + } + } +} + +static void WriteAsciiTextGeomBasics(FILE* File, + CoordSys_e CoordSys, + Boolean_t AttachToZone, + EntIndex_t Zone, + ColorIndex_t Color, + Scope_e Scope, + Boolean_t IncludeZ, + Boolean_t WriteGridDataAsPolar, + AnchorPos_u const* AnchorPos, + double ScaleFact) +{ + REQUIRE(VALID_REF(File)); + REQUIRE(VALID_TEXT_COORDSYS(CoordSys) || VALID_GEOM_COORDSYS(CoordSys)); + REQUIRE(VALID_BOOLEAN(AttachToZone)); + REQUIRE(IMPLICATION(AttachToZone, Zone >= 0)); + REQUIRE(VALID_ENUM(Scope, Scope_e)); + REQUIRE(VALID_BOOLEAN(IncludeZ)); + REQUIRE(VALID_BOOLEAN(WriteGridDataAsPolar)); + REQUIRE(VALID_REF(AnchorPos)); + + fprintf(File, "CS="); + if (CoordSys == CoordSys_Frame) + fprintf(File, "FRAME"); + else if (CoordSys == CoordSys_Grid) + fprintf(File, "GRID"); + /* + * Not currently used + * + else if (CoordSys == CoordSys_FrameOffset) + fprintf(File,"FRAMEOFFSET"); + */ + else if (CoordSys == CoordSys_Grid3D) + fprintf(File, "GRID3D"); + else + CHECK(FALSE); + + if (CoordSys == CoordSys_Grid && !IncludeZ && WriteGridDataAsPolar) + { + fprintf(File, "\nTHETA=%.12G,R=%.12G", + ScaleFact*AnchorPos->ThetaR.Theta, + ScaleFact*AnchorPos->ThetaR.R); + CHECK(!IncludeZ); + } + else + { + fprintf(File, "\nX=%.12G,Y=%.12G", + ScaleFact*AnchorPos->XYZ.X, + ScaleFact*AnchorPos->XYZ.Y); + if (IncludeZ) + fprintf(File, ",Z=%.12G", ScaleFact*AnchorPos->XYZ.Z); + } + + if (AttachToZone) + fprintf(File, "\nZN=%d", Zone + 1); + + fprintf(File, "\nC="); + WriteAsciiColor(File, Color); + + fprintf(File, "\nS="); + if (Scope == Scope_Global) + fprintf(File, "GLOBAL"); + else if (Scope == Scope_Local) + fprintf(File, "LOCAL"); + else + CHECK(FALSE); + + fputc('\n', File); +} + + +bool DumpGeometry(FileStream_s* FileStream, + Geom_s const* Geom, + Boolean_t WriteBinary, + Boolean_t WriteGridDataAsPolar) +{ + LgIndex_t I, Index; + LgIndex_t SegIndex; + bool IsOk = TRUE; + FieldDataType_e FDT; + + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(VALID_REF(Geom)); + REQUIRE(Geom->GeomType != GeomType_Image); + + if (WriteBinary) + { + WriteBinaryReal(FileStream, GeomMarker, FieldDataType_Float); + if (Geom->PositionCoordSys == CoordSys_Grid) + WriteBinaryInt32(FileStream, 0); + else if (Geom->PositionCoordSys == CoordSys_Frame) + WriteBinaryInt32(FileStream, 1); +#if 0 /* + * Not currently used + */ + else if (Geom->PositionCoordSys == CoordSys_FrameOffset) + WriteBinaryInt32(FileStream, 2); +#endif + /* + * PositionCoordSys == 3 is for old window coordinate system + */ + else if (Geom->PositionCoordSys == CoordSys_Grid3D) + WriteBinaryInt32(FileStream, 4); + else + CHECK(FALSE); + + WriteBinaryInt32(FileStream, (LgIndex_t)Geom->Scope); + WriteBinaryInt32(FileStream, (LgIndex_t)Geom->DrawOrder); + WriteBinaryReal(FileStream, Geom->AnchorPos.Generic.V1, FieldDataType_Double); + WriteBinaryReal(FileStream, Geom->AnchorPos.Generic.V2, FieldDataType_Double); + WriteBinaryReal(FileStream, Geom->AnchorPos.Generic.V3, FieldDataType_Double); + if (Geom->AttachToZone) + WriteBinaryInt32(FileStream, (LgIndex_t)Geom->Zone); + else + WriteBinaryInt32(FileStream, (LgIndex_t) - 1); + WriteBinaryInt32(FileStream, (LgIndex_t)Geom->BColor); + WriteBinaryInt32(FileStream, (LgIndex_t)Geom->FillBColor); + WriteBinaryInt32(FileStream, (LgIndex_t)Geom->IsFilled); + CHECK(Geom->GeomType != GeomType_LineSegs3D); /* deprecated */ + WriteBinaryInt32(FileStream, (LgIndex_t)Geom->GeomType); + WriteBinaryInt32(FileStream, (LgIndex_t)Geom->LinePattern); + WriteBinaryReal(FileStream, Geom->PatternLength, FieldDataType_Double); + WriteBinaryReal(FileStream, Geom->LineThickness, FieldDataType_Double); + WriteBinaryInt32(FileStream, (LgIndex_t)Geom->NumEllipsePts); + WriteBinaryInt32(FileStream, (LgIndex_t)Geom->ArrowheadStyle); + WriteBinaryInt32(FileStream, (LgIndex_t)Geom->ArrowheadAttachment); + WriteBinaryReal(FileStream, Geom->ArrowheadSize, FieldDataType_Double); + + WriteBinaryReal(FileStream, Geom->ArrowheadAngle, FieldDataType_Double); + + /* MACRO FUNCTION COMMAND */ + DumpDatafileString(FileStream, Geom->MacroFunctionCommand, TRUE); + + /* + * Assume geometry has X,Y (and Z) all using same field + * data type. + */ + FDT = GetGeomFieldDataType(Geom); + WriteFieldDataType(FileStream, FDT, TRUE); + WriteBinaryInt32(FileStream, (LgIndex_t)Geom->Clipping); + + if (Geom->GeomType == GeomType_LineSegs) + { + short S; + WriteBinaryInt32(FileStream, Geom->NumSegments); + I = 0; + for (S = 0; IsOk && (S < Geom->NumSegments); S++) + { + WriteBinaryInt32(FileStream, Geom->NumSegPts[S]); + WriteBinaryFieldDataBlock(FileStream, Geom->GeomData.Generic.V1Base, I, Geom->NumSegPts[S]); + IsOk = WriteBinaryFieldDataBlock(FileStream, Geom->GeomData.Generic.V2Base, I, Geom->NumSegPts[S]) == TRUE; + if (Geom->PositionCoordSys == CoordSys_Grid3D) + IsOk = WriteBinaryFieldDataBlock(FileStream, Geom->GeomData.Generic.V3Base, I, Geom->NumSegPts[S]) == TRUE; + I += Geom->NumSegPts[S]; + } + } + else if (Geom->GeomType == GeomType_Rectangle || + Geom->GeomType == GeomType_Ellipse) + { + WriteBinaryReal(FileStream, GetFieldValue(Geom->GeomData.XYZ.XBase, 0), FDT); + IsOk = WriteBinaryReal(FileStream, GetFieldValue(Geom->GeomData.XYZ.YBase, 0), FDT) == TRUE; + } + else + { + CHECK((Geom->GeomType == GeomType_Square) || + (Geom->GeomType == GeomType_Circle)); + IsOk = WriteBinaryReal(FileStream, GetFieldValue(Geom->GeomData.XYZ.XBase, 0), FDT) == TRUE; + } + + } + else + { + double ScaleFact; + if (Geom->PositionCoordSys == CoordSys_Frame) + ScaleFact = 100.0; + else + ScaleFact = 1.0; + + fprintf(FileStream->File, "GEOMETRY\nF=POINT\n"); + WriteAsciiTextGeomBasics(FileStream->File, + Geom->PositionCoordSys, + Geom->AttachToZone, + Geom->Zone, + Geom->BColor, + Geom->Scope, + TRUE, + WriteGridDataAsPolar, + &Geom->AnchorPos, + ScaleFact); + + switch (Geom->LinePattern) + { + case LinePattern_Solid : fprintf(FileStream->File, "L=SOLID\n"); break; + case LinePattern_Dashed : fprintf(FileStream->File, "L=DASHED\n"); break; + case LinePattern_DashDot : fprintf(FileStream->File, "L=DASHDOT\n"); break; + case LinePattern_Dotted : fprintf(FileStream->File, "L=DOTTED\n"); break; + case LinePattern_LongDash : fprintf(FileStream->File, "L=LONGDASH\n"); break; + case LinePattern_DashDotDot : fprintf(FileStream->File, "L=DASHDOTDOT\n"); break; + default: CHECK(FALSE); break; + } + fprintf(FileStream->File, "PL=%.12G\n", + Geom->PatternLength*PatternLengthInputSpec.InterfaceAdjust.ScaleFact); + fprintf(FileStream->File, "LT=%.12G\n", + Geom->LineThickness*LineThicknessInputSpec.InterfaceAdjust.ScaleFact); + + if (Geom->IsFilled) + { + fprintf(FileStream->File, "FC="); + WriteAsciiColor(FileStream->File, Geom->FillBColor); + } + + if (Geom->Clipping == Clipping_ClipToViewport) + fprintf(FileStream->File, "CLIPPING=CLIPTOVIEWPORT\n"); + else if (Geom->Clipping == Clipping_ClipToFrame) + fprintf(FileStream->File, "CLIPPING=CLIPTOFRAME\n"); + else + CHECK(FALSE); + + if (Geom->DrawOrder == DrawOrder_AfterData) + fprintf(FileStream->File, "DRAWORDER=AFTERDATA\n"); + else if (Geom->DrawOrder == DrawOrder_BeforeData) + fprintf(FileStream->File, "DRAWORDER=BEFOREDATA\n"); + else + CHECK(FALSE); + + /* Macro function command */ + fprintf(FileStream->File, "MFC="); + DumpDatafileString(FileStream, Geom->MacroFunctionCommand, FALSE); + + if ((Geom->GeomType == GeomType_Circle) || (Geom->GeomType == GeomType_Ellipse)) + fprintf(FileStream->File, "EP=%ld\n", (long)Geom->NumEllipsePts); + + if (Geom->GeomType == GeomType_LineSegs && Geom->PositionCoordSys != CoordSys_Grid3D) + { + switch (Geom->ArrowheadStyle) + { + case ArrowheadStyle_Plain : fprintf(FileStream->File, "AST=PLAIN\n"); break; + case ArrowheadStyle_Filled : fprintf(FileStream->File, "AST=FILLED\n"); break; + case ArrowheadStyle_Hollow : fprintf(FileStream->File, "AST=HOLLOW\n"); break; + default: CHECK(FALSE); break; + } + + switch (Geom->ArrowheadAttachment) + { + case ArrowheadAttachment_None : break; + case ArrowheadAttachment_AtBeginning : fprintf(FileStream->File, "AAT=BEGINNING\n"); break; + case ArrowheadAttachment_AtEnd : fprintf(FileStream->File, "AAT=END\n"); break; + case ArrowheadAttachment_AtBothEnds : fprintf(FileStream->File, "AAT=BOTH\n"); break; + default: CHECK(FALSE); break; + } + if (Geom->ArrowheadAttachment != ArrowheadAttachment_None) + { + fprintf(FileStream->File, "ASZ=%.12G\n", + Geom->ArrowheadSize*ArrowheadSizeInputSpec.InterfaceAdjust.ScaleFact); + fprintf(FileStream->File, "AAN=%.12G\n", + Geom->ArrowheadAngle*ArrowheadAngleInputSpec.InterfaceAdjust.ScaleFact); + } + } + + switch (Geom->GeomType) + { + case GeomType_LineSegs : + { + fprintf(FileStream->File, "T=LINE\n"); + fprintf(FileStream->File, "DT="); + WriteFieldDataType(FileStream, GetFieldDataType(Geom->GeomData.Generic.V1Base), FALSE); + fputc('\n', FileStream->File); + fprintf(FileStream->File, "%d\n", (int)Geom->NumSegments); + SegIndex = 0; + for (I = 0; IsOk && (I < Geom->NumSegments); I++) + { + fprintf(FileStream->File, "%ld\n", (long)Geom->NumSegPts[I]); + for (Index = 0; Index < Geom->NumSegPts[I]; Index++) + { + fprintf(FileStream->File, "%.12G ", GetFieldValue(Geom->GeomData.Generic.V1Base, SegIndex + Index)*ScaleFact); + fprintf(FileStream->File, "%.12G", GetFieldValue(Geom->GeomData.Generic.V2Base, SegIndex + Index)*ScaleFact); + if (Geom->PositionCoordSys == CoordSys_Grid3D) + IsOk = FPRINTFOK(fprintf(FileStream->File, " %.12G\n", GetFieldValue(Geom->GeomData.Generic.V3Base, SegIndex + Index))); + else + IsOk = (Boolean_t)(fputc('\n', FileStream->File) != EOF); + } + SegIndex += Geom->NumSegPts[I]; + } + } break; + case GeomType_Rectangle : + { + fprintf(FileStream->File, "T=RECTANGLE %.12G %.12G\n", + GetFieldValue(Geom->GeomData.XYZ.XBase, 0)*ScaleFact, + GetFieldValue(Geom->GeomData.XYZ.YBase, 0)*ScaleFact); + } break; + case GeomType_Square : + { + fprintf(FileStream->File, "T=SQUARE %.12G\n", + GetFieldValue(Geom->GeomData.XYZ.XBase, 0)*ScaleFact); + } break; + case GeomType_Circle : + { + fprintf(FileStream->File, "T=CIRCLE %.12G\n", + GetFieldValue(Geom->GeomData.XYZ.XBase, 0)*ScaleFact); + } break; + case GeomType_Ellipse : + { + fprintf(FileStream->File, "T=ELLIPSE %.12G %.12G\n", + GetFieldValue(Geom->GeomData.XYZ.XBase, 0)*ScaleFact, + GetFieldValue(Geom->GeomData.XYZ.YBase, 0)*ScaleFact); + } break; + default: CHECK(FALSE); + } + } + return IsOk; +} + +/** + */ +bool DumpText(FileStream_s* FileStream, + Text_s const* Text, + Boolean_t WriteBinary, + Boolean_t WriteGridDataAsPolar) +{ + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(VALID_REF(Text)); + REQUIRE(VALID_BOOLEAN(WriteBinary)); + REQUIRE(VALID_BOOLEAN(WriteGridDataAsPolar)); + + if (WriteBinary) + { + WriteBinaryReal(FileStream, TextMarker, FieldDataType_Float); + if (Text->PositionCoordSys == CoordSys_Grid) + WriteBinaryInt32(FileStream, 0); + else if (Text->PositionCoordSys == CoordSys_Frame) + WriteBinaryInt32(FileStream, 1); +#if 0 /* + * Not currently used + */ + else if (Geom->PositionCoordSys == CoordSys_FrameOffset) + WriteBinaryInt32(FileStream, 2); +#endif + /* + * 3 is used for old window coordinate system + */ + else if (Text->PositionCoordSys == CoordSys_Grid3D) + WriteBinaryInt32(FileStream, 4); + else + CHECK(FALSE); + + WriteBinaryInt32(FileStream, (LgIndex_t)Text->Scope); + WriteBinaryReal(FileStream, Text->AnchorPos.Generic.V1, FieldDataType_Double); + WriteBinaryReal(FileStream, Text->AnchorPos.Generic.V2, FieldDataType_Double); + WriteBinaryReal(FileStream, Text->AnchorPos.Generic.V3, FieldDataType_Double); + WriteBinaryInt32(FileStream, (LgIndex_t)Text->TextShape.Font); + WriteBinaryInt32(FileStream, (LgIndex_t)Text->TextShape.SizeUnits); + WriteBinaryReal(FileStream, Text->TextShape.Height, FieldDataType_Double); + WriteBinaryInt32(FileStream, (LgIndex_t)Text->Box.BoxType); + WriteBinaryReal(FileStream, Text->Box.Margin, FieldDataType_Double); + WriteBinaryReal(FileStream, Text->Box.LineThickness, FieldDataType_Double); + WriteBinaryInt32(FileStream, (LgIndex_t)Text->Box.BColor); + WriteBinaryInt32(FileStream, (LgIndex_t)Text->Box.FillBColor); + WriteBinaryReal(FileStream, Text->Angle, FieldDataType_Double); + WriteBinaryReal(FileStream, Text->LineSpacing, FieldDataType_Double); + WriteBinaryInt32(FileStream, (LgIndex_t)Text->Anchor); + if (Text->AttachToZone) + WriteBinaryInt32(FileStream, (LgIndex_t)Text->Zone); + else + WriteBinaryInt32(FileStream, (LgIndex_t) - 1); + WriteBinaryInt32(FileStream, (LgIndex_t)Text->BColor); + } + else + { + double ScaleFact; + Boolean_t IncludeZ = Text->PositionCoordSys == CoordSys_Grid3D; + if (Text->PositionCoordSys == CoordSys_Frame) + ScaleFact = 100.0; + else + ScaleFact = 1.0; + fprintf(FileStream->File, "TEXT\n"); + WriteAsciiTextGeomBasics(FileStream->File, + Text->PositionCoordSys, + Text->AttachToZone, + Text->Zone, + Text->BColor, + Text->Scope, + IncludeZ, + WriteGridDataAsPolar, + &Text->AnchorPos, + ScaleFact); + fprintf(FileStream->File, "HU="); + switch (Text->TextShape.SizeUnits) + { + case Units_Grid : fprintf(FileStream->File, "GRID\n"); break; + case Units_Frame : fprintf(FileStream->File, "FRAME\n"); break; + case Units_Point : fprintf(FileStream->File, "POINT\n"); break; + case Units_AxisPercentage : /* Not allowed */ + default: CHECK(FALSE); break; + } + + fprintf(FileStream->File, "LS=%.4G ", Text->LineSpacing); + + fprintf(FileStream->File, "AN="); + switch (Text->Anchor) + { + case TextAnchor_Left : fprintf(FileStream->File, "LEFT\n"); break; + case TextAnchor_Center : fprintf(FileStream->File, "CENTER\n"); break; + case TextAnchor_Right : fprintf(FileStream->File, "RIGHT\n"); break; + case TextAnchor_MidLeft : fprintf(FileStream->File, "MIDLEFT\n"); break; + case TextAnchor_MidCenter : fprintf(FileStream->File, "MIDCENTER\n"); break; + case TextAnchor_MidRight : fprintf(FileStream->File, "MIDRIGHT\n"); break; + case TextAnchor_HeadLeft : fprintf(FileStream->File, "HEADLEFT\n"); break; + case TextAnchor_HeadCenter : fprintf(FileStream->File, "HEADCENTER\n"); break; + case TextAnchor_HeadRight : fprintf(FileStream->File, "HEADRIGHT\n"); break; + default: CHECK(FALSE); break; + } + + switch (Text->Box.BoxType) + { + case TextBox_Hollow : fprintf(FileStream->File, "BX=Hollow "); break; + case TextBox_Filled : fprintf(FileStream->File, "BX=Filled "); break; + default :; + } + fprintf(FileStream->File, "BXM=%.4G ", Text->Box.Margin*100); + fprintf(FileStream->File, "LT=%.4G ", Text->Box.LineThickness*100.0); + fprintf(FileStream->File, "BXO="); WriteAsciiColor(FileStream->File, Text->Box.BColor); + fprintf(FileStream->File, "BXF="); WriteAsciiColor(FileStream->File, Text->Box.FillBColor); + + fprintf(FileStream->File, "\nF="); + switch (Text->TextShape.Font) + { + case Font_Helvetica : fprintf(FileStream->File, "HELV"); break; + case Font_HelveticaBold : fprintf(FileStream->File, "HELV-BOLD"); break; + case Font_Times : fprintf(FileStream->File, "TIMES"); break; + case Font_TimesBold: fprintf(FileStream->File, "TIMES-BOLD"); break; + case Font_TimesItalic : fprintf(FileStream->File, "TIMES-ITALIC"); break; + case Font_TimesItalicBold : fprintf(FileStream->File, "TIMES-ITALIC-BOLD"); break; + case Font_Courier : fprintf(FileStream->File, "COURIER"); break; + case Font_CourierBold : fprintf(FileStream->File, "COURIER-BOLD"); break; + case Font_Greek : fprintf(FileStream->File, "GREEK"); break; + case Font_Math : fprintf(FileStream->File, "MATH"); break; + case Font_UserDefined : fprintf(FileStream->File, "USER-DEF"); break; + default: CHECK(FALSE); break; + } + if (Text->TextShape.SizeUnits == Units_Frame) + ScaleFact = 100.0; + else + ScaleFact = 1.0; + fprintf(FileStream->File, "\nH=%.12G A=%.12G", + Text->TextShape.Height*ScaleFact, + Text->Angle*DEGPERRADIANS); + } + + + if (!WriteBinary) + fprintf(FileStream->File, "\nMFC="); + + DumpDatafileString(FileStream, Text->MacroFunctionCommand, WriteBinary); + + if (!WriteBinary) + { + if (Text->Clipping == Clipping_ClipToViewport) + fprintf(FileStream->File, "CLIPPING=CLIPTOVIEWPORT\n"); + else if (Text->Clipping == Clipping_ClipToFrame) + fprintf(FileStream->File, "CLIPPING=CLIPTOFRAME\n"); + else + CHECK(FALSE); + } + else + { + WriteBinaryInt32(FileStream, (LgIndex_t)Text->Clipping); + } + + if (!WriteBinary) + fprintf(FileStream->File, "T="); + + return DumpDatafileString(FileStream, Text->Text, WriteBinary) == TRUE; +} + +Boolean_t DumpCustomAxisLabels(FileStream_s *FileStream, + Boolean_t WriteBinary, + StringList_pa LabelBase) +{ + Boolean_t IsOk = TRUE; + LgIndex_t Index = 0; + LgIndex_t Count = 0; + + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); + REQUIRE(VALID_BOOLEAN(WriteBinary)); + REQUIRE(StringListValid(LabelBase)); + + Count = StringListCount(LabelBase); + if (WriteBinary) + { + WriteBinaryReal(FileStream, CustomLabelMarker, FieldDataType_Float); + WriteBinaryInt32(FileStream, Count); + } + else + { + fprintf(FileStream->File, " CUSTOMLABELS = \n"); + } + + for (Index = 0, IsOk = TRUE; Index < Count && IsOk; Index++) + { + const char *CurLabel = StringListGetStringRef(LabelBase, Index); + IsOk = DumpDatafileString(FileStream, CurLabel, WriteBinary); + } + + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + +/** + */ +Boolean_t WriteBinaryMagic(FileStream_s *FileStream) +{ + /* + * Write an integer value of 1 to the file. This is used + * by the reader to determine byte order of the file. + */ + return (WriteBinaryInt32(FileStream, 1)); +} + +/** + */ +bool writeBinaryVersionNumber(FileStream_s& fileStream, + int versionNumber) +{ + char buffer[5]; + sprintf(buffer, + "V%-3d", + versionNumber); + CHECK(strlen(buffer) == 4); + return fprintf(fileStream.File, + "#!TD%s", + buffer) > 0; +} + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined SUN +#else +#endif +#if !defined NO_ASSERTS +#endif +#if defined ALLOW_USERDEF_NO_NEIGHBORING_ELEMENT +#else +#endif +#if 0 /* not used yet */ +#endif +#if defined TECPLOTKERNEL +#endif +#if defined TECPLOTKERNEL +#endif +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataset.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataset.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fd35a87dcf20358649b4e6d518e28bdefa70c401 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataset.cpp @@ -0,0 +1,283 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +#define DATASETMODULE +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" +#include "STRUTIL.h" +#include "AUXDATA.h" +#include "ARRLIST.h" +#include "STRLIST.h" +#include "ALLOC.h" +#include "SET.h" +#include "DATASET.h" +#include "FILESTREAM.h" + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +#include "DATASET0.h" + + +#include <float.h> + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined ENGINE /* TODO(RMS)-H 12/12/2005: ENGINE: refactor to use just the Interrupted flag as-is */ +#else +#endif +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined USE_MACROS_FOR_FUNCTIONS +#endif +#if !defined USE_MACROS_FOR_FUNCTIONS +#endif +#endif /* TECPLOTKERNEL */ + +/** + * Cleanout the contents of the zone spec item but leaves the zone spec item. + * This effectively leaves the zone spec structure in the same state as calling + * ZoneSpecAlloc initially. + * + * param ZoneSpec + * Zone spec item to cleanup. + */ +void CleanoutZoneSpec(ZoneSpec_s *ZoneSpec) +{ + REQUIRE(VALID_REF(ZoneSpec)); + + if (ZoneSpec->Name != NULL) + FREE_ARRAY(ZoneSpec->Name, "ZoneSpec name"); + if (ZoneSpec->AuxData != NULL) + AuxDataDealloc(&ZoneSpec->AuxData); + SetZoneSpecDefaults(ZoneSpec); +} + + +/** + */ +void ZoneSpecDealloc(ZoneSpec_s **ZoneSpec) +{ + REQUIRE(VALID_REF(ZoneSpec)); + REQUIRE(VALID_REF(*ZoneSpec) || *ZoneSpec == NULL); + + if (*ZoneSpec != NULL) + { + CleanoutZoneSpec(*ZoneSpec); + + FREE_ITEM(*ZoneSpec, "ZoneSpec structure"); + *ZoneSpec = NULL; + } + + ENSURE(*ZoneSpec == NULL); +} + +/** + */ +Boolean_t ZoneSpecItemDestructor(void *ItemRef, + ArbParam_t ClientData) +{ + ZoneSpec_s **ZoneSpecRef = (ZoneSpec_s **)ItemRef; + + REQUIRE(VALID_REF(ZoneSpecRef)); + REQUIRE(VALID_REF(*ZoneSpecRef) || *ZoneSpecRef == NULL); + + if (*ZoneSpecRef != NULL) + ZoneSpecDealloc(ZoneSpecRef); + + ENSURE(*ZoneSpecRef == NULL); + return TRUE; +} + +/** + */ +void SetZoneSpecDefaults(ZoneSpec_s *ZoneSpec) +{ + REQUIRE(VALID_REF(ZoneSpec)); + ZoneSpec->Name = NULL; + ZoneSpec->UniqueID = INVALID_UNIQUE_ID; + ZoneSpec->ParentZone = BAD_SET_VALUE; + ZoneSpec->StrandID = STRAND_ID_STATIC; + ZoneSpec->SolutionTime = 0.0; + ZoneSpec->NumPtsI = 0; + ZoneSpec->NumPtsJ = 0; + ZoneSpec->NumPtsK = 0; + ZoneSpec->ICellDim = 0; // ...currently not used + ZoneSpec->JCellDim = 0; // ...currently not used + ZoneSpec->KCellDim = 0; // ...currently not used + ZoneSpec->Type = ZoneType_Ordered; + ZoneSpec->ZoneLoadInfo.PresetZoneColor = NoColor_C; + ZoneSpec->ZoneLoadInfo.IsInBlockFormat = TRUE; + ZoneSpec->AuxData = NULL; + ZoneSpec->BuildZoneOptInfo = TRUE; + + /* classic data only */ + ZoneSpec->FNMode = FaceNeighborMode_LocalOneToOne; + ZoneSpec->FNAreCellFaceNbrsSupplied = FALSE; + + /* polytope data only */ + ZoneSpec->NumFaceNodes = 0; + ZoneSpec->NumFaceBndryFaces = 0; + ZoneSpec->NumFaceBndryItems = 0; +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + +/** + */ +void ZoneSpecExcludeBndryConnsFromMetrics(ZoneSpec_s* ZoneSpec) +{ + REQUIRE(VALID_REF(ZoneSpec)); + + /* classic data face connectivity fixup (leave FNMode as-is) */ + ZoneSpec->FNAreCellFaceNbrsSupplied = FALSE; // ...if we invalidate boundary connections CellFaceNbrs must now be auto-generated + + /* polytope data face connectivity fixup */ + ZoneSpec->NumFaceBndryFaces = 0; + ZoneSpec->NumFaceBndryItems = 0; +} + +/** + */ +ZoneSpec_s *ZoneSpecAlloc(void) +{ + ZoneSpec_s *Result; + + Result = (ZoneSpec_s *)ALLOC_ITEM(ZoneSpec_s, "ZoneSpec structure"); + if (Result != NULL) + SetZoneSpecDefaults(Result); + + ENSURE(Result == NULL || VALID_REF(Result)); + return Result; +} + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +/** + * Adjusts the capacity request as necessary to minimize memory reallocations + * for large lists. The adjusted capacity will be at least as big as requested + * however it may be larger if it is determined that the space requirement is + * growing faster. + * + * param ZoneOrVarArrayList + * Array list requesting the change in capacity. + * param CurrentCapacity + * Current capacity of the array list. + * param RequestedCapacity + * Capacity request or zero for default size. + * param ClientData + * Any client data needed for the adjustment. + * + * return + * Adjusted capacity that is at least as large as the request or zero if + * unable to satisfy the requested capacity. + */ +LgIndex_t ZoneOrVarListAdjustCapacityRequest(ArrayList_pa ZoneOrVarArrayList, + LgIndex_t CurrentCapacity, + LgIndex_t RequestedCapacity, + ArbParam_t ClientData) +{ + LgIndex_t Result; + + REQUIRE(ArrayListIsValid(ZoneOrVarArrayList)); + REQUIRE((RequestedCapacity == 0 && CurrentCapacity == 0) || + RequestedCapacity > CurrentCapacity); + REQUIRE(CurrentCapacity <= MaxNumZonesOrVars); + + if (RequestedCapacity <= MaxNumZonesOrVars) + { + if (RequestedCapacity != 0 && CurrentCapacity == 0) + { + /* first allocation; assume the request is the desired capacityy */ + Result = RequestedCapacity; + } + else + { + const LgIndex_t DEFAULT_CAPACITY = 32; + LgIndex_t BlockSize = MAX(DEFAULT_CAPACITY, CurrentCapacity / 2); + if (RequestedCapacity == 0) + Result = DEFAULT_CAPACITY; + else + Result = ((RequestedCapacity - 1) / BlockSize + 1) * BlockSize; + + /* put a cap on the maximum */ + if (Result > MaxNumZonesOrVars) + Result = MaxNumZonesOrVars; + } + } + else + Result = 0; /* request exceeded maximum; unable to satisfy request */ + + ENSURE(Result == 0 || Result >= RequestedCapacity); + ENSURE(Result <= MaxNumZonesOrVars); + return Result; +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined USE_MACROS_FOR_FUNCTIONS +#endif +# if defined DEBUGUNIQUE +# endif +#endif /* TECPLOTKERNEL */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataset0.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataset0.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c18ca539d9f0c3afefa45dff7f33543eb968f83c --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataset0.cpp @@ -0,0 +1,1668 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +#define DATASET0MODULE +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" +#include "ALLOC.h" +#include "ARRLIST.h" +#include "DATASET.h" +#include "SET.h" +#include "DATASHR.h" +#include "FILESTREAM.h" +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +#include "Q_MSG.h" +#include "DATASET0.h" + +using namespace tecplot::strutil; +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +/* + * Low level dataset functions. No references to zones, vars or + * the DataSet_s master structure here. + */ + + +/* + */ +void OutOfMemoryMsg(void) +{ + ErrMsg(translate("Cannot allocate enough memory for this operation.")); +} /* OutOfMemoryMsg() */ + + +/** + */ +FieldData_pa FieldDataAlloc(void) +{ + FieldData_pa Result; + + Result = (FieldData_pa)ALLOC_ITEM(struct _FieldData_a, "FieldDataPtr"); + if (Result != NULL) + { + Result->Data = NULL; + +# if defined TECPLOTKERNEL /* TecIO doesn't require these features yet */ +/* CORE SOURCE CODE REMOVED */ +# else /* ...for TecIO only */ + Result->GetValueCallback[0] = NULL; + Result->SetValueCallback[0] = NULL; +# endif + +# if defined TECPLOTKERNEL /* TecIO doesn't require these features yet */ +/* CORE SOURCE CODE REMOVED */ +# endif + + Result->Type = FieldDataType_Invalid; + Result->ValueLocation = ValueLocation_Invalid; + Result->RefCount = 1; /* self */ + Result->VarShareRefCount = 1; /* self */ + Result->NumValues = 0; +# if defined TECPLOTKERNEL /* TecIO doesn't require these features yet */ +/* CORE SOURCE CODE REMOVED */ +# endif + } + + ENSURE(VALID_REF(Result) || Result == NULL); + return Result; +} + +/** + * Most clients should not call this function but FieldDataCleanup() instead. + * An exception to this would be Tecplot's own storable load-on-demand + * functions. + */ +void FieldDataDeallocData(FieldData_pa FieldData) +{ + REQUIRE(VALID_REF(FieldData)); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + if (FieldData->Data != NULL) + { + /* Hack to remove 'deleting void* is undefined' warning... */ + char *Tmp = (char *)FieldData->Data; + FREE_ARRAY(Tmp, "FieldData _Data"); + FieldData->Data = NULL; + } + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + ENSURE(FieldData->Data == NULL); +} + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +/** + */ +void FieldDataCleanup(FieldData_pa FieldData) +{ + REQUIRE(VALID_REF(FieldData)); + +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# else + FieldDataDeallocData(FieldData); +# endif +} + +/** + */ +void FieldDataDealloc(FieldData_pa *FieldData, + Boolean_t DoTrackVarSharing) +{ + REQUIRE(VALID_REF(FieldData)); + REQUIRE(VALID_REF(*FieldData) || *FieldData == NULL); + REQUIRE(IMPLICATION(*FieldData != NULL, + IsStructureReferenced(*FieldData))); + REQUIRE(IMPLICATION(*FieldData != NULL && DoTrackVarSharing, + IsVarStructureReferenced(*FieldData))); + REQUIRE(VALID_BOOLEAN(DoTrackVarSharing)); + REQUIRE(IMPLICATION(*FieldData != NULL, + (*FieldData)->RefCount >= (*FieldData)->VarShareRefCount)); + + if (*FieldData != NULL) + { + if (DoTrackVarSharing) + DecVarStructureReference(*FieldData); + DecStructureReference(*FieldData); + if (!IsStructureReferenced(*FieldData)) + { + FieldDataCleanup(*FieldData); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + FREE_ITEM(*FieldData, "field data"); + } + *FieldData = NULL; + } + + ENSURE(*FieldData == NULL); +} + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined NDEBUG || defined CHECKED_BUILD +#endif +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined NDEBUG || defined CHECKED_BUILD +#endif +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +template <typename T> +static void copyTypedValueArray(void* DstArray, + LgIndex_t DstStart, + void* SrcArray, + LgIndex_t SrcStart, + LgIndex_t SrcEnd) +{ + T* SrcPtr = ((T*)SrcArray) + SrcStart; + T* DstPtr = ((T*)DstArray) + DstStart; + size_t numBytes = sizeof(T) * (SrcEnd - SrcStart + 1); + memcpy(DstPtr, SrcPtr, numBytes); +} +/** + * DstArray and SrcArray are aligned on proper word boundaries. + */ +void CopyTypedValueArray(FieldDataType_e ValueType, + void *DstArray, + LgIndex_t DstStart, + void *SrcArray, + LgIndex_t SrcStart, + LgIndex_t SrcEnd) +{ + REQUIRE(VALID_FIELD_DATA_TYPE(ValueType) && + ValueType != FieldDataType_Bit); + REQUIRE(VALID_REF(DstArray)); + REQUIRE(DstStart >= 0); + REQUIRE(VALID_REF(SrcArray)); + REQUIRE(0 <= SrcStart && SrcStart <= SrcEnd); + REQUIRE(DstArray != SrcArray); + + switch (ValueType) + { + case FieldDataType_Int64 : CHECK(FALSE); /* Future work: remove check */ + case FieldDataType_Double : + { + CHECK(sizeof(UInt64_t) == 8 && sizeof(double) == 8); + copyTypedValueArray<UInt64_t>(DstArray, + DstStart, + SrcArray, + SrcStart, + SrcEnd); + } break; + case FieldDataType_Float : + case FieldDataType_Int32 : + { + CHECK(sizeof(UInt32_t) == 4 && sizeof(float) == 4); + copyTypedValueArray<UInt32_t>(DstArray, + DstStart, + SrcArray, + SrcStart, + SrcEnd); + } break; + case FieldDataType_Int16 : + { + CHECK(sizeof(UInt16_t) == 2); + copyTypedValueArray<UInt16_t>(DstArray, + DstStart, + SrcArray, + SrcStart, + SrcEnd); + } break; + case FieldDataType_Byte : + { + copyTypedValueArray<Byte_t>(DstArray, + DstStart, + SrcArray, + SrcStart, + SrcEnd); + } break; + default : CHECK(FALSE); + } +} + +/** + * SrcArray is aligned on proper word boundaries. + */ +void SwapBytesInTypedValueArray(FieldDataType_e ValueType, + void *SrcArray, + LgIndex_t SrcStart, + LgIndex_t SrcEnd, + LgIndex_t SrcSkip) +{ + REQUIRE(VALID_FIELD_DATA_TYPE(ValueType) && + ValueType != FieldDataType_Bit); + REQUIRE(VALID_REF(SrcArray)); + REQUIRE(0 <= SrcStart && SrcStart <= SrcEnd); + REQUIRE(SrcSkip > 0); + + switch (ValueType) + { + case FieldDataType_Int64: CHECK(FALSE); /* Future work: remove CHECK */ + case FieldDataType_Double: + { + /* swap 8 bytes blocks */ + UInt64_t *SrcPtr = ((UInt64_t *)SrcArray) + SrcStart; + UInt64_t *SrcPtrEnd = ((UInt64_t *)SrcArray) + SrcEnd; + CHECK(sizeof(UInt64_t) == 8 && sizeof(double) == 8); + while (SrcPtr <= SrcPtrEnd) + { + REVERSE_8_BYTES(SrcPtr); + SrcPtr += SrcSkip; + } + } break; + case FieldDataType_Float: + case FieldDataType_Int32: + { + /* swap 4 bytes blocks */ + UInt32_t *SrcPtr = ((UInt32_t *)SrcArray) + SrcStart; + UInt32_t *SrcPtrEnd = ((UInt32_t *)SrcArray) + SrcEnd; + CHECK(sizeof(UInt32_t) == 4 && sizeof(float) == 4); + while (SrcPtr <= SrcPtrEnd) + { + REVERSE_4_BYTES(SrcPtr); + SrcPtr += SrcSkip; + } + } break; + case FieldDataType_Int16: + { + /* swap 4 bytes blocks */ + UInt16_t *SrcPtr = ((UInt16_t *)SrcArray) + SrcStart; + UInt16_t *SrcPtrEnd = ((UInt16_t *)SrcArray) + SrcEnd; + CHECK(sizeof(UInt16_t) == 2); + while (SrcPtr <= SrcPtrEnd) + { + REVERSE_2_BYTES(SrcPtr); + SrcPtr += SrcSkip; + } + } break; + case FieldDataType_Byte: + case FieldDataType_Bit: + { + /* nothing to do */ + } break; + default: CHECK(FALSE); + } +} + +/** + * Same as SwapBytesInTypedValueArray, but does extra work. Doesn't assume + * DstArray and SrcArray are aligned on proper word boundaries. + */ +void SwapBytesInUnalignedTypedValueArray(FieldDataType_e ValueType, + void *SrcArray, + LgIndex_t SrcStart, + LgIndex_t SrcEnd, + LgIndex_t SrcSkip) +{ + REQUIRE(VALID_FIELD_DATA_TYPE(ValueType) && + ValueType != FieldDataType_Bit); + REQUIRE(VALID_REF(SrcArray)); + REQUIRE(0 <= SrcStart && SrcStart <= SrcEnd); + REQUIRE(SrcSkip > 0); + + switch (ValueType) + { + case FieldDataType_Int64: CHECK(FALSE); /* Future work: remove CHECK */ + case FieldDataType_Double: + { + /* swap 8-byte blocks */ + Byte_t *SrcPtr = ((Byte_t *)SrcArray) + SrcStart * sizeof(UInt64_t); + Byte_t *SrcPtrEnd = ((Byte_t *)SrcArray) + SrcEnd * sizeof(UInt64_t); + size_t byte_skip = SrcSkip * sizeof(UInt64_t); + CHECK(sizeof(UInt64_t) == 8 && sizeof(double) == 8); + while (SrcPtr <= SrcPtrEnd) + { + REVERSE_8_BYTES_1_AT_A_TIME(SrcPtr); + SrcPtr += byte_skip; + } + } break; + case FieldDataType_Float: + case FieldDataType_Int32: + { + /* swap 4-byte blocks */ + Byte_t *SrcPtr = ((Byte_t *)SrcArray) + SrcStart * sizeof(UInt32_t); + Byte_t *SrcPtrEnd = ((Byte_t *)SrcArray) + SrcEnd * sizeof(UInt32_t); + size_t byte_skip = SrcSkip * sizeof(UInt32_t); + CHECK(sizeof(UInt32_t) == 4 && sizeof(float) == 4); + while (SrcPtr <= SrcPtrEnd) + { + REVERSE_4_BYTES_1_AT_A_TIME(SrcPtr); + SrcPtr += byte_skip; + } + } break; + case FieldDataType_Int16: + { + /* swap 2-byte blocks */ + Byte_t *SrcPtr = ((Byte_t *)SrcArray) + SrcStart * sizeof(UInt16_t); + Byte_t *SrcPtrEnd = ((Byte_t *)SrcArray) + SrcEnd * sizeof(UInt16_t); + size_t byte_skip = SrcSkip * sizeof(UInt16_t); + CHECK(sizeof(UInt16_t) == 2); + while (SrcPtr <= SrcPtrEnd) + { + REVERSE_2_BYTES_1_AT_A_TIME(SrcPtr); + SrcPtr += byte_skip; + } + } break; + case FieldDataType_Byte: + case FieldDataType_Bit: + { + /* No swapping required. */ + } break; + default: CHECK(FALSE); + } +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined DEBUG_FIELDVALUES +# define DEBUG_FIELDVALUES_BAD_VALUE 0x11 +static unsigned char BadValueStr[] = +{ + DEBUG_FIELDVALUES_BAD_VALUE, + DEBUG_FIELDVALUES_BAD_VALUE, + DEBUG_FIELDVALUES_BAD_VALUE, + DEBUG_FIELDVALUES_BAD_VALUE, + DEBUG_FIELDVALUES_BAD_VALUE, + DEBUG_FIELDVALUES_BAD_VALUE, + DEBUG_FIELDVALUES_BAD_VALUE, + DEBUG_FIELDVALUES_BAD_VALUE +}; +/** + * If Tecplot is responsible for managing (allocating and deallocating) the + * raw data then + */ +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# else +# define FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, type) \ + ((sizeof(type) < 4) /* cannot make reliably test with less than four bytes */ || \ + memcmp(BadValueStr,((char *)((fd)->Data))+sizeof(type)*(pt), sizeof(type)) != 0) +# endif +#else +# define FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, type) TRUE +#endif + + + +/** + * Used in macros, thus not static + */ +double STDCALL GetFieldValueForFloat(const FieldData_pa fd, + LgIndex_t pt) +{ + REQUIRE(VALID_REF(fd)); +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); + REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, float)); + + double Result = (double)GetFieldDataFloatPtr(fd)[pt]; + + return Result; +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/** + * Used in macros, thus not static + */ +double STDCALL GetFieldValueForDouble(const FieldData_pa fd, + LgIndex_t pt) +{ + REQUIRE(VALID_REF(fd)); +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); + REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, double)); + + double Result = GetFieldDataDoublePtr(fd)[pt]; + + return Result; +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/** + */ +double STDCALL GetFieldValueForInt32(const FieldData_pa fd, + LgIndex_t pt) +{ + REQUIRE(VALID_REF(fd)); +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); + REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Int32_t)); + + double Result = (double)GetFieldDataInt32Ptr(fd)[pt]; + + return Result; +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/** + */ +double STDCALL GetFieldValueForInt16(const FieldData_pa fd, + LgIndex_t pt) +{ + REQUIRE(VALID_REF(fd)); +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); + REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Int16_t)); + + double Result = (double)GetFieldDataInt16Ptr(fd)[pt]; + + return Result; +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/** + */ +double STDCALL GetFieldValueForByte(const FieldData_pa fd, + LgIndex_t pt) +{ + REQUIRE(VALID_REF(fd)); +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + REQUIRE(fd->Type == FieldDataType_Byte); + REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); + REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Byte_t)); + + double Result = (double)GetFieldDataBytePtr(fd)[pt]; + + return Result; +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/** + */ +double STDCALL GetFieldValueForBit(const FieldData_pa fd, + LgIndex_t pt) +{ + REQUIRE(VALID_REF(fd)); +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + REQUIRE(fd->Type == FieldDataType_Bit); + REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); + REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt / 8, Byte_t)); + + LgIndex_t ByteOffset = pt / 8; + Byte_t BitMask = (01 << (pt % 8)); + + Byte_t *byte_array = GetFieldDataBytePtr(fd); + double Result = (byte_array[ByteOffset] & BitMask) ? 1.0 : 0.0; + + return Result; +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/** + */ +FieldValueGetFunction_pf DetermineFieldDataGetFunction(FieldDataType_e DataType, + Boolean_t IsFragmented) +{ + FieldValueGetFunction_pf Result; + + REQUIRE(VALID_FIELD_DATA_TYPE(DataType)); + REQUIRE(VALID_BOOLEAN(IsFragmented)); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + { + switch (DataType) + { + case FieldDataType_Float : + { + Result = GetFieldValueForFloat; + } break; + case FieldDataType_Double : + { + Result = GetFieldValueForDouble; + } break; + case FieldDataType_Int32 : + { + Result = GetFieldValueForInt32; + } break; + case FieldDataType_Int16 : + { + Result = GetFieldValueForInt16; + } break; + case FieldDataType_Byte : + { + Result = GetFieldValueForByte; + } break; + case FieldDataType_Bit : + { + Result = GetFieldValueForBit; + } break; + default : + { + CHECK(FALSE); + Result = NULL; /* satisfy compiler */ + } break; + } + } + return (Result); +} + +/** + */ +static void STDCALL SetFieldValueForFloat(FieldData_pa fd, + LgIndex_t pt, + double val) +{ + REQUIRE(VALID_REF(fd)); +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); + REQUIRE("val can have any value"); + + GetFieldDataFloatPtr(fd)[pt] = CONVERT_DOUBLE_TO_FLOAT(val); + + ENSURE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, float)); +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/** + */ +static void STDCALL SetFieldValueForDouble(FieldData_pa fd, + LgIndex_t pt, + double val) +{ + REQUIRE(VALID_REF(fd)); +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); + REQUIRE("val can have any value"); + + GetFieldDataDoublePtr(fd)[pt] = CLAMP_DOUBLE(val); + + ENSURE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, double)); +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/** + */ +static void STDCALL SetFieldValueForInt32(FieldData_pa fd, + LgIndex_t pt, + double val) +{ + REQUIRE(VALID_REF(fd)); +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); + REQUIRE("val can have any value"); + + GetFieldDataInt32Ptr(fd)[pt] = CONVERT_DOUBLE_TO_INT32(val); + + ENSURE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Int32_t)); +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/** + */ +static void STDCALL SetFieldValueForInt16(FieldData_pa fd, + LgIndex_t pt, + double val) +{ + REQUIRE(VALID_REF(fd)); +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); + REQUIRE("val can have any value"); + + GetFieldDataInt16Ptr(fd)[pt] = CONVERT_DOUBLE_TO_INT16(val); + + ENSURE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Int16_t)); +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/** + */ +static void STDCALL SetFieldValueForByte(FieldData_pa fd, + LgIndex_t pt, + double val) +{ + REQUIRE(VALID_REF(fd)); +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + REQUIRE(fd->Type == FieldDataType_Byte); + REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); + REQUIRE("val can have any value"); + + if (val < 1.0) + GetFieldDataBytePtr(fd)[pt] = 0; + else if (val > 255.0) + GetFieldDataBytePtr(fd)[pt] = 255; + else + GetFieldDataBytePtr(fd)[pt] = (Byte_t)val; + + ENSURE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Byte_t)); +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/** + */ +static void STDCALL SetFieldValueForBit(FieldData_pa fd, + LgIndex_t pt, + double val) +{ + REQUIRE(VALID_REF(fd)); +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + REQUIRE(fd->Type == FieldDataType_Bit); + REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); + REQUIRE("val can have any value"); + + LgIndex_t ByteOffset = pt / 8; + Byte_t BitMask = (01 << (pt % 8)); + + if (val < 1.0) + GetFieldDataBytePtr(fd)[ByteOffset] &= ~BitMask; + else + GetFieldDataBytePtr(fd)[ByteOffset] |= BitMask; + + ENSURE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt / 8, Byte_t)); +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/** + */ +FieldValueSetFunction_pf DetermineFieldDataSetFunction(FieldDataType_e DataType, + Boolean_t IsFragmented) +{ + FieldValueSetFunction_pf Result; + + REQUIRE(VALID_FIELD_DATA_TYPE(DataType)); + REQUIRE(VALID_BOOLEAN(IsFragmented)); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + { + switch (DataType) + { + case FieldDataType_Float : + { + Result = SetFieldValueForFloat; + } break; + case FieldDataType_Double : + { + Result = SetFieldValueForDouble; + } break; + case FieldDataType_Int32 : + { + Result = SetFieldValueForInt32; + } break; + case FieldDataType_Int16 : + { + Result = SetFieldValueForInt16; + } break; + case FieldDataType_Byte : + { + Result = SetFieldValueForByte; + } break; + case FieldDataType_Bit : + { + Result = SetFieldValueForBit; + } break; + default : + { + CHECK(FALSE); + Result = NULL; /* satisfy compiler */ + } break; + } + } + return (Result); +} + + +/** + */ +Int64_t FieldDataGetBytesNeeded(LgIndex_t NumValues, + FieldDataType_e DataType) +{ + Int64_t Result = 0; /* ...quite compiler */ + + REQUIRE(NumValues >= 0); + REQUIRE(VALID_FIELD_DATA_TYPE(DataType)); + + switch (DataType) + { + case FieldDataType_Float: Result = ((Int64_t)NumValues)*sizeof(float); break; + case FieldDataType_Double: Result = ((Int64_t)NumValues)*sizeof(double); break; + case FieldDataType_Int32: Result = ((Int64_t)NumValues)*sizeof(LgIndex_t); break; + case FieldDataType_Int16: Result = ((Int64_t)NumValues)*sizeof(SmInteger_t); break; + case FieldDataType_Byte: Result = ((Int64_t)NumValues)*sizeof(Byte_t); break; + case FieldDataType_Bit: Result = ((Int64_t)(NumValues+7)/8)*sizeof(Byte_t); break; + default: CHECK(FALSE); break; + } + + ENSURE(Result >= 0); + return Result; +} + +/** + * On the SGI, HP, and Sun machines 64 bit objects such as doubles must be 8 + * byte aligned while on all other machines 32 bit alignment suffices. Some + * allow 1 byte alignment but we won't bother with that. + */ +#if defined IRISX || defined HPUX || defined SUNX +# define SIZEOF_LARGEST_OBJECT_TO_ALIGN sizeof(Int64_t) +#else +# define SIZEOF_LARGEST_OBJECT_TO_ALIGN sizeof(Int32_t) +#endif + +/** + */ +Boolean_t IsOffsetAlignedForFieldDataType(FieldDataType_e FieldDataType, + Int64_t Offset) +{ + REQUIRE(VALID_FIELD_DATA_TYPE(FieldDataType)); + REQUIRE(Offset >= 0); + + Int64_t SizeOfType = FieldDataGetBytesNeeded(1, FieldDataType); + if (SizeOfType > (Int64_t)SIZEOF_LARGEST_OBJECT_TO_ALIGN) + SizeOfType = SIZEOF_LARGEST_OBJECT_TO_ALIGN; + + Boolean_t HasValidAlignment = (Offset % SizeOfType == 0); + + ENSURE(VALID_BOOLEAN(HasValidAlignment)); + return HasValidAlignment; +} + +/** + */ +Int64_t GetAlignedOffsetForFieldDataType(FieldDataType_e FieldDataType, + Int64_t Offset) +{ + REQUIRE(VALID_FIELD_DATA_TYPE(FieldDataType)); + REQUIRE(Offset >= 0); + + Int64_t SizeOfType = FieldDataGetBytesNeeded(1, FieldDataType); + if (SizeOfType > (Int64_t)SIZEOF_LARGEST_OBJECT_TO_ALIGN) + SizeOfType = SIZEOF_LARGEST_OBJECT_TO_ALIGN; + + Int64_t NumBytesPastAlignment = (Offset % SizeOfType); + Int64_t Result = Offset - NumBytesPastAlignment; + + ENSURE(0 <= Result && Result <= Offset); + ENSURE(IsOffsetAlignedForFieldDataType(FieldDataType, Result)); + return Result; +} + +/** + */ +void FieldDataDefineData(FieldData_pa FieldData, + LgIndex_t NumValues, + FieldDataType_e DataType, + ValueLocation_e ValueLocation) +{ + REQUIRE(VALID_REF(FieldData)); + REQUIRE(NumValues >= 0); + REQUIRE(VALID_FIELD_DATA_TYPE(DataType)); + REQUIRE(VALID_ENUM(ValueLocation, ValueLocation_e)); + + /* + * Remove any old data (transformed UVW is one example that calls this + * function with a non-null data pointer when switching the value location + * when style changes the value location and therefore the amount of data + * allocated.) + */ + FieldDataCleanup(FieldData); + + /* + * The reference count is not modified here. This function only allocates the + * structure and makes adjustments to the some of the members. The reference + * count was initialized when the structure was initially created and the + * structure may be shared before the data portion is even allocated. + */ + FieldData->NumValues = NumValues; + FieldData->Type = DataType; + FieldData->ValueLocation = ValueLocation; +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# else /* ...for TecIO only */ + FieldData->GetValueCallback[0] = (void *)DetermineFieldDataGetFunction(DataType, FALSE); + FieldData->SetValueCallback[0] = (void *)DetermineFieldDataSetFunction(DataType, FALSE); +#endif + + ENSURE(FieldData->Data == NULL); +} + +/** + */ +Boolean_t FieldDataAllocData(FieldData_pa FieldData, + Boolean_t ShowErrMsg) +{ + REQUIRE(VALID_REF(FieldData)); + REQUIRE(FieldData->Type != FieldDataType_Invalid); /* ...must call FieldDataDefineData first */ + REQUIRE(FieldData->Data == NULL); + REQUIRE(VALID_BOOLEAN(ShowErrMsg)); + + /* + * The size of size_t may be smaller than our unsigned 64 bit integer value + * so we might have to squeeze it down possibly loosing precision. + */ + Int64_t ActualBytesNeeded = FieldDataGetBytesNeeded(FieldData->NumValues, FieldData->Type); + size_t BytesToAllocate = (size_t)ActualBytesNeeded; + + /* + * 64 bit architectures are effectively unlimited in their allocation size + * while 32 architectures are limited to 4GB (some may limit further to 2GB + * which will be borne out by the call to malloc). + */ + CHECK(sizeof(size_t) == 4 || sizeof(size_t) == 8); + Boolean_t IsOk = (FieldData->NumValues <= MAXINDEX && + IMPLICATION(sizeof(size_t) == 4, + ActualBytesNeeded <= (Int64_t)0xffffffff)); + if (IsOk) + { + if (FieldData->NumValues > 0) + { + FieldData->Data = (void *)ALLOC_ARRAY(BytesToAllocate, char, "FieldData's Data"); + #if defined DEBUG_FIELDVALUES + { + if (FieldData->Data != NULL) + memset(FieldData->Data, DEBUG_FIELDVALUES_BAD_VALUE, BytesToAllocate); + } + #endif + /* + * For bit type data zero the last byte in the data array. We do + * this because NumValues is probably not a multiple of 8 bits and + * thus the valid bit values will not occupy all bits of the last + * byte. By zeroing the unused bits at the end of the array we + * produce consistent data files when written to disk. + */ + if (FieldData->Type == FieldDataType_Bit) + ((char*)FieldData->Data)[BytesToAllocate-1] = '\0'; + } + IsOk = (FieldData->NumValues == 0 || + FieldData->Data != NULL); + if (!IsOk && ShowErrMsg) + OutOfMemoryMsg(); + } + else if (ShowErrMsg) + ErrMsg(translate("Storage limit (%ld) exceeded for a single variable."), (long)MAXINDEX); + +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + + ENSURE(VALID_REF(FieldData->Data) || FieldData->Data == NULL); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if !defined NO_ASSERTS +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +/** + * Allocates a field data pointer with space for "num_pts" of field data type + * "field_data_type" nodal values. + * + * IMPORTANT: + * This field data may NOT be used for zones but only for things like + * geometries or other temporary field data that will never be placed + * into a COB or zone. + */ +FieldData_pa AllocScratchNodalFieldDataPtr(LgIndex_t NumValues, + FieldDataType_e Type, + Boolean_t ShowErrMsg) +{ + REQUIRE(NumValues >= 0); + REQUIRE(VALID_FIELD_DATA_TYPE(Type)); + REQUIRE(VALID_BOOLEAN(ShowErrMsg)); + + FieldData_pa Result = FieldDataAlloc(); + if (Result != NULL) + { + FieldDataDefineData(Result, NumValues, Type, ValueLocation_Nodal); + if (!FieldDataAllocData(Result, ShowErrMsg)) + FieldDataDealloc(&Result, FALSE); + } + else if (ShowErrMsg) + OutOfMemoryMsg(); + + ENSURE(VALID_REF(Result) || Result == NULL); +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# endif + ENSURE(IMPLICATION(Result != NULL, + (Result->NumValues >= 0 && + IMPLICATION(Result->NumValues != 0, + VALID_REF(Result->Data)) && + VALID_FIELD_DATA_TYPE(Result->Type)))); + + return Result; +} + + +/** + * Frees memory allocated with AllocScratchNodalFieldDataPtr(). + * + * @param ScratchFieldData + * Scratch field data pointer to deallocate. This should NEVER be a field + * data from a zone or COB. See note in AllocScratchNodalFieldDataPtr(). + */ +void DeallocScratchNodalFieldDataPtr(FieldData_pa *FieldDataRef) +{ + FieldDataDealloc(FieldDataRef, + FALSE); /* DoTrackVarSharing */ +} + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/** + */ +FieldDataType_e GetFieldDataType_FUNC(FieldData_pa FieldData) +{ + REQUIRE(VALID_REF(FieldData)); + + FieldDataType_e Result = GetFieldDataType_MACRO(FieldData); + + ENSURE(VALID_FIELD_DATA_TYPE(Result)); + return Result; +} +#endif /* !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS */ + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/** + */ +FieldValueGetFunction_pf GetFieldDataGetFunction_FUNC(FieldData_pa FieldData) +{ + REQUIRE(VALID_REF(FieldData)); + + FieldValueGetFunction_pf Result = GetFieldDataGetFunction_MACRO(FieldData); + + ENSURE(VALID_FN_REF(Result)); + return Result; +} +#endif /* !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS */ + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/** + */ +FieldValueSetFunction_pf GetFieldDataSetFunction_FUNC(FieldData_pa FieldData) +{ + REQUIRE(VALID_REF(FieldData)); + + FieldValueSetFunction_pf Result = GetFieldDataSetFunction_MACRO(FieldData); + + ENSURE(VALID_FN_REF(Result)); + return Result; +} +#endif /* !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS */ + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/** + */ +LgIndex_t GetFieldDataNumValues_FUNC(FieldData_pa FieldData) +{ + REQUIRE(VALID_REF(FieldData)); + + LgIndex_t Result = GetFieldDataNumValues_MACRO(FieldData); + + ENSURE(Result >= 0); + return Result; +} +#endif /* !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS */ + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/** + */ +ValueLocation_e GetFieldDataValueLocation_FUNC(FieldData_pa FieldData) +{ + REQUIRE(VALID_REF(FieldData)); + + ValueLocation_e Result = GetFieldDataValueLocation_MACRO(FieldData); + + ENSURE(Result == ValueLocation_Invalid || /* i.e. pending assignment */ + VALID_ENUM(Result, ValueLocation_e)); + return Result; +} +#endif /* !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS */ + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/** + */ +Boolean_t IsFieldDataDirectAccessAllowed_FUNC(FieldData_pa FieldData) +{ + REQUIRE(VALID_REF(FieldData)); + + Boolean_t Result = IsFieldDataDirectAccessAllowed_MACRO(FieldData); + + ENSURE(VALID_BOOLEAN(Result)); + return Result; +} +#endif + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/** + */ +float *GetFieldDataFloatPtr_FUNC(FieldData_pa fd) +{ + REQUIRE(VALID_REF(fd)); + + float *Result = GetFieldDataFloatPtr_MACRO(fd); + + ENSURE(VALID_REF(Result)); + return Result; +} +#endif + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/** + */ +double *GetFieldDataDoublePtr_FUNC(FieldData_pa fd) +{ + REQUIRE(VALID_REF(fd)); + + double *Result = GetFieldDataDoublePtr_MACRO(fd); + + ENSURE(VALID_REF(Result)); + return Result; +} +#endif + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/** + */ +Int64_t *GetFieldDataInt64Ptr_FUNC(FieldData_pa fd) +{ + REQUIRE(VALID_REF(fd)); + + Int64_t *Result = GetFieldDataInt64Ptr_MACRO(fd); + + ENSURE(VALID_REF(Result)); + return Result; +} +#endif + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/** + */ +Int32_t *GetFieldDataInt32Ptr_FUNC(FieldData_pa fd) +{ + REQUIRE(VALID_REF(fd)); + + Int32_t *Result = GetFieldDataInt32Ptr_MACRO(fd); + + ENSURE(VALID_REF(Result)); + return Result; +} +#endif + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/** + */ +Int16_t *GetFieldDataInt16Ptr_FUNC(FieldData_pa fd) +{ + REQUIRE(VALID_REF(fd)); + + Int16_t *Result = GetFieldDataInt16Ptr_MACRO(fd); + + ENSURE(VALID_REF(Result)); + return Result; +} +#endif + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/* + * No byte ordering or alignment issues with single bytes (which are also used with the "Bit" type) + */ +Byte_t *GetFieldDataBytePtr_FUNC(FieldData_pa fd) +{ + /* + * This function gets called for Byte and Bit types, but we cannot REQUIRE + * those types because it is also used for non-aligned values. We can't + * check for non-aligned because we might be copying aligned bytes to a + * non-aligned location. + */ + REQUIRE(VALID_REF(fd)); + + Byte_t *Result = GetFieldDataBytePtr_MACRO(fd); + + ENSURE(VALID_REF(Result)); + return Result; +} +#endif + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/** + * Gets a ptr to 2-byte blocks regardless of byte ordering, but still has to + * worry about byte alignment + */ +UInt16_t *GetFieldData2BytePtr_FUNC(FieldData_pa fd) +{ + REQUIRE(VALID_REF(fd)); + REQUIRE(fd->Type == FieldDataType_Int16); + + UInt16_t *Result = GetFieldData2BytePtr_MACRO(fd); + + ENSURE(VALID_REF(Result)); + return Result; +} +#endif + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/* + * Gets a ptr to 4-byte blocks regardless of byte ordering, but still has to + * worry about byte alignment + */ +UInt32_t *GetFieldData4BytePtr_FUNC(FieldData_pa fd) +{ + REQUIRE(VALID_REF(fd)); + REQUIRE(fd->Type == FieldDataType_Int32 || fd->Type == FieldDataType_Float); + + UInt32_t *Result = GetFieldData4BytePtr_MACRO(fd); + + ENSURE(VALID_REF(Result)); + return Result; +} +#endif + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/* + * Gets a ptr to 8-byte blocks regardless of byte ordering, but still has to + * worry about byte alignment + */ +UInt64_t *GetFieldData8BytePtr_FUNC(FieldData_pa fd) +{ + REQUIRE(VALID_REF(fd)); + REQUIRE(fd->Type == FieldDataType_Int64 || fd->Type == FieldDataType_Double); + + UInt64_t *Result = GetFieldData8BytePtr_MACRO(fd); + + ENSURE(VALID_REF(Result)); + return Result; +} +#endif + + +#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS +/* + * WARNING: GetFieldDataVoidPtr checks nothing, and thus should only be + * used with extreme caution (that is, checking the alignment + * and byte order by hand). + */ +void *GetFieldDataVoidPtr_FUNC(FieldData_pa fd) +{ + REQUIRE(VALID_REF(fd)); + + void *Result = GetFieldDataVoidPtr_MACRO(fd); + + ENSURE(VALID_REF(Result)); + return Result; +} +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/* + */ +void CopyFieldValue(FieldData_pa dst, + LgIndex_t dstindex, + FieldData_pa src, + LgIndex_t srcindex) +{ + REQUIRE(VALID_REF(dst)); + REQUIRE(VALID_REF(src)); +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + REQUIRE(dstindex >= 0 && dstindex < GetFieldDataNumValues(dst) && + srcindex >= 0 && srcindex < GetFieldDataNumValues(src)); + + Boolean_t DoBruteForceCopy = TRUE; + + if (IsFieldDataDirectAccessAllowed(src) && + IsFieldDataDirectAccessAllowed(dst) && + GetFieldDataType(src) == GetFieldDataType(dst)) + { + switch (GetFieldDataType(src)) + { + case FieldDataType_Int64 : CHECK(FALSE); /* Future work: remove and let fall through */ + case FieldDataType_Double : + { + CHECK(sizeof(UInt64_t) == 8 && sizeof(double) == 8); + UInt64_t *dst_ptr = GetFieldData8BytePtr(dst) + dstindex; + UInt64_t *src_ptr = GetFieldData8BytePtr(src) + srcindex; + *dst_ptr = *src_ptr; + DoBruteForceCopy = FALSE; + } break; + case FieldDataType_Float : + case FieldDataType_Int32 : + { + CHECK(sizeof(UInt32_t) == 4 && sizeof(float) == 4); + UInt32_t *dst_ptr = GetFieldData4BytePtr(dst) + dstindex; + UInt32_t *src_ptr = GetFieldData4BytePtr(src) + srcindex; + *dst_ptr = *src_ptr; + DoBruteForceCopy = FALSE; + } break; + case FieldDataType_Int16 : + { + CHECK(sizeof(UInt16_t) == 2); + UInt16_t *dst_ptr = GetFieldData2BytePtr(dst) + dstindex; + UInt16_t *src_ptr = GetFieldData2BytePtr(src) + srcindex; + *dst_ptr = *src_ptr; + } break; + case FieldDataType_Byte : + { + GetFieldDataBytePtr(dst)[dstindex] = GetFieldDataBytePtr(src)[srcindex]; + DoBruteForceCopy = FALSE; + } break; + case FieldDataType_Bit : break; /* handle below */ + default : CHECK(FALSE); /* Future work: when more complex types are added, remove this CHECK */ + } + } + + if (DoBruteForceCopy) + { + double val = GetFieldValue(src, srcindex); + SetFieldValue(dst, dstindex, val); + } +} /* CopyFieldValue() */ + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + + +/* + */ +void SetFieldDataPtrToAllZeros(FieldData_pa fd) +{ + REQUIRE(VALID_REF(fd)); +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + + LgIndex_t NumValues = GetFieldDataNumValues(fd); + + /* + * memset each byte to 0 works for floats and doubles and works regardless + * of byte ordering or alignment. + */ + size_t NumBytesToMemSet = 0; + if (IsFieldDataDirectAccessAllowed(fd)) + { + switch (GetFieldDataType(fd)) + { + case FieldDataType_Int64 : CHECK(FALSE); /* Future work: remove CHECK */ + case FieldDataType_Double : + { + CHECK(sizeof(UInt64_t) == 8 && sizeof(double) == 8); + NumBytesToMemSet = NumValues * sizeof(Int64_t); + } break; + case FieldDataType_Int32 : + case FieldDataType_Float : + { + CHECK(sizeof(UInt32_t) == 4 && sizeof(float) == 4); + NumBytesToMemSet = NumValues * sizeof(Int32_t); + } break; + case FieldDataType_Int16 : + { + CHECK(sizeof(UInt16_t) == 2); + NumBytesToMemSet = NumValues * sizeof(Int16_t); + } break; + case FieldDataType_Byte : + { + NumBytesToMemSet = NumValues * sizeof(Byte_t); + } break; + case FieldDataType_Bit : + { + NumBytesToMemSet = ((NumValues + 7) / 8) * sizeof(Byte_t); + } break; + default : + { + CHECK(FALSE); + } break; + } + } + + if (NumBytesToMemSet > 0) + { + void *fd_data = GetFieldDataVoidPtr(fd); + memset(fd_data, 0, NumBytesToMemSet); + } + else + { + int ii; + for (ii = 0; ii < NumValues; ii++) + SetFieldValue(fd, ii, 0.0); + } + +} /* SetFieldDataPtrToAllZeros() */ + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/datautil.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/datautil.cpp new file mode 100644 index 0000000000000000000000000000000000000000..783abec0c404116d4c98ccb122d20f3746769306 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/datautil.cpp @@ -0,0 +1,941 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +/* + * datautil.c: + * + * version 1.00 : 12/10/91 (cm) changes made for manual + * version 1.01 : 12/30/91 Get and ReturnHugeBlock are now ptr to function + * version 6.00 : 04/21/92 updated to match version 6 of tecplot. + * version 6.30 : 10/15/92 updated to match binary file version 6.3 + * version 6.30a: 05/04/93 (cm) minor changes to prototypes + * version : 11/01/93 (cm) put in D4GW stuff + * version 6.30b: 12/27/93 (cm) fixed missing NumKPts in DumpZone + * version 6.30c: 12/27/93 (cm) put back in D4GW stuff +BEGIN CODELOG TECXXX +C 03/06/96 (BDP) +C Update to V7 +C +C 03/14/97 (BDP) +C Added code to main tecplot source. Now can +C be built stand alone or added so TecUtil_ functions +C can access. +C 06/02/98 (bdp) +C v75 coding. Also removed Array of ZoneSpec_s +C structs in favor of zonenames, i,j,and k dimensions +C and zonetype array. +END CODELOG + */ + + + +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" +#include "SYSTEM.h" +#include "ALLOC.h" +#include "TECXXX.h" +#include "ARRLIST.h" +#include "SET.h" +#include "DATASET.h" +#include "FILESTREAM.h" +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +#include "DATAIO.h" +#include "DATAIO4.h" +#include "DATAUTIL.h" +#include "STRLIST.h" +#include "Q_MSG.h" +#if defined MAKEARCHIVE +#define INITMODULE +#endif +#include "INPUT.h" + +using namespace tecplot::strutil; + +#if defined MAKEARCHIVE +#define ANGLEEPSILON 1.0e-10 + +void InitInputSpecs(void) +{ + LineThicknessInputSpec.Type = Input_Double; + LineThicknessInputSpec.Min = 0.000001; + LineThicknessInputSpec.Max = 1.0; + LineThicknessInputSpec.InterfaceAdjust.ScaleFact = 100.0; + LineThicknessInputSpec.SuffixModifier = NULL; + + PatternLengthInputSpec.Type = Input_Double; + PatternLengthInputSpec.Min = 0.0001; + PatternLengthInputSpec.Max = 1.0; + PatternLengthInputSpec.InterfaceAdjust.ScaleFact = 100.0; + PatternLengthInputSpec.SuffixModifier = NULL; + + TextBoxMarginInputSpec.Type = Input_Double; + TextBoxMarginInputSpec.Min = 0.0; + TextBoxMarginInputSpec.Max = 20.0; + TextBoxMarginInputSpec.InterfaceAdjust.ScaleFact = 100.0; + TextBoxMarginInputSpec.SuffixModifier = NULL; + + TextLineSpacingInputSpec.Type = Input_Double; + TextLineSpacingInputSpec.Min = 0.0; + TextLineSpacingInputSpec.Max = 5.0; + TextLineSpacingInputSpec.InterfaceAdjust.ScaleFact = 1.0; + TextLineSpacingInputSpec.SuffixModifier = NULL; + + + ArrowheadSizeInputSpec.Type = Input_Double; + ArrowheadSizeInputSpec.Min = 0.0; + ArrowheadSizeInputSpec.Max = 0.5; + ArrowheadSizeInputSpec.InterfaceAdjust.ScaleFact = 100.0; + ArrowheadSizeInputSpec.SuffixModifier = NULL; + + TextAngleInputSpec.Type = Input_Double; + TextAngleInputSpec.Min = -PI - ANGLEEPSILON; + TextAngleInputSpec.Max = PI + ANGLEEPSILON; + TextAngleInputSpec.InterfaceAdjust.ScaleFact = DEGPERRADIANS; + TextAngleInputSpec.SuffixModifier = NULL; + + ArrowheadAngleInputSpec.Type = Input_Double; + ArrowheadAngleInputSpec.Min = 1.0 / DEGPERRADIANS - ANGLEEPSILON; + ArrowheadAngleInputSpec.Max = PIOVER2 + ANGLEEPSILON; + ArrowheadAngleInputSpec.InterfaceAdjust.ScaleFact = DEGPERRADIANS; + ArrowheadAngleInputSpec.SuffixModifier = NULL; +} +#endif + + + + +void LocalReadBlock(FileStream_s *FileStream, + double *CurVPtr, + FieldDataType_e FieldDataTypeInFile, + HgIndex_t NumValues, + Boolean_t *IsOk) +{ + REQUIRE(VALID_REF(IsOk) && VALID_BOOLEAN(*IsOk)); + REQUIRE(!(*IsOk) || VALID_REF(FileStream)); + REQUIRE(!(*IsOk) || VALID_FIELD_DATA_TYPE(FieldDataTypeInFile)); + + if (*IsOk) + { + Boolean_t DoRead = (CurVPtr != NULL); + Boolean_t ReadByBlock = (FieldDataType_Double == FieldDataTypeInFile) || !DoRead; + if (ReadByBlock) + { + ReadPureBlock(FileStream, + DoRead, + (void *)CurVPtr, + FieldDataTypeInFile, + 0, + NumValues, + IsOk); + } + else + { + LgIndex_t N; + for (N = 0; *IsOk && (N < NumValues); N++) + { + double D = GetNextValue(FileStream, FieldDataTypeInFile, -LARGEDOUBLE, LARGEDOUBLE, IsOk); + if (DoRead) + CurVPtr[N] = D; + } + } + } +} + + + + +/* + * + * NOTE: ReadTec only allocates space for NodeMap and VDataBase + * if RawDataSpaceAllocated == FALSE and GetHeaderInfoOnly + * is FALSE. + * + * Also note that all data read in by ReadTec is currently + * limited to be in double precision. + * + */ + + +Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly, + char *FName, + short *IVersion, + char **DataSetTitle, + EntIndex_t *NumZones, + EntIndex_t *NumVars, + StringList_pa *VarNames, + StringList_pa *ZoneNames, + LgIndex_t **NumPtsI, + LgIndex_t **NumPtsJ, + LgIndex_t **NumPtsK, + ZoneType_e **ZoneType, + StringList_pa *UserRec, + Boolean_t RawDataSpaceAllocated, + NodeMap_t ***NodeMap, + double ***VDataBase) +{ + Boolean_t InputIsOk = FALSE; + ArrayList_pa ZoneSpecList = NULL; + LgIndex_t *FNNumBndryConns = NULL; /* [NumZones] */ + FileStream_s *ReadTecFileStream = NULL; + Set_pa *IsVarCellCentered = NULL; /* [NumZones] */ + + REQUIRE(VALID_BOOLEAN(GetHeaderInfoOnly)); + REQUIRE(VALID_NON_ZERO_LEN_STR(FName)); + REQUIRE(VALID_REF(IVersion)); + REQUIRE(VALID_REF(DataSetTitle) || DataSetTitle == NULL); + REQUIRE(VALID_REF(NumZones)); + REQUIRE(VALID_REF(NumVars)); + REQUIRE(VarNames == NULL || VALID_REF(VarNames)); + REQUIRE(ZoneNames == NULL || VALID_REF(ZoneNames)); + REQUIRE(NumPtsI == NULL || VALID_REF(NumPtsI)); + REQUIRE(NumPtsJ == NULL || VALID_REF(NumPtsJ)); + REQUIRE(NumPtsK == NULL || VALID_REF(NumPtsK)); + REQUIRE(ZoneType == NULL || VALID_REF(ZoneType)); + REQUIRE(UserRec == NULL || VALID_REF(UserRec)); + REQUIRE(VALID_BOOLEAN(RawDataSpaceAllocated)); + REQUIRE(IMPLICATION(!GetHeaderInfoOnly && RawDataSpaceAllocated, + VALID_REF(NodeMap) && VALID_REF(VDataBase))); + +#if defined MAKEARCHIVE + InitInputSpecs(); +#endif + + InputIsOk = OpenBinaryFileAndCheckMagicNumber(&ReadTecFileStream, + FName, + 0, + IVersion); + + if (InputIsOk) + InputIsOk = ReadDataFileHeader(ReadTecFileStream, + *IVersion, + FALSE, + NumZones, + NumVars, + (SmInteger_t *)NULL, + DataSetTitle, + (Text_s **)NULL, + (Geom_s **)NULL, + (StringList_pa **)NULL, + UserRec, + (AuxData_pa *)NULL, + &IsVarCellCentered, + (Boolean_t *)NULL, + (Boolean_t *)NULL, + &ZoneSpecList, + VarNames, + (ArrayList_pa *)NULL, + (Set_pa *)NULL, + &FNNumBndryConns, + (DataFileType_e *)NULL); + + + + if (InputIsOk) + { + if (*NumZones == 0) + *NumVars = 0; + else if (*IVersion > 112) + { + /* + * This may not be true but we put it hear to remind us to make + * updates to this code when we change the version number. + */ + ErrMsg(translate("ReadTec does not yet support version %d " + "Tecplot binary data files."), *IVersion); + InputIsOk = FALSE; + } + else if (!GetHeaderInfoOnly) + { + EntIndex_t Z; + for (Z = 0; Z < *NumZones && InputIsOk; Z++) + { + InputIsOk = (MemberCount(IsVarCellCentered[Z]) == 0); + if (!InputIsOk) + ErrMsg(translate("Cell centered data not supported by ReadTec.")); + } + } + } + + if (IsVarCellCentered != NULL) + { + EntIndex_t Z; + for (Z = 0; Z < *NumZones; Z++) + DeallocSet(&IsVarCellCentered[Z]); + FREE_ARRAY(IsVarCellCentered, "Array of IsVarCellCentered sets"); + } + + if (InputIsOk) + { + EntIndex_t Z; + /* + * Allocate space for the zone info pieces. + */ + if (ZoneNames) + *ZoneNames = StringListAlloc(); + if (NumPtsI) + *NumPtsI = ALLOC_ARRAY(*NumZones, LgIndex_t, "numptsi"); + if (NumPtsJ) + *NumPtsJ = ALLOC_ARRAY(*NumZones, LgIndex_t, "numptsj"); + if (NumPtsK) + *NumPtsK = ALLOC_ARRAY(*NumZones, LgIndex_t, "numptsk"); + if (ZoneType) + *ZoneType = ALLOC_ARRAY(*NumZones, ZoneType_e, "zonetype"); + for (Z = 0; Z < *NumZones; Z++) + { + ZoneSpec_s *ZoneSpec = GetZoneSpec(ZoneSpecList, Z); + if (ZoneSpec != NULL) + { + if (ZoneNames && *ZoneNames) + StringListAppendString(*ZoneNames, ZoneSpec->Name); + + if (NumPtsI && *NumPtsI) + (*NumPtsI)[Z] = ZoneSpec->NumPtsI; + + if (NumPtsJ && *NumPtsJ) + (*NumPtsJ)[Z] = ZoneSpec->NumPtsJ; + + if (NumPtsK && *NumPtsK) + (*NumPtsK)[Z] = ZoneSpec->NumPtsK; + + if (ZoneType && *ZoneType) + (*ZoneType)[Z] = ZoneSpec->Type; + } + else + { + if (ZoneNames && *ZoneNames) + StringListAppendString(*ZoneNames, NULL); + + if (NumPtsI && *NumPtsI) + (*NumPtsI)[Z] = 0; + + if (NumPtsJ && *NumPtsJ) + (*NumPtsJ)[Z] = 0; + + if (NumPtsK && *NumPtsK) + (*NumPtsK)[Z] = 0; + + if (ZoneType && *ZoneType) + (*ZoneType)[Z] = ZoneType_Invalid; + } + } + } + if (!GetHeaderInfoOnly && InputIsOk && (*NumZones > 0)) + { + EntIndex_t *VarSharesFromZone = NULL; /* [NumVars] */ + Boolean_t *IsVarPassive = NULL; /* [NumVars] */ + EntIndex_t *ConnectivitySharesFromZone = NULL; /* [NumZones] */ + FieldDataType_e *VarType = NULL; + int CurZone; + int CurVar; + LgIndex_t NumIPts = 0; + LgIndex_t NumJPts = 0; + LgIndex_t NumKPts = 0; + LgIndex_t TotalNumPts; + LgIndex_t I, J; + + if ((*NumZones > 0) && !RawDataSpaceAllocated) + { + *VDataBase = ALLOC_ARRAY(*NumZones * (*NumVars), double *, "vdatabase array"); + if (*VDataBase == NULL) + { + ErrMsg(translate("Cannot allocate space for field data")); + InputIsOk = FALSE; + } + else + { + int I; + for (I = 0; I < *NumZones*(*NumVars); I++) + (*VDataBase)[I] = NULL; + } + + if (InputIsOk) + { + *NodeMap = ALLOC_ARRAY(*NumZones, NodeMap_t *, "nodemap array"); + if (*NodeMap == NULL) + { + ErrMsg(translate("Cannot allocate space for nodemap")); + InputIsOk = FALSE; + } + else + { + int I; + for (I = 0; I < *NumZones; I++) + (*NodeMap)[I] = NULL; + } + } + } + + if (InputIsOk) + { + VarType = ALLOC_ARRAY(*NumVars + 1, FieldDataType_e, "Var Type"); + VarSharesFromZone = ALLOC_ARRAY(*NumVars + 1, EntIndex_t, "VarSharesFromZone"); + IsVarPassive = ALLOC_ARRAY(*NumVars + 1, Boolean_t, "IsVarPassive"); + + ConnectivitySharesFromZone = ALLOC_ARRAY(*NumZones, EntIndex_t, "ConnectivitySharesFromZone"); + InputIsOk = (VarType != NULL && + VarSharesFromZone != NULL && + IsVarPassive != NULL && + ConnectivitySharesFromZone != NULL); + } + + /* for each zone */ + for (CurZone = 0; CurZone < *NumZones && InputIsOk; CurZone++) + { + double X1 = GetNextValue(ReadTecFileStream, FieldDataType_Float, 0.0, 1000.0, &InputIsOk); + if (InputIsOk && (X1 == ZoneMarker)) + { + ZoneSpec_s *CurZoneSpec = GetZoneSpec(ZoneSpecList, CurZone); + Boolean_t ZoneIsFinite = (CurZoneSpec->Type != ZoneType_Ordered); + Boolean_t ZoneIsFEPoly = (CurZoneSpec->Type == ZoneType_FEPolygon || + CurZoneSpec->Type == ZoneType_FEPolyhedron); + Boolean_t InBlockFormat = CurZoneSpec->ZoneLoadInfo.IsInBlockFormat; + for (J = 0; J < *NumVars; J++) + { + VarSharesFromZone[J] = -1; /* eumulate DupVar: no DupVar */ + VarType[J] = FieldDataType_Float; + IsVarPassive[J] = FALSE; + } + + /* dupvars */ + if (*IVersion > 45 && *IVersion < 101 && InputIsOk) + { + EntIndex_t NumDupVars, ZZ; + + NumDupVars = (EntIndex_t)GetIoFileInt(ReadTecFileStream, *IVersion, 0, (LgIndex_t) * NumVars, &InputIsOk); + for (J = 0; J < NumDupVars; J++) + { + ZZ = (EntIndex_t)GetIoFileInt(ReadTecFileStream, *IVersion, 0, *NumVars, &InputIsOk) - 1; + VarSharesFromZone[ZZ] = CurZone - 1; /* emulate DupVar: share from previous zone */ + } + /* Can't duplicate from the first zone */ + if ((NumDupVars > 0) && (CurZone == 0)) + { + ErrMsg(translate("Cannot duplicate variables from the first zone since there are " + "no previous zones to duplicate from.")); + InputIsOk = FALSE; + } + } + + /* get the data type for each variable */ + if (*IVersion >= 70 && InputIsOk) + { + for (J = 0; J < *NumVars; J++) + { + VarType[J] = (FieldDataType_e)GetIoFileInt(ReadTecFileStream, *IVersion, + 0, + (LgIndex_t)FieldDataType_Bit, + &InputIsOk); + if (!InputIsOk) + { + ErrMsg(translate("Invalid data type - binary input file corrupted")); + InputIsOk = FALSE; + } + } + } + + if (InputIsOk) + { + NumIPts = CurZoneSpec->NumPtsI; + NumJPts = CurZoneSpec->NumPtsJ; + NumKPts = CurZoneSpec->NumPtsK; + } + + if (ZoneIsFinite) + TotalNumPts = NumIPts; + else + TotalNumPts = (NumIPts * NumJPts * NumKPts); + + for (CurVar = 0; CurVar < *NumVars && InputIsOk; CurVar++) + { + if (!RawDataSpaceAllocated && TotalNumPts >= 1) + { + /* + * The calling program did not allocate space for the + * data so do it here. + */ + (*VDataBase)[CurVar+CurZone*(*NumVars)] = + ALLOC_ARRAY(TotalNumPts, double, "raw data"); + } + } + + if (*IVersion >= 105 && InputIsOk) + { + /* passive variables */ + if ((Boolean_t)GetIoFileInt(ReadTecFileStream, *IVersion, 0, 1, &InputIsOk) && InputIsOk) + { + for (CurVar = 0; CurVar < *NumVars && InputIsOk; CurVar++) + { + IsVarPassive[CurVar] = (Boolean_t)GetIoFileInt(ReadTecFileStream, + *IVersion, + 0, 1, &InputIsOk); + } + } + } + + if (*IVersion >= 101 && InputIsOk) + { + /* variable sharing: equivalent to DupVar for ReadTec */ + if ((Boolean_t)GetIoFileInt(ReadTecFileStream, *IVersion, 0, 1, &InputIsOk) && InputIsOk) + { + for (CurVar = 0; CurVar < *NumVars && InputIsOk; CurVar++) + { + EntIndex_t SharedZone = GetIoFileInt(ReadTecFileStream, *IVersion, + -1, MaxNumZonesOrVars - 1, + &InputIsOk); + if (SharedZone != -1 && InputIsOk) + VarSharesFromZone[CurVar] = SharedZone; + } + } + + /* face neighbor or FE node connectivity sharing */ + if (InputIsOk) + { + EntIndex_t SharedZone = GetIoFileInt(ReadTecFileStream, *IVersion, + -1, MaxNumZonesOrVars - 1, + &InputIsOk); + if (InputIsOk) + ConnectivitySharesFromZone[CurZone] = SharedZone; + } + } + + /* + * Non-shared variable min/max (but not for Zombie zones). + */ + if (*IVersion >= 103 && InputIsOk) + { + for (CurVar = 0; CurVar < *NumVars && InputIsOk; CurVar++) + { + if (VarSharesFromZone[CurVar] == -1 && !IsVarPassive[CurVar]) + { + /* + * Currently ReadTec doesn't do anything with the + * min/max values. + */ + GetNextValue(ReadTecFileStream, FieldDataType_Double, + -LARGEDOUBLE, LARGEDOUBLE, + &InputIsOk); + GetNextValue(ReadTecFileStream, FieldDataType_Double, + -LARGEDOUBLE, LARGEDOUBLE, + &InputIsOk); + } + } + } + + if (InBlockFormat) + { + CurVar = -1; + while (InputIsOk && ((CurVar + 1) < *NumVars)) + { + CurVar++; + if ((CurVar < *NumVars) && (TotalNumPts > 0)) + { + double *CurVPtr = (*VDataBase)[CurVar+CurZone*(*NumVars)]; + J = 0; + if (VarSharesFromZone[CurVar] != -1) + { + LgIndex_t M; + EntIndex_t SourceZone = VarSharesFromZone[CurVar]; + double *SourceVPtr = (*VDataBase)[CurVar+SourceZone*(*NumVars)]; + for (M = 0; M < TotalNumPts; M++) + CurVPtr[M] = SourceVPtr[M]; + } + else if (!IsVarPassive[CurVar]) + { + LocalReadBlock(ReadTecFileStream, + CurVPtr, + VarType[CurVar], + TotalNumPts, + &InputIsOk); + } + } + } + if (!InputIsOk) + ErrMsg(translate("Invalid raw data section of binary file")); + } + else if (TotalNumPts > 0) + { + /* + * Zone is not empty and is in POINT format + */ + J = -1; + if (InputIsOk) + { + LgIndex_t N; + N = 0; + while (InputIsOk && (N < TotalNumPts)) + { + EntIndex_t CurVar; + for (CurVar = 0; InputIsOk && (CurVar < *NumVars); CurVar++) + { + double *CurVPtr = (*VDataBase)[CurVar+CurZone*(*NumVars)]; + if (VarSharesFromZone[CurVar] != -1) + { + EntIndex_t SourceZone = VarSharesFromZone[CurVar]; + double *SourceVPtr = (*VDataBase)[CurVar+SourceZone*(*NumVars)]; + CurVPtr[N] = SourceVPtr[N]; + } + else if (!IsVarPassive[CurVar]) + { + double D = GetNextValue(ReadTecFileStream, + VarType[CurVar], + -LARGEDOUBLE, + LARGEDOUBLE, + &InputIsOk); + + if (InputIsOk && CurVPtr) + CurVPtr[N] = D; + } + } + + if (!InputIsOk) + ErrMsg(translate("Binary datafile corrupted!")); + N++; + } + } + } + + if (InputIsOk && *IVersion < 101) + { + if (ZoneIsFinite) + { + /* + * Pre-version 101 had FE connectivity sharing, + * FECONNECT, information here. + */ + Boolean_t DupConnectivity; + if (*IVersion > 61) + DupConnectivity = GetIoFileInt(ReadTecFileStream, *IVersion, 0, 1, &InputIsOk); + else + DupConnectivity = FALSE; + + if (DupConnectivity) + ConnectivitySharesFromZone[CurZone] = CurZone - 1; /* previous zone */ + else + ConnectivitySharesFromZone[CurZone] = -1; + } + else + ConnectivitySharesFromZone[CurZone] = -1; + } + + if (InputIsOk && ZoneIsFinite && !ZoneIsFEPoly) + { + Boolean_t SkipNodemap; + NodeMap_t *NM = NULL; + NodeMap_t *ONM = NULL; + /* + * Allocate the nodemap ptr if necessary Note that if + * RawDataSpaceAllocated is TRUE then (*NodeMap)[CurZone] + * can either contain a valid address (read the connectivity + * list) or be NULL (skip the list). + */ + if (!RawDataSpaceAllocated && NumKPts*NumJPts >= 1) + { + (*NodeMap)[CurZone] = ALLOC_ARRAY(NumKPts * NumJPts, NodeMap_t, "node map"); + if ((*NodeMap)[CurZone] == NULL) + ErrMsg(translate("Cannot allocate space for connectivity list", + "See the Tecplot User's Manual for a definition of 'connectivity list'")); + } + + if (InputIsOk) + NM = (*NodeMap)[CurZone]; + + SkipNodemap = (NM == NULL); + + if (InputIsOk && ConnectivitySharesFromZone[CurZone] != -1) + { + EntIndex_t SourceZone = ConnectivitySharesFromZone[CurZone]; + if (SourceZone >= CurZone) + { + ErrMsg(translate("Zone %d is attempting to share connectivity " + "with a zone that has not yet been loaded."), + CurZone + 1); + InputIsOk = FALSE; + } + else + { + ONM = (*NodeMap)[SourceZone]; + if (ONM == NULL) + { + ErrMsg(translate("Zone %d is attempting to share connectivity " + "with a zone that is not finite element."), + CurZone + 1); + InputIsOk = FALSE; + } + } + } + + if (InputIsOk) + { + /* load the FE node connectivity */ + for (J = 0; J < NumJPts; J++) + for (I = 0; I < NumKPts; I++) + { + LgIndex_t M; + LgIndex_t L = J * NumKPts + I; + if (ConnectivitySharesFromZone[CurZone] != -1) + M = ONM[L]; + else + M = GetNextI(ReadTecFileStream, &InputIsOk) - 1; + if (!SkipNodemap) + NM[L] = M; + } + } + } + + /* skip over the face neighbor connectivity */ + if (*IVersion >= 101 && InputIsOk) + { + EntIndex_t SharedZone = ConnectivitySharesFromZone[CurZone]; + if (SharedZone == -1 && FNNumBndryConns[CurZone] != 0) + { + LgIndex_t Connection = 0; + while (Connection < FNNumBndryConns[CurZone] && InputIsOk) + { + /* + * Face neighbor connection have the following format for both + * ASCII and binary: + * + * FaceNeighborMode_LocalOneToOne 3 cz,fz,cz + * FaceNeighborMode_LocalOneToMany nz+4 cz,fz,oz,nz,cz1,cz2,...,czn + * FaceNeighborMode_GlobalOneToOne 4 cz,fz,ZZ,CZ + * FaceNeighborMode_GlobalOneToMany 2*nz+4 cz,fz,oz,nz,ZZ1,CZ1,ZZ2,CZ2,...,ZZn,CZn + * + * Where: + * cz = cell in current zone + * fz = face of cell in current zone + * oz = face obsuration flag (only applies to one-to-many): + * 0 = face partially obscured + * 1 = face entirely obscured + * nz = number of cell or zone/cell associations (only applies to one-to-many) + * ZZ = remote Zone + * CZ = cell in remote zone + */ + (void)GetNextI(ReadTecFileStream, &InputIsOk); /* read cz */ + if (!InputIsOk) + ErrMsg(translate("Unexpected end-of-file while reading face neighbor data.")); + + (void)GetNextI(ReadTecFileStream, &InputIsOk); /* read fz */ + + if (InputIsOk) + { + /* + * read FaceNeighborMode_LocalOneToOne: cz || + * FaceNeighborMode_LocalOneToMany: oz || + * FaceNeighborMode_GlobalOneToOne: ZZ || + * FaceNeighborMode_GlobalOneToMany: oz + */ + if (CurZoneSpec->FNMode == FaceNeighborMode_LocalOneToOne) + (void)GetNextI(ReadTecFileStream, &InputIsOk); + else if (CurZoneSpec->FNMode == FaceNeighborMode_LocalOneToMany) + (void)GetNextI(ReadTecFileStream, &InputIsOk); + else if (CurZoneSpec->FNMode == FaceNeighborMode_GlobalOneToOne) + (void)GetNextI(ReadTecFileStream, &InputIsOk); + else if (CurZoneSpec->FNMode == FaceNeighborMode_GlobalOneToMany) + (void)GetNextI(ReadTecFileStream, &InputIsOk); + else + CHECK(FALSE); + + if (CurZoneSpec->FNMode != FaceNeighborMode_LocalOneToOne && InputIsOk) + { + LgIndex_t NumAssociations = 0; + /* + * read FaceNeighborMode_LocalOneToMany: nz || + * FaceNeighborMode_GlobalOneToOne: CZ || + * FaceNeighborMode_GlobalOneToMany: nz + */ + if (CurZoneSpec->FNMode == FaceNeighborMode_LocalOneToMany) + NumAssociations = GetNextI(ReadTecFileStream, &InputIsOk); + else if (CurZoneSpec->FNMode == FaceNeighborMode_GlobalOneToOne) + (void)GetNextI(ReadTecFileStream, &InputIsOk); + else if (CurZoneSpec->FNMode == FaceNeighborMode_GlobalOneToMany) + NumAssociations = GetNextI(ReadTecFileStream, &InputIsOk); + else + CHECK(FALSE); + + if (CurZoneSpec->FNMode != FaceNeighborMode_GlobalOneToOne && InputIsOk) + { + LgIndex_t Assoc; + if (CurZoneSpec->FNMode == FaceNeighborMode_LocalOneToMany) + for (Assoc = 0; Assoc < NumAssociations && InputIsOk; Assoc++) + (void)GetNextI(ReadTecFileStream, &InputIsOk); /* read czn */ + else if (CurZoneSpec->FNMode == FaceNeighborMode_GlobalOneToMany) + for (Assoc = 0; Assoc < NumAssociations && InputIsOk; Assoc++) + { + (void)GetNextI(ReadTecFileStream, &InputIsOk); /* read ZZn */ + (void)GetNextI(ReadTecFileStream, &InputIsOk); /* read CZn */ + } + else + CHECK(FALSE); + + if (InputIsOk) + Connection += NumAssociations; + } + else if (InputIsOk) /* CurZoneSpec->FNMode == FaceNeighborMode_GlobalOneToOne */ + Connection += 1; + } + else if (InputIsOk) /* CurZoneSpec->FNMode == FaceNeighborMode_LocalOneToOne */ + Connection += 1; + + if (!InputIsOk) + ErrMsg(translate("Corrupt input file: invalid face neighbors.")); + } + } + } + }/* face neighbor connectivity */ + /* skip over face map section */ + if (ZoneIsFEPoly && + *IVersion >= 110 && + ConnectivitySharesFromZone[CurZone] != -1 && + InputIsOk) + { + if (!InBlockFormat) + { + ErrMsg(translate("Poly zones must be in block format")); + InputIsOk = FALSE; + } + if (InputIsOk) + { + HgIndex_t NumFaces = CurZoneSpec->NumPtsK; + if (*IVersion == 110) // ...version 111 moved these to the zone header + { + CurZoneSpec->NumFaceNodes = GetNextI(ReadTecFileStream, &InputIsOk); + CurZoneSpec->NumFaceBndryFaces = GetNextI(ReadTecFileStream, &InputIsOk); + CurZoneSpec->NumFaceBndryItems = GetNextI(ReadTecFileStream, &InputIsOk); + } + HgIndex_t TotalNumFaceNodes = CurZoneSpec->NumFaceNodes; + HgIndex_t TotalNumBndryFaces = CurZoneSpec->NumFaceBndryFaces; + HgIndex_t TotalNumBndryItems = CurZoneSpec->NumFaceBndryItems; + if (CurZoneSpec->Type == ZoneType_FEPolyhedron) + ReadInt32Block(ReadTecFileStream, FALSE, NULL, 0, NumFaces + 1, &InputIsOk); + if (InputIsOk) + ReadInt32Block(ReadTecFileStream, FALSE, NULL, 0, TotalNumFaceNodes, &InputIsOk); + if (InputIsOk) + ReadInt32Block(ReadTecFileStream, FALSE, NULL, 0, NumFaces, &InputIsOk); + if (InputIsOk) + ReadInt32Block(ReadTecFileStream, FALSE, NULL, 0, NumFaces, &InputIsOk); + if (TotalNumBndryFaces > 0) + { + if (InputIsOk) + ReadInt32Block(ReadTecFileStream, FALSE, NULL, 0, TotalNumBndryFaces + 1, &InputIsOk); + if (InputIsOk) + ReadInt32Block(ReadTecFileStream, FALSE, NULL, 0, TotalNumBndryItems, &InputIsOk); + if (InputIsOk) + { + if (*IVersion >= 112) + ReadInt32Block(ReadTecFileStream, FALSE, NULL, 0, TotalNumBndryItems, &InputIsOk); + else + ReadInt16Block(ReadTecFileStream, FALSE, NULL, 0, TotalNumBndryItems, &InputIsOk); + } + } + } + }/* face map section */ + } + else + { + ErrMsg(translate("Corrupt input file")); + InputIsOk = FALSE; + } + } + + if (VarSharesFromZone) + FREE_ARRAY(VarSharesFromZone, "VarSharesFromZone"); + if (IsVarPassive) + FREE_ARRAY(IsVarPassive, "IsVarPassive"); + if (ConnectivitySharesFromZone) + FREE_ARRAY(ConnectivitySharesFromZone, "ConnectivitySharesFromZone"); + if (VarType) + FREE_ARRAY(VarType, "VarType"); + + if (!InputIsOk && !RawDataSpaceAllocated) + { + int I; + if (*VDataBase) + { + for (I = 0; I < *NumZones*(*NumVars); I++) + { + if ((*VDataBase)[I]) + FREE_ARRAY((*VDataBase)[I], "vdatabase array"); + } + FREE_ARRAY(*VDataBase, "vdatabase pointer array"); + } + + + if (*NodeMap) + { + for (I = 0; I < *NumZones; I++) + { + if ((*NodeMap)[I]) + FREE_ARRAY((*NodeMap)[I], "connectivity list"); + } + FREE_ARRAY(*NodeMap, "connectivity pointer array"); + } + } + } /*Reading Raw Data*/ + + if (FNNumBndryConns != NULL) + FREE_ARRAY(FNNumBndryConns, "FNNumBndryConns"); + if (ZoneSpecList) + ArrayListDealloc(&ZoneSpecList, ZoneSpecItemDestructor, 0); + + if (ReadTecFileStream) + { +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else + TP_FCLOSE(ReadTecFileStream->File); + free(ReadTecFileStream); +#endif + } + return (InputIsOk); +} + + +void * STDCALL TecAlloc(size_t size) +{ + return (void *)ALLOC_ARRAY(size, char, "TecAlloc"); +} + +void STDCALL TecFree(void *ptr) +{ + /* Hack to remove delete warning... */ + char *Tmp = (char *)ptr; + FREE_ARRAY(Tmp, "TecAlloc"); +} + + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/filestream.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/filestream.cpp new file mode 100644 index 0000000000000000000000000000000000000000..049f99ed74791f968339faff51af265fb9a231f0 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/filestream.cpp @@ -0,0 +1,78 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE + +/* + ***************************************************************** + ***************************************************************** + ******* ******** + ****** Copyright (C) 1988-2008 Tecplot, Inc. ******* + ******* ******** + ***************************************************************** + ***************************************************************** +*/ + +#define FILESTREAMMODULE + +#include "GLOBAL.h" +#include "TASSERT.h" +#include "ALLOC.h" +#include "SYSTEM.h" +#include "FILESTREAM.h" + +/** + */ +FileStream_s *FileStreamAlloc(FILE *File, + Boolean_t IsByteOrderNative) +{ + REQUIRE(VALID_REF(File) || File == NULL); + + FileStream_s *Result = ALLOC_ITEM(FileStream_s, "FileStream"); + if (Result != NULL) + { + Result->File = File; + Result->IsByteOrderNative = IsByteOrderNative; + } + + ENSURE(VALID_REF(Result) || Result == NULL); + return Result; +} + +/** + */ +void FileStreamDealloc(FileStream_s **FileStream) +{ + REQUIRE(VALID_REF(FileStream)); + REQUIRE(VALID_REF(*FileStream) || *FileStream == NULL); + + if (*FileStream != NULL) + { + FREE_ITEM(*FileStream, "FileStream"); + *FileStream = NULL; + } + + ENSURE(*FileStream == NULL); +} diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/geom2.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/geom2.cpp new file mode 100644 index 0000000000000000000000000000000000000000..198f096fd9efe20dfaabd2d99fb4c4902a848f74 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/geom2.cpp @@ -0,0 +1,89 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE + +/* +***************************************************************** +***************************************************************** +******* ******** +****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +***************************************************************** +***************************************************************** +*/ + +#define GEOM2MODULE +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" +#include "ALLOC.h" + +#include "GEOM.h" +#include "TEXT.h" +#include "STRUTIL.h" +#include "GEOM2.h" + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +#include "DATASET0.h" + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# if 0 /* 3D geometry arrowheads are not drawn at this time. */ +#endif +# if 0 /* 3D geometry arrowheads are not drawn at this time. */ +# endif +#if 0 +#endif +# ifndef NO_ASSERTS +# endif +# ifndef NO_ASSERTS +# endif +#endif /* TECPLOTKERNEL */ + + +FieldDataType_e GetGeomFieldDataType(Geom_s const* Geom) +{ + FieldDataType_e Result; + + REQUIRE(VALID_REF(Geom)); + REQUIRE(VALID_REF(Geom->GeomData.Generic.V1Base)); + + Result = Geom->DataType; + + ENSURE(VALID_GEOM_FIELD_DATA_TYPE(Result)); + /* + * Check that the geom's field data arrays (if they exist) + * have the same type as the geometry. + */ + ENSURE(IMPLICATION(VALID_REF(Geom->GeomData.Generic.V1Base), Result == GetFieldDataType(Geom->GeomData.Generic.V1Base))); + ENSURE(IMPLICATION(VALID_REF(Geom->GeomData.Generic.V2Base), Result == GetFieldDataType(Geom->GeomData.Generic.V2Base))); + ENSURE(IMPLICATION(VALID_REF(Geom->GeomData.Generic.V3Base), Result == GetFieldDataType(Geom->GeomData.Generic.V3Base))); + + return Result; +} diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_msg.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_msg.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6a20cf56041abe9cb11696a33ab6c81d00de9729 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_msg.cpp @@ -0,0 +1,415 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" + +#define TECPLOTENGINEMODULE + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +#define Q_MSGMODULE +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" +#include "ALLOC.h" +#include "ARRLIST.h" + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined ENGINE +#if defined MOTIF +#endif +#if defined MSWIN +#endif +#endif +#endif + +#include "STRUTIL.h" +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +using std::string; +using namespace tecplot::strutil; +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#define MAXCHARACTERSPERLINE 60 +/* + * Wrap a string so it contains at most CharactersPerLine + * characters. Embedded newlines are left alone. Spaces + * following newlines are also left alone. + */ +Boolean_t WrapString(const char *OldString, + char **NewString) +{ + size_t L; + if (OldString == NULL) + return (FALSE); + + /* + * Assume Old string has ample spaces. Will only be + * replacing some spaces with newlines and removing + * other spaces. New string can be allocated to be + * same length as old string. + */ + + L = strlen(OldString); + *NewString = ALLOC_ARRAY(L + 1, char, "new error message string"); + if (*NewString == NULL) + return (FALSE); + + strcpy(*NewString, OldString); + + if (L > MAXCHARACTERSPERLINE) + { + char *LineStart = *NewString; + char *LastWord = *NewString; + char *WPtr = *NewString; + while (WPtr && (*WPtr != '\0')) + { + size_t CurLen; + /* + * Find next hard newline. If there is one befor the + * line should be chopped then reset the Last Word to + * be at the first word after the newline. + */ + WPtr = strchr(LineStart, '\n'); + if (WPtr && ((WPtr - LineStart) < MAXCHARACTERSPERLINE)) + { + WPtr++; + while (*WPtr == '\n') + WPtr++; + LineStart = WPtr; + /* + * Skip over trailing spaces. Special handling to + * allow indent after hard newline. + */ + while (*WPtr == ' ') + WPtr++; + LastWord = WPtr; + continue; + } + /* + * Find next "word" + */ + WPtr = strchr(LastWord, ' '); + if (WPtr != NULL) + { + while (*WPtr == ' ') + WPtr++; + } + + if (WPtr == NULL) + { + CurLen = strlen(LineStart); + } + else + { + CurLen = WPtr - LineStart; + } + + if (CurLen > MAXCHARACTERSPERLINE) + { + /* + * Line is too long. Back up to previous + * word and replace preceeding space with + * a newline. + */ + if (LastWord == LineStart) + { + /* + * Bad news, line has very long word. + */ + if (WPtr && (*WPtr != '\0')) + { + *(WPtr - 1) = '\n'; + LastWord = WPtr; + } + } + else + { + *(LastWord - 1) = '\n'; + } + LineStart = LastWord; + } + else + LastWord = WPtr; + } + } + return (TRUE); +} + + +static void SendWarningToFile(FILE *F, + const char *S) +{ + char *S2; + REQUIRE(VALID_REF(F)); + REQUIRE(VALID_REF(S)); + if (WrapString(S, &S2)) + { + fprintf(F, "Warning: %s\n", S2); + FREE_ARRAY(S2, "temp warning string"); + } +} + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + +/** + * Show the warning message. Note that the Format string can be the only + * argument, in which case it is essentially the warning message itself. + * + * param Format + * C Format string or a simple message. + * param ... + * Zero or more variable arguments. The number of arguments must correspond + * to the placeholders in the format string. + */ +void Warning(TranslatedString Format, + ...) /* zero or more arguments */ +{ + REQUIRE(!Format.isNull()); + + static Boolean_t InWarning = FALSE; /* ...used to prevent recursive deadlock */ + if (!InWarning) + { +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + InWarning = TRUE; + { + /* + * Attempt to format the string. Failing that simply use the original format + * string argument which, if we ran out of memory while formatting, is + * probably just an warning message saying that we ran out of memory in some + * previous operation anyway. + */ + Boolean_t cleanUp = TRUE; + + va_list Arguments; + va_start(Arguments, Format); + char* message = vFormatString(Format.c_str(), Arguments); + va_end(Arguments); + + if (message == NULL) + { + cleanUp = FALSE; // ...this boolean allows us to "carefully" cast away the const'ness + message = (char*)Format.c_str(); + } + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#ifdef MSWIN +#endif +#if defined UNIXX +#endif +#if defined MSWIN +#endif +#else /* !TECPLOTKERNEL */ + { + SendWarningToFile(stderr, message); + } +#endif + + if (cleanUp) + FREE_ARRAY(message, "message"); + } + InWarning = FALSE; + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + } +} + + +static void SendErrToFile(FILE *File, + const char *Msg) +{ + char *FormattedMsg; + REQUIRE(VALID_REF(File)); + REQUIRE(VALID_REF(Msg)); + if (WrapString(Msg, &FormattedMsg)) + { + fprintf(File, "Err: %s\n", FormattedMsg); + FREE_ARRAY(FormattedMsg, "temp error string"); + } + else + fprintf(File, "Err: %s\n", Msg); +} + + +/* Fall-back ErrMsg procedure when nothing else works */ +static void DefaultErrMsg(const char *Msg) +{ + REQUIRE(VALID_REF(Msg)); + +#ifdef MSWIN +#ifdef TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else + MessageBox(NULL, Msg, "Error", MB_OK | MB_ICONERROR); +#endif +#else + SendErrToFile(stderr, Msg); +#endif +} + +static void PostErrorMessage(TranslatedString Format, + va_list Arguments) +{ + REQUIRE(!Format.isNull()); + + /* + * Attempt to format the string. Failing that simply use the original format + * string argument which, if we ran out of memory while formatting, is + * probably just an error message saying that we ran out of memory in some + * previous operation anyway. + */ + Boolean_t cleanUp = TRUE; + char* messageString = vFormatString(Format.c_str(), Arguments); + if (messageString == NULL) + { + cleanUp = FALSE; // ...this boolean allows us to "carefully" cast away the const'ness + messageString = (char*)Format.c_str(); + } + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#ifdef MSWIN +#endif +#if defined UNIXX +#if !defined ENGINE +#endif +#endif +#else /* !TECPLOTKERNEL */ + { + DefaultErrMsg(messageString); + } +#endif + + /* cleanup if we allocated the string */ + if (cleanUp) + FREE_ARRAY(messageString, "messageString"); +} + +/* + * NOTES: + * This function is thread safe in that it may be safely called by multiple + * threads however when running interactively only the first error message is + * queued for display on idle. In batch mode all messages are sent to the + * batch log file. + */ +void vErrMsg(TranslatedString Format, + va_list Arguments) +{ + REQUIRE(!Format.isNull()); + + static Boolean_t InErrMsg = FALSE; /* ...used to prevent recursive deadlock */ + if (!InErrMsg) + { +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + InErrMsg = TRUE; + { + PostErrorMessage(Format, Arguments); + } + InErrMsg = FALSE; + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + } +} + +/** + * Show the error message. Note that the Format string can be the only + * argument, in which case it is essentially the error message itself. + * + * @param Format + * C Format string or a simple message. + * @param ... + * Zero or more variable arguments. The number of arguments must correspond + * to the placeholders in the format string. + */ +void ErrMsg(TranslatedString Format, + ...) /* zero or more arguments */ +{ + REQUIRE(!Format.isNull()); + + va_list Arguments; + va_start(Arguments, Format); +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else + PostErrorMessage(Format, Arguments); +#endif + va_end(Arguments); +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined ENGINE +#endif +#if !defined ENGINE +#if defined MOTIF +#endif +#if defined MSWIN +#endif +#endif +#if !defined ENGINE +#if defined MOTIF +#endif +#if defined MSWIN +#endif +#endif +#if !defined ENGINE +#if defined MOTIF +#endif /* MOTIF */ +#if defined MSWIN +#endif +#if defined MOTIF +#endif /* MOTIF */ +#endif +#if !defined ENGINE +#endif +#endif /* TECPLOTKERNEL */ + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_unicode.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_unicode.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4d4db61e1ddb9fd3fec146882ef268a9b4973ea1 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_unicode.cpp @@ -0,0 +1,447 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" + +#define TECPLOTENGINEMODULE + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ +#define Q_UNICODEMODULE + +#include "GLOBAL.h" +#include "TASSERT.h" + +#if !defined TECPLOTKERNEL +#include "TranslatedString.h" +#endif + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#include "ALLOC.h" + +#include "Q_UNICODE.h" + +using namespace std; + +namespace tecplot +{ +namespace strutil +{ + +typedef std::map<std::string, char *> EnvStringPoolMap_t; +static EnvStringPoolMap_t mapEnvStringPool; + + +#if defined MSWIN + + +string WStringToString(wstring str) +{ + REQUIRE("str is any wide string"); + string Result = WideCharToUtf8(str.c_str()); + + ENSURE("Result is any string"); + return Result; +} + +wstring StringToWString(string str) +{ + REQUIRE("str is any string"); + + wstring Result = Utf8ToWideChar(str.c_str()); + + ENSURE("Result is any string"); + return Result; +} +#endif + +/************************************************ + * Utf8Api + ************************************************/ +#define VALID_CODE_PAGE(cp) \ + ( (cp) == 932 || (cp) == CP_UTF8 || (cp) == CP_ACP || (cp) == CP_OEMCP || (cp) == CP_THREAD_ACP ) + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined MSWIN && !defined ENGINE +#endif +#if defined MSWIN +#endif +#endif + + +#if defined MSWIN + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + +std::string WideCharToMultiByte(const wchar_t* WideString, + unsigned int CodePage) +{ + REQUIRE(VALID_REF(WideString)); + REQUIRE(VALID_CODE_PAGE(CodePage)); + + string strResult; + wstring wString(WideString); + + + if (wString.length() > 0) + { + size_t nLen = + (size_t) ::WideCharToMultiByte(CodePage, + 0, + wString.c_str(), + -1, + NULL, + 0, + NULL, + NULL); + if (nLen > 0) + { + char *pBuffer = ALLOC_ARRAY(nLen, char, "pBuffer"); + + VERIFY(::WideCharToMultiByte(CodePage, + 0, + WideString, + (int)(wString.length() + 1), + pBuffer, + (int)nLen, + NULL, + NULL) != 0); + + strResult = pBuffer; + FREE_ARRAY(pBuffer, "pBuffer"); + + } + else + { + // this should never be an error + CHECK(FALSE); + } + } + else + { + // output 'str' remains empty + } + + ENSURE("strResult is a valid STL string"); + return strResult; + + +} + +wstring MultiByteToWideChar(const char *UTF8String, + unsigned int CodePage) +{ + REQUIRE(VALID_REF(UTF8String)); + REQUIRE(VALID_CODE_PAGE(CodePage)); + + wstring strResult; + string UTF8str(UTF8String); + + size_t wLen; + + if (UTF8str.length() > 0) + { + wLen = + (size_t) ::MultiByteToWideChar(CodePage, + 0, + UTF8str.c_str(), + -1, + NULL, + 0); + if (wLen > 0) + { + wchar_t *wBuffer = ALLOC_ARRAY(wLen + 1, wchar_t, "wBuffer"); + VERIFY(::MultiByteToWideChar(CodePage, + 0, + UTF8str.c_str(), + (int)(UTF8str.length() + 1), + wBuffer, + (int)wLen) != 0); + + strResult = wBuffer; + FREE_ARRAY(wBuffer, "wBuffer"); + + } + else + { + CHECK(FALSE); // We should never get an error here + } + } + else + { + // strResult is left empty + } + + ENSURE("strResult is a valid CString"); + + wstring strRet(strResult); + return strRet; + +} +#endif + + + +#if defined MSWIN +std::string WideCharToUtf8(const wchar_t *str) +{ + REQUIRE(VALID_REF(str)); /* really cannot be NULL - 2007-10-22 CAM/DTO */ + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + UINT CodePage = CP_ACP; + + string Result = ""; + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + Result = WideCharToMultiByte(str, CodePage); + + ENSURE("Result is any string"); + return Result; +} + +wstring Utf8ToWideChar(const char *str) +{ + REQUIRE(VALID_REF(str)); /* really cannot be NULL - 2007-10-22 CAM/DTO */ + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + UINT CodePage = CP_ACP; + wstring Result; + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + Result = MultiByteToWideChar(str, CodePage); + + ENSURE("Result is any string"); + return Result; +} +#endif + + +Boolean_t IsValidUtf8LeadByte(Byte_t uch) +{ + REQUIRE("uch is any byte"); + Boolean_t Result = + uch <= 0x7F || + (uch >= 0xC0 && uch <= 0xDF) || + (uch >= 0xE0 && uch <= 0xEF) || + (uch >= 0xF0 && uch <= 0xF4); + + ENSURE(VALID_BOOLEAN(Result)); + return Result; +} + +Boolean_t IsValidUtf8ContinuingByte(Byte_t uch) +{ + REQUIRE("uch is any char"); + + Boolean_t Result = + (uch >= 0x80 && uch <= 0xBF); + + ENSURE(VALID_BOOLEAN(Result)); + return Result; +} + +Boolean_t IsValidUtf8Byte(Byte_t uch) +{ + REQUIRE("uch is any char"); + Boolean_t Result = + IsValidUtf8LeadByte(uch) || + IsValidUtf8ContinuingByte(uch); + + REQUIRE(VALID_BOOLEAN(Result)); + return Result; +} + + +Boolean_t ShouldConvertWideStringToUtf8String(const wchar_t *str) +{ + Boolean_t Result = FALSE; + +#if defined MSWIN && defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* MSWIN and TECPLOTKERNEL */ + + ENSURE(VALID_BOOLEAN(Result)); + return Result; + +} + +Boolean_t IsValidUtf8String(const char *str) +{ + Boolean_t IsValid = TRUE; + REQUIRE(VALID_REF(str)); + +#if defined MSWIN + size_t len = strlen(str); + Boolean_t InUtf8Sequence = FALSE; + int Utf8SequenceCount = 0; + int MaxUtf8SequenceCount = 0; + + /* we want to process the final \0, so go to <= len */ + + for (size_t ii = 0; IsValid && ii <= len; ii++) + { + Byte_t uch = (Byte_t)str[ii]; + + if (uch <= 0x7F) + { + /* This must be the end of a sequence, + so the sequence count must match + the max sequence count */ + + InUtf8Sequence = FALSE; + IsValid = (Utf8SequenceCount == MaxUtf8SequenceCount); + Utf8SequenceCount = 0; + MaxUtf8SequenceCount = 0; + } + else if (uch >= 0x80 && uch <= 0xBF) + { + /* Continuing byte in a multi byte sequence */ + if (InUtf8Sequence) + { + Utf8SequenceCount++; + } + else + { + IsValid = FALSE; + } + + } + else if (uch >= 0xC0 && uch <= 0xDF) + { + /* Lead byte of 000080-0007FF */ + IsValid = (Utf8SequenceCount == MaxUtf8SequenceCount); + InUtf8Sequence = TRUE; + Utf8SequenceCount = 0; + MaxUtf8SequenceCount = 1; + } + else if (uch >= 0xE0 && uch <= 0xEF) + { + /* Lead byte of 000800-00FFFF */ + IsValid = (Utf8SequenceCount == MaxUtf8SequenceCount); + InUtf8Sequence = TRUE; + Utf8SequenceCount = 0; + MaxUtf8SequenceCount = 2; + } + else if (uch >= 0xF0 && uch <= 0xF4) + { + /* Lead byte of 010000-10FFFF */ + IsValid = (Utf8SequenceCount == MaxUtf8SequenceCount); + Utf8SequenceCount = 0; + InUtf8Sequence = TRUE; + MaxUtf8SequenceCount = 3; + } + + else + { + /* Invalid Utf 8 */ + IsValid = FALSE; + } + } +#endif + + ENSURE(VALID_BOOLEAN(IsValid)); + return IsValid; +} + + +/** + */ +Boolean_t IsNullOrZeroLengthString(const char *str) +{ + REQUIRE(VALID_REF_OR_NULL(str)); + + Boolean_t Result = (str == NULL || strlen(str) == 0); + + ENSURE(VALID_BOOLEAN(Result)); + return Result; +} + +/** + */ +Boolean_t IsNullOrZeroLengthString(TranslatedString TS) +{ + REQUIRE(TS.isValid()); + return TS.isNullOrZeroLength(); +} + + +} +} + +#if defined MSWIN && TECPLOTKERNEL && (!defined NO_ASSERTS || defined CHECKED_BUILD) +/* Keeping Trace out of the release builds + will verify for us that it has been optimized away. + + See the definition of TRACE in MASTER.h for + more information... */ +void MSWinTrace(const char *Format, ...) +{ + REQUIRE(VALID_REF(Format)); + + const int BufferSize = 512; /* Only print the first 512 characers */ + va_list Arguments; + + /* Don't use ALLOC_ARRAY here */ + char *buffer = new char[BufferSize]; + memset(buffer, 0, BufferSize); + + va_start(Arguments, Format); + _vsnprintf(buffer, BufferSize - 1, Format, Arguments); + va_end(Arguments); + + ::OutputDebugStringA(buffer); + + delete [] buffer; +} + + + +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/set.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/set.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2f6252a4c9893a028d15cc535c20572e53ee46ea --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/set.cpp @@ -0,0 +1,696 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE + + +/* +***************************************************************** +***************************************************************** +******* ******** +****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +***************************************************************** +***************************************************************** +*/ + + + +#define SETMODULE +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" +#include "ALLOC.h" +#include "SET.h" + + +/* * SET FUNCTIONS * */ + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if InitNumZones > InitNumVars +#else +#endif +#if ZoneExpansionFactor > VarExpansionFactor +#else +#endif +#else +#define SetInitSize (PadOut(1,SetBitSize)) +#define SetExpansionFactor 2 +#endif + +using namespace tecplot::strutil; + +/* + */ +Set_pa AllocSet(Boolean_t show_error_msg) +{ + Set_pa Set = ALLOC_ITEM(struct _Set_a, "Set header"); + if (Set) + { + Set->size = SetInitSize; + Set->data = ALLOC_ARRAY(SetInitSize / SetBitSize, SetData_t, "Set data"); + if (Set->data == NULL) + DeallocSet(&Set); + else + ClearSet(Set); + } + if ((Set == NULL) && show_error_msg) + { +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# else + fprintf(stderr, "Out of memory for sets"); +# endif + } + return Set; +} /* AllocSet() */ + + +/* + */ +void DeallocSet(Set_pa *Set) +{ + if (Set && *Set) + { + if ((*Set)->data) + FREE_ARRAY((*Set)->data, "Set data"); + FREE_ITEM(*Set, "Set header"); + *Set = NULL; + } +} /* DeallocSet() */ + + +/** + * This function adapts the DeallocSet function to work with the + * ArrayList's deallocation callback. + */ +Boolean_t SetItemDestructor(void *ItemRef, + ArbParam_t ClientData) +{ + Set_pa *SetRef = (Set_pa *)ItemRef; + + REQUIRE(VALID_REF(SetRef)); + REQUIRE(VALID_REF(*SetRef) || *SetRef == NULL); + + if (*SetRef != NULL) + DeallocSet(SetRef); + + ENSURE(*SetRef == NULL); + return TRUE; +} + + +/* + */ +Boolean_t ExpandSet(Set_pa Set, + SetIndex_t max_val, + Boolean_t show_error_msg) +{ + SetData_t *data; + long new_size; + + REQUIRE(max_val >= 0); + + if (!Set) + { + if (show_error_msg) + { +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# else + fprintf(stderr, "Null Set expand"); +# endif + } + return FALSE; + } + + if (max_val <= Set->size) + return TRUE; + + new_size = Set->size; + while (new_size < max_val) + new_size *= SetExpansionFactor; + + new_size = PadOut(new_size, SetBitSize); + + data = ALLOC_ARRAY(new_size / SetBitSize, SetData_t, "new Set data"); + + if (!data) + { + if (show_error_msg) + { +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# else + fprintf(stderr, "Out of memory for sets"); +# endif + } + return FALSE; + } + size_t old_set_size_in_bytes = sizeof(data[0]) * (Set->size / SetBitSize); + memcpy(data, Set->data, old_set_size_in_bytes); + + size_t new_set_size_in_bytes = sizeof(data[0]) * (new_size / SetBitSize); + size_t numBytesToReset = new_set_size_in_bytes - old_set_size_in_bytes; + memset(((char*)data) + old_set_size_in_bytes, 0, numBytesToReset); + + FREE_ARRAY(Set->data, "old Set data"); + Set->data = data; + Set->size = new_size; + return TRUE; +} /* ExpandSet() */ + + +/* + */ +Boolean_t CopySet(Set_pa dst, + Set_pa src, + Boolean_t show_error_msg) +{ + if (dst && dst->data && + src && src->data && + ExpandSet(dst, src->size, show_error_msg)) + { + SetIndex_t src_size_in_words = src->size / SetBitSize; + size_t numBytesToCopy = sizeof(dst->data[0]) * src_size_in_words; + memcpy(dst->data, src->data, numBytesToCopy); + + SetIndex_t dst_size_in_words = dst->size / SetBitSize; + CHECK(dst_size_in_words>=src_size_in_words); // ...guaranteed by above ExpandSet() call + size_t numBytesToReset = sizeof(dst->data[0]) * (dst_size_in_words - src_size_in_words); + memset((char*)(dst->data + src_size_in_words), 0, numBytesToReset); + + return TRUE; + } + else + return FALSE; +} /* CopySet() */ + + +/* + */ +Boolean_t AppendSet(Set_pa dst, + Set_pa src, + Boolean_t show_error_msg) +{ + if (dst && dst->data && + src && src->data) + { + SetIndex_t member; + ForAllMembersInSet(member, src) + { + if (!AddToSet(dst, member, TRUE)) + return FALSE; + } + return TRUE; + } + else + return FALSE; +} /* AppendSet() */ + + +/* + */ +void ClearSet(Set_pa Set) +{ + if (Set && Set->data) + memset(Set->data, 0, Set->size / SetBitSize * sizeof(Set->data[0])); +} /* ClearSet() */ + + +#if defined USE_FUNCTIONS_FOR_SETS +/* + */ +Boolean_t AddToSet(Set_pa Set, + SetIndex_t member, + Boolean_t show_error_msg) +{ + REQUIRE(member >= 0); + if (Set && + Set->data && + ((member + 1 <= Set->size) || ExpandSet(Set, member + 1, show_error_msg))) + { + SetIndex_t word = member / SetBitSize; + SetData_t bit = (SetData_t)1 << (member % SetBitSize); + Set->data[word] |= bit; + return TRUE; + } + else + return FALSE; +} /* AddToSet() */ +#endif + + +/* + */ +void RemoveFromSet(Set_pa Set, + SetIndex_t member) +{ + REQUIRE(member >= 0); + if (Set && (member < Set->size) && Set->data) + { + SetIndex_t word = member / SetBitSize; + SetData_t bit = (SetData_t)1 << (member % SetBitSize); + Set->data[word] &= (((SetData_t) - 1) ^ bit); + } +} /* RemoveFromSet() */ + + +/** + * Similar to RemoveFromSet except it shifts the Set. + */ +void DeleteSetMember(Set_pa Set, + SetIndex_t Member) +{ + SetIndex_t LastMember; + + REQUIRE(VALID_REF(Set)); + REQUIRE(Member >= 0); + + LastMember = GetPrevMember(Set, BAD_SET_VALUE); + if (Member <= LastMember) + { + ShiftSet(Set, Member + 1, LastMember, -1); + RemoveFromSet(Set, LastMember); + } +} + + +/** + * Similar to AddToSet except that if the new member is within the currently + * defined set the members are shifted accordingly. + */ +Boolean_t InsertSetMember(Set_pa Set, + SetIndex_t Member, + Boolean_t ShowErrMsg) +{ + Boolean_t IsOk = TRUE; + SetIndex_t OrigLastMember; + + REQUIRE(VALID_REF(Set)); + + /* first, determine if we need to shift the set */ + OrigLastMember = GetPrevMember(Set, BAD_SET_VALUE); + if (Member <= OrigLastMember) + { + IsOk = ExpandSet(Set, (OrigLastMember + 1) + 1, ShowErrMsg); + ShiftSet(Set, Member, OrigLastMember, 1); + } + + if (IsOk) + IsOk = AddToSet(Set, Member, ShowErrMsg); + + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + +#if defined USE_FUNCTIONS_FOR_SETS +/* + */ +Boolean_t InSet(Set_pa Set, + SetIndex_t member) +{ + /* + * Sometimes InSet is called with negative numbers. This is not correct, but + * its what we have to work with. Maybe some day, we can make this assertion. + REQUIRE(member>=0); + */ + if (Set && (0 <= member && member < Set->size)) + { + SetIndex_t word = member / SetBitSize; + SetData_t bit = (SetData_t)1 << (member % SetBitSize); + return (Set->data[word]&bit) != 0; + } + else + return FALSE; +} /* InSet() */ +#endif + + +/* + */ +Boolean_t IsEmpty(Set_pa Set) +{ + if (Set && Set->data) + { + SetIndex_t set_size_in_words = Set->size / SetBitSize; + SetIndex_t word; + for (word = 0; word < set_size_in_words; word++) + if (Set->data[word] != 0) + return FALSE; + } + return TRUE; +} /* IsEmpty() */ + + +/* + */ +Boolean_t HasVoids(Set_pa Set) +{ + Boolean_t Result = FALSE; + SetIndex_t ContiguousMember = 0; + SetIndex_t Member = 0; + + REQUIRE(VALID_REF(Set)); + + /* look for voids in the set */ + ForAllMembersInSet(Member, Set) + { + if (Member == ContiguousMember) + { + ContiguousMember++; + } + else + { + Result = TRUE; + break; + } + } + + ENSURE(VALID_BOOLEAN(Result)); + return Result; +} + + +/* + */ +SetIndex_t MemberCount(Set_pa Set) +{ + SetIndex_t count = 0; + if (Set && Set->data) + { + SetIndex_t set_size_in_words = Set->size / SetBitSize; + SetIndex_t word; + for (word = 0; word < set_size_in_words; word++) + { + SetData_t word_val = Set->data[word]; + while (word_val) + { + if (word_val&1) + count++; + word_val = word_val >> 1; + } + } + } + return count; +} /* MemberCount() */ + + +/* + */ +SetIndex_t GetNextMember(Set_pa Set, + SetIndex_t start_at) +{ + SetIndex_t next_member = BAD_SET_VALUE; + if (Set && Set->data) + { + SetIndex_t set_size_in_words = Set->size / SetBitSize; + SetIndex_t word; + SetData_t word_val = 0; + int bit; + if (start_at == BAD_SET_VALUE) + { + word = 0; + bit = 0; + if (word < set_size_in_words) + word_val = Set->data[0]; + } + else if (start_at + 1 < Set->size) + { + word = (start_at + 1) / SetBitSize; + bit = (start_at + 1) % SetBitSize; + if (word < set_size_in_words) + word_val = Set->data[word] >> bit; + } + else + { + return BAD_SET_VALUE; + } + while ((word < set_size_in_words) && (word_val == 0)) + { + word++; + bit = 0; + if (word < set_size_in_words) + word_val = Set->data[word]; + } + if (word < set_size_in_words) + { + while (!(word_val&1)) + { + word_val >>= 1; + bit++; + } + next_member = word * SetBitSize + bit; + } + } + return next_member; +} /* GetNextMember() */ + + +/* + */ +SetIndex_t GetPrevMember(Set_pa Set, + SetIndex_t start_at) +{ + SetIndex_t next_member = BAD_SET_VALUE; + if (Set && Set->data) + { + SetIndex_t set_size_in_words = Set->size / SetBitSize; + SetIndex_t word; + SetData_t word_val = 0; + int bit; + if (start_at == BAD_SET_VALUE) + { + word = set_size_in_words - 1; + bit = SetBitSize - 1; + if (word >= 0) + word_val = Set->data[word]; + } + else if (start_at > 0) + { + word = (start_at - 1) / SetBitSize; + bit = (start_at - 1) % SetBitSize; + if (word >= 0) + word_val = Set->data[word] << (SetBitSize - bit - 1); + } + else + { + return BAD_SET_VALUE; + } + while ((word >= 0) && (word_val == 0)) + { + word--; + bit = SetBitSize - 1; + if (word >= 0) + word_val = Set->data[word] << (SetBitSize - bit - 1); + } + if (word >= 0) + { + while (!(word_val&SetLastBit)) + { + word_val <<= 1; + bit--; + } + next_member = word * SetBitSize + bit; + } + } + return next_member; +} /* GetPrevMember() */ + + +/* + */ +Boolean_t EqualSets(Set_pa set1, + Set_pa set2) +{ + SetIndex_t set1_size_in_words, + set2_size_in_words, + min_set_size_in_words, + ii; + if (!set1 || !set2) + return FALSE; + + set1_size_in_words = set1->size / SetBitSize; + set2_size_in_words = set2->size / SetBitSize; + min_set_size_in_words = MIN(set1_size_in_words, set2_size_in_words); + + for (ii = 0; ii < min_set_size_in_words; ii++) + if (set1->data[ii] != set2->data[ii]) + return FALSE; + for (ii = min_set_size_in_words; ii < set1_size_in_words; ii++) + if (set1->data[ii] != 0) + return FALSE; + for (ii = min_set_size_in_words; ii < set2_size_in_words; ii++) + if (set2->data[ii] != 0) + return FALSE; + + return TRUE; + +} /* EqualSets() */ + + +Boolean_t IsSubSet(Set_pa childset, + Set_pa parentset) +{ + SetIndex_t s; + + ForAllMembersInSet(s, childset) + { + if (!InSet(parentset, s)) + return (FALSE); + } + + return (TRUE); + +} /* IsSubSet() */ + + + + + + +/* + * functions added 11/7 by byron. These are roughed in for now and could + * stand to be optimized later..... + */ + +/* + * Return the number of members in a set that preceed a given member. + */ + +SetIndex_t MemberOffset(Set_pa Set, + SetIndex_t Member) +{ + SetIndex_t I; + SetIndex_t Offset = -1; + if (InSet(Set, Member)) + { + for (I = 0; I <= Member; I++) + { + if (InSet(Set, I)) + Offset++; + } + } + return (Offset); +} + +/* + * Return the position in the set of the nth member of a set. + */ +SetIndex_t OffsetMember(Set_pa Set, + SetIndex_t Offset) +{ + SetIndex_t I; + SetIndex_t Member = BAD_SET_VALUE; + for (I = 0; I <= Offset; I++) + { + Member = GetNextMember(Set, Member); + if (Member == BAD_SET_VALUE) + break; + } + return (Member); +} + +Boolean_t CopySetMember(Set_pa DstSet, + SetIndex_t DstOffset, + Set_pa SrcSet, + SetIndex_t SrcOffset) +{ + if (InSet(SrcSet, SrcOffset)) + return (AddToSet(DstSet, DstOffset, TRUE)); + else + RemoveFromSet(DstSet, DstOffset); + return (TRUE); +} + + + +/* + * Initial: + * v---ShiftPos1 v--ShiftPos2 + * +-------------------------------------+ + * | | | | | | | |x| | | | | | | |x| | | | + * +-------------------------------------+ + * + * Shift +2 + * v---ShiftPos1 v--ShiftPos2 + * +-------------------------------------+ + * | | | | | | | | | |x| | | | | | | |x| | + * +-------------------------------------+ + * + * + * Shift all bits between ShiftPos1 and ShiftPos2 + * by ShiftAmount. The bits that the shift + * replaces fill in the hole left by the shift + * + * + */ +void ShiftSet(Set_pa Set, + SetIndex_t ShiftPos1, + SetIndex_t ShiftPos2, + SetIndex_t ShiftAmount) +{ + Set_pa NewSet; + SetIndex_t DPos; + SetIndex_t SPos; + + if ((Set == NULL) || (IsEmpty(Set))) + return; + + NewSet = AllocSet(TRUE); + + if (NewSet == NULL) + return; + + if (!CopySet(NewSet, Set, TRUE)) + return; + + if (ShiftAmount < 0) + { + DPos = ShiftPos2; + SPos = ShiftPos1 - 1; + while (DPos > ShiftPos2 + ShiftAmount) + CopySetMember(NewSet, DPos--, Set, SPos--); + SPos = ShiftPos2; + while (SPos >= ShiftPos1) + CopySetMember(NewSet, DPos--, Set, SPos--); + } + else if (ShiftAmount > 0) + { + DPos = ShiftPos1; + SPos = ShiftPos2 + 1; + while (DPos < ShiftPos1 + ShiftAmount) + CopySetMember(NewSet, DPos++, Set, SPos++); + SPos = ShiftPos1; + while (SPos <= ShiftPos2) + CopySetMember(NewSet, DPos++, Set, SPos++); + } + CopySet(Set, NewSet, TRUE); + DeallocSet(&NewSet); +} + + + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/stdafx.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/stdafx.h new file mode 100644 index 0000000000000000000000000000000000000000..066d102e7c732daf416bdf937ab64b3c5ea05500 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/stdafx.h @@ -0,0 +1,130 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#if !defined STDAFX_H_ +# define STDAFX_H_ + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ +/* + * stdafx.h : include file for standard system include files, + * or project specific include files that are used frequently, but + * are changed infrequently + * Used for Windows only + */ +#if defined _WIN32 + +/* + * Set NDEBUG before including "custafx.h" since that file may + * use NDEBUG. (In fact, for SmartHeap builds this is the case.) + * CAM 2007-04-11 + * + * Previous comment: "Note that _DEBUG is defined by the Windows compiler + * if any of the multi-threaded DLL runtime libraries are used." + */ +#if !defined _DEBUG +#if !defined NDEBUG +#define NDEBUG +#endif +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + +#if !defined MSWIN +#define MSWIN +#endif + +#define ENGLISH_ONLY // remove to support non-english dll's + +#if !defined WINVER +#define WINVER 0x0500 +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined CHECKED_BUILD || defined _DEBUG && !defined COREAPI +#if defined _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES +#endif +#else +#endif +#endif /* TECPLOTKERNEL */ + +/* Windows builds are UNICODE */ +#pragma warning(disable : 4786) /* truncated identifiers in debug symbol table. */ +#pragma warning(disable : 4996) /* deprecated functions */ + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined UNICODE +#endif +#if !defined _AFXDLL +#endif +#if defined _M_IX86 +#else +#endif +#if defined _WIN64 +#if !defined _M_IA64 && !defined _M_AMD64 +#endif +#endif +#if !defined MSWIN +#endif +#if !defined THREED +#endif +#ifndef _AFX_NO_AFXCMN_SUPPORT +#endif /* _AFX_NO_AFXCMN_SUPPORT */ +#ifndef _AFX +#endif +#else /* !TECPLOTKERNEL */ +#define AfxIsValidAddress(ptr,bb) ((ptr)!=NULL) +#endif + +/* 64-bit adjustments */ +#if defined _M_IA64 || defined _M_AMD64 +#define WININT INT_PTR +#define WINUINT UINT_PTR +#else +#define WININT int +#define WINUINT UINT +#endif + +#define WINCALLBACK CALLBACK + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined (NDEBUG) +#else +#endif +#endif /* TECPLOTKERNEL */ +#endif /* _WIN32 */ + + +#endif /* STDAFX_H_ */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/strlist.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/strlist.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ab34a5274c9eac16224facd1c66456348a718c5b --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/strlist.cpp @@ -0,0 +1,1065 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +#define STRLISTMODULE +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" +#include "STRUTIL.h" +#include "ALLOC.h" +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +#include "ARRLIST.h" +#include "STRLIST.h" + +/* END HEADER */ + +using namespace tecplot::strutil; + +/* + * This set of functions provide a wrapper around the array list utilities + * thereby making it aware of item allocation and deallocation. All strings + * given to the string list and returned to the client are copies. Therefore + * it is the client's responsibility to deallocate string results when no + * longer needed. + */ + + +/* + * Destructor for cleaning up string allocations. + * + * param ItemRef + * Reference to the string item to destroy. + * param ClientData + * Any client data needed for destroying the string. + * + * return + * TRUE is a requirement + */ +static Boolean_t StringListItemDestructor(void *ItemRef, + ArbParam_t ClientData) +{ + char **StringRef = (char **)ItemRef; + + REQUIRE(VALID_REF(StringRef)); + REQUIRE(VALID_REF(*StringRef) || *StringRef == NULL); + + if (*StringRef != NULL) + { + FREE_ARRAY(*StringRef, "string"); + *StringRef = NULL; + } + + ENSURE(*StringRef == NULL); + return TRUE; +} + +/* + * String item duplicator. + * + * param TargetItemRef + * Reference to the string list item to receive the duplicate. + * param SourceItemRef + * Reference to the string list item to duplicate. + * param ClientData + * Any client data required for duplication. + * + * return + * TRUE if the duplication was a success + * FALSE otherwise. If the duplication failed it + * is the client's responsibility to cleanup any + * partial duplication + */ +static Boolean_t StringListItemDuplicator(void *TargetItemRef, + void *SourceItemRef, + ArbParam_t ClientData) +{ + Boolean_t IsOk = TRUE; + char **TargetStringRef = (char **)TargetItemRef; + char **SourceStringRef = (char **)SourceItemRef; + + REQUIRE(VALID_REF(TargetStringRef)); + REQUIRE(VALID_REF(SourceStringRef)); + REQUIRE(VALID_REF(*SourceStringRef) || *SourceStringRef == NULL); + + if (*SourceStringRef != NULL) + IsOk = ((*TargetStringRef = DupString(dontTranslate(*SourceStringRef))) != NULL); + else + *TargetStringRef = NULL; + + ENSURE(VALID_REF(*TargetStringRef) || *TargetStringRef == NULL); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} + + +/* + * Determine if the string list handle and its members are sane. + */ +Boolean_t StringListValid(StringList_pa stringList) +{ + Boolean_t isValid = ArrayListIsValid((ArrayList_pa)stringList); + + if (isValid) + { + LgIndex_t stringCount = ArrayListGetCount((ArrayList_pa)stringList); + +#if defined PERFORM_EXPENSIVE_STRLIST_TESTS + { + for (LgIndex_t index = 0; index < stringCount; index++) + { + char *string = ArrayListGetCharPtr((ArrayList_pa)stringList, index); + if (string != NULL && !VALID_REF(string)) + { + isValid = FALSE; + break; + } + } +#else + { + /* Check first and last only */ + if (stringCount > 0) + { + char *string = ArrayListGetCharPtr((ArrayList_pa)stringList, 0); + if (string != NULL && !VALID_REF(string)) + { + isValid = FALSE; + } + } + if (isValid && stringCount > 1) + { + char *string = ArrayListGetCharPtr((ArrayList_pa)stringList, stringCount - 1); + if (string != NULL && !VALID_REF(string)) + { + isValid = FALSE; + } + } + } +#endif /* PERFORM_SKIP_EXPENSIVE_STRLIST_TESTS */ + } + + ENSURE(VALID_BOOLEAN(isValid)); + return isValid; + } + + + /* + * Remove all members of the string list. + */ + void StringListClear(StringList_pa StringList) + { + REQUIRE(StringListValid(StringList)); + + ArrayListDeleteAllItems((ArrayList_pa)StringList, StringListItemDestructor, 0); + + ENSURE(StringListValid(StringList) && StringListCount(StringList) == 0); + } + + + /* + * Remove 'Count' strings from the list beginning at the specified offset. + * The members following the items removed are shifted down accordingly to + * fill the vacated space. + */ + void StringListRemoveStrings(StringList_pa StringList, + LgIndex_t StringOffset, + LgIndex_t Count) + { + REQUIRE(StringListValid(StringList)); + REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1); + REQUIRE(1 <= Count && StringOffset + Count <= StringListCount(StringList)); + + ArrayListDeleteItems((ArrayList_pa)StringList, StringOffset, Count, + StringListItemDestructor, 0); + + ENSURE(StringListValid(StringList)); + } + + + /* + * Remove the string from the list at the specified offset. The members + * following the item removed are shifted down accordingly to fill the + * vacated space. + */ + void StringListRemoveString(StringList_pa StringList, + LgIndex_t StringOffset) + { + REQUIRE(StringListValid(StringList)); + REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1); + + ArrayListDeleteItems((ArrayList_pa)StringList, StringOffset, 1, + StringListItemDestructor, 0); + + ENSURE(StringListValid(StringList)); + } + + + /* + * Deallocate the string list members and handle and set the handle to NULL. + */ + void LIBCALL StringListDealloc(StringList_pa *StringList) + { + REQUIRE(VALID_REF(StringList)); + REQUIRE(*StringList == NULL || StringListValid(*StringList)); + + if (*StringList != NULL) + ArrayListDealloc((ArrayList_pa *)StringList, StringListItemDestructor, 0); + + ENSURE(*StringList == NULL); + } + + + /* + * Allocate a string list handle. A handle of NULL is + * returned if sufficient memory is not available. + */ + StringList_pa StringListAlloc(void) + { + StringList_pa Result; + + Result = (StringList_pa)ArrayListAlloc(0, ArrayListType_CharPtr, NULL, 0); + + ENSURE(Result == NULL || StringListValid(Result)); + return Result; + } + + + /* + * Append a copy of the string to the string list. The string list will be + * expanded to accommodate the additional item. A return value of TRUE + * indicates the operation was successful otherwise FALSE is returned + * indicating that sufficient memory was not available for the additional + * item. + */ + Boolean_t StringListAppendString(StringList_pa StringList, + const char *String) + { + Boolean_t IsOk; + + REQUIRE(StringListValid(StringList)); + REQUIRE(String == NULL || VALID_REF(String)); + + IsOk = StringListSetString(StringList, StringListCount(StringList), String); + + ENSURE(StringListValid(StringList)); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; + } + + + /* + * Return the number of strings currently in the string list. + */ + LgIndex_t LIBCALL StringListCount(StringList_pa StringList) + { + LgIndex_t Result; + + REQUIRE(StringListValid(StringList)); + + Result = ArrayListGetCount((ArrayList_pa)StringList); + + ENSURE(Result >= 0); + return Result; + } + + + /* + * Return a copy of the string at the specified offset in the string list. + */ + char * LIBCALL StringListGetString(StringList_pa StringList, + LgIndex_t StringOffset) + { + char *Result; + const char *StringRef; + + REQUIRE(StringListValid(StringList)); + REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1); + + StringRef = StringListGetStringRef(StringList, StringOffset); + if (StringRef == NULL) + Result = NULL; + else + Result = DupString(dontTranslate(StringRef)); + + ENSURE(Result == NULL || VALID_REF(Result)); + return Result; + } + + +#if !defined USE_MACROS_FOR_FUNCTIONS + /* + * Returns actual string at the specified offset in the string list. Do not + * attempt to free this string. Changing this string should be done with + * utmost caution. + */ + const char *StringListGetStringRef_FUNC(StringList_pa StringList, + LgIndex_t StringOffset) + { + const char *Result; + + REQUIRE(StringListValid(StringList)); + REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1); + + Result = StringListGetStringRef_MACRO(StringList, StringOffset); + + ENSURE(Result == NULL || VALID_REF(Result)); + return Result; + } +#endif + + + /* + * Place a copy of the specified string at the specified offset. If the offset + * is beyond the end of the string list it is sized accordingly and the + * intervening string references between the last item of the original + * state and the last item of the new state are assigned NULL. If a string + * already exists at the specified location its resources are released. + * A return value of TRUE indicates the operation was successful otherwise + * FALSE is returned indicating that sufficient memory was not available + * for the additional item at the specified offset. + */ + Boolean_t StringListSetString(StringList_pa StringList, + LgIndex_t StringOffset, + const char *String) + { + Boolean_t IsOk; + ArrayListItem_u ItemCopy; + + REQUIRE(StringListValid(StringList)); + REQUIRE(StringOffset >= 0); + REQUIRE(String == NULL || VALID_REF(String)); + + if (String != NULL) + { + ItemCopy.CharPtr = DupString(dontTranslate(String)); + IsOk = (ItemCopy.CharPtr != NULL); + } + else + { + ItemCopy.CharPtr = NULL; + IsOk = TRUE; + } + + if (IsOk) + IsOk = ArrayListSetItem((ArrayList_pa)StringList, StringOffset, ItemCopy, + StringListItemDestructor, 0); + + ENSURE(StringListValid(StringList)); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; + } + + + /* + * Insert a copy of the string into the string list at the specified offset. + * The string list will be expanded to accommodate the additional item. + * A return value of TRUE indicates the operation was successful otherwise + * FALSE is returned indicating that sufficient memory was not available + * for the additional item. + */ + Boolean_t StringListInsertString(StringList_pa StringList, + LgIndex_t StringOffset, + const char *String) + { + Boolean_t IsOk; + ArrayListItem_u ItemCopy; + + REQUIRE(StringListValid(StringList)); + REQUIRE(StringOffset >= 0); + REQUIRE(String == NULL || VALID_REF(String)); + + if (String != NULL) + { + ItemCopy.CharPtr = DupString(dontTranslate(String)); + IsOk = (ItemCopy.CharPtr != NULL); + } + else + { + ItemCopy.CharPtr = NULL; + IsOk = TRUE; + } + + if (IsOk) + IsOk = ArrayListInsertItem( + (ArrayList_pa)StringList, StringOffset, ItemCopy); + + ENSURE(StringListValid(StringList)); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; + } + + + /* + * Return a handle to a duplicate of the specified string list and its contents. + * A handle of NULL is returned if sufficient memory is not available. + */ + StringList_pa StringListCopy(StringList_pa StringList) + { + StringList_pa Result; + + REQUIRE(StringListValid(StringList)); + + Result = (StringList_pa)ArrayListCopy((ArrayList_pa)StringList, + StringListItemDuplicator, 0); + + ENSURE(Result == NULL || + (StringListValid(Result) && + StringListCount(Result) == StringListCount(StringList))); + return Result; + } + + + + /* + * Append a copy of the contents of the source list to the target list. + * A return value of TRUE indicates the operation was successful otherwise + * FALSE is returned indicating that sufficient memory was not available + * for the request. + */ + Boolean_t StringListAppend(StringList_pa Target, + StringList_pa Source) + { + Boolean_t IsOk; + StringList_pa SourceCopy; + + REQUIRE(StringListValid(Target)); + REQUIRE(StringListValid(Source)); + + SourceCopy = StringListCopy(Source); + IsOk = (SourceCopy != NULL); + if (IsOk) + { + ArrayListAppend((ArrayList_pa)Target, (ArrayList_pa)SourceCopy); + /* deallocate the list but not the string items since Target now owns them */ + ArrayListDealloc((ArrayList_pa *)(void *)&SourceCopy, NULL, 0); + } + + ENSURE(StringListValid(Target)); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; + } + + + + /* + * Return a new line, '\n', separated string representation of the string list. + * Caller is responsible for de-allocating the result. + */ + char *StringListToNLString(StringList_pa StringList) + { + char *Result; + int Count; + size_t Length = 0; + + REQUIRE(StringListValid(StringList)); + + /* determine the resulting new line, '\n', separated string length */ + Count = StringListCount(StringList); + if (Count >= 1) + { + int Index; + for (Index = 0, Length = strlen("\n") * (Count - 1); + Index < Count; + Index++) + { + char *String = ArrayListGetCharPtr((ArrayList_pa)StringList, Index); + if (String != NULL) + Length += strlen(String); + } + } + + /* create a new line, '\n', separated string */ + Result = ALLOC_ARRAY(Length + 1, char, "new line separated string"); + if (Result != NULL) + { + int Index; + for (Index = 0, strcpy(Result, ""); + Index < Count; + Index++) + { + char *String = ArrayListGetCharPtr( + (ArrayList_pa)StringList, Index); + + if (Index != 0) + strcat(Result, "\n"); + + if (String != NULL) + strcat(Result, String); + } + } + + ENSURE(Result == NULL || VALID_REF(Result)); + return Result; + } + + + /* + * Create a string list from the new line, '\n', separated string. The string + * is copied and therefore owned and managed by the caller. + */ + StringList_pa StringListFromNLString(const char *String) + { + StringList_pa Result; + LgIndex_t StartIndex; + LgIndex_t EndIndex; + + REQUIRE(VALID_REF(String)); + + /* create the string list and scan the entire string */ + Result = StringListAlloc(); + for (StartIndex = EndIndex = 0; Result != NULL; EndIndex++) + { + /* end of sub-string ? */ + if (String[EndIndex] == '\n' || String[EndIndex] == '\0') + { + /* extract the sub-string and append it to the string list */ + LgIndex_t Length = EndIndex - StartIndex; + char *SubString = ALLOC_ARRAY(Length + 1, char, "sub string"); + if (SubString != NULL) + { + CopySubString(SubString, String, StartIndex, Length); + StringListAppendString(Result, SubString); + + FREE_ARRAY(SubString, "sub string"); + + if (String[EndIndex] != '\0') + StartIndex = EndIndex + 1; + else + break; /* nothing left to scan */ + } + else + { + /* memory allocation failure: bail out */ + StringListDealloc(&Result); + Result = NULL; + break; + } + } + } + + ENSURE(Result == NULL || StringListValid(Result)); + return Result; + } + + + /* + * Return a 'C' string array representation of the string list. + * Caller is responsible for de-allocating the result. + */ + char **StringListToArray(StringList_pa StringList) + { + char **Result; + + REQUIRE(StringListValid(StringList)); + + Result = (char **)ArrayListToArray((ArrayList_pa)StringList, + StringListItemDuplicator, 0); + + ENSURE(Result == NULL || VALID_REF(Result)); + return Result; + } + + + + /* + * Create a string list from the 'C' string array. The string array + * is copied and therefore owned and managed by the caller. + */ + StringList_pa StringListFromArray(const char **StringArray, + LgIndex_t Count) + { + StringList_pa Result; + + REQUIRE((Count == 0 && StringArray == NULL) || + (Count >= 1 && VALID_REF(StringArray))); + + Result = (StringList_pa)ArrayListFromArray((void *)StringArray, + Count, ArrayListType_CharPtr, + StringListItemDuplicator, 0); + + ENSURE(Result == NULL || StringListValid(Result)); + return Result; + } + + + +#define ISJOINCHAR(c) ((c == ';') || (c == '+')) + + static void SkipWhiteSpaceOrComma(const char **CPtr) + { + REQUIRE(VALID_REF(CPtr) && VALID_REF(*CPtr)); + while (ISWHITESPACE(**CPtr) || (**CPtr == ',')) + (*CPtr)++; + } + + /* + * Obtain the next sub-string. This can be of the form: + * + * [del]any-character-sequence[del] + * + * or + * + * limited-character-sequence + * + * where a limited-character-sequence cannot contain + * any of the following characters: +;,<space> + * + */ + static Boolean_t GetNextSubString(const char **OriginalCPtr, + char **NextSubString) + { + Boolean_t IsOk = TRUE; + const char *CStart; + const char *CPtr; + char InsideDelimiter = '\0'; + + REQUIRE(VALID_REF(OriginalCPtr) && (VALID_REF(*OriginalCPtr))); + REQUIRE(VALID_REF(NextSubString)); + + *NextSubString = NULL; + + CPtr = *OriginalCPtr; + SkipWhiteSpaceOrComma(&CPtr); + + if (*CPtr == '"' || *CPtr == '\'') + { + InsideDelimiter = *CPtr; + CPtr++; + } + + CStart = CPtr; + + while (*CPtr && + ((InsideDelimiter && (*CPtr != InsideDelimiter)) || + (!InsideDelimiter && (*CPtr != ',') && + !ISJOINCHAR(*CPtr) && + !ISWHITESPACE(*CPtr)))) + { + if (InsideDelimiter && + (*CPtr == '\\') && + (*(CPtr + 1) == InsideDelimiter)) + CPtr += 2; + else + CPtr++; + } + + if (InsideDelimiter && (*CPtr != InsideDelimiter)) + IsOk = FALSE; + + + if (IsOk && CStart < CPtr) + { + size_t StrLen = (size_t)(CPtr - CStart); + *NextSubString = ALLOC_ARRAY(StrLen + 1, char, "GetNextSubString: NextSubString"); + if (*NextSubString) + { + char *NPtr = *NextSubString; + /* + * Don't just copy the string because escaped delimiters need to have + * the escape removed... + */ + while (CStart < CPtr) + { + if ((*CStart == '\\') && (*(CStart + 1) == InsideDelimiter)) + CStart++; + *NPtr++ = *CStart++; + } + *NPtr = '\0'; + } + else + IsOk = FALSE; + } + + if (IsOk) + { + if (InsideDelimiter) + CPtr++; + SkipWhiteSpaceOrComma(&CPtr); + *OriginalCPtr = CPtr; + } + + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; + } + + + + + /* + * Return a string list representation of a compound string. + * + * The compound String parameter has the following form: + * + * [del]<character-sequence>[del] [GroupJoinCharacter] [del]<character-sequence>[del] [GroupJoinCharacter] ..... + * or + * <nospace-character-sequence> <nospace-character-sequence> ... + * + * where: + * [del] is an optional single quote or a double quote. [del] must be used + * if <character-sequence> contains spaces, commas, or the plus symbol. + * + * GroupJoinCharacter can be either a "+" or a ";" + * + * The GroupJoinCharacter symbol is used to separate character sequences that + * are to be grouped together. If the GroupJoinCharacter symbol is omitted then + * a new group is started. + * + * Internally, the original string is converted to a list of strings where + * each string uses newlines to separate one sub-string from the next. + */ + StringList_pa StringListFromCompound(const char *String) + { + const char *CPtr; + StringList_pa Result; + Boolean_t IsOk = TRUE; + char *CurString = NULL; + + REQUIRE(VALID_REF(String)); + SkipWhiteSpaceOrComma(&String); + REQUIRE(!ISJOINCHAR(*String)); + + /* extract character sequences */ + Result = StringListAlloc(); + CPtr = String; + + while (IsOk && *CPtr != '\0') + { + char *NextSubString = NULL; + Boolean_t WantsToJoin = FALSE; + + if (ISJOINCHAR(*CPtr)) + { + WantsToJoin = TRUE; + CPtr++; + SkipWhiteSpaceOrComma(&CPtr); + } + + IsOk = GetNextSubString(&CPtr, + &NextSubString); + + if (IsOk) + { + /* + * Tack on the sub-string to the running string. + */ + if (WantsToJoin) + TackOnChar(&CurString, '\n'); + if (NextSubString != NULL && strlen(NextSubString) != 0) + IsOk = TackOnString(&CurString, NextSubString, FALSE, FALSE); + else if (CurString == NULL) + CurString = DupString(dontTranslate("")); + } + + if (NextSubString != NULL) + FREE_ARRAY(NextSubString, "StringListFromCompound: NextSubString"); + + /* + * If this is the end of processing or if the next character is + * not a join character then add the current string to the stringlist. + */ + + if (IsOk && !ISJOINCHAR(*CPtr)) + { + StringListAppendString(Result, CurString); + if (CurString != NULL) + FREE_ARRAY(CurString, "current string"); + CurString = NULL; + } + } + + if (CurString != NULL) + FREE_ARRAY(CurString, "current string"); + + if (!IsOk) + StringListDealloc(&Result); + + ENSURE(Result == NULL || StringListValid(Result)); + return Result; + } + + + /* + * Return a compound string representation of a string list. + * + * One common usage in Tecplot: + * The $!OpenLayout command in tecplot has the sub-option + * ALTDATALOADINSTRUCTIONS that has the form: + * '"instr-string1" [GroupJoinCharacter] "instr-string2" [+] ...' + */ + char *StringListToCompound(StringList_pa StringList, + char GroupJoinCharacter, + const char *CharsToEscape) + { + Boolean_t IsOk = TRUE; + LgIndex_t Index; + LgIndex_t Count; + char *Result = NULL; + + REQUIRE(StringListValid(StringList)); + REQUIRE(StringListCount(StringList) >= 1); + REQUIRE(ISJOINCHAR(GroupJoinCharacter)); + REQUIRE(VALID_REF(CharsToEscape)); + + for (Index = 0, Count = StringListCount(StringList), IsOk = TRUE; + Index < Count && IsOk; + Index++) + { + char *String = StringListGetString(StringList, Index); + + if (String != NULL && strlen(String) != 0) + { + char *CStart = NULL; + char *CEnd = NULL; + char *EscapedString = NULL; + const char *EscChar = NULL; + char *StrChar = NULL; + + /* First scan the string and escape any specified characters. */ + /* Note that the Escape sequence is a double backslash because */ + /* it the first escape escapes the escape for variable usage. */ + for (StrChar = String; *StrChar != '\0'; StrChar++) + { + for (EscChar = CharsToEscape; *EscChar != '\0'; EscChar++) + if (*StrChar == *EscChar) + { + IsOk = TackOnChar(&EscapedString, '\\'); + IsOk = TackOnChar(&EscapedString, '\\'); + break; + } + IsOk = TackOnChar(&EscapedString, *StrChar); + } + + CEnd = EscapedString; + while (IsOk && *CEnd != '\0') + { + int Len = 0; + char *TString; + + CStart = CEnd; + while (*CEnd != '\0' && *CEnd != '\n') + { + Len++; + if (*CEnd == '"') + Len++; + CEnd++; + } + + TString = ALLOC_ARRAY(Len + 4, char, "temp compound sub-string"); + if (TString != NULL) + { + char *TStr; + + /* prepend the new string with either */ + /* a space character or the plus symbol */ + if (CStart == EscapedString) + { + if (Index != 0) + IsOk = TackOnChar(&Result, ' '); + } + else + { + IsOk = TackOnChar(&Result, GroupJoinCharacter); + } + + /* stuff TString and append the new string */ + TStr = TString; + *TStr++ = '"'; + while (CStart != CEnd) + { + if (*CStart == '"') + *TStr++ = '\\'; + *TStr++ = *CStart++; + } + *TStr++ = '"'; + *TStr = '\0'; + + TackOnString(&Result, TString, FALSE, FALSE); + FREE_ARRAY(TString, "StringListToCompound"); + TString = NULL; + if (*CEnd) + CEnd++; + } + else + { + IsOk = FALSE; + } + } + + if (EscapedString != NULL) + FREE_ARRAY(EscapedString, "escaped string"); + } + else + { + /* a null pointer or length of zero indicates an empty sub-string */ + if (Index == 0) + TackOnString(&Result, "\"\"", FALSE, FALSE); + else + TackOnString(&Result, " \"\"", FALSE, FALSE); + } + + if (String != NULL) + FREE_ARRAY(String, "string list item"); + } + + if (!IsOk) + { + if (Result != NULL) + { + FREE_ARRAY(Result, "StringListToCompound"); + Result = NULL; + } + } + + ENSURE(Result == NULL || VALID_REF(Result)); + return Result; + } + + + /** + * Holds the comparator function pointer. + */ + static StringListStringComparator_pf ComparatorFunction = NULL; + + + /** + * Forwards the comparison test to the 'Comparator' supplied to the + * 'StringListSort' function. + * + * param Item1 + * Item to compare against Item2. + * param Item2 + * Item to compare against Item1. + * param ClientData + * Contextual information that was passed to the 'ArrayListQSort' function. + * + * return + * -1: if Item1 is less than Item2 + * 0: if Item1 is equal to Item2 + * 1: if Item1 is greater than Item2 + */ + static int STDCALL ComparatorProxy(ArrayListItem_u Item1, + ArrayListItem_u Item2, + ArbParam_t ClientData) + { + /* forward the request */ + return ComparatorFunction(Item1.CharPtr, Item2.CharPtr, ClientData); + } + + + /** + * Compares two strings from a list string. Note that either string may be + * NULL as StringLists allow for NULL elements. + * + * param String1 + * String to compare against String2. + * param String2 + * String to compare against String1. + * param ClientData + * Contextual information that was passed to the 'StringListSort' function. + * + * return + * - A value less than zero if String1 is less than String2. + * - A value of zero if String1 is equal to String2. + * - A value greater than zero if String1 is greater than String2. + */ + static int STDCALL DefaultStrcmpComparator(const char *String1, + const char *String2, + ArbParam_t ClientData) + { + int Result = 0; /* ...quite compiler */ + + REQUIRE(VALID_REF(String1) || String1 == NULL); + REQUIRE(VALID_REF(String2) || String2 == NULL); + + if (String1 != NULL && String2 != NULL) + { + Result = strcmp(String1, String2); + if (Result < 0) + Result = -1; + else if (Result > 0) + Result = 1; + } + else if (String1 == NULL && String2 == NULL) + Result = 0; + else if (String1 == NULL) + Result = -1; + else if (String2 == NULL) + Result = 1; + else + CHECK(FALSE); + + ENSURE((Result == -1) || (Result == 0) || (Result == 1)); + return Result; + } + + /** + * Sorts the string list by repeatedly calling the 'Comparator' function until + * the list is in order. + * + * param StringList + * String list to sort. + * param Comparator + * Function called to compare two string list strings or NULL for the + * default sort. The default sorting handles NULL elements and uses the + * system's strcmp utility for comparing valid strings elements. + * param ClientData + * Contextual information that is passed along to the comparator function. + */ + void StringListSort(StringList_pa StringList, + StringListStringComparator_pf Comparator, + ArbParam_t ClientData) + { +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + REQUIRE(VALID_REF(StringList)); + REQUIRE(VALID_FN_REF(Comparator) || Comparator == NULL); + + /* set up for comparator proxy */ + if (Comparator != NULL) + ComparatorFunction = Comparator; + else + ComparatorFunction = DefaultStrcmpComparator; + + /* sort the array using the comparator proxy to forward */ + /* the comparison request to the supplied comparator */ + ArrayListQSort((ArrayList_pa)StringList, ComparatorProxy, ClientData); + + /* cleanup */ + ComparatorFunction = NULL; + } diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/strutil.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/strutil.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9611722224db84ca7d0600cb9c52b007f35a2897 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/strutil.cpp @@ -0,0 +1,936 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +#define STRUTILMODULE +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +#include "ARRLIST.h" +#include "STRLIST.h" +#include "STRUTIL.h" +#include "ALLOC.h" + +#include "Q_MSG.h" + +#include <algorithm> +#include <cctype> // ...needed to find std::tolower and std::toupper +#include <limits.h> +#include "TranslatedString.h" +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +using namespace std; +using namespace tecplot::strutil; + +#ifdef MSWIN +# pragma warning (disable : 4786) /* STL warning about trucated identifiers */ +#endif + +/* END HEADER */ + +/** + */ +#define INITIAL_FORMAT_BUFFER_SIZE 16384*3 +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +static char *FormatStringBuffer = NULL; +static int FormatStringBufferSize = INITIAL_FORMAT_BUFFER_SIZE; + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined MSWIN +#else +#endif /* !MSWIN */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +/** + * This should be one of the last functions called by Tecplot while mopping up. + */ +void FormatStringBufferCleanup(void) +{ + /* + * NOTE: We use free instead of FREE_ARRAY for the scratch buffer because in + * debug mode FREE_ARRAY uses ErrMsg which uses vFormatString causing + * infinite recursion. + */ + if (FormatStringBuffer != NULL) + free(FormatStringBuffer); + FormatStringBuffer = NULL; +} + +/** + */ +char *vFormatString(const char *Format, + va_list Arguments) +{ + char *Result = NULL; + + REQUIRE(VALID_REF(Format)); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + /* + * NOTE: We use malloc instead of ALLOC_ARRAY for the scratch buffer because + * in debug mode ALLOC_ARRAY uses ErrMsg which uses vFormatString + * causing infinite recursion. + */ + if (FormatStringBuffer == NULL) + FormatStringBuffer = (char *)malloc(FormatStringBufferSize); + + if (FormatStringBuffer != NULL) + { + Boolean_t TryAgain = FALSE; + do + { + /* + * Assign a value other than '\0' to the end of the buffer so that we + * can determine if the buffer needs to be expanded. If after we call + * vsnprintf the end of the buffer has a '\0' we need to expand it. + */ + FormatStringBuffer[FormatStringBufferSize - 1] = (char)!'\0'; + +# if defined MSWIN + memset(FormatStringBuffer, 0, FormatStringBufferSize - 1); + + TryAgain = + _vsnprintf(FormatStringBuffer, + FormatStringBufferSize, + Format, + Arguments) == -1; +# elif defined IRIX62 + vsprintf(FormatStringBuffer, + Format, + Arguments); + CHECK(strlen(FormatStringBuffer) < FormatStringBufferSize); +# else + vsnprintf(FormatStringBuffer, + FormatStringBufferSize, + Format, + Arguments); +# endif + +#ifndef MSWIN + TryAgain = (FormatStringBuffer[FormatStringBufferSize - 1] == '\0'); +#endif + if (TryAgain) + { + /* + * Reallocate the buffer and try again. + * + * NOTE: We use malloc/free instead of ALLOC/FREE_ARRAY for the + * scratch buffer because in debug mode ALLOC/FREE_ARRAY + * uses ErrMsg which uses vFormatString causing infinite + * recursion. + */ + free(FormatStringBuffer); + FormatStringBufferSize += MAX(1, FormatStringBufferSize / 2); + FormatStringBuffer = (char *)malloc(FormatStringBufferSize); + TryAgain = (FormatStringBuffer != NULL); + if (!TryAgain) + FormatStringBufferSize = INITIAL_FORMAT_BUFFER_SIZE; + } + } + while (TryAgain); + + if (FormatStringBuffer != NULL) + Result = DupString(dontTranslate(FormatStringBuffer)); + } + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + ENSURE(VALID_REF(Result) || Result == NULL); + return Result; +} + +/** + */ +char *FormatString(TranslatedString Format, + ...) /* 0 or more variable arguments */ +{ + REQUIRE(!Format.isNull()); + + va_list Arguments; + va_start(Arguments, Format); + char *Result = vFormatString(Format.c_str(), Arguments); + va_end(Arguments); + + ENSURE(VALID_REF(Result) || Result == NULL); + return Result; +} + +/** + */ +int FormatString(string& Buffer, + TranslatedString Format + ...) /* 0 or more variable arguments */ +{ + REQUIRE(!Format.isNull()); + + va_list Arguments; + va_start(Arguments, Format); + char *FormattedString = vFormatString(Format.c_str(), Arguments); + va_end(Arguments); + + int Result; + if (FormattedString != NULL) + { + Buffer.assign(FormattedString); + Result = (int)Buffer.size(); + FREE_ARRAY(FormattedString, "FormattedString"); + } + else + Result = -1; + + + ENSURE(Result == -1 || Result >= 0); + return Result; +} + +/** + * Returns a duplicate of the string or NULL if sufficient memory is not + * available. + * + * NOTE: This function was created because ResetString(...) does not + * duplicate zero length strings but returns NULL instead. + */ +char *DupString(TranslatedString String) +{ + REQUIRE(VALID_TRANSLATED_STRING(String)); + + char *Result = ALLOC_ARRAY(strlen(String.c_str()) + 1, char, "duplicate string"); + if (Result != NULL) + strcpy(Result, String.c_str()); + + ENSURE(Result == NULL || (VALID_REF(Result) && strcmp(Result, String.c_str()) == 0)); + return Result; +} + + +/* + * Copy up to 'Count' characters from the 'Source' string beginning at + * position 'Index' to the 'Target' string. The actual number of characters + * copied may be less than 'Count' if a '\0' was encountered in the + * 'Source' string before 'Count' characters were copied. + * + * NOTE: The 'Target' and 'Source' strings may overlap. + */ +void CopySubString(char *Target, + const char *Source, + int Index, + int Count) +{ + LgIndex_t Length = 0; + + REQUIRE(VALID_REF(Target)); + REQUIRE("Target string is sized to accommodate a string who's length " + "is at least MIN(strlen(&Source[Index]), Count) characters."); + REQUIRE(VALID_REF(Source)); + REQUIRE(0 <= Index && Index <= (LgIndex_t)strlen(Source)); + REQUIRE(Count >= 0); + + Length = MIN((LgIndex_t)strlen(&Source[Index]), Count); + memmove(Target, &Source[Index], Length); + Target[Length] = '\0'; + + ENSURE(VALID_REF(Target) && (LgIndex_t)strlen(Target) == Length); +} + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + +/* + * Remove any leading white space from the string and return + * a reference to it. NOTE: The input string is modified. + */ +char *StringFlushLeft(char *String) +{ + char *Result = String; + char *Start = String; + + REQUIRE(VALID_REF(String)); + + /* move the substring beginning at the first non-whitespace */ + /* character to the head of the string */ + while (isspace(*Start)) + Start++; + if (Start != String) + memmove(String, Start, strlen(Start) + 1); + + ENSURE(VALID_REF(Result) && Result == String); + return Result; +} + + +/* + * Remove any trailing white space from the string and return + * a reference to it. NOTE: The input string is modified. + */ +static char *StringFlushRight(char *String) +{ + char *Result = String; + char *End = NULL; + + REQUIRE(VALID_REF(String)); + + for (End = EndOfString(String); End != String && isspace(End[-1]); End--) + End[-1] = '\0'; + + ENSURE(VALID_REF(Result) && Result == String); + return Result; +} + + +/* + * Remove any leading and trailing white space from the string + * and return a reference to it. The return value is not + * absolutely necessary since the input string is modified + * but it is convenient sometimes. + * NOTE: The input string is modified but no memory is + * allocated nor deallocated. + */ +char *TrimLeadAndTrailSpaces(char *String) +{ + REQUIRE((String == NULL) || VALID_REF(String)); + if (String) + return (StringFlushLeft(StringFlushRight(String))); + else + return String; +} + + +/* + * If the specified string is longer than the maximum specified length + * truncate it and return a reference to it. + * + * String + * String to truncate if necessary. + * MaxLength + * Length at which to truncate the specified string if exceeded. + * + * Return + * Reference to the input string. + */ + +// Okay for UTF-8 +char *StringTruncate(char *String, + LgIndex_t MaxLength) +{ + REQUIRE(VALID_REF(String)); + REQUIRE(MaxLength >= 0); + + if ((LgIndex_t)strlen(String) > MaxLength) + String[MaxLength] = '\0';/* UTF8_SetAt(String,'\0',MaxLength); */ + + ENSURE(VALID_REF(String)); + ENSURE((LgIndex_t)strlen(String) <= MaxLength); + return String; +} + + +/* + * Trim and truncate the specified string such that its trimmed length + * does not exceed the specified length and return a reference to it. + * + * String + * String to trim and truncate if necessary. + * MaxLength + * Length at which to truncate the trimmed string if exceeded. + * + * Return + * Reference to the input string. + */ +char *StringTrimAndTruncate(char *String, + LgIndex_t MaxLength) +{ + REQUIRE(VALID_REF(String)); + REQUIRE(MaxLength >= 0); + + TrimLeadAndTrailSpaces(String); + StringTruncate(String, MaxLength); + + ENSURE(VALID_REF(String)); + ENSURE((LgIndex_t)strlen(String) <= MaxLength); + return String; +} + +/** + */ + +#ifndef MSWIN +StringList_pa LineBreakString(const char *String, + UInt32_t WrapMargin) +{ + REQUIRE(VALID_REF(String)); + + StringList_pa Result = StringListAlloc(); + if (Result != NULL) + { + Boolean_t IsOk = TRUE; + if (strlen(String) > WrapMargin) + { + char *StringCopy = DupString(dontTranslate(String)); + IsOk = (StringCopy != NULL); + if (IsOk) + { + char *CPtr = StringCopy; + char *SubString = StringCopy; + UInt32_t SubStringLen = 0; + while (*CPtr != '\0' && IsOk) + { + while (*CPtr != '\0' && SubStringLen < WrapMargin) + { + /* look for a hard break */ + if (*CPtr == '\n') + { + *CPtr = '\0'; /* replace the newline */ + CPtr++; + break; + } + + CPtr++; + SubStringLen++; + } + + /* + * If we didn't find a hard break or the end of the string + * then we need to back up and find the closest space. + */ + if (*CPtr != '\0' && SubStringLen == WrapMargin) + { + /* find the closes space from the right */ + if (*CPtr != ' ') + { + while (CPtr != SubString && *CPtr != ' ') + CPtr--; + if (*CPtr != ' ') + { + /* + * Bummer, this line will exceed the wrap margin. + * Search forward for the next space or newline. + */ + while (*CPtr != '\0' && *CPtr != ' ' && *CPtr != '\n') + CPtr++; + while (*CPtr != '\0' && *CPtr == ' ') + CPtr++; /* skip over the white space */ + } + } + + if (*CPtr != '\0') + { + *CPtr = '\0'; + CPtr++; + } + StringFlushRight(SubString); + } + + IsOk = StringListAppendString(Result, SubString); + SubString = CPtr; + SubStringLen = 0; + } + + FREE_ARRAY(StringCopy, "StringCopy"); + } + } + else + IsOk = StringListAppendString(Result, String); + + if (!IsOk) + StringListDealloc(&Result); + } + + ENSURE(Result == NULL || VALID_REF(Result)); + return Result; +} +#endif + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /* TECPLOTKERNEL */ + + +/** + * Lexicographically compares, at most, the first 'Len' characters of + * s1 and s2. + * + * param s1 + * First string or NULL. + * param s2 + * Second string or NULL. + * param Len + * Maximum number of characters to compare. + * return + * Integer value greater than, equal to, or less than zero according + * to whether the first 'Len' characters of 's1' are greater than, + * equal to, or less than 's2'. + */ + +// Okay for UTF-8 +int ustrncmp(const char *s1, + const char *s2, + size_t Len) +{ + REQUIRE((s1 == NULL) || VALID_REF(s1)); + REQUIRE((s2 == NULL) || VALID_REF(s2)); + REQUIRE(Len >= 0); + + char *t1; + char *t2; + char ct1; + char ct2; + size_t I = 0; + if ((s1 == NULL) && (s2 == NULL)) + return 0; + if (s1 == NULL) + return -1; + else if (s2 == NULL) + return 1; + + t1 = (char*)s1; + t2 = (char*)s2; + + while (*t1 && *t2 && (I < Len)) + { + ct1 = CAPITAL(*t1); + ct2 = CAPITAL(*t2); + if (ct1 != ct2) + return (ct1 - ct2); + t1++; + t2++; + I++; + } + if ((I == Len) || + ((*t1 == '\0') && (*t2 == '\0'))) + return 0; + else + return CAPITAL(*t1) - CAPITAL(*t2); + + +} + + +/** + * Lexicographically compares the characters of s1 and s2. + * + * param s1 + * First string or NULL. + * param s2 + * Second string or NULL. + * return + * Integer value greater than, equal to, or less than zero according to + * whether the characters of 's1' are greater than, equal to, or less + * than 's2'. + */ +int ustrcmp(const char *s1, + const char *s2) +{ + REQUIRE((s1 == NULL) || VALID_REF(s1)); + REQUIRE((s2 == NULL) || VALID_REF(s2)); + + return (ustrncmp(s1, s2, INT_MAX)); +} + + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if !defined NO_ASSERTS && defined DEBUG_ALLOC +#endif +#endif /* TECPLOTKERNEL */ + + +/* + * The problem with passing file names for release builds is that + * the full path name is used (i.e., c:\user\craig\v7.5\tecplot\alloc.c) + */ + +// Okay for UTF-8 + +#if !defined NO_ASSERTS +Boolean_t InternalResetString(char **SBase, + const char *NewString, + Boolean_t IssueErrMsg, + const char *FileName, + int LineNumber) +#else +Boolean_t InternalResetString(char **SBase, + const char *NewString, + Boolean_t IssueErrMsg) +#endif +{ + REQUIRE(VALID_REF(SBase)); + REQUIRE(*SBase == NULL || VALID_REF(*SBase)); + REQUIRE(NewString == NULL || VALID_REF(NewString)); + REQUIRE(IMPLICATION(VALID_REF(*SBase), *SBase != NewString)); /* Prevent calling with same string. */ + REQUIRE(VALID_BOOLEAN(IssueErrMsg)); + REQUIRE(VALID_NON_ZERO_LEN_STR(FileName)); + REQUIRE(LineNumber >= 1); + + if (*SBase) + { +#if !defined NO_ASSERTS && defined DEBUG_ALLOC + char S[80+1]; + MakeDebugRecord(FileName, LineNumber, "releasing", *SBase, S, 80); + FREE_ARRAY(*SBase, S); +#else + FREE_ARRAY(*SBase, ""); +#endif + } + if (NewString == NULL) + { + *SBase = NULL; + return (TRUE); + } + else + { +#if !defined NO_ASSERTS && defined DEBUG_ALLOC + char S[80+1]; + MakeDebugRecord(FileName, LineNumber, "duplicating", NewString, S, 80); + *SBase = ALLOC_ARRAY(strlen(NewString) + 1, char, S); +#else +# if defined MSWIN && defined _DEBUG && !defined(MAKEARCHIVE) && !defined(NO_ASSERTS) + /* Allow the MFC memory leak detection to report the leak at the + * calling programs location, and not here (which is fairly useless). + * But first, we have to turn off the preprocessor definition of new + * and get to the original. */ +# undef new + *SBase = new(FileName, LineNumber) char[strlen(NewString)+1]; +# define new DEBUG_NEW +# else + *SBase = ALLOC_ARRAY(strlen(NewString) + 1, char, ""); +# endif +#endif + if (*SBase) + { + strcpy(*SBase, NewString); + return (TRUE); + } + else + { + if (IssueErrMsg) + ErrMsg(translate("Out of memory")); + return (FALSE); + } + } +} + + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + + +/* + * Unfortunately, this routine uses the interface of DeleteStringToAdd + * forcing StringToAdd to be non-const. Another copy of this routine + * for const char *'s is below. Eventually we should get rid of + * the two routines and DeleteStringToAdd, always using the const version + * and deleting the string if necessary in the code that calls TackOnString. + */ +Boolean_t TackOnString(char **SBase, + const char *StringToAdd, + Boolean_t DeleteStringToAdd, + Boolean_t ConvertNewlinesToAscii) +{ + size_t CurLen; + size_t NewLen; + int NumNewlines = 0; + char *NewString; + const char *CPtr = StringToAdd; + Boolean_t IsOk = TRUE; + + REQUIRE(VALID_REF(SBase)); + REQUIRE((StringToAdd == NULL) || VALID_REF(StringToAdd)); + REQUIRE(VALID_BOOLEAN(DeleteStringToAdd)); + REQUIRE(VALID_BOOLEAN(ConvertNewlinesToAscii)); + + if ((StringToAdd == NULL) || + (*StringToAdd == '\0')) + { + if (StringToAdd && + (*StringToAdd == '\0') && + DeleteStringToAdd) + { + char *TMP = (char *)StringToAdd; + FREE_ARRAY(TMP, "empty string to add"); + } + } + else + { + + if (*SBase == NULL) + CurLen = 0; + else + CurLen = strlen(*SBase); + + while (*CPtr) + if (*CPtr++ == '\n') + NumNewlines++; + + NewLen = CurLen + strlen(StringToAdd) + 1 + NumNewlines; + + NewString = ALLOC_ARRAY(NewLen, char, StringToAdd); + + if (NewString == NULL) + { + if (DeleteStringToAdd) + { + char *TMP = (char *)StringToAdd; + FREE_ARRAY(TMP, StringToAdd); + } + IsOk = FALSE; + } + else + { + if (*SBase) + { + strcpy(NewString, *SBase); + FREE_ARRAY(*SBase, (CurLen > 0 ? *SBase : "previous text")); + } + else + *NewString = '\0'; + + { + char *NPtr = EndOfString(NewString); + const char *APtr = StringToAdd; + while (*APtr) + { + if ((*APtr == '\n') && ConvertNewlinesToAscii) + { + *NPtr++ = '\\'; + *NPtr++ = 'n'; + } + else + *NPtr++ = *APtr; //UTF8_AssignAndIncrement(&NPtr,(char**)&APtr,TRUE,FALSE); //*NPtr++ = *APtr; + APtr++; + } + *NPtr = '\0'; + } + + if (DeleteStringToAdd) + { + char *TMP = (char *)StringToAdd; + FREE_ARRAY(TMP, StringToAdd); + } + + *SBase = NewString; + } + } + + ENSURE(VALID_BOOLEAN(IsOk)); + return (IsOk); +} + + +/* + * See TackOnString for discussion. + */ + +// Okay for UTF-8 +Boolean_t TackOnConstString(char **SBase, + const char *StringToAdd, + Boolean_t ConvertNewlinesToAscii) +{ + size_t CurLen; + size_t NewLen; + int NumNewlines = 0; + char *NewString; + const char *CPtr = StringToAdd; + Boolean_t IsOk = TRUE; + + REQUIRE(VALID_REF(SBase)); + REQUIRE((StringToAdd == NULL) || VALID_REF(StringToAdd)); + REQUIRE(VALID_BOOLEAN(ConvertNewlinesToAscii)); + + if ((StringToAdd != NULL) && + (*StringToAdd != '\0')) + { + if (*SBase == NULL) + CurLen = 0; + else + CurLen = strlen(*SBase); + + while (*CPtr) + if (*CPtr++ == '\n') + NumNewlines++; + + NewLen = CurLen + strlen(StringToAdd) + 1 + NumNewlines; + + NewString = ALLOC_ARRAY(NewLen, char, StringToAdd); + + if (NewString == NULL) + { + IsOk = FALSE; + } + else + { + if (*SBase) + { + strcpy(NewString, *SBase); + FREE_ARRAY(*SBase, (CurLen > 0 ? *SBase : "previous text")); + } + else + *NewString = '\0'; + + { + char *NPtr = EndOfString(NewString); + const char *APtr = StringToAdd; + while (*APtr) + { + if ((*APtr == '\n') && ConvertNewlinesToAscii) + { + *NPtr++ = '\\'; + *NPtr++ = 'n'; + } + else + *NPtr++ = *APtr; // UTF8_AssignAndIncrement(&NPtr,(char**)&APtr,TRUE,FALSE); + APtr++; + } + *NPtr = '\0'; + } + *SBase = NewString; + } + } + + ENSURE(VALID_BOOLEAN(IsOk)); + return (IsOk); +} + + +// Okay for UTF-8 +Boolean_t TackOnChar(char **SBase, + char CharToAdd) +{ + REQUIRE(VALID_REF(SBase)); + + char S[2]; + S[0] = CharToAdd; + S[1] = '\0'; + + return (TackOnString(SBase, S, FALSE, FALSE)); +} + + + +/** + * Converts all one character new line characters in the allocated string + * to a two character "\n" sequence. + * + * param String + * String to scan and convert if necessary. Note that the string will + * be reallocated if any new line characters are discovered. + * + * return + * TRUE if the request was successfull, FALSE otherwise. + */ + +// Okay for UTF-8 +Boolean_t ReplaceNewlineWithBackslashN(char **String) +{ + size_t I; + LgIndex_t NewlineCount; + size_t Length; + char *Replacement; + + REQUIRE(VALID_REF(String)); + REQUIRE(VALID_REF(*String)); + + /* count how many new line character are present */ + NewlineCount = 0; + Length = strlen(*String); + for (I = 0; I < Length; I++) + if ((*String)[I] == '\n') + NewlineCount++; + + if (NewlineCount != 0) + { + /* allocate a new string and convert */ + Replacement = ALLOC_ARRAY(Length + NewlineCount + 1, char, + "replacement string"); + if (Replacement != NULL) + { + size_t J; + for (I = J = 0; I < Length + 1; I++, J++) + { + if ((*String)[I] == '\n') + { + Replacement[J] = '\\'; + J++; + Replacement[J] = 'n'; + } + else + { + Replacement[J] = (*String)[I]; + } + } + + /* sanity check */ + CHECK(I == Length + 1); + CHECK(J == Length + NewlineCount + 1); + } + + /* release the old string and record the new one */ + FREE_ARRAY(*String, "original string"); + *String = Replacement; + } + + ENSURE(*String == NULL || VALID_REF(*String)); + return (*String != NULL); +} + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined TECPLOTKERNEL +#if !defined NO_ASSERTS +#endif /* !NO_ASSERTS */ +#endif /*TECPLOTKERNEL*/ +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tassert.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tassert.cpp new file mode 100644 index 0000000000000000000000000000000000000000..75b3586225ced6efc6213a1bc82de9fba0043e04 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tassert.cpp @@ -0,0 +1,261 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" +#define TECPLOTENGINEMODULE + +/* +***************************************************************** +***************************************************************** +******* ******** +****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +***************************************************************** +***************************************************************** +*/ + +#define TASSERTMODULE +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined (MSWIN) +#endif +#endif + +#include "STRUTIL.h" + +using namespace tecplot::strutil; +using namespace std; + +#define MAX_ERRMSG_LENGTH 2096 + +/* the mopup from assert and the writing out of crash.lay are */ +/* used by TUASSERT and thus are needed even if NO_ASSERTS */ +/* is set */ +#if !defined NO_TU_ASSERTS || !defined NO_ASSERTS + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined MSWIN /* ...Unix/Linux calls this via signal handlers */ +#endif +#endif /* TECPLOTKERNEL */ + +#endif /* Mopup function needed ... */ + + + +#if !defined STD_ASSERTS +/* + * Define the final assertion notification function. + */ +#if defined UNIXX && !defined NO_ASSERTS +/******************************************************************* + * * + * UNIX * + * * + *******************************************************************/ + + +# if defined NDEBUG +/* + * if NDEBUG is defined __assert is NOT defined so we must supply + * our own assertion notification function..... + */ +# define ASSERT assert +static void UnixAssert(const char *expression, + const char *file_name, + int line) +{ + fprintf(stderr, "Assertion: %s\n" + "Tecplot version: %s\n" + "File Name: %s\n" + "Line Number: %d\n", + expression, TecVersionId, file_name, line); + exit(ExitCode_AssertionFailure); +} +static TAssertFailureNotifyFunc assert_failure_notify = UnixAssert; +# else +/* + * NDEBUG is not defined so __assert is available.... + */ +# if defined LINUX +# define LOWLEVELASSERTFUNCTION __linuxassertproxy +/* + * In linux, __assert does not exist but rather + * __assert_fail which has a differnt API. Thus + * a proxy is provided + */ +static void __linuxassertproxy(const char *__assertion, + const char *__file, + int __line) +{ + __assert_fail(__assertion, __file, __line, __ASSERT_FUNCTION); +} +# elif defined DARWIN +# define LOWLEVELASSERTFUNCTION __darwinassertproxy +/* + * In Darwin (Mac OS X), __assert is #defined to a call to __eprintf, + * which also has a different API. Another proxy... + */ +static void __darwinassertproxy(const char *__assertion, + const char *__file, + int __line) +{ + __eprintf("Assertion: %s\n" + "Tecplot version: %s\n" + "File Name: %s\n" + "Line Number: %d\n", + __assertion, TecVersionId, __file, (unsigned)__line); +} +# else +# define LOWLEVELASSERTFUNCTION __assert +# endif + +static TAssertFailureNotifyFunc assert_failure_notify = (TAssertFailureNotifyFunc) LOWLEVELASSERTFUNCTION; + +# endif +#endif /* UNIXX */ + +#if defined UNIXX && !defined NO_ASSERTS +/* + * Replace the current assert failure notification function and + * return the current one. + * + * Assumptions: + * new function points to valid function (not null) that + * conforms to the specified prototype + * + * Guarantees: + * result is a pointer to the previously installed + * function (not null) + */ +TAssertFailureNotifyFunc InstallTAssertFailureNotify( + TAssertFailureNotifyFunc new_function) /* new notification function */ +{ + TAssertFailureNotifyFunc result = 0; /* old function address */ + + ASSERT(new_function != 0); + + result = assert_failure_notify; + assert_failure_notify = new_function; + + ASSERT(result != 0); + return result; +} + + + + + + +/* + * Perform the installed assert failure notification action. + */ +void TAssert(const char *expression, /* text representation of the assertion */ + const char *file_name, /* name of the file containing the assertion */ + int line) /* line number in the file of the assertion */ +{ + static Boolean_t InTAssert = FALSE; +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + char Message[MAX_ERRMSG_LENGTH+1]; + ASSERT(expression != 0 && strlen(expression) != 0); + ASSERT(file_name != 0 && strlen(file_name) != 0); + ASSERT(line >= 1); + + /* check for recursion */ + if (InTAssert) + { + fprintf(stderr, "Already in assert!\n"); + fprintf(stderr, "Assertion: %s\n" + "Tecplot version: %s\n" + "File Name: %s\n" + "Line Number: %d\n", + expression, TecVersionId, file_name, line); + PrintCurBacktrace(stderr, 100); + ASSERT(FALSE); /*... really exit */ + } + + InTAssert = TRUE; + + sprintf(Message, "Assertion: %s\n" + "Tecplot version: %s\n" + "File Name: %s\n" + "Line Number: %d\n", + expression, TecVersionId, file_name, line); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +# if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +# else + fprintf(stderr, "%s", Message); +# endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + (*assert_failure_notify)(expression, file_name, line); +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + + InTAssert = FALSE; /* just in case assert_failure_notify has an ignore */ +} +#endif /* defined UNIXX && !defined NO_ASSERTS */ +#endif /* STD_ASSERTS */ + + +#if defined MSWIN && defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined CHECKED_BUILD +#endif +#if !defined ENGINE +# if defined CHECKED_BUILD +# endif // CHECKED_BUILD +#endif //!ENGINE +#endif /* MSWIN */ + + +#if defined NICE_NOT_IMPLEMENTED +static Boolean_t NotImplementedCalled = FALSE; +void NiceNotImplemented(void) +{ + if (!NotImplementedCalled) + { + Warning("Not Implemented!"); + NotImplementedCalled = TRUE; + } +} +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tecxxx.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tecxxx.cpp new file mode 100644 index 0000000000000000000000000000000000000000..dbace9f91fbff4104c08251de4f8659d521cd8d1 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tecxxx.cpp @@ -0,0 +1,4812 @@ +/* + * NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM + * + * Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide. + * + * Tecplot hereby grants OpenCFD limited authority to distribute without + * alteration the source code to the Tecplot Input/Output library, known + * as TecIO, as part of its distribution of OpenFOAM and the + * OpenFOAM_to_Tecplot converter. Users of this converter are also hereby + * granted access to the TecIO source code, and may redistribute it for the + * purpose of maintaining the converter. However, no authority is granted + * to alter the TecIO source code in any form or manner. + * + * This limited grant of distribution does not supersede Tecplot, Inc.'s + * copyright in TecIO. Contact Tecplot, Inc. for further information. + * + * Tecplot, Inc. + * 3535 Factoria Blvd, Ste. 550 + * Bellevue, WA 98006, USA + * Phone: +1 425 653 1200 + * http://www.tecplot.com/ + * + */ +#include "stdafx.h" +#include "MASTER.h" + +#define TECPLOTENGINEMODULE + +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2008 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ +/* Source file revision $Revision: 7627 $ */ + +#include "GLOBAL.h" +#include "TASSERT.h" +#include "Q_UNICODE.h" +#include "SYSTEM.h" +#include "FILESTREAM.h" +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +#include "DATAIO4.h" +#include "DATASET0.h" +#include "TECXXX.h" +#include "DATAUTIL.h" +#include "ALLOC.h" +#include <vector> + +#if !defined MAKEARCHIVE +#include "AUXDATA.h" +#endif /* MAKEARCHIVE */ + +#if defined MSWIN +#include <io.h> +#endif + +#if defined UNIXX +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +using namespace std; + +#if defined MAKEARCHIVE + #if defined MSWIN && defined _DEBUG +/* For debug .dll builds, send debug info to debug window. */ + #define PRINT0(s) do { OutputDebugString(s); } while (0) + #define PRINT1(s,a1) do { char buffer[512]; sprintf(buffer,s,a1); OutputDebugString(buffer); } while (0) + #define PRINT2(s,a1,a2) do { char buffer[512]; sprintf(buffer,s,a1,a2); OutputDebugString(buffer); } while (0) + #else +/* For all other builds (including release .dll), send debug info to stdout. */ + #define PRINT0(s) printf(s) + #define PRINT1(s,a1) printf(s,a1) + #define PRINT2(s,a1,a2) printf(s,a1,a2) +#endif +#else + #if defined MSWIN +/* For nonarchive, Windows, don't send debug info. */ + #define PRINT0(s) ((void)0) + #define PRINT1(s,a1) ((void)0) + #define PRINT2(s,a1,a2) ((void)0) + #else +/* For nonarchive, nonwindows, send debug info to stdout. */ + #define PRINT0(s) printf(s) + #define PRINT1(s,a1) printf(s,a1) + #define PRINT2(s,a1,a2) printf(s,a1,a2) + #endif +#endif + +typedef char *FNameType; +typedef FILE *FilePtr; + +#define MaxNumFiles 10 +#define MAX_DUPLIST_VARS 50 /* maybe crank up in the future */ + +#define BYTES_PER_CHUNK 4096 +#define TECIO_NO_NEIGHBORING_ELEM 0 +#define TECIO_NO_NEIGHBORING_ZONE 0 + +#if defined MAKEARCHIVE +static LgIndex_t DebugLevel[MaxNumFiles] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +#endif +static INTEGER4 IsOpen[MaxNumFiles] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static INTEGER4 NumErrs[MaxNumFiles] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static INTEGER4 NumVars[MaxNumFiles]; +static FNameType DestFName[MaxNumFiles] = {NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL + }; +static FNameType BlckFName[MaxNumFiles] = {NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL + }; +static FileStream_s* BlckFile[MaxNumFiles]; +static FileStream_s* HeadFile[MaxNumFiles]; +static vector<FileOffset_t> MinMaxOffset[MaxNumFiles]; /* vector dimensioned by num zones */ +static vector<double> VarMinValue[MaxNumFiles]; /* vector dimensioned by num vars */ +static vector<double> VarMaxValue[MaxNumFiles]; /* vector dimensioned by num vars */ +static INTEGER4 DoWriteForeign = FALSE; /* ...default is to write native */ +static INTEGER4 IsWritingNative[MaxNumFiles]; +static INTEGER4 IsBlock[MaxNumFiles]; +static INTEGER4 ZoneType[MaxNumFiles]; +static LgIndex_t IMax[MaxNumFiles]; /* ones based indices */ +static LgIndex_t JMax[MaxNumFiles]; /* ones based indices */ +static LgIndex_t KMax[MaxNumFiles]; /* ones based indices */ +static vector<LgIndex_t> TotalNumFaceNodes[MaxNumFiles]; /* vector dimensioned by num zones */ +static LgIndex_t TotalNumFaceBndryFaces[MaxNumFiles]; +static LgIndex_t TotalNumFaceBndryConns[MaxNumFiles]; +static LgIndex_t ICellMax[MaxNumFiles]; +static LgIndex_t JCellMax[MaxNumFiles]; +static LgIndex_t KCellMax[MaxNumFiles]; +static vector<INTEGER4> NumFaceConnections[MaxNumFiles]; /* vector dimensioned by num zones */ +static INTEGER4 FaceNeighborMode[MaxNumFiles]; +static vector<INTEGER4> FaceNeighborsOrMapWritten[MaxNumFiles]; /* vector dimensioned by num zones */ +static INTEGER4 NumIndices[MaxNumFiles]; +static LgIndex_t NumDataValuesWritten[MaxNumFiles]; +static LgIndex_t NumOrderedCCDataValuesWritten[MaxNumFiles]; /* CC data only */ +static LgIndex_t NumDataValuesToWrite[MaxNumFiles]; +static vector<LgIndex_t> NumRunningVarValues[MaxNumFiles]; /* vector dimensioned by num vars */ +static vector<Boolean_t> IsSharedVar[MaxNumFiles]; /* vector dimensioned by num vars */ +static vector<Boolean_t> IsPassiveVar[MaxNumFiles]; /* vector dimensioned by num vars */ +static INTEGER4 CurZone[MaxNumFiles]; /* zero based zone numbers */ +static INTEGER4 CurVar[MaxNumFiles]; /* zero based var numbers */ +static INTEGER4 FieldDataType; +static INTEGER4 CurFile = -1; +static vector<Boolean_t> IsCellCentered[MaxNumFiles]; /* vector dimensioned by num vars */ +static Boolean_t HasFECONNECT[MaxNumFiles]; +static INTEGER4 FileTypes[MaxNumFiles]; +static vector<INTEGER4> NumConnectivityNodes[MaxNumFiles]; /* vector dimensioned by num zones */ +static vector<Boolean_t> ConnectivityWritten[MaxNumFiles]; /* vector dimensioned by num zones */ + +/* + * From preplot.cpp: + * + * ZoneType 0=ORDERED,1=FELINESEG,2=FETRIANGLE, + * 3=FEQUADRILATERAL,4=FETETRAHEDRON,5=FEBRICK, + * 6=FEPOLYGON,7=FEPOLYHEDRON + */ +#define ORDERED 0 +#define FELINESEG 1 +#define FETRIANGLE 2 +#define FEQUADRILATERAL 3 +#define FETETRAHEDRON 4 +#define FEBRICK 5 +#define FEPOLYGON 6 +#define FEPOLYHEDRON 7 +/* + * FileType 0=FULLFILE,1=GRIDFILE,2=SOLUTIONFILE + */ +#define FULLFILE 0 +#define GRIDFILE 1 +#define SOLUTIONFILE 2 + +#if defined MAKEARCHIVE +static char const* ZoneTypes[] = +{ + "ORDERED", + "FELINESEG", + "FETRIANGLE", + "FEQUADRILATERAL", + "FETETRAHEDRON", + "FEBRICK", + "FEPOLYGON", + "FEPOLYHEDRON" +}; +#endif /* MAKEARCHIVE */ + + +static void WriteErr(const char *routine_name) +{ + #if defined MAKEARCHIVE + PRINT2("Err: (%s) Write failure on file %d.\n", routine_name, CurFile + 1); + #endif + NumErrs[CurFile]++; +} + +static LgIndex_t TecXXXZoneNum = 0; + +Boolean_t ParseDupList(LgIndex_t **ShareVarFromZone, + LgIndex_t *ShareConnectivityFromZone, + const char *DupList) +{ + Boolean_t IsOk = TRUE; + + REQUIRE(VALID_REF(ShareVarFromZone) && *ShareVarFromZone == NULL); + REQUIRE(VALID_REF(ShareConnectivityFromZone)); + REQUIRE(VALID_REF(DupList)); + + while (IsOk && *DupList) + { + /* skip leading spaces */ + while (*DupList && *DupList == ' ') + DupList++; + + /* is this the FECONNECT keyword? */ + if (*DupList && !strncmp(DupList, "FECONNECT", 9)) + *ShareConnectivityFromZone = TecXXXZoneNum; + + else if (*DupList && !isdigit(*DupList)) + IsOk = FALSE; /* syntax error */ + + else if (*DupList) + { + char *NotUsed = NULL; + EntIndex_t WhichVar = strtol(DupList, &NotUsed, 10); + EntIndex_t numVarsForFile = NumVars[CurFile]; + + if (0 < WhichVar && WhichVar < numVarsForFile) + { + if (!(*ShareVarFromZone)) + { + *ShareVarFromZone = ALLOC_ARRAY(numVarsForFile, LgIndex_t, "Variable sharing list"); + if (*ShareVarFromZone) + memset(*ShareVarFromZone, (char)0, numVarsForFile * sizeof(LgIndex_t)); + } + + if (*ShareVarFromZone) + (*ShareVarFromZone)[WhichVar - 1] = TecXXXZoneNum; + else + IsOk = FALSE; + } + else + { + /* Invalid var num */ + IsOk = FALSE; + } + } + + /* + * Skip to the comma. This + * will also allow the syntax error + * of more than one consecutive comma + */ + + while (*DupList && *DupList != ',') + DupList++; + + /* skip past the comma (can handle the syntax error of more than 1 comma) */ + while (*DupList && *DupList == ',') + DupList++; + } + + return IsOk; +} + +/** + */ +static FileStream_s *OpenFileStream(const char *FilePath, + const char *AccessMode, + Boolean_t IsByteOrderNative) +{ + REQUIRE(VALID_REF(FilePath)); + REQUIRE(VALID_REF(AccessMode)); + + FileStream_s *Result = NULL; + FILE *File = TP_FOPEN(FilePath, AccessMode); + if (File != NULL) + { + Result = FileStreamAlloc(File, IsByteOrderNative); + if (Result == NULL) + TP_FCLOSE(File); + } + + ENSURE((VALID_REF(Result) && VALID_REF(Result->File)) || Result == NULL); + return Result; +} + +/** + */ +static void CloseFileStream(FileStream_s **FileStream) +{ + REQUIRE(VALID_REF(FileStream)); + REQUIRE(VALID_REF(*FileStream) || *FileStream == NULL); + + if (*FileStream != NULL) + { + TP_FCLOSE((*FileStream)->File); + FileStreamDealloc(FileStream); + } + + ENSURE(*FileStream == NULL); +} + +/** + * Get the best terminator (separator) character to use for the string. First + * precedence goes to the new line then the command and finally by default the + * space. NOTE: We use a do loop to allow it to be used as a single statement. + */ +#define GET_BEST_TERMINATOR_CHAR(CompoundStr, TerminatorChar) \ + do \ + { \ + if (strchr((CompoundStr), '\n') != NULL) \ + (TerminatorChar) = '\n'; \ + else if (strchr((CompoundStr), ',') != NULL) \ + (TerminatorChar) = ','; \ + else \ + (TerminatorChar) = ' '; \ + } while (0) + + +/** + * TECINIXXX + */ +INTEGER4 LIBCALL TECINI112(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *FileType, + INTEGER4 *Debug, + INTEGER4 *VIsDouble) +{ + size_t L; + int I; + char RName[80]; + char *CPtr; + int NewFile = -1; + + /* + * Note that users should not mix TECXXX, TEC100XXX, and TEC110XXX calls, but + * just in case, initialize the TecXXXZoneNum variable. It may not help, but + * it doesn't hurt... + */ + TecXXXZoneNum = 0; + + #if defined MAKEARCHIVE + InitInputSpecs(); + #endif + + for (I = 0; (I < MaxNumFiles) && (NewFile == -1); I++) + { + if (!IsOpen[I]) + NewFile = I; + } + + if (NewFile == -1) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECINI112) Too many files (%d) opened for printing.\n", NewFile); + #endif + return (-1); + } + + if (CurFile == -1) + CurFile = 0; + + #if defined MAKEARCHIVE + DebugLevel[NewFile] = *Debug; + #endif + /* check sizes for array sized by number of variables */ + CHECK(VarMinValue[NewFile].empty()); + CHECK(VarMaxValue[NewFile].empty()); + CHECK(NumRunningVarValues[NewFile].empty()); + CHECK(IsSharedVar[NewFile].empty()); + CHECK(IsPassiveVar[NewFile].empty()); + CHECK(IsCellCentered[NewFile].empty()); + + /* check sizes for array sized by number of zones */ + CHECK(MinMaxOffset[NewFile].empty()); + CHECK(TotalNumFaceNodes[NewFile].empty()); + CHECK(NumFaceConnections[NewFile].empty()); + CHECK(FaceNeighborsOrMapWritten[NewFile].empty()); + CHECK(NumConnectivityNodes[NewFile].empty()); + CHECK(ConnectivityWritten[NewFile].empty()); + + CurZone[NewFile] = -1; + L = 0; + if (FName != NULL) + L = strlen(FName); + if (L == 0) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECINI112) Bad file name for file %d.\n", NewFile); + #endif + return (-1); + } + DestFName[NewFile] = ALLOC_ARRAY(L + 1, char, "data set fname"); + strcpy(DestFName[NewFile], FName); + + #if defined (DOS) + { + sprintf(RName, "BLCKFILE.%03d", (int)(NewFile + 1)); + } + #else + { + sprintf(RName, "tp%1dXXXXXX", NewFile + 1); + } + #endif + + L = strlen(RName); + if (ScratchDir != NULL) + L += strlen(ScratchDir) + 1; /* +1 for the slash delimeter */ + BlckFName[NewFile] = ALLOC_ARRAY(L + 1, char, "data set fname"); + if (ScratchDir != NULL) + { + strcpy(BlckFName[NewFile], ScratchDir); + #if defined DOS || defined MSWIN + { + strcat(BlckFName[NewFile], "\\"); + } + #else + { + strcat(BlckFName[NewFile], "/"); + } + #endif + } + else + BlckFName[NewFile][0] = '\0'; + + strcat(BlckFName[NewFile], RName); + CHECK(strlen(BlckFName[NewFile]) <= L); + + #if defined MSWIN + { + _mktemp(BlckFName[NewFile]); + } + #elif defined UNIXX + { + /* + * POSIX compiant behavior is to make + * sure umask is set correctly first. + */ + mode_t OrigUmask = umask(0022); /* ...should produce rw------- */ + int FileDesc = mkstemp(BlckFName[NewFile]); + if (FileDesc != -1) + close(FileDesc); + umask(OrigUmask); + } + #endif + + #if defined MAKEARCHIVE + if (DebugLevel[NewFile]) + { + PRINT2("Scratch File #%d: %s\n", NewFile + 1, BlckFName[NewFile]); + PRINT2("Dest File #%d: %s\n", NewFile + 1, DestFName[NewFile]); + } + #endif + + IsWritingNative[NewFile] = !DoWriteForeign; + + #if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ + #endif + + HeadFile[NewFile] = OpenFileStream(DestFName[NewFile], "wb", IsWritingNative[NewFile]); + BlckFile[NewFile] = OpenFileStream(BlckFName[NewFile], "wb", IsWritingNative[NewFile]); + + if (BlckFile[NewFile] == NULL) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECINI112) Cannot open scratch file for output.\n"); + PRINT0(" Check permissions in scratch directory.\n"); + #endif + NumErrs[NewFile]++; + return (-1); + } + if (HeadFile[NewFile] == NULL) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECINI112) Cannot open plot file. Check permissions.\n"); + #endif + NumErrs[NewFile]++; + return (-1); + } + + writeBinaryVersionNumber(*HeadFile[NewFile], + TecplotBinaryFileVersion); + WriteBinaryMagic(HeadFile[NewFile]); + + /* Write file type */ + if (*FileType >= FULLFILE && *FileType <= SOLUTIONFILE) + FileTypes[NewFile] = *FileType; + else + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECINI112) Bad filetype argument. Check documentation.\n"); + #endif + NumErrs[NewFile]++; + return (-1); + } + + CHECK(TecplotBinaryFileVersion == 112); + if (!WriteBinaryInt32(HeadFile[NewFile], (LgIndex_t)FileTypes[NewFile])) + { + WriteErr("TECINI112"); + return (-1); + } + + if (!DumpDatafileString(HeadFile[NewFile], + Title, + TRUE)) + { + WriteErr("TECINI112"); + return (-1); + } + + NumVars[NewFile] = 0; + CPtr = Variables; + + + /* + * Three possible variable name separators are accepted with the following + * precidence: newline, comma, and space. + */ + { + char terminator; + + GET_BEST_TERMINATOR_CHAR(CPtr, terminator); + while (*CPtr) + { + /* strip leading spaces */ + while (*CPtr && *CPtr == ' ') + CPtr++; + + if (*CPtr) + { + NumVars[NewFile]++; + /* skip to terminating character */ + while (*CPtr && *CPtr != terminator) + CPtr++; + /* skip past terminating character */ + if (*CPtr) + CPtr++; + } + } + } + +#if 0 + /* A grid file can have no variables in it as long as there is a connectivity list */ + if (NumVars[NewFile] == 0 && FileTypes[NewFile] != GRIDFILE) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECINI110) No variable names were defined.\n"); + #endif + NumErrs[NewFile]++; + return (-1); + } +#endif + + #if defined MAKEARCHIVE + if (DebugLevel[NewFile]) + PRINT1("NumVars=%d\n", NumVars[NewFile]); + #endif + /* make sure var-sized arrays are big enough for all vars */ + try + { + VarMinValue[NewFile].resize(NumVars[NewFile]); + VarMaxValue[NewFile].resize(NumVars[NewFile]); + NumRunningVarValues[NewFile].resize(NumVars[NewFile]); + IsSharedVar[NewFile].resize(NumVars[NewFile]); + IsPassiveVar[NewFile].resize(NumVars[NewFile]); + IsCellCentered[NewFile].resize(NumVars[NewFile]); + } + catch (std::bad_alloc const&) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECINI112) Memory allocation error.\n"); + #endif + NumErrs[NewFile]++; + return (-1); + } + + if (!WriteBinaryInt32(HeadFile[NewFile], (LgIndex_t)NumVars[NewFile])) + { + WriteErr("TECINI110"); + return (-1); + } + + CPtr = Variables; + { + char terminator; + char TString[MaxChrsVarName+1]; + int I; + + GET_BEST_TERMINATOR_CHAR(CPtr, terminator); + while (*CPtr) + { + /* skip leading space characters */ + while (*CPtr && *CPtr == ' ') + CPtr++; + if (*CPtr) + { + I = 0; + /* skip to terminator */ + while (*CPtr && *CPtr != terminator) + { + TString[I++] = *CPtr++; + } + /* skip past terminator */ + if (*CPtr) + CPtr++; + + /* strip trailing spaces */ + I--; + while (I >= 0 && TString[I] == ' ') + I--; + + TString[I+1] = '\0'; + + if (!DumpDatafileString(HeadFile[NewFile], TString, TRUE)) + { + WriteErr("TECINI110"); + return (-1); + } + } + } + } + + IsOpen[NewFile] = 1; + + if (*VIsDouble) + FieldDataType = FieldDataType_Double; + else + FieldDataType = FieldDataType_Float; + + return (0); +} + +INTEGER4 LIBCALL TECINI111(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *FileType, + INTEGER4 *Debug, + INTEGER4 *VIsDouble) +{ + return TECINI112(Title, + Variables, + FName, + ScratchDir, + FileType, + Debug, + VIsDouble); +} + +INTEGER4 LIBCALL TECINI110(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *Debug, + INTEGER4 *VIsDouble) +{ + INTEGER4 FType = FULLFILE; + + TecXXXZoneNum = 0; + return TECINI112(Title, + Variables, + FName, + ScratchDir, + &FType, + Debug, + VIsDouble); +} + +INTEGER4 LIBCALL TECINI100(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *Debug, + INTEGER4 *VIsDouble) +{ + INTEGER4 FType = FULLFILE; + + TecXXXZoneNum = 0; + return TECINI112(Title, + Variables, + FName, + ScratchDir, + &FType, + Debug, + VIsDouble); +} + +INTEGER4 LIBCALL TECINI(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *Debug, + INTEGER4 *VIsDouble) +{ + INTEGER4 FType = FULLFILE; + + TecXXXZoneNum = 0; + return TECINI112(Title, + Variables, + FName, + ScratchDir, + &FType, + Debug, + VIsDouble); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecini112_(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *FileType, + INTEGER4 *Debug, + INTEGER4 *VIsDouble) +{ + return TECINI112(Title, Variables, FName, ScratchDir, FileType, Debug, VIsDouble); +} + +LIBFUNCTION INTEGER4 LIBCALL tecini111_(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *FileType, + INTEGER4 *Debug, + INTEGER4 *VIsDouble) +{ + return TECINI112(Title, Variables, FName, ScratchDir, FileType, Debug, VIsDouble); +} + +LIBFUNCTION INTEGER4 LIBCALL tecini110_(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *Debug, + INTEGER4 *VIsDouble) +{ + INTEGER4 FType = FULLFILE; + return TECINI112(Title, Variables, FName, ScratchDir, &FType, Debug, VIsDouble); +} + +LIBFUNCTION INTEGER4 LIBCALL tecini100_(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *Debug, + INTEGER4 *VIsDouble) +{ + INTEGER4 FType = FULLFILE; + return TECINI112(Title, Variables, FName, ScratchDir, &FType, Debug, VIsDouble); +} + +LIBFUNCTION INTEGER4 LIBCALL tecini_(char *Title, + char *Variables, + char *FName, + char *ScratchDir, + INTEGER4 *Debug, + INTEGER4 *VIsDouble) +{ + INTEGER4 FType = FULLFILE; + return TECINI112(Title, + Variables, + FName, + ScratchDir, + &FType, + Debug, + VIsDouble); +} +#endif + + +static int CheckData(const char *routine_name) +{ + + if (NumDataValuesToWrite[CurFile] != NumDataValuesWritten[CurFile]) + { + #if defined MAKEARCHIVE + PRINT2("Err: (%s) Wrong number of data values in file %d:\n", routine_name, CurFile + 1); + PRINT2(" %d data values for Zone %d were processed,\n", NumDataValuesWritten[CurFile], CurZone[CurFile] + 1); + PRINT1(" %d data values were expected.\n", NumDataValuesToWrite[CurFile]); + #endif + NumErrs[CurFile]++; + return (-1); + } + return (0); +} + +static int CheckFile(const char *routine_name) +{ + if ((CurFile == -1) || (!IsOpen[CurFile])) + { + #if defined MAKEARCHIVE + PRINT2("Err: (%s) Attempt to use invalid file (%d).\n", + routine_name, CurFile + 1); + #endif + return (-1); + } + return (0); +} + +/** + * Advances CurVar[CurFile] to the next non-shared active variable. TECDATXXX + * clients should not supply values for shared or passive variables. + */ +static void AdvanceToNextVarWithValues(void) +{ + /* search for the next variable with values */ + do + { + CurVar[CurFile]++; + } + while (CurVar[CurFile] < NumVars[CurFile] && + (IsSharedVar[CurFile][CurVar[CurFile]] || + IsPassiveVar[CurFile][CurVar[CurFile]])); +} + +/** + * TECZNEXXX + */ +INTEGER4 LIBCALL TECZNE112(char *ZnTitle, + INTEGER4 *ZnType, + INTEGER4 *IMxOrNumPts, + INTEGER4 *JMxOrNumElements, + INTEGER4 *KMxOrNumFaces, + INTEGER4 *ICellMx, + INTEGER4 *JCellMx, + INTEGER4 *KCellMx, + double *SolutionTime, + INTEGER4 *StrandID, + INTEGER4 *ParentZone, + INTEGER4 *IsBlk, + INTEGER4 *NumFaceConn, + INTEGER4 *FNMode, + INTEGER4 *NumFaceNodes, + INTEGER4 *NumFaceBndryFaces, + INTEGER4 *NumFaceBndryConns, + INTEGER4 *PassiveVarList, + INTEGER4 *ValueLocation, + INTEGER4 *ShareVarFromZone, + INTEGER4 *ShareConnectivityFromZone) +{ + int I; + int IsOk = 1; + + if (CheckFile("TECZNE112") < 0) + return (-1); + + if (CurZone[CurFile] > -1) + { + if (CheckData("TECZNE112") < 0) + return (-1); + } + + if (NumVars[CurFile] == 0) + { + WriteErr("TECZNE112"); + #if defined MAKEARCHIVE + PRINT1("Err: (TECZNE112) Cannot write out zones if numvars is equal to zero (file %d).\n", + CurFile + 1); + #endif + return (-1); + } + + if (CurZone[CurFile] > MaxNumZonesOrVars - 2) /* -1 based */ + { + WriteErr("TECZNE112"); + #if defined MAKEARCHIVE + PRINT2("Err: (TECZNE112) Exceeded max number of zones (%d) in file %d.\n", + MaxNumZonesOrVars, CurFile + 1); + #endif + return (-1); + } + + if (*StrandID < -1) + { + #if defined MAKEARCHIVE + PRINT2("Err: (TECZNE112) Invalid StrandID supplied for file %d, zone %d.\n", + CurFile + 1, CurZone[CurFile] + 1 + 1); + #endif + return (-1); + } + + if (*ParentZone < 0) + { + #if defined MAKEARCHIVE + PRINT2("Err: (TECZNE112) Invalid ParentZone supplied for file %d, zone %d.\n", + CurFile + 1, CurZone[CurFile] + 1 + 1); + #endif + return (-1); + } + + /* + * This is a temporary error. Point format should no longer be written to the file + * and should instead be converted to block format before being written. Since the + * conversion has not yet been implemented, it is an error to use point data. + * TODO (JN): Remove this error when point to block conversion has been implemented. + */ + if (*IsBlk != 1) + { + #if defined MAKEARCHIVE + PRINT2("Err: (TECZNE112) Point data is not currently allowed. " + " Please use block format for file %d, zone %d.\n", + CurFile + 1, CurZone[CurFile] + 1 + 1); + #endif + return (-1); + } + + NumDataValuesWritten[CurFile] = 0; + NumOrderedCCDataValuesWritten[CurFile] = 0; + CurZone[CurFile]++; + + /* Resize zone-dimensioned arrays (CurZone[] is 0-based) */ + try + { + MinMaxOffset[CurFile].resize(CurZone[CurFile] + 1); + TotalNumFaceNodes[CurFile].resize(CurZone[CurFile] + 1); + NumFaceConnections[CurFile].resize(CurZone[CurFile] + 1); + FaceNeighborsOrMapWritten[CurFile].resize(CurZone[CurFile] + 1); + NumConnectivityNodes[CurFile].resize(CurZone[CurFile] + 1); + ConnectivityWritten[CurFile].resize(CurZone[CurFile] + 1); + } + catch (std::bad_alloc const&) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECZNE112) Memory allocation error.\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + ZoneType[CurFile] = *ZnType; + IMax[CurFile] = *IMxOrNumPts; + JMax[CurFile] = *JMxOrNumElements; + KMax[CurFile] = *KMxOrNumFaces; + ICellMax[CurFile] = *ICellMx; + JCellMax[CurFile] = *JCellMx; + KCellMax[CurFile] = *KCellMx; + /* Set the flags that connectivity, face neighbors or face map hasn't been written for the zone yet. */ + FaceNeighborsOrMapWritten[CurFile][CurZone[CurFile]] = FALSE; + ConnectivityWritten[CurFile][CurZone[CurFile]] = FALSE; + + if (ZoneType[CurFile] == ZoneType_FEPolygon || + ZoneType[CurFile] == ZoneType_FEPolyhedron) + { + NumFaceConnections[CurFile][CurZone[CurFile]] = 0; /* ...not used for polytope data */ + FaceNeighborMode[CurFile] = 0; /* ...not used for polytope data */ + NumConnectivityNodes[CurFile][CurZone[CurFile]] = 0; /* ...not used for polytope data */ + + IsBlock[CurFile] = TRUE; /* ...polytope data is always block */ + TotalNumFaceNodes[CurFile][CurZone[CurFile]] = *NumFaceNodes; + TotalNumFaceBndryFaces[CurFile] = *NumFaceBndryFaces; + TotalNumFaceBndryConns[CurFile] = *NumFaceBndryConns; + } + else /* ...classic data */ + { + IsBlock[CurFile] = *IsBlk; + NumFaceConnections[CurFile][CurZone[CurFile]] = *NumFaceConn; + FaceNeighborMode[CurFile] = *FNMode; + + TotalNumFaceNodes[CurFile][CurZone[CurFile]] = 0; /* ...not used for classic data */ + TotalNumFaceBndryFaces[CurFile] = 0; /* ...not used for classic data */ + TotalNumFaceBndryConns[CurFile] = 0; /* ...not used for classic data */ + } + + WriteBinaryReal(HeadFile[CurFile], + (double)ZoneMarker, + FieldDataType_Float); + if (!DumpDatafileString(HeadFile[CurFile], + ZnTitle, + TRUE)) + { + WriteErr("TECZNE112"); + return (-1); + } + + if ((ShareVarFromZone && *ShareConnectivityFromZone) && + CurZone[CurFile] == 0) + { + /* can't have a duplist if there's nothing to duplicate */ + IsOk = 0; + } + + if (IsOk == 0) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECZNE112) Bad zone format for file %d.\n", CurFile + 1); + #endif + NumErrs[CurFile]++; + return (-1); + } + + switch (ZoneType[CurFile]) + { + case ORDERED: + NumIndices[CurFile] = 0; + break; + case FELINESEG: + NumIndices[CurFile] = 2; + break; + case FETRIANGLE: + NumIndices[CurFile] = 3; + break; + case FEQUADRILATERAL: + NumIndices[CurFile] = 4; + break; + case FETETRAHEDRON: + NumIndices[CurFile] = 4; + break; + case FEBRICK: + NumIndices[CurFile] = 8; + break; + } + + /* ...not used for poly or ordered data and don't count sharing or solution files. */ + if (ZoneType[CurFile] != ZoneType_FEPolygon && + ZoneType[CurFile] != ZoneType_FEPolyhedron && + *ShareConnectivityFromZone == 0 && + FileTypes[CurFile] != SOLUTIONFILE) + NumConnectivityNodes[CurFile][CurZone[CurFile]] = NumIndices[CurFile] * JMax[CurFile]; + + /* + * We do not check any return values until the end. If these calls fail, + * WriteFieldDataType below should fail as well. + */ + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)(*ParentZone) - 1); /* ...ParentZone is zero based for binary file */ + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)(*StrandID) - 1); /* ...StrandID is zero based for binary file */ + WriteBinaryReal(HeadFile[CurFile], *SolutionTime, FieldDataType_Double); + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t) - 1); /* No Zone Color Assignment */ + WriteBinaryInt32(HeadFile[CurFile], ZoneType[CurFile]); + + NumDataValuesToWrite[CurFile] = 0; + for (I = 0; I < NumVars[CurFile]; I++) + { + IsSharedVar[CurFile][I] = (ShareVarFromZone != NULL && ShareVarFromZone[I] != 0); /* ...shared? */ + IsPassiveVar[CurFile][I] = (PassiveVarList != NULL && PassiveVarList[I] == 1); /* ...passive? */ + } + + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)(ValueLocation != NULL ? 1 : 0)); /* ...are var locations specified? */ + if (ValueLocation) + { + for (I = 0; I < NumVars[CurFile]; I++) + { + int VIndex; + LgIndex_t NumNodes; + LgIndex_t NumCells; + + if (ZoneType[CurFile] == ORDERED) + { + NumNodes = IMax[CurFile] * JMax[CurFile] * KMax[CurFile]; + NumCells = (MAX(IMax[CurFile] - 1, 1) * + MAX(JMax[CurFile] - 1, 1) * + MAX(KMax[CurFile] - 1, 1)); + } + else + { + NumNodes = IMax[CurFile]; + NumCells = JMax[CurFile]; + } + + if (IsSharedVar[CurFile][I]) + VIndex = ShareVarFromZone[I] - 1; + else + VIndex = I; + + if (VIndex == 0) + NumRunningVarValues[CurFile][I] = 0; + else + NumRunningVarValues[CurFile][VIndex] = NumRunningVarValues[CurFile][VIndex-1]; + + IsCellCentered[CurFile][VIndex] = (ValueLocation[I] == ValueLocation_CellCentered); + if (ValueLocation[I] == ValueLocation_CellCentered) + { + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)1); + if (!IsSharedVar[CurFile][I] && !IsPassiveVar[CurFile][I]) + { + NumDataValuesToWrite[CurFile] += NumCells; + NumRunningVarValues[CurFile][VIndex] += NumCells; + } + } + else if (ValueLocation[I] == ValueLocation_Nodal) + { + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)0); + if (!IsSharedVar[CurFile][I] && !IsPassiveVar[CurFile][I]) + { + NumDataValuesToWrite[CurFile] += NumNodes; + NumRunningVarValues[CurFile][VIndex] += NumNodes; + } + } + else + { + #if defined MAKEARCHIVE + PRINT2("Err: (TECZNE112) Bad zone value location for file %d, variable %d.\n", CurFile + 1, I + 1); + #endif + NumErrs[CurFile]++; + return(-1); + } + } + } + else + { + LgIndex_t NumNodes; + if (ZoneType[CurFile] == ORDERED) + { + NumNodes = IMax[CurFile] * JMax[CurFile] * KMax[CurFile]; + } + else + { + NumNodes = IMax[CurFile]; + } + + for (I = 0; I < NumVars[CurFile]; I++) + { + int VIndex; + if (IsSharedVar[CurFile][I]) + VIndex = ShareVarFromZone[I] - 1; + else + VIndex = I; + + if (VIndex == 0) + NumRunningVarValues[CurFile][I] = 0; + else + NumRunningVarValues[CurFile][VIndex] = NumRunningVarValues[CurFile][VIndex-1]; + + IsCellCentered[CurFile][VIndex] = FALSE; + if (!IsSharedVar[CurFile][I] && !IsPassiveVar[CurFile][I]) + { + NumDataValuesToWrite[CurFile] += NumNodes; + NumRunningVarValues[CurFile][VIndex] += NumNodes; + } + } + } + + /* + * As of binary version 108 Tecplot introduced + * the ability to output its auto-generated face + * neighbor array in its raw form. For now + * TecIO will always decline to perform this + * step and instead fall back to the delivering + * one neighbor at a time. + */ + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)0); /* IsRawFNAvailable */ + + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)NumFaceConnections[CurFile][CurZone[CurFile]]); + if (NumFaceConnections[CurFile][CurZone[CurFile]] > 0) + { + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)FaceNeighborMode[CurFile]); + if (ZoneType[CurFile] != ORDERED) + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)0); /* FEFaceNeighborsComplete */ + } + + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)IMax[CurFile]); + if (ZoneType[CurFile] == FEPOLYGON || + ZoneType[CurFile] == FEPOLYHEDRON) + { + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)KMax[CurFile]); + + /* + * As of binary version 111 these items moved from the data section to + * the header. + */ + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)TotalNumFaceNodes[CurFile][CurZone[CurFile]]); + if (TotalNumFaceBndryFaces[CurFile] > 0) + { + /* Each boundary face must have >= 1 boundary connection. */ + if (TotalNumFaceBndryConns[CurFile] < TotalNumFaceBndryFaces[CurFile]) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECZNE112) There must be at least 1 boundary connection for each boundary face in zone %d.\n", + CurZone[CurFile] + 1); + PRINT2(" %d boundary faces and %d boundary connections were specified.\n", + TotalNumFaceBndryFaces[CurFile], TotalNumFaceBndryConns[CurFile]); + #endif + NumErrs[CurFile]++; + return(-1); + } + + /* + * As a convenience for the ASCII format, TecUtil, and TECIO layers if any + * boundary connections exists we automatically add a no-neighboring + * connection as the first item so that they can user 0 for no-neighboring + * element in the element list regardless if they have boundary connections + * or not. + */ + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)TotalNumFaceBndryFaces[CurFile] + 1); /* ...add a boundary face for no neighboring element as a convenience */ + } + else + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)TotalNumFaceBndryFaces[CurFile]); + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)TotalNumFaceBndryConns[CurFile]); + } + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)JMax[CurFile]); + + if (ZoneType[CurFile] == ORDERED) + { + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)KMax[CurFile]); + } + else + { + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)ICellMax[CurFile]); + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)JCellMax[CurFile]); + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)KCellMax[CurFile]); + } + + /* + * Aux data. This has to be over-written by the aux data writing routine. + * Because it currently at the end of the header section we don't need to + * keep track of the position for seeking back to it. + */ + WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)0); + + WriteBinaryReal(BlckFile[CurFile], + (double)ZoneMarker, + FieldDataType_Float); + + for (I = 0; I < NumVars[CurFile]; I++) + { + if (!WriteFieldDataType(BlckFile[CurFile], + (FieldDataType_e)FieldDataType, + TRUE)) + { + WriteErr("TECZNE112"); + return (-1); + } + } + + /* Passive variable identification */ + if (PassiveVarList) + { + WriteBinaryInt32(BlckFile[CurFile], 1); + for (I = 0; I < NumVars[CurFile]; I++) + WriteBinaryInt32(BlckFile[CurFile], PassiveVarList[I]); + } + else + WriteBinaryInt32(BlckFile[CurFile], 0); + + /* get the CurVar[CurFile] on the first active variable */ + CurVar[CurFile] = -1; + AdvanceToNextVarWithValues(); + + /* Variable & Connectivity Sharing */ + if (ShareVarFromZone) + { + WriteBinaryInt32(BlckFile[CurFile], 1); + for (I = 0; I < NumVars[CurFile]; I++) + WriteBinaryInt32(BlckFile[CurFile], ShareVarFromZone[I] - 1); + } + else + WriteBinaryInt32(BlckFile[CurFile], 0); + WriteBinaryInt32(BlckFile[CurFile], *ShareConnectivityFromZone - 1); + + /* + * Create place holders or the variable min/max value. We will come back + * later after writing the data portion with the real min/max values. In the + * mean time, keep track of the starting point so we can seek back to this + * place. + */ + MinMaxOffset[CurFile][CurZone[CurFile]] = (FileOffset_t)TP_FTELL(BlckFile[CurFile]->File); + + for (I = 0; I < NumVars[CurFile]; I++) + { + /* initialize to unset values */ + VarMinValue[CurFile][I] = LARGEDOUBLE; + VarMaxValue[CurFile][I] = -LARGEDOUBLE; + + if (!IsSharedVar[CurFile][I] && !IsPassiveVar[CurFile][I]) + { + WriteBinaryReal(BlckFile[CurFile], 0.0, FieldDataType_Double); + WriteBinaryReal(BlckFile[CurFile], 0.0, FieldDataType_Double); + } + } + + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + { + PRINT1("Writing Zone %d:\n", CurZone[CurFile] + 1); + PRINT1(" Title = %s\n", ZnTitle); + PRINT1(" Type = %s\n", ZoneTypes[ZoneType[CurFile]]); + PRINT1(" IMax = %d\n", IMax[CurFile]); + PRINT1(" JMax = %d\n", JMax[CurFile]); + PRINT1(" KMax = %d\n", KMax[CurFile]); + if (ShareVarFromZone) + { + char DupList[1024] = ""; + + for (I = 0; I < NumVars[CurFile]; I++) + { + if (I > 0) + strcat(DupList, ","); + sprintf(&DupList[strlen(DupList)], "%d", ShareVarFromZone[I]); + } + PRINT1(" DupList = %s\n", DupList); + } + } + #endif + + return (0); +} + +INTEGER4 LIBCALL TECZNE111(char *ZnTitle, + INTEGER4 *ZnType, + INTEGER4 *IMxOrNumPts, + INTEGER4 *JMxOrNumElements, + INTEGER4 *KMxOrNumFaces, + INTEGER4 *ICellMx, + INTEGER4 *JCellMx, + INTEGER4 *KCellMx, + double *SolutionTime, + INTEGER4 *StrandID, + INTEGER4 *ParentZone, + INTEGER4 *IsBlk, + INTEGER4 *NumFaceConn, + INTEGER4 *FNMode, + INTEGER4 *NumFaceNodes, + INTEGER4 *NumFaceBndryFaces, + INTEGER4 *NumFaceBndryConns, + INTEGER4 *PassiveVarList, + INTEGER4 *ValueLocation, + INTEGER4 *ShareVarFromZone, + INTEGER4 *ShareConnectivityFromZone) +{ + return TECZNE112(ZnTitle, + ZnType, + IMxOrNumPts, + JMxOrNumElements, + KMxOrNumFaces, + ICellMx, + JCellMx, + KCellMx, + SolutionTime, + StrandID, + ParentZone, + IsBlk, + NumFaceConn, + FNMode, + NumFaceNodes, + NumFaceBndryFaces, + NumFaceBndryConns, + PassiveVarList, + ValueLocation, + ShareVarFromZone, + ShareConnectivityFromZone); +} + +INTEGER4 LIBCALL TECZNE110(char *ZnTitle, + INTEGER4 *ZnType, + INTEGER4 *IMxOrNumPts, + INTEGER4 *JMxOrNumElements, + INTEGER4 *KMx, + INTEGER4 *ICellMx, + INTEGER4 *JCellMx, + INTEGER4 *KCellMx, + double *SolutionTime, + INTEGER4 *StrandID, + INTEGER4 *ParentZone, + INTEGER4 *IsBlk, + INTEGER4 *NumFaceConn, + INTEGER4 *FNMode, + INTEGER4 *PassiveVarList, + INTEGER4 *ValueLocation, + INTEGER4 *ShareVarFromZone, + INTEGER4 *ShareConnectivityFromZone) +{ + INTEGER4 NumFaceNodes = 0; + INTEGER4 NumFaceBndryFaces = 0; + INTEGER4 NumFaceBndryConns = 0; + + return TECZNE112(ZnTitle, + ZnType, + IMxOrNumPts, + JMxOrNumElements, + KMx, + ICellMx, + JCellMx, + KCellMx, + SolutionTime, + StrandID, + ParentZone, + IsBlk, + NumFaceConn, + FNMode, + &NumFaceNodes, + &NumFaceBndryFaces, + &NumFaceBndryConns, + PassiveVarList, + ValueLocation, + ShareVarFromZone, + ShareConnectivityFromZone); +} + +INTEGER4 LIBCALL TECZNE100(char *ZnTitle, + INTEGER4 *ZnType, + INTEGER4 *IMxOrNumPts, + INTEGER4 *JMxOrNumElements, + INTEGER4 *KMx, + INTEGER4 *ICellMx, + INTEGER4 *JCellMx, + INTEGER4 *KCellMx, + INTEGER4 *IsBlk, + INTEGER4 *NumFaceConn, + INTEGER4 *FNMode, + INTEGER4 *ValueLocation, + INTEGER4 *ShareVarFromZone, + INTEGER4 *ShareConnectivityFromZone) +{ + double SolutionTime = 0.0; + INTEGER4 StrandID = STRAND_ID_STATIC + 1; /* TECXXX is ones based for StrandID */ + INTEGER4 ParentZone = BAD_SET_VALUE + 1; /* TECXXX is ones based for ParentZone */ + INTEGER4 NumFaceNodes = 0; + INTEGER4 NumFaceBndryFaces = 0; + INTEGER4 NumFaceBndryConns = 0; + + return TECZNE112(ZnTitle, + ZnType, + IMxOrNumPts, + JMxOrNumElements, + KMx, + ICellMx, + JCellMx, + KCellMx, + &SolutionTime, + &StrandID, + &ParentZone, + IsBlk, + NumFaceConn, + FNMode, + &NumFaceNodes, + &NumFaceBndryFaces, + &NumFaceBndryConns, + NULL, /* PassiveVarList */ + ValueLocation, + ShareVarFromZone, + ShareConnectivityFromZone); +} + +#if !defined INDEX_16_BIT // not supported in this test-only mode +INTEGER4 LIBCALL TECZNE(char *ZoneTitle, + INTEGER4 *IMx, + INTEGER4 *JMx, + INTEGER4 *KMx, + char *ZFormat, + char *DupList) +{ + + LgIndex_t ZoneType; + LgIndex_t IsBlock; + LgIndex_t *ShareVarFromZone = NULL; + LgIndex_t ShareConnectivityFromZone; + LgIndex_t Result = 0; + + + if (ZFormat == NULL) + Result = -1; + else if (!strcmp(ZFormat, "BLOCK")) + { + IsBlock = 1; + ZoneType = ZoneType_Ordered; + } + else if (!strcmp(ZFormat, "FEBLOCK")) + { + IsBlock = 1; + switch (*KMx) + { + /* + * From preplot.c: + * + * ZoneType 0=ORDERED,1=FELINESEG,2=FETRIANGLE, + * 3=FEQUADRILATERAL,4=FETETRAHEDRON,5=FEBRICK + */ + case 0: /* Triangular. */ + ZoneType = 2; + break; + case 1: /* Quadrilateral */ + ZoneType = 3; + break; + case 2: /* Tetrahedral */ + ZoneType = 4; + break; + case 3: /* Brick. */ + ZoneType = 5; + break; + } + } + else if (!strcmp(ZFormat, "POINT")) + { + IsBlock = 0; + ZoneType = ZoneType_Ordered; + } + else if (!strcmp(ZFormat, "FEPOINT")) + { + IsBlock = 0; + switch (*KMx) + { + case 0: /* Triangular. */ + ZoneType = 2; + break; + case 1: /* Quadrilateral */ + ZoneType = 3; + break; + case 2: /* Tetrahedral */ + ZoneType = 4; + break; + case 3: /* Brick. */ + ZoneType = 5; + break; + } + } + else + Result = -1; + + ShareConnectivityFromZone = 0; + + + if (Result == 0 && + DupList && + !ParseDupList(&ShareVarFromZone, &ShareConnectivityFromZone, DupList)) + { + Result = -1; + } + + /*Result = TECZNE((char *)ZoneTitle, IMx, JMx, KMx, (char *)ZFormat,(char*)DupList);*/ + if (Result == 0) + { + INTEGER4 ICellMx = 0; + INTEGER4 JCellMx = 0; + INTEGER4 KCellMx = 0; + INTEGER4 NumFaceConnections = 0; + INTEGER4 FaceNeighborMode = FaceNeighborMode_LocalOneToOne; + double SolutionTime = 0.0; + INTEGER4 StrandID = STRAND_ID_STATIC + 1; /* TECXXX is ones based for StrandID */ + INTEGER4 ParentZone = BAD_SET_VALUE + 1; /* TECXXX is ones based for ParentZone */ + INTEGER4 NumFaceNodes = 0; + INTEGER4 NumFaceBndryFaces = 0; + INTEGER4 NumFaceBndryConns = 0; + + Result = TECZNE112((char *)ZoneTitle, + &ZoneType, + IMx, + JMx, + KMx, + &ICellMx, + &JCellMx, + &KCellMx, + &SolutionTime, + &StrandID, + &ParentZone, + &IsBlock, + &NumFaceConnections, + &FaceNeighborMode, + &NumFaceNodes, + &NumFaceBndryFaces, + &NumFaceBndryConns, + NULL, /* PassiveVarList */ + NULL, /* ValueLocation */ + DupList ? ShareVarFromZone : NULL, + &ShareConnectivityFromZone); + TecXXXZoneNum++; + } + + if (ShareVarFromZone) + FREE_ARRAY(ShareVarFromZone, "Variable sharing list"); + + return (INTEGER4) Result; +} +#endif // INDEX_16_BIT -- not supported in this test-only mode + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL teczne112_(char *ZoneTitle, + INTEGER4 *ZnType, + INTEGER4 *IMxOrNumPts, + INTEGER4 *JMxOrNumElements, + INTEGER4 *KMx, + INTEGER4 *ICellMx, + INTEGER4 *JCellMx, + INTEGER4 *KCellMx, + double *SolutionTime, + INTEGER4 *StrandID, + INTEGER4 *ParentZone, + INTEGER4 *IsBlk, + INTEGER4 *NumFaceConn, + INTEGER4 *FNMode, + INTEGER4 *NumFaceNodes, + INTEGER4 *NumFaceBndryFaces, + INTEGER4 *NumFaceBndryConns, + INTEGER4 *PassiveVarList, + INTEGER4 *ValueLocation, + INTEGER4 *ShareVarFromZone, + INTEGER4 *ShareConnectivityFromZone) +{ + return TECZNE112(ZoneTitle, + ZnType, + IMxOrNumPts, + JMxOrNumElements, + KMx, + ICellMx, + JCellMx, + KCellMx, + SolutionTime, + StrandID, + ParentZone, + IsBlk, + NumFaceConn, + FNMode, + NumFaceNodes, + NumFaceBndryFaces, + NumFaceBndryConns, + PassiveVarList, + ValueLocation, + ShareVarFromZone, + ShareConnectivityFromZone); +} + +LIBFUNCTION INTEGER4 LIBCALL teczne111_(char *ZoneTitle, + INTEGER4 *ZnType, + INTEGER4 *IMxOrNumPts, + INTEGER4 *JMxOrNumElements, + INTEGER4 *KMx, + INTEGER4 *ICellMx, + INTEGER4 *JCellMx, + INTEGER4 *KCellMx, + double *SolutionTime, + INTEGER4 *StrandID, + INTEGER4 *ParentZone, + INTEGER4 *IsBlk, + INTEGER4 *NumFaceConn, + INTEGER4 *FNMode, + INTEGER4 *NumFaceNodes, + INTEGER4 *NumFaceBndryFaces, + INTEGER4 *NumFaceBndryConns, + INTEGER4 *PassiveVarList, + INTEGER4 *ValueLocation, + INTEGER4 *ShareVarFromZone, + INTEGER4 *ShareConnectivityFromZone) +{ + return TECZNE112(ZoneTitle, + ZnType, + IMxOrNumPts, + JMxOrNumElements, + KMx, + ICellMx, + JCellMx, + KCellMx, + SolutionTime, + StrandID, + ParentZone, + IsBlk, + NumFaceConn, + FNMode, + NumFaceNodes, + NumFaceBndryFaces, + NumFaceBndryConns, + PassiveVarList, + ValueLocation, + ShareVarFromZone, + ShareConnectivityFromZone); +} + +LIBFUNCTION INTEGER4 LIBCALL teczne110_(char *ZoneTitle, + INTEGER4 *ZnType, + INTEGER4 *IMxOrNumPts, + INTEGER4 *JMxOrNumElements, + INTEGER4 *KMx, + INTEGER4 *ICellMx, + INTEGER4 *JCellMx, + INTEGER4 *KCellMx, + double *SolutionTime, + INTEGER4 *StrandID, + INTEGER4 *ParentZone, + INTEGER4 *IsBlk, + INTEGER4 *NumFaceConn, + INTEGER4 *FNMode, + INTEGER4 *PassiveVarList, + INTEGER4 *ValueLocation, + INTEGER4 *ShareVarFromZone, + INTEGER4 *ShareConnectivityFromZone) +{ + INTEGER4 NumFaceNodes = 0; + INTEGER4 NumFaceBndryFaces = 0; + INTEGER4 NumFaceBndryConns = 0; + + return TECZNE112(ZoneTitle, + ZnType, + IMxOrNumPts, + JMxOrNumElements, + KMx, + ICellMx, + JCellMx, + KCellMx, + SolutionTime, + StrandID, + ParentZone, + IsBlk, + NumFaceConn, + FNMode, + &NumFaceNodes, + &NumFaceBndryFaces, + &NumFaceBndryConns, + PassiveVarList, + ValueLocation, + ShareVarFromZone, + ShareConnectivityFromZone); +} + +LIBFUNCTION INTEGER4 LIBCALL teczne100_(char *ZoneTitle, + INTEGER4 *ZnType, + INTEGER4 *IMxOrNumPts, + INTEGER4 *JMxOrNumElements, + INTEGER4 *KMx, + INTEGER4 *ICellMx, + INTEGER4 *JCellMx, + INTEGER4 *KCellMx, + INTEGER4 *IsBlk, + INTEGER4 *NumFaceConn, + INTEGER4 *FNMode, + INTEGER4 *ValueLocation, + INTEGER4 *ShareVarFromZone, + INTEGER4 *ShareConnectivityFromZone) +{ + return TECZNE100(ZoneTitle, + ZnType, + IMxOrNumPts, + JMxOrNumElements, + KMx, + ICellMx, + JCellMx, + KCellMx, + IsBlk, + NumFaceConn, + FNMode, + ValueLocation, + ShareVarFromZone, + ShareConnectivityFromZone); +} + +LIBFUNCTION INTEGER4 LIBCALL teczne_(char *ZoneTitle, + INTEGER4 *IMx, + INTEGER4 *JMx, + INTEGER4 *KMx, + char *ZFormat, + char *DupList) +{ + return TECZNE(ZoneTitle, + IMx, + JMx, + KMx, + ZFormat, + DupList); +} +#endif + +/** + * Rewrite the var min/max place holders which currently have zero in them. + */ +static void RewritePendingMinMaxValues(void) +{ + FileOffset_t CurrentOffset = (FileOffset_t)TP_FTELL(BlckFile[CurFile]->File); + + TP_FSEEK(BlckFile[CurFile]->File, MinMaxOffset[CurFile][CurZone[CurFile]], SEEK_SET); + int I; + for (I = 0; I < NumVars[CurFile]; I++) + { + if (!IsSharedVar[CurFile][I] && !IsPassiveVar[CurFile][I]) + { + WriteBinaryReal(BlckFile[CurFile], VarMinValue[CurFile][I], FieldDataType_Double); + WriteBinaryReal(BlckFile[CurFile], VarMaxValue[CurFile][I], FieldDataType_Double); + } + } + + /* return the original position */ + TP_FSEEK(BlckFile[CurFile]->File, CurrentOffset, SEEK_SET); +} + +/** + * TECDATXXX + */ +INTEGER4 LIBCALL TECDAT112(INTEGER4 *N, + void *Data, + INTEGER4 *IsDouble) +{ + LgIndex_t I; + double *dptr = (double *)Data; + float *fptr = (float *)Data; + + if (CheckFile("TECDAT112") < 0) + return (-1); + + #if defined MAKEARCHIVE + if (DebugLevel[CurFile] && (*N > 1)) + PRINT2("Writing %d values to file %d.\n", *N, CurFile + 1); + #endif + + for (I = 0; I < *N; I++) + { + double Value = (*IsDouble == 1 ? dptr[I] : fptr[I]); + + /* keep track of var min/max */ + if (Value < VarMinValue[CurFile][CurVar[CurFile]]) + VarMinValue[CurFile][CurVar[CurFile]] = Value; + if (Value > VarMaxValue[CurFile][CurVar[CurFile]]) + VarMaxValue[CurFile][CurVar[CurFile]] = Value; + + if (!WriteBinaryReal(BlckFile[CurFile], Value, (FieldDataType_e)FieldDataType)) + { + WriteErr("TECDAT112"); + return (-1); + } + + /* + * As of version 103 Tecplot writes binary data files so that the ordered + * cell centered field data includes the ghost cells. This makes it much + * easier for Tecplot to map the data when reading by simply writing out + * field data's as a block. As of version 104 the ghost cells of the + * slowest moving index are not included. + */ + if (IsCellCentered[CurFile][CurVar[CurFile]] && ZoneType[CurFile] == ORDERED) + { + CHECK(IsBlock[CurFile]); /* ...ordered CC data must be block format */ + LgIndex_t PIndex = (NumOrderedCCDataValuesWritten[CurFile]); + LgIndex_t FinalIMax = MAX(IMax[CurFile] - 1, 1); + LgIndex_t FinalJMax = MAX(JMax[CurFile] - 1, 1); + LgIndex_t FinalKMax = MAX(KMax[CurFile] - 1, 1); + LgIndex_t IIndex = (PIndex % IMax[CurFile]); + LgIndex_t JIndex = ((PIndex % (IMax[CurFile] * JMax[CurFile])) / IMax[CurFile]); + LgIndex_t KIndex = (PIndex / (IMax[CurFile] * JMax[CurFile])); + LgIndex_t IMaxAdjust = 0; + LgIndex_t JMaxAdjust = 0; + LgIndex_t KMaxAdjust = 0; + if (KMax[CurFile] > 1) + KMaxAdjust = 1; /* ...K is slowest */ + else if (JMax[CurFile] > 1) + JMaxAdjust = 1; /* ...J is slowest */ + else if (IMax[CurFile] > 1) + IMaxAdjust = 1; /* ...I is slowest */ + + if (IIndex + 1 == FinalIMax && FinalIMax < IMax[CurFile] - IMaxAdjust) + { + NumOrderedCCDataValuesWritten[CurFile]++; + if (!WriteBinaryReal(BlckFile[CurFile], 0.0, (FieldDataType_e)FieldDataType)) + { + WriteErr("TECDAT112"); + return (-1); + } + } + if (IIndex + 1 == FinalIMax && + (JIndex + 1 == FinalJMax && FinalJMax < JMax[CurFile] - JMaxAdjust)) + { + LgIndex_t II; + for (II = 1; II <= IMax[CurFile] - IMaxAdjust; II++) + { + NumOrderedCCDataValuesWritten[CurFile]++; + if (!WriteBinaryReal(BlckFile[CurFile], 0.0, (FieldDataType_e)FieldDataType)) + { + WriteErr("TECDAT112"); + return (-1); + } + } + } + if (IIndex + 1 == FinalIMax && + JIndex + 1 == FinalJMax && + (KIndex + 1 == FinalKMax && FinalKMax < KMax[CurFile] - KMaxAdjust)) + { + LgIndex_t JJ, II; + for (JJ = 1; JJ <= JMax[CurFile] - JMaxAdjust; JJ++) + for (II = 1; II <= IMax[CurFile] - IMaxAdjust; II++) + { + NumOrderedCCDataValuesWritten[CurFile]++; + if (!WriteBinaryReal(BlckFile[CurFile], 0.0, (FieldDataType_e)FieldDataType)) + { + WriteErr("TECDAT112"); + return (-1); + } + } + } + + /* increment for the original cell value */ + NumOrderedCCDataValuesWritten[CurFile]++; + } + + /* update the number of data points written */ + NumDataValuesWritten[CurFile]++; + + if (IsBlock[CurFile]) + { + /* for block format update the variable when all values have been given */ + if (NumRunningVarValues[CurFile][CurVar[CurFile]] == NumDataValuesWritten[CurFile]) + { + AdvanceToNextVarWithValues(); /* ...move on to the next variable */ + if (CurVar[CurFile] < NumVars[CurFile] && + IsCellCentered[CurFile][CurVar[CurFile]] && + ZoneType[CurFile] == ORDERED) + NumOrderedCCDataValuesWritten[CurFile] = 0; /* reset for next CC variable */ + } + } + else + { + /* for point format update the variable after each value */ + AdvanceToNextVarWithValues(); + if (CurVar[CurFile] >= NumVars[CurFile]) + { + /* reset to the first active variable */ + CurVar[CurFile] = -1; + AdvanceToNextVarWithValues(); + } + } + + #if defined MAKEARCHIVE + if (DebugLevel[CurFile] > 1) + PRINT2("%d %G\n", NumDataValuesWritten[CurFile] + I + 1, Value); + #endif + } + + /* + * If this is the last call to TECDAT112, + * then we may have to set the 'repeat adjacency list' + * flag in the file. + */ + if (HasFECONNECT[CurFile] && + + /* (essentialy this is CheckData() but we don't want to print + an error message) */ + (NumDataValuesToWrite[CurFile] == NumDataValuesWritten[CurFile])) + { + if (!WriteBinaryInt32(BlckFile[CurFile], (LgIndex_t)1)) + { + WriteErr("TECDAT112"); + return (-1); + } + } + + /* re-write min/max values when all data has been delivered */ + if (NumDataValuesToWrite[CurFile] == NumDataValuesWritten[CurFile]) + RewritePendingMinMaxValues(); + + return (0); +} + +INTEGER4 LIBCALL TECDAT111(INTEGER4 *N, + void *Data, + INTEGER4 *IsDouble) +{ + return TECDAT112(N, + Data, + IsDouble); +} + +INTEGER4 LIBCALL TECDAT110(INTEGER4 *N, + void *FieldData, + INTEGER4 *IsDouble) +{ + return TECDAT112(N, + FieldData, + IsDouble); +} + +INTEGER4 LIBCALL TECDAT100(INTEGER4 *N, + void *FieldData, + INTEGER4 *IsDouble) +{ + return TECDAT112(N, + FieldData, + IsDouble); +} + +INTEGER4 LIBCALL TECDAT(INTEGER4 *N, + void *FieldData, + INTEGER4 *IsDouble) +{ + return TECDAT112(N, + FieldData, + IsDouble); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecdat112_(INTEGER4 *N, + void *Data, + INTEGER4 *IsDouble) +{ + return TECDAT112(N, Data, IsDouble); +} + +LIBFUNCTION INTEGER4 LIBCALL tecdat111_(INTEGER4 *N, + void *Data, + INTEGER4 *IsDouble) +{ + return TECDAT112(N, Data, IsDouble); +} + +LIBFUNCTION INTEGER4 LIBCALL tecdat110_(INTEGER4 *N, + void *Data, + INTEGER4 *IsDouble) +{ + return TECDAT112(N, Data, IsDouble); +} + +LIBFUNCTION INTEGER4 LIBCALL tecdat100_(INTEGER4 *N, + void *Data, + INTEGER4 *IsDouble) +{ + return TECDAT112(N, Data, IsDouble); +} + +LIBFUNCTION INTEGER4 LIBCALL tecdat_(INTEGER4 *N, + void *FieldData, + INTEGER4 *IsDouble) +{ + return TECDAT112(N, + FieldData, + IsDouble); +} +#endif + +/** + * TECNODXXX + */ +INTEGER4 LIBCALL TECNOD112(INTEGER4 *NData) +{ + LgIndex_t L = NumConnectivityNodes[CurFile][CurZone[CurFile]]; + LgIndex_t I; + + ConnectivityWritten[CurFile][CurZone[CurFile]] = TRUE; + + if (CheckFile("TECNOD112") < 0) + return (-1); + + if (ZoneType[CurFile] == FEPOLYGON || + ZoneType[CurFile] == FEPOLYHEDRON) + { + /* Wrong way to specify connectivity for polygons and polyhedrons */ + #if defined MAKEARCHIVE + PRINT0("Err: (TECNOD112) Cannot call TECNOD112 for polygonal or polyhedral zones.\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + if (HasFECONNECT[CurFile]) + { + /* + * The connectivity list is duplicated, + * so we shouldn't be calling TECNOD112() + */ + return (-1); + } + + if (FileTypes[CurFile] == SOLUTIONFILE) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECNOD112) Cannot call TECNOD112 if file type is SOLUTIONFILE.\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + if (ZoneType[CurFile] == ORDERED) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECNOD112) Cannot call TECNOD110 if zone type is ORDERED.\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + if (CheckData("TECNOD112") < 0) + return (-1); + + for (I = 0; I < L; I++) + { + if ((NData[I] > IMax[CurFile]) || + (NData[I] < 1)) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECNOD112) Invalid node map value at position %d:\n", I); + PRINT2(" node map value = %d, max value = %d.\n", NData[I], IMax[CurFile]); + #endif + NumErrs[CurFile]++; + return (-1); + } + /* + * As of version 103 Tecplot assumes that node maps are zero based + * instead of ones based. Since we have to maintain the contract we + * subtract 1 for the caller. + */ + if (!WriteBinaryInt32(BlckFile[CurFile], NData[I] - 1)) /* zero based */ + { + WriteErr("TECNOD112"); + return (-1); + } + } + return (0); +} + +INTEGER4 LIBCALL TECNOD111(INTEGER4 *NData) +{ + return TECNOD112(NData); +} + +INTEGER4 LIBCALL TECNOD110(INTEGER4 *NData) +{ + return TECNOD112(NData); +} + +INTEGER4 LIBCALL TECNOD100(INTEGER4 *NData) +{ + return TECNOD112(NData); +} + +INTEGER4 LIBCALL TECNOD(INTEGER4 *NData) +{ + return TECNOD112(NData); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecnod112_(INTEGER4 *NData) +{ + return TECNOD112(NData); +} + +LIBFUNCTION INTEGER4 LIBCALL tecnod111_(INTEGER4 *NData) +{ + return TECNOD112(NData); +} + +LIBFUNCTION INTEGER4 LIBCALL tecnod110_(INTEGER4 *NData) +{ + return TECNOD112(NData); +} + +LIBFUNCTION INTEGER4 LIBCALL tecnod100_(INTEGER4 *NData) +{ + return TECNOD112(NData); +} + +LIBFUNCTION INTEGER4 LIBCALL tecnod_(INTEGER4 *NData) +{ + return TECNOD112(NData); +} +#endif + +/** + * TECENDXXX + */ +INTEGER4 LIBCALL TECEND112(void) +{ + int RetVal = 0; + + /** + * Validate that all zone data was given for the file since there are no + * more chances to give it. Note that solution files don't define the + * connectivity again. + */ + if (FileTypes[CurFile] != SOLUTIONFILE) + { + for (int ZoneIndex = 0; (RetVal == 0) && (ZoneIndex <= CurZone[CurFile]); ZoneIndex++) + { + if (((NumConnectivityNodes[CurFile][ZoneIndex] > 0) && + (ConnectivityWritten[CurFile][ZoneIndex] == FALSE))) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECEND112) File %d is being closed without writing connectivity data.\n", CurFile + 1); + PRINT1(" Zone %d was defined with a Classic FE zone type but TECNOD112() was not called.\n", ZoneIndex + 1); + #endif + NumErrs[CurFile]++; + RetVal = -1; + } + if (((NumFaceConnections[CurFile][ZoneIndex] > 0) && + (FaceNeighborsOrMapWritten[CurFile][ZoneIndex] == FALSE))) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECEND112) File %d is being closed without writing face neighbor data.\n", CurFile + 1); + PRINT2(" %d connections were specified for zone %d but TECFACE112() was not called.\n", + NumFaceConnections[CurFile][ZoneIndex], ZoneIndex + 1); + #endif + NumErrs[CurFile]++; + RetVal = -1; + } + else if (((TotalNumFaceNodes[CurFile][ZoneIndex] > 0) && + (FaceNeighborsOrMapWritten[CurFile][ZoneIndex] == FALSE))) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECEND112) File %d is being closed without writing face map data.\n", CurFile + 1); + PRINT2(" %d face nodes were specified for zone %d but TECPOLY112() was not called.\n", + TotalNumFaceNodes[CurFile][ZoneIndex], ZoneIndex + 1); + #endif + NumErrs[CurFile]++; + RetVal = -1; + } + } + } + + if (RetVal == 0) + { + if (CheckFile("TECEND112") < 0) + RetVal = -1; + } + + if (RetVal == 0) + { + if (CheckData("TECEND112") < 0) + RetVal = -1; + } + + if (RetVal == 0) + if (!WriteBinaryReal(HeadFile[CurFile], EndHeaderMarker, FieldDataType_Float)) + { + WriteErr("TECEND112"); + RetVal = -1; + } + + CloseFileStream(&BlckFile[CurFile]); + + if (RetVal == 0) + { + BlckFile[CurFile] = OpenFileStream(BlckFName[CurFile], "rb", IsWritingNative[CurFile]); + + /* Append data from BlckFile to HeadFile... */ + char buffer[BYTES_PER_CHUNK]; + size_t bytesRead = 0; + while ((RetVal == 0) && + (feof(BlckFile[CurFile]->File) == 0)) + { + bytesRead = fread((void*)buffer, 1, BYTES_PER_CHUNK, BlckFile[CurFile]->File); + if (ferror(BlckFile[CurFile]->File) == 0) + { + if (bytesRead != fwrite((void*)buffer, 1, bytesRead, HeadFile[CurFile]->File)) + { + /* do not call WriteErr, use custom message instead */ + #if defined MAKEARCHIVE + PRINT1("Err: (TECEND112) Write failure during repack on file %d.\n", CurFile + 1); + #endif + NumErrs[CurFile]++; + RetVal = -1; + } + } + else + { + /* do not call WriteErr, use custom message instead */ + #if defined MAKEARCHIVE + PRINT1("Err: (TECEND112) Write failure during repack on file %d.\n", CurFile + 1); + #endif + NumErrs[CurFile]++; + RetVal = -1; + } + } + CloseFileStream(&BlckFile[CurFile]); + } + + TP_UNLINK(BlckFName[CurFile]); + + CloseFileStream(&HeadFile[CurFile]); + + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + { + PRINT1("File %d closed.\n", CurFile + 1); + if (NumErrs[CurFile]) + { + PRINT0("********************************************\n"); + PRINT1(" %d Errors occurred on this file\n", NumErrs[CurFile]); + PRINT0("********************************************\n"); + } + } + #endif + + NumErrs[CurFile] = 0; + IsOpen[CurFile] = 0; + if (DestFName[CurFile]) + FREE_ARRAY(DestFName[CurFile], "data set fname"); + if (BlckFName[CurFile]) + FREE_ARRAY(BlckFName[CurFile], "data set fname"); + BlckFName[CurFile] = NULL; + DestFName[CurFile] = NULL; + + /* reset arrays sized by number of variables */ + VarMinValue[CurFile].clear(); + VarMaxValue[CurFile].clear(); + NumRunningVarValues[CurFile].clear(); + IsSharedVar[CurFile].clear(); + IsPassiveVar[CurFile].clear(); + IsCellCentered[CurFile].clear(); + + /* reset arrays sized by number of zones */ + MinMaxOffset[CurFile].clear(); + TotalNumFaceNodes[CurFile].clear(); + NumFaceConnections[CurFile].clear(); + FaceNeighborsOrMapWritten[CurFile].clear(); + NumConnectivityNodes[CurFile].clear(); + ConnectivityWritten[CurFile].clear(); + + CurFile = 0; + while ((CurFile < MaxNumFiles) && !IsOpen[CurFile]) + CurFile++; + + if (CurFile == MaxNumFiles) + CurFile = -1; + + return RetVal; +} + +INTEGER4 LIBCALL TECEND111(void) +{ + return TECEND112(); +} + +INTEGER4 LIBCALL TECEND110(void) +{ + return TECEND112(); +} + +INTEGER4 LIBCALL TECEND100(void) +{ + return TECEND112(); +} + +INTEGER4 LIBCALL TECEND(void) +{ + return TECEND112(); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecend112_(void) +{ + return TECEND112(); +} + +LIBFUNCTION INTEGER4 LIBCALL tecend111_(void) +{ + return TECEND112(); +} + +LIBFUNCTION INTEGER4 LIBCALL tecend110_(void) +{ + return TECEND112(); +} + +LIBFUNCTION INTEGER4 LIBCALL tecend100_(void) +{ + return TECEND112(); +} + +LIBFUNCTION INTEGER4 LIBCALL tecend_(void) +{ + return TECEND112(); +} +#endif + + + + +static void GetNextLabel(const char **CPtr, + char *NextLabel) +{ + int N = 0; + char *NPtr = NextLabel; + *NPtr = '\0'; + /* Find label start */ + while ((**CPtr) && (**CPtr != '"')) + (*CPtr)++; + if (**CPtr) + (*CPtr)++; + while ((N < 60) && (**CPtr) && (**CPtr != '"')) + { + if (**CPtr == '\\') + { + (*CPtr)++; + } + *NPtr++ = **CPtr; + N++; + (*CPtr)++; + } + if (**CPtr) + (*CPtr)++; + *NPtr = '\0'; +} + + +/** + * TECLABXXX + */ +INTEGER4 LIBCALL TECLAB112(char *S) +{ + const char *CPtr = (const char *)S; + LgIndex_t N = 0; + char Label[60]; + + if (CheckFile("TECLAB112") < 0) + return (-1); + + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + PRINT0("\nInserting Custom Labels:\n"); + #endif + + do + { + GetNextLabel(&CPtr, Label); + if (*Label) + N++; + } + while (*Label); + + if (N == 0) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECLAB112) Invalid custom label string: %s\n", + (S ? S : " ")); + #endif + NumErrs[CurFile]++; + return (-1); + } + + WriteBinaryReal(HeadFile[CurFile], CustomLabelMarker, FieldDataType_Float); + if (!WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)N)) + { + WriteErr("TECLAB112"); + return (-1); + } + + CPtr = (const char *)S; + do + { + GetNextLabel(&CPtr, Label); + if (*Label) + { + if (!DumpDatafileString(HeadFile[CurFile], Label, TRUE)) + { + WriteErr("TECLAB112"); + return (-1); + } + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + printf(" %s\n", Label); + #endif + } + } + while (*Label); + + return (0); +} + +INTEGER4 LIBCALL TECLAB111(char *S) +{ + return TECLAB112(S); +} + +INTEGER4 LIBCALL TECLAB110(char *S) +{ + return TECLAB112(S); +} + +INTEGER4 LIBCALL TECLAB100(char *S) +{ + return TECLAB112(S); +} + +INTEGER4 LIBCALL TECLAB(char *S) +{ + return TECLAB112(S); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL teclab112_(char *S) +{ + return TECLAB112(S); +} + +LIBFUNCTION INTEGER4 LIBCALL teclab111_(char *S) +{ + return TECLAB112(S); +} + +LIBFUNCTION INTEGER4 LIBCALL teclab110_(char *S) +{ + return TECLAB112(S); +} + +LIBFUNCTION INTEGER4 LIBCALL teclab100_(char *S) +{ + return TECLAB112(S); +} + +LIBFUNCTION INTEGER4 LIBCALL teclab_(char *S) +{ + return TECLAB112(S); +} +#endif + + +/** + * TECUSRXXX + */ +INTEGER4 LIBCALL TECUSR112(char *S) +{ + if (CheckFile("TECUSR112") < 0) + return (-1); + + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + PRINT1("\nInserting UserRec: %s\n", S); + #endif + + if ((S == NULL) || (*S == '\0')) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECUSR112) Invalid TECUSR110 string\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + WriteBinaryReal(HeadFile[CurFile], UserRecMarker, FieldDataType_Float); + if (!DumpDatafileString(HeadFile[CurFile], S, TRUE)) + { + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + printf("Err: (TECUSR112) Write failure for file %d\n", CurFile + 1); + #endif + NumErrs[CurFile]++; + return (-1); + } + return (0); +} + +INTEGER4 LIBCALL TECUSR111(char *S) +{ + return TECUSR112(S); +} + +INTEGER4 LIBCALL TECUSR110(char *S) +{ + return TECUSR112(S); +} + +INTEGER4 LIBCALL TECUSR100(char *S) +{ + return TECUSR112(S); +} + +INTEGER4 LIBCALL TECUSR(char *S) +{ + return TECUSR112(S); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecusr112_(char *S) +{ + return TECUSR112(S); +} + +LIBFUNCTION INTEGER4 LIBCALL tecusr111_(char *S) +{ + return TECUSR112(S); +} + +LIBFUNCTION INTEGER4 LIBCALL tecusr110_(char *S) +{ + return TECUSR112(S); +} + +LIBFUNCTION INTEGER4 LIBCALL tecusr100_(char *S) +{ + return TECUSR112(S); +} + +LIBFUNCTION INTEGER4 LIBCALL tecusr_(char *S) +{ + return TECUSR112(S); +} +#endif + +#if 0 // NOT_CURRENTLY_USED +static int WriteGeomDataBlock(float *Data, + LgIndex_t NumPts) +{ + LgIndex_t I; + + for (I = 0; I < NumPts; I++) + { + if (!WriteBinaryReal(HeadFile[CurFile], Data[I], FieldDataType_Float)) + { + return (-1); + } + } + return (0); +} + + +static void ShowDebugColor(LgIndex_t Color) +{ + #if defined MAKEARCHIVE + switch (Color) + { + case 0 : PRINT0("BLACK\n"); break; + case 1 : PRINT0("RED\n"); break; + case 2 : PRINT0("GREEN\n"); break; + case 3 : PRINT0("BLUE\n"); break; + case 4 : PRINT0("CYAN\n"); break; + case 5 : PRINT0("YELLOW\n"); break; + case 6 : PRINT0("PURPLE\n"); break; + case 7 : PRINT0("WHITE\n"); break; + case 8 : + case 9 : + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: PRINT1("CUSTOM%1d\n", Color-7); break; + default : PRINT0("INVALID\n"); + } + #endif +} +#endif /* NOT_CURRENTLY_USED */ + + +/** + * TECGEOXXX + */ +INTEGER4 LIBCALL TECGEO112(double *XOrThetaPos, + double *YOrRPos, + double *ZPos, + INTEGER4 *PosCoordMode, /* 0=Grid, 1=Frame, 3=Grid3D */ + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *Clipping, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XOrThetaGeomData, + float *YOrRGeomData, + float *ZGeomData, + char *mfc) +{ + int I, RetVal; + int RawDataSize = 0; + double Fract; + + Geom_s Geom; + + if (CheckFile("TECGEO112") < 0) + return (-1); + + Geom.PositionCoordSys = (CoordSys_e) * PosCoordMode; + if (Geom.PositionCoordSys == CoordSys_Frame) + Fract = 0.01; + else + Fract = 1.0; + + Geom.AnchorPos.Generic.V1 = (*XOrThetaPos) * Fract; + Geom.AnchorPos.Generic.V2 = (*YOrRPos) * Fract; + Geom.AnchorPos.Generic.V3 = (*ZPos) * Fract; + Geom.AttachToZone = *AttachToZone != 0; + Geom.Zone = *Zone - 1; + Geom.BColor = (ColorIndex_t) * Color; + Geom.FillBColor = (ColorIndex_t) * FillColor; + Geom.IsFilled = *IsFilled; + Geom.GeomType = (GeomType_e) * GeomType; + Geom.LinePattern = (LinePattern_e) * LinePattern; + Geom.PatternLength = *PatternLength / 100.0; + Geom.LineThickness = *LineThickness / 100.0; + Geom.NumEllipsePts = *NumEllipsePts; + Geom.ArrowheadStyle = (ArrowheadStyle_e) * ArrowheadStyle; + Geom.ArrowheadAttachment = (ArrowheadAttachment_e) * ArrowheadAttachment; + Geom.ArrowheadSize = *ArrowheadSize / 100.0; + Geom.ArrowheadAngle = *ArrowheadAngle / DEGPERRADIANS; + Geom.Scope = (Scope_e) * Scope; + Geom.DrawOrder = DrawOrder_AfterData; + Geom.Clipping = (Clipping_e) * Clipping; + Geom.NumSegments = *NumSegments; + Geom.MacroFunctionCommand = mfc; + Geom.ImageFileName = NULL; + Geom.ImageNumber = 0; + Geom.MaintainAspectRatio = TRUE; + Geom.PixelAspectRatio = 1.0; + Geom.ImageResizeFilter = ImageResizeFilter_Texture; + + if (Geom.GeomType == GeomType_LineSegs3D) + { + Geom.GeomType = GeomType_LineSegs; + Geom.PositionCoordSys = CoordSys_Grid3D; + } + + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + PRINT0("\nInserting Geometry\n"); + #endif + + switch (Geom.GeomType) + { + case GeomType_LineSegs : + { + int I; + RawDataSize = 0; + for (I = 0; I < *NumSegments; I++) + { + Geom.NumSegPts[I] = NumSegPts[I]; + RawDataSize += NumSegPts[I]; + } + } break; + case GeomType_Rectangle : + case GeomType_Square : + case GeomType_Circle : + case GeomType_Ellipse : + { + RawDataSize = 1; + } break; + case GeomType_Image : + { + CHECK(FALSE); /* Images not allowed in data files. */ + } break; + default : + { + CHECK(FALSE); + } break; + } + + Geom.DataType = FieldDataType_Float; + Geom.GeomData.Generic.V1Base = AllocScratchNodalFieldDataPtr(RawDataSize, FieldDataType_Float, TRUE); + Geom.GeomData.Generic.V2Base = AllocScratchNodalFieldDataPtr(RawDataSize, FieldDataType_Float, TRUE); + Geom.GeomData.Generic.V3Base = AllocScratchNodalFieldDataPtr(RawDataSize, FieldDataType_Float, TRUE); + + for (I = 0; I < RawDataSize; I++) + { + SetFieldValue(Geom.GeomData.Generic.V1Base, I, (double)XOrThetaGeomData[I]*Fract); + SetFieldValue(Geom.GeomData.Generic.V2Base, I, (double)YOrRGeomData[I]*Fract); + SetFieldValue(Geom.GeomData.Generic.V3Base, I, (double)ZGeomData[I]*Fract); + } + + if (DumpGeometry(HeadFile[CurFile], &Geom, TRUE, FALSE)) + RetVal = 0; + else + RetVal = -1; + + DeallocScratchNodalFieldDataPtr(&Geom.GeomData.Generic.V1Base); + DeallocScratchNodalFieldDataPtr(&Geom.GeomData.Generic.V2Base); + DeallocScratchNodalFieldDataPtr(&Geom.GeomData.Generic.V3Base); + + return RetVal; +} + +INTEGER4 LIBCALL TECGEO111(double *XOrThetaPos, + double *YOrRPos, + double *ZPos, + INTEGER4 *PosCoordMode, /* 0=Grid, 1=Frame, 3=Grid3D */ + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *Clipping, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XOrThetaGeomData, + float *YOrRGeomData, + float *ZGeomData, + char *mfc) +{ + return TECGEO112(XOrThetaPos, + YOrRPos, + ZPos, + PosCoordMode, + AttachToZone, + Zone, + Color, + FillColor, + IsFilled, + GeomType, + LinePattern, + PatternLength, + LineThickness, + NumEllipsePts, + ArrowheadStyle, + ArrowheadAttachment, + ArrowheadSize, + ArrowheadAngle, + Scope, + Clipping, + NumSegments, + NumSegPts, + XOrThetaGeomData, + YOrRGeomData, + ZGeomData, + mfc); +} + +INTEGER4 LIBCALL TECGEO110(double *XOrThetaPos, + double *YOrRPos, + double *ZPos, + INTEGER4 *PosCoordMode, /* 0=Grid, 1=Frame, 3=Grid3D */ + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *Clipping, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XOrThetaGeomData, + float *YOrRGeomData, + float *ZGeomData, + char *mfc) +{ + return TECGEO112(XOrThetaPos, + YOrRPos, + ZPos, + PosCoordMode, + AttachToZone, + Zone, + Color, + FillColor, + IsFilled, + GeomType, + LinePattern, + PatternLength, + LineThickness, + NumEllipsePts, + ArrowheadStyle, + ArrowheadAttachment, + ArrowheadSize, + ArrowheadAngle, + Scope, + Clipping, + NumSegments, + NumSegPts, + XOrThetaGeomData, + YOrRGeomData, + ZGeomData, + mfc); +} + +INTEGER4 LIBCALL TECGEO100(double *XOrThetaPos, + double *YOrRPos, + double *ZPos, + INTEGER4 *PosCoordMode, /* 0=Grid, 1=Frame, 3=Grid3D */ + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *Clipping, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XOrThetaGeomData, + float *YOrRGeomData, + float *ZGeomData, + char *mfc) +{ + return TECGEO112(XOrThetaPos, + YOrRPos, + ZPos, + PosCoordMode, + AttachToZone, + Zone, + Color, + FillColor, + IsFilled, + GeomType, + LinePattern, + PatternLength, + LineThickness, + NumEllipsePts, + ArrowheadStyle, + ArrowheadAttachment, + ArrowheadSize, + ArrowheadAngle, + Scope, + Clipping, + NumSegments, + NumSegPts, + XOrThetaGeomData, + YOrRGeomData, + ZGeomData, + mfc); +} + +INTEGER4 LIBCALL TECGEO(double *XPos, + double *YPos, + double *ZPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XGeomData, + float *YGeomData, + float *ZGeomData, + char *mfc) +{ + int Clipping = (int)Clipping_ClipToViewport; + return TECGEO112(XPos, + YPos, + ZPos, + PosCoordMode, + AttachToZone, + Zone, + Color, + FillColor, + IsFilled, + GeomType, + LinePattern, + PatternLength, + LineThickness, + NumEllipsePts, + ArrowheadStyle, + ArrowheadAttachment, + ArrowheadSize, + ArrowheadAngle, + Scope, + &Clipping, + NumSegments, + NumSegPts, + XGeomData, + YGeomData, + ZGeomData, + mfc); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecgeo112_(double *XPos, + double *YPos, + double *ZPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *Clipping, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XGeomData, + float *YGeomData, + float *ZGeomData, + char *mfc) +{ + return TECGEO112(XPos, + YPos, + ZPos, + PosCoordMode, + AttachToZone, + Zone, + Color, + FillColor, + IsFilled, + GeomType, + LinePattern, + PatternLength, + LineThickness, + NumEllipsePts, + ArrowheadStyle, + ArrowheadAttachment, + ArrowheadSize, + ArrowheadAngle, + Scope, + Clipping, + NumSegments, + NumSegPts, + XGeomData, + YGeomData, + ZGeomData, + mfc); +} + +LIBFUNCTION INTEGER4 LIBCALL tecgeo111_(double *XPos, + double *YPos, + double *ZPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *Clipping, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XGeomData, + float *YGeomData, + float *ZGeomData, + char *mfc) +{ + return TECGEO112(XPos, + YPos, + ZPos, + PosCoordMode, + AttachToZone, + Zone, + Color, + FillColor, + IsFilled, + GeomType, + LinePattern, + PatternLength, + LineThickness, + NumEllipsePts, + ArrowheadStyle, + ArrowheadAttachment, + ArrowheadSize, + ArrowheadAngle, + Scope, + Clipping, + NumSegments, + NumSegPts, + XGeomData, + YGeomData, + ZGeomData, + mfc); +} + +LIBFUNCTION INTEGER4 LIBCALL tecgeo110_(double *XPos, + double *YPos, + double *ZPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *Clipping, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XGeomData, + float *YGeomData, + float *ZGeomData, + char *mfc) +{ + return TECGEO112(XPos, + YPos, + ZPos, + PosCoordMode, + AttachToZone, + Zone, + Color, + FillColor, + IsFilled, + GeomType, + LinePattern, + PatternLength, + LineThickness, + NumEllipsePts, + ArrowheadStyle, + ArrowheadAttachment, + ArrowheadSize, + ArrowheadAngle, + Scope, + Clipping, + NumSegments, + NumSegPts, + XGeomData, + YGeomData, + ZGeomData, + mfc); +} + +LIBFUNCTION INTEGER4 LIBCALL tecgeo100_(double *XPos, + double *YPos, + double *ZPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *Clipping, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XGeomData, + float *YGeomData, + float *ZGeomData, + char *mfc) +{ + return TECGEO112(XPos, + YPos, + ZPos, + PosCoordMode, + AttachToZone, + Zone, + Color, + FillColor, + IsFilled, + GeomType, + LinePattern, + PatternLength, + LineThickness, + NumEllipsePts, + ArrowheadStyle, + ArrowheadAttachment, + ArrowheadSize, + ArrowheadAngle, + Scope, + Clipping, + NumSegments, + NumSegPts, + XGeomData, + YGeomData, + ZGeomData, + mfc); +} + +LIBFUNCTION INTEGER4 LIBCALL tecgeo_(double *XPos, + double *YPos, + double *ZPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *Color, + INTEGER4 *FillColor, + INTEGER4 *IsFilled, + INTEGER4 *GeomType, + INTEGER4 *LinePattern, + double *PatternLength, + double *LineThickness, + INTEGER4 *NumEllipsePts, + INTEGER4 *ArrowheadStyle, + INTEGER4 *ArrowheadAttachment, + double *ArrowheadSize, + double *ArrowheadAngle, + INTEGER4 *Scope, + INTEGER4 *NumSegments, + INTEGER4 *NumSegPts, + float *XGeomData, + float *YGeomData, + float *ZGeomData, + char *mfc) +{ + return TECGEO(XPos, + YPos, + ZPos, + PosCoordMode, + AttachToZone, + Zone, + Color, + FillColor, + IsFilled, + GeomType, + LinePattern, + PatternLength, + LineThickness, + NumEllipsePts, + ArrowheadStyle, + ArrowheadAttachment, + ArrowheadSize, + ArrowheadAngle, + Scope, + NumSegments, + NumSegPts, + XGeomData, + YGeomData, + ZGeomData, + mfc); +} +#endif + +/** + * TECTXTXXX + */ +INTEGER4 LIBCALL TECTXT112(double *XOrThetaPos, + double *YOrRPos, + double *ZOrUnusedPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + INTEGER4 *Clipping, + char *String, + char *mfc) +{ + int RetVal; + Text_s Text; + double Fract; + if (CheckFile("TECTXT112") < 0) + return (-1); + + Text.PositionCoordSys = (CoordSys_e) * PosCoordMode; + if (Text.PositionCoordSys == CoordSys_Frame) + Fract = 0.01; + else + Fract = 1.0; + + Text.AnchorPos.Generic.V1 = (*XOrThetaPos) * Fract; + Text.AnchorPos.Generic.V2 = (*YOrRPos) * Fract; + Text.AnchorPos.Generic.V3 = (*ZOrUnusedPos) * Fract; + Text.AttachToZone = *AttachToZone != 0; + Text.Zone = *Zone - 1; + Text.BColor = (ColorIndex_t) * TextColor; + Text.TextShape.Font = (Font_e) * BFont; + Text.TextShape.SizeUnits = (Units_e) * FontHeightUnits; + if (Text.TextShape.SizeUnits == Units_Frame) + Text.TextShape.Height = (*FontHeight) / 100.0; + else + Text.TextShape.Height = *FontHeight; + Text.Box.BoxType = (TextBox_e) * BoxType; + Text.Box.Margin = *BoxMargin / 100.0; + Text.Box.LineThickness = *BoxLineThickness / 100.0; + Text.Box.BColor = (ColorIndex_t) * BoxColor; + Text.Box.FillBColor = (ColorIndex_t) * BoxFillColor; + Text.Anchor = (TextAnchor_e) * Anchor; + Text.LineSpacing = *LineSpacing; + Text.Angle = *Angle / DEGPERRADIANS; + Text.Scope = (Scope_e) * Scope; + Text.Text = String; + Text.MacroFunctionCommand = mfc; + Text.Clipping = (Clipping_e) * Clipping; + + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + PRINT1("\nInserting Text: %s\n", String); + #endif + + if (DumpText(HeadFile[CurFile], &Text, TRUE, FALSE)) + RetVal = 0; + else + RetVal = -1; + + return RetVal; +} + +INTEGER4 LIBCALL TECTXT111(double *XOrThetaPos, + double *YOrRPos, + double *ZOrUnusedPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + INTEGER4 *Clipping, + char *String, + char *mfc) +{ + return TECTXT112(XOrThetaPos, + YOrRPos, + ZOrUnusedPos, + PosCoordMode, + AttachToZone, + Zone, + BFont, + FontHeightUnits, + FontHeight, + BoxType, + BoxMargin, + BoxLineThickness, + BoxColor, + BoxFillColor, + Angle, + Anchor, + LineSpacing, + TextColor, + Scope, + Clipping, + String, + mfc); +} + +INTEGER4 LIBCALL TECTXT110(double *XOrThetaPos, + double *YOrRPos, + double *ZOrUnusedPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + INTEGER4 *Clipping, + char *String, + char *mfc) +{ + return TECTXT112(XOrThetaPos, + YOrRPos, + ZOrUnusedPos, + PosCoordMode, + AttachToZone, + Zone, + BFont, + FontHeightUnits, + FontHeight, + BoxType, + BoxMargin, + BoxLineThickness, + BoxColor, + BoxFillColor, + Angle, + Anchor, + LineSpacing, + TextColor, + Scope, + Clipping, + String, + mfc); +} + +INTEGER4 LIBCALL TECTXT100(double *XOrThetaPos, + double *YOrRPos, + double *ZOrUnusedPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + INTEGER4 *Clipping, + char *String, + char *mfc) +{ + return TECTXT112(XOrThetaPos, + YOrRPos, + ZOrUnusedPos, + PosCoordMode, + AttachToZone, + Zone, + BFont, + FontHeightUnits, + FontHeight, + BoxType, + BoxMargin, + BoxLineThickness, + BoxColor, + BoxFillColor, + Angle, + Anchor, + LineSpacing, + TextColor, + Scope, + Clipping, + String, + mfc); +} + +INTEGER4 LIBCALL TECTXT(double *XPos, + double *YPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + char *Text, + char *mfc) +{ + double ZPos = 0.0; + int Clipping = (int)Clipping_ClipToViewport; + return TECTXT112(XPos, + YPos, + &ZPos, + PosCoordMode, + AttachToZone, + Zone, + BFont, + FontHeightUnits, + FontHeight, + BoxType, + BoxMargin, + BoxLineThickness, + BoxColor, + BoxFillColor, + Angle, + Anchor, + LineSpacing, + TextColor, + Scope, + &Clipping, + Text, + mfc); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tectxt112_(double *XOrThetaPos, + double *YOrRPos, + double *ZOrUnusedPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + INTEGER4 *Clipping, + char *String, + char *mfc) +{ + return TECTXT112(XOrThetaPos, + YOrRPos, + ZOrUnusedPos, + PosCoordMode, + AttachToZone, + Zone, + BFont, + FontHeightUnits, + FontHeight, + BoxType, + BoxMargin, + BoxLineThickness, + BoxColor, + BoxFillColor, + Angle, + Anchor, + LineSpacing, + TextColor, + Scope, + Clipping, + String, + mfc); +} + +LIBFUNCTION INTEGER4 LIBCALL tectxt111_(double *XOrThetaPos, + double *YOrRPos, + double *ZOrUnusedPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + INTEGER4 *Clipping, + char *String, + char *mfc) +{ + return TECTXT112(XOrThetaPos, + YOrRPos, + ZOrUnusedPos, + PosCoordMode, + AttachToZone, + Zone, + BFont, + FontHeightUnits, + FontHeight, + BoxType, + BoxMargin, + BoxLineThickness, + BoxColor, + BoxFillColor, + Angle, + Anchor, + LineSpacing, + TextColor, + Scope, + Clipping, + String, + mfc); +} + +LIBFUNCTION INTEGER4 LIBCALL tectxt110_(double *XOrThetaPos, + double *YOrRPos, + double *ZOrUnusedPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + INTEGER4 *Clipping, + char *String, + char *mfc) +{ + return TECTXT112(XOrThetaPos, + YOrRPos, + ZOrUnusedPos, + PosCoordMode, + AttachToZone, + Zone, + BFont, + FontHeightUnits, + FontHeight, + BoxType, + BoxMargin, + BoxLineThickness, + BoxColor, + BoxFillColor, + Angle, + Anchor, + LineSpacing, + TextColor, + Scope, + Clipping, + String, + mfc); +} + +LIBFUNCTION INTEGER4 LIBCALL tectxt100_(double *XOrThetaPos, + double *YOrRPos, + double *ZOrUnusedPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + INTEGER4 *Clipping, + char *String, + char *mfc) +{ + return TECTXT112(XOrThetaPos, + YOrRPos, + ZOrUnusedPos, + PosCoordMode, + AttachToZone, + Zone, + BFont, + FontHeightUnits, + FontHeight, + BoxType, + BoxMargin, + BoxLineThickness, + BoxColor, + BoxFillColor, + Angle, + Anchor, + LineSpacing, + TextColor, + Scope, + Clipping, + String, + mfc); +} + +LIBFUNCTION INTEGER4 LIBCALL tectxt_(double *XPos, + double *YPos, + INTEGER4 *PosCoordMode, + INTEGER4 *AttachToZone, + INTEGER4 *Zone, + INTEGER4 *BFont, + INTEGER4 *FontHeightUnits, + double *FontHeight, + INTEGER4 *BoxType, + double *BoxMargin, + double *BoxLineThickness, + INTEGER4 *BoxColor, + INTEGER4 *BoxFillColor, + double *Angle, + INTEGER4 *Anchor, + double *LineSpacing, + INTEGER4 *TextColor, + INTEGER4 *Scope, + char *Text, + char *mfc) +{ + return TECTXT(XPos, + YPos, + PosCoordMode, + AttachToZone, + Zone, + BFont, + FontHeightUnits, + FontHeight, + BoxType, + BoxMargin, + BoxLineThickness, + BoxColor, + BoxFillColor, + Angle, + Anchor, + LineSpacing, + TextColor, + Scope, + Text, + mfc); +} +#endif + + +/** + * TECFILXXX + */ +INTEGER4 LIBCALL TECFIL112(INTEGER4 *F) +{ + if ((*F < 1) || (*F > MaxNumFiles)) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECFIL112) Invalid file number requested (%d). File not changed.\n", *F); + #endif + return (-1); + } + + if (!IsOpen[*F-1]) + { + #if defined MAKEARCHIVE + int I; + PRINT1("Err: (TECFIL112) file %d is not open. File not changed.\n", *F); + PRINT0("\n\nFile states are:\n"); + for (I = 0; I < MaxNumFiles; I++) + PRINT2("file %d, IsOpen=%d\n", I + 1, IsOpen[I]); + PRINT1("Current File is: %d\n", CurFile + 1); + #endif + return (-1); + } + CurFile = *F - 1; + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + { + PRINT1("Switching to file #%d\n\n", CurFile + 1); + PRINT0("Current State is:\n"); + PRINT1(" Debug = %d\n", DebugLevel[CurFile]); + PRINT1(" NumVars = %d\n", NumVars[CurFile]); + PRINT1(" DestFName = %s\n", DestFName[CurFile]); + PRINT1(" BlckFName = %s\n", BlckFName[CurFile]); + PRINT1(" ZoneType = %s\n", ZoneTypes[ZoneType[CurFile]]); + + if (ZoneType[CurFile] == ORDERED) + { + PRINT1(" IMax = %d\n", IMax[CurFile]); + PRINT1(" JMax = %d\n", JMax[CurFile]); + PRINT1(" KMax = %d\n", KMax[CurFile]); + } + else + { + PRINT1(" NumPoints = %d\n", IMax[CurFile]); + PRINT1(" NumElmnts = %d\n", JMax[CurFile]); + } + PRINT1(" NumDataValuesWritten = %d\n", NumDataValuesWritten[CurFile]); + PRINT1(" CurZone = %d\n", CurZone[CurFile] + 1); + } + #endif /* MAKEARCHIVE */ + return (0); +} + +INTEGER4 LIBCALL TECFIL111(INTEGER4 *F) +{ + return TECFIL112(F); +} + +INTEGER4 LIBCALL TECFIL110(INTEGER4 *F) +{ + return TECFIL112(F); +} + +INTEGER4 LIBCALL TECFIL100(INTEGER4 *F) +{ + return TECFIL112(F); +} + +INTEGER4 LIBCALL TECFIL(INTEGER4 *F) +{ + return TECFIL112(F); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecfil112_(INTEGER4 *F) +{ + return TECFIL112(F); +} + +LIBFUNCTION INTEGER4 LIBCALL tecfil111_(INTEGER4 *F) +{ + return TECFIL112(F); +} + +LIBFUNCTION INTEGER4 LIBCALL tecfil110_(INTEGER4 *F) +{ + return TECFIL112(F); +} + +LIBFUNCTION INTEGER4 LIBCALL tecfil100_(INTEGER4 *F) +{ + return TECFIL112(F); +} + +LIBFUNCTION INTEGER4 LIBCALL tecfil_(INTEGER4 *F) +{ + return TECFIL112(F); +} +#endif + +/** + * TECFOREIGNXXX + */ +void LIBCALL TECFOREIGN112(INTEGER4 *OutputForeignByteOrder) +{ + REQUIRE(VALID_REF(OutputForeignByteOrder)); + + DoWriteForeign = (*OutputForeignByteOrder != 0); +} + +void LIBCALL TECFOREIGN111(INTEGER4 *OutputForeignByteOrder) +{ + TECFOREIGN112(OutputForeignByteOrder); +} + +void LIBCALL TECFOREIGN110(INTEGER4 *OutputForeignByteOrder) +{ + TECFOREIGN112(OutputForeignByteOrder); +} + +void LIBCALL TECFOREIGN100(INTEGER4 *OutputForeignByteOrder) +{ + TECFOREIGN112(OutputForeignByteOrder); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION void LIBCALL tecforeign112_(INTEGER4 *OutputForeignByteOrder) +{ + TECFOREIGN112(OutputForeignByteOrder); +} + +LIBFUNCTION void LIBCALL tecforeign111_(INTEGER4 *OutputForeignByteOrder) +{ + TECFOREIGN112(OutputForeignByteOrder); +} + +LIBFUNCTION void LIBCALL tecforeign110_(INTEGER4 *OutputForeignByteOrder) +{ + TECFOREIGN112(OutputForeignByteOrder); +} + +LIBFUNCTION void LIBCALL tecforeign100_(INTEGER4 *OutputForeignByteOrder) +{ + TECFOREIGN112(OutputForeignByteOrder); +} +#endif + +#if defined MAKEARCHIVE + +/** + * A valid auxiliary data name character must begin with a '_' or alpha + * character and may be followed by one or more '_', '.', alpha or digit + * characters. + */ +static Boolean_t AuxDataIsValidNameChar(char Char, + Boolean_t IsLeadChar) +{ + Boolean_t IsValidNameChar; + + REQUIRE(0 <= Char && "Char <= 127"); + REQUIRE(VALID_BOOLEAN(IsLeadChar)); + + IsValidNameChar = (Char == '_' || + isalpha(Char)); + if (!IsLeadChar) + IsValidNameChar = (IsValidNameChar || + Char == '.' || + isdigit(Char)); + + ENSURE(VALID_BOOLEAN(IsValidNameChar)); + return IsValidNameChar; +} + +/** + * Indicates if the auxiliary data name is valid. A valid auxiliary data name + * must begin with a '_' or alpha character and may be followed by one or + * more '_', '.', alpha or digit characters. + */ +static Boolean_t AuxDataIsValidName(const char *Name) +{ + Boolean_t IsValidName; + const char *NPtr; + REQUIRE(VALID_REF(Name)); + + for (NPtr = Name, IsValidName = AuxDataIsValidNameChar(*NPtr, TRUE); + IsValidName && *NPtr != '\0'; + NPtr++) + { + IsValidName = AuxDataIsValidNameChar(*NPtr, FALSE); + } + + ENSURE(VALID_BOOLEAN(IsValidName)); + return IsValidName; +} + +#endif /* MAKEARCHIVE */ + +/** + * TECAUXSTRXXX + */ +LIBFUNCTION INTEGER4 LIBCALL TECAUXSTR112(char *Name, + char *Value) +{ + if (CheckFile("TECAUXSTR112") < 0) + return (-1); + + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + PRINT2("\nInserting data set aux data: '%s' = '%s'\n", Name, Value); + #endif + + if ((Name == NULL) || !AuxDataIsValidName(Name)) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECAUXSTR112) Invalid Name string\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + if ((Value == NULL) || (*Value == '\0')) + { + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + PRINT0("Err: (TECAUXSTR112) Invalid Value string\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + /* + * Because the auxiliary data is at the end of the header section we don't + * need to seek back to it. + */ + if (!WriteBinaryReal(HeadFile[CurFile], DataSetAuxMarker, FieldDataType_Float) || + !DumpDatafileString(HeadFile[CurFile], Name, TRUE /* WriteBinary */) || + !WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)AuxDataType_String) || + !DumpDatafileString(HeadFile[CurFile], (const char *)Value, TRUE /* WriteBinary */)) + { + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + printf("Err: (TECAUXSTR112) Write failure for file %d\n", CurFile + 1); + #endif + NumErrs[CurFile]++; + return (-1); + } + return (0); +} + +LIBFUNCTION INTEGER4 LIBCALL TECAUXSTR111(char *Name, + char *Value) +{ + return TECAUXSTR112(Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL TECAUXSTR110(char *Name, + char *Value) +{ + return TECAUXSTR112(Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL TECAUXSTR100(char *Name, + char *Value) +{ + return TECAUXSTR112(Name, Value); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecauxstr112_(char *Name, + char *Value) +{ + return TECAUXSTR112(Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL tecauxstr111_(char *Name, + char *Value) +{ + return TECAUXSTR112(Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL tecauxstr110_(char *Name, + char *Value) +{ + return TECAUXSTR112(Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL tecauxstr100_(char *Name, + char *Value) +{ + return TECAUXSTR112(Name, Value); +} +#endif + + +/** + * TECZAUXSTRXXX + */ +LIBFUNCTION INTEGER4 LIBCALL TECZAUXSTR112(char *Name, + char *Value) +{ + if (CheckFile("TECZAUXSTR112") < 0) + return (-1); + + if (CurZone[CurFile] == -1) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECZAUXSTR112) Must call TECZNE112 prior to TECZAUXSTR112\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + PRINT2("\nInserting zone aux data: '%s' = '%s'\n", Name, Value); + #endif + + if ((Name == NULL) || !AuxDataIsValidName(Name)) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECZAUXSTR112) Invalid Name string\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + if ((Value == NULL) || (*Value == '\0')) + { + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + PRINT0("Err: (TECZAUXSTR112) Invalid Value string\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + /* + * Have to back over the 0 already written, then write another one afterward. + */ + if (TP_FSEEK(HeadFile[CurFile]->File, -4, SEEK_CUR) || + !WriteBinaryInt32(HeadFile[CurFile], 1) || + !DumpDatafileString(HeadFile[CurFile], Name, TRUE /* WriteBinary */) || + !WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)AuxDataType_String) || + !DumpDatafileString(HeadFile[CurFile], (const char *)Value, TRUE /* WriteBinary */) || + !WriteBinaryInt32(HeadFile[CurFile], 0)) + { + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + printf("Err: (TECZAUXSTR112) Write failure for file %d\n", CurFile + 1); + #endif + NumErrs[CurFile]++; + return (-1); + } + + return (0); +} + +LIBFUNCTION INTEGER4 LIBCALL TECZAUXSTR111(char *Name, + char *Value) +{ + return TECZAUXSTR112(Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL TECZAUXSTR110(char *Name, + char *Value) +{ + return TECZAUXSTR112(Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL TECZAUXSTR100(char *Name, + char *Value) +{ + return TECZAUXSTR112(Name, Value); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL teczauxstr112_(char *Name, + char *Value) +{ + return TECZAUXSTR112(Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL teczauxstr111_(char *Name, + char *Value) +{ + return TECZAUXSTR112(Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL teczauxstr110_(char *Name, + char *Value) +{ + return TECZAUXSTR112(Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL teczauxstr100_(char *Name, + char *Value) +{ + return TECZAUXSTR112(Name, Value); +} +#endif + + +/** + * TECVAUXSTRXXX + */ +LIBFUNCTION INTEGER4 LIBCALL TECVAUXSTR112(INTEGER4 *Var, + char *Name, + char *Value) +{ + if (CheckFile("TECVAUXSTR112") < 0) + return (-1); + + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + PRINT2("\nInserting variable aux data: '%s' = '%s'\n", Name, Value); + #endif + + if ((Name == NULL) || !AuxDataIsValidName(Name)) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECVAUXSTR112) Invalid Name string\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + if ((Value == NULL) || (*Value == '\0')) + { + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + PRINT0("Err: (TECVAUXSTR112) Invalid Value string\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + if (!WriteBinaryReal(HeadFile[CurFile], VarAuxMarker, FieldDataType_Float) || + !WriteBinaryInt32(HeadFile[CurFile], *Var - 1) || + !DumpDatafileString(HeadFile[CurFile], Name, TRUE /* WriteBinary */) || + !WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)AuxDataType_String) || + !DumpDatafileString(HeadFile[CurFile], (const char *)Value, TRUE /* WriteBinary */)) + { + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + printf("Err: (TECVAUXSTR112) Write failure for file %d\n", CurFile + 1); + #endif + NumErrs[CurFile]++; + return (-1); + } + + return (0); +} + +LIBFUNCTION INTEGER4 LIBCALL TECVAUXSTR111(INTEGER4 *Var, + char *Name, + char *Value) +{ + return TECVAUXSTR112(Var, Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL TECVAUXSTR110(INTEGER4 *Var, + char *Name, + char *Value) +{ + return TECVAUXSTR112(Var, Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL TECVAUXSTR100(INTEGER4 *Var, + char *Name, + char *Value) +{ + return TECVAUXSTR112(Var, Name, Value); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecvauxstr112_(INTEGER4 *Var, + char *Name, + char *Value) +{ + return TECVAUXSTR112(Var, Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL tecvauxstr111_(INTEGER4 *Var, + char *Name, + char *Value) +{ + return TECVAUXSTR112(Var, Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL tecvauxstr110_(INTEGER4 *Var, + char *Name, + char *Value) +{ + return TECVAUXSTR112(Var, Name, Value); +} + +LIBFUNCTION INTEGER4 LIBCALL tecvauxstr100_(INTEGER4 *Var, + char *Name, + char *Value) +{ + return TECVAUXSTR112(Var, Name, Value); +} +#endif + + +/** + * TECFACEXXX + */ +LIBFUNCTION INTEGER4 LIBCALL TECFACE112(INTEGER4 *FaceConnections) +{ + INTEGER4 i, *Ptr; + + /* Mark that the face neighbors have been written for the zone even if it fails so as not to add extra error messages. */ + FaceNeighborsOrMapWritten[CurFile][CurZone[CurFile]] = TRUE; + + if (CheckFile("TECFACE112") < 0) + return (-1); + + if (ZoneType[CurFile] == FEPOLYGON || + ZoneType[CurFile] == FEPOLYHEDRON) + { + /* Wrong way to specify face neighbors for polygons and polyhedrons */ + #if defined MAKEARCHIVE + PRINT0("Err: (TECFACE112) Cannot call TECFACE112 for polygonal or polyhedral zones.\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + if (FileTypes[CurFile] == SOLUTIONFILE) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECFACE112) Cannot call TECFACE112 if the file type is SOLUTIONFILE.\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + PRINT0("\nInserting face neighbor data\n"); + #endif + + if (FaceConnections == NULL) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECFACE112) Invalid array\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + /* + * Face neighbor connection have the following format for both + * binary: + * + * LOCALONETOONE 3 cz,fz,cz + * LOCALONETOMANY nz+4 cz,fz,oz,nz,cz1,cz2,...,czn + * GLOBALONETOONE 4 cz,fz,ZZ,CZ + * GLOBALONETOMANY 2*nz+4 cz,fz,oz,nz,ZZ1,CZ1,ZZ2,CZ2,...,ZZn,CZn + * + * Where: + * cz = cell in current zone + * fz = face of cell in current zone + * oz = face obsuration flag (only applies to one-to-many): + * 0 = face partially obscured + * 1 = face entirely obscured + * nz = number of cell or zone/cell associations (only applies to one-to-many) + * ZZ = remote Zone + * CZ = cell in remote zone + * + * NOTE: + * As of version 103 Tecplot assumes that face neighbors are zero based + * instead of ones based. Since we have to maintain the contract we + * subtract 1 for the caller. + */ + Ptr = FaceConnections; + i = 0; + while (i < NumFaceConnections[CurFile][CurZone[CurFile]]) + { + INTEGER4 n; + INTEGER4 NumNum = 0; + + switch (FaceNeighborMode[CurFile]) + { + case FaceNeighborMode_LocalOneToOne: + NumNum = 3; + i++; + break; + case FaceNeighborMode_LocalOneToMany: + NumNum = 4 + Ptr[3]; + i += Ptr[3]; + break; + case FaceNeighborMode_GlobalOneToOne: + NumNum = 4; + i++; + break; + case FaceNeighborMode_GlobalOneToMany: + NumNum = 4 + 2 * Ptr[3]; + i += Ptr[3]; + break; + default: + CHECK(FALSE); + break; + } + + n = 0; + if (FaceNeighborMode[CurFile] == FaceNeighborMode_LocalOneToMany || + FaceNeighborMode[CurFile] == FaceNeighborMode_GlobalOneToMany) + { + /* + * Write cz,fz,oz,nz: we do this by hand because the oz and nz values + * are not zero based values. + */ + if (!WriteBinaryInt32(BlckFile[CurFile], Ptr[n++] - 1) || /* zero based as of version 103 */ + !WriteBinaryInt32(BlckFile[CurFile], Ptr[n++] - 1) || /* zero based as of version 103 */ + !WriteBinaryInt32(BlckFile[CurFile], Ptr[n++]) || /* ones based */ + !WriteBinaryInt32(BlckFile[CurFile], Ptr[n++])) /* ones based */ + { + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + printf("Err: (TECFACE112) Write failure for file %d\n", CurFile + 1); + #endif + NumErrs[CurFile]++; + return (-1); + } + + } + /* starting from where we left off, output the remaining values */ + for (; n < NumNum; n++) + if (!WriteBinaryInt32(BlckFile[CurFile], Ptr[n] - 1)) /* zero based as of version 103 */ + { + #if defined MAKEARCHIVE + if (DebugLevel[CurFile]) + printf("Err: (TECFACE112) Write failure for file %d\n", CurFile + 1); + #endif + NumErrs[CurFile]++; + return (-1); + } + Ptr += NumNum; + } + + return (0); +} + +LIBFUNCTION INTEGER4 LIBCALL TECFACE111(INTEGER4 *FaceConnections) +{ + return TECFACE112(FaceConnections); +} + +LIBFUNCTION INTEGER4 LIBCALL TECFACE110(INTEGER4 *FaceConnections) +{ + return TECFACE112(FaceConnections); +} + +LIBFUNCTION INTEGER4 LIBCALL TECFACE100(INTEGER4 *FaceConnections) +{ + return TECFACE112(FaceConnections); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecface112_(INTEGER4 *FaceConnections) +{ + return TECFACE112(FaceConnections); +} + +LIBFUNCTION INTEGER4 LIBCALL tecface111_(INTEGER4 *FaceConnections) +{ + return TECFACE112(FaceConnections); +} + +LIBFUNCTION INTEGER4 LIBCALL tecface110_(INTEGER4 *FaceConnections) +{ + return TECFACE112(FaceConnections); +} + +LIBFUNCTION INTEGER4 LIBCALL tecface100_(INTEGER4 *FaceConnections) +{ + return TECFACE112(FaceConnections); +} +#endif + + +/** + * TECPOLYXXX + */ +LIBFUNCTION INTEGER4 LIBCALL TECPOLY112(INTEGER4 *FaceNodeCounts, + INTEGER4 *FaceNodes, + INTEGER4 *FaceLeftElems, + INTEGER4 *FaceRightElems, + INTEGER4 *FaceBndryConnectionCounts, + INTEGER4 *FaceBndryConnectionElems, + INTEGER4 *FaceBndryConnectionZones) +{ + INTEGER4 NumFaces = KMax[CurFile]; + INTEGER4 Result = 0; + LgIndex_t Index; + LgIndex_t MinNeighborValue = TECIO_NO_NEIGHBORING_ELEM; + + /* Mark that the face map has been written for the zone even if it fails so as not to add extra error messages. */ + FaceNeighborsOrMapWritten[CurFile][CurZone[CurFile]] = TRUE; + + if (NumFaces == 0 || + (ZoneType[CurFile] != FEPOLYGON && + ZoneType[CurFile] != FEPOLYHEDRON)) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECPOLY112) The zone type must be FEPOLYGON or FEPOLYHEDRON and have NumFaces (KMax) > 0.\n"); + PRINT1(" NumFaces = %d\n", NumFaces); + #endif + NumErrs[CurFile]++; + return (-1); + } + + if (ZoneType[CurFile] == FEPOLYHEDRON) /* FEPOLYGON doesn't need TotalNumFaceNodes since this is 2*NumFaces */ + { + if (TotalNumFaceNodes[CurFile][CurZone[CurFile]] <= 0) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECPOLY112) TotalNumFaceNodes MUST be specified for polyhedral zones.\n"); + PRINT1(" TotalNumFaceNodes = %d\n", TotalNumFaceNodes[CurFile][CurZone[CurFile]]); + #endif + NumErrs[CurFile]++; + return (-1); + } + } + else + { + if (TotalNumFaceNodes[CurFile][CurZone[CurFile]] != (2 * NumFaces)) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECPOLY112) TotalNumFaceNodes is specified for the polygonal zone but is not equal to 2 * NumFaces.\n"); + PRINT2(" TotalNumFaceNodes = %d. If specified, it must be 2 * %d.", TotalNumFaceNodes[CurFile][CurZone[CurFile]], NumFaces); + #endif + NumErrs[CurFile]++; + return (-1); + } + } + + if ((TotalNumFaceBndryFaces[CurFile] > 0 && + TotalNumFaceBndryConns[CurFile] > 0) || + (TotalNumFaceBndryFaces[CurFile] == 0 && + TotalNumFaceBndryConns[CurFile] == 0)) + { + if (TotalNumFaceBndryFaces[CurFile] > 0) + MinNeighborValue = -TotalNumFaceBndryFaces[CurFile]; + } + else + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECPOLY112) TotalNumFaceBndryFaces and TotalNumFaceBndryConns must both be 0 or both be > 0.\n"); + PRINT2(" TotalNumFaceBndryFaces = %d, TotalNumFaceBndryConns = %d\n", TotalNumFaceBndryFaces[CurFile], TotalNumFaceBndryConns[CurFile]); + #endif + NumErrs[CurFile]++; + return (-1); + } + + /* Write the facenodesoffsets array from the facenodecounts array. */ + if (Result == 0) + { + if (ZoneType[CurFile] == FEPOLYHEDRON) /* FEPOLYGON doesn't need to specify facenodesoffsets */ + { + Int32_t FaceNodeSum = 0; + if (!WriteBinaryInt32(BlckFile[CurFile], 0)) + Result = -1; + for (Index = 0; (Result == 0) && (Index < NumFaces); Index++) + { + FaceNodeSum += FaceNodeCounts[Index]; + if (FaceNodeCounts[Index] < 3) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECPOLY112) Invalid face node count value at face %d. There must be at least 3 nodes in a face.\n", Index + 1); + PRINT1(" Face node count value = %d.\n", FaceNodeCounts[Index]); + #endif + NumErrs[CurFile]++; + return (-1); + } + else if (FaceNodeSum > TotalNumFaceNodes[CurFile][CurZone[CurFile]]) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECPOLY112) The running face node count exceeds the TotalNumFaceNodes (%d) specified.\n", TotalNumFaceNodes[CurFile][CurZone[CurFile]]); + PRINT1(" Face node count value = %d.\n", FaceNodeCounts[Index]); + #endif + NumErrs[CurFile]++; + return (-1); + } + else if (!WriteBinaryInt32(BlckFile[CurFile], FaceNodeSum)) + Result = -1; + } + } + } + + /* Write the facenodes array but convert 1-based to 0-based. */ + for (Index = 0; (Result == 0) && (Index < TotalNumFaceNodes[CurFile][CurZone[CurFile]]); Index++) + { + if (FaceNodes[Index] < 1 || + FaceNodes[Index] > IMax[CurFile]) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECPOLY112) Invalid face node value at node %d:\n", Index + 1); + PRINT2(" face node value = %d, valid values are are 1 to %d (inclusive).\n", FaceNodes[Index], IMax[CurFile]); + #endif + NumErrs[CurFile]++; + return (-1); + } + else if (!WriteBinaryInt32(BlckFile[CurFile], FaceNodes[Index] - 1)) + Result = -1; + } + + /* Write the left elements array but convert 1-based to 0-based. */ + for (Index = 0; (Result == 0) && (Index < NumFaces); Index++) + { + if (FaceLeftElems[Index] < MinNeighborValue || + FaceLeftElems[Index] > JMax[CurFile]) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECPOLY112) Invalid left neighbor value at face %d:\n", Index); + PRINT2(" left neighbor value = %d, min value = %d,", FaceLeftElems[Index], MinNeighborValue); + PRINT1(" max value = %d.\n", JMax[CurFile]); + #endif + NumErrs[CurFile]++; + return (-1); + } + else if (!WriteBinaryInt32(BlckFile[CurFile], FaceLeftElems[Index] - 1)) + Result = -1; + } + /* Write the right elements array but convert 1-based to 0-based. */ + for (Index = 0; (Result == 0) && (Index < NumFaces); Index++) + { + if (FaceRightElems[Index] < MinNeighborValue || + FaceRightElems[Index] > JMax[CurFile]) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECPOLY112) Invalid right neighbor value at face %d:\n", Index); + PRINT2(" right neighbor value = %d, min value = %d,", FaceRightElems[Index], MinNeighborValue); + PRINT1(" max value = %d.\n", JMax[CurFile]); + #endif + NumErrs[CurFile]++; + return (-1); + } + else if (!WriteBinaryInt32(BlckFile[CurFile], FaceRightElems[Index] - 1)) + Result = -1; + + if (Result == 0 && + (FaceLeftElems[Index] == TECIO_NO_NEIGHBORING_ELEM && + FaceRightElems[Index] == TECIO_NO_NEIGHBORING_ELEM)) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECPOLY112) Both left and right neighbors are set to no neighboring element at face %d.\n", Index); + #endif + NumErrs[CurFile]++; + return (-1); + } + } + + /* Write the boundary arrays. */ + if (Result == 0 && TotalNumFaceBndryFaces[CurFile] > 0) + { + /* Write the boundaryconnectionoffsets array from the boundaryconnectioncounts array. */ + + /* + * As a convenience for the ASCII format, TecUtil, and TECIO layers if any + * boundary connections exists we automatically add a no-neighboring + * connection as the first item so that they can user 0 for no-neighboring + * element in the element list regardless if they have boundary connections + * or not. + * + * The first 2 offsets are always 0 so that -1 in the left/right element + * arrays always indicates "no neighboring element". + */ + if (!(WriteBinaryInt32(BlckFile[CurFile], 0) && + WriteBinaryInt32(BlckFile[CurFile], 0))) + Result = -1; + + Int32_t BndryConnCount = 0; + for (Index = 0; (Result == 0) && (Index < TotalNumFaceBndryFaces[CurFile]); Index++) + { + BndryConnCount += FaceBndryConnectionCounts[Index]; + if (FaceBndryConnectionCounts[Index] < 0 || + BndryConnCount > TotalNumFaceBndryConns[CurFile]) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECPOLY112) Invalid boundary connection count at boundary face %d:\n", Index + 1); + PRINT1(" boundary connection count = %d.\n", FaceBndryConnectionCounts[Index]); + #endif + NumErrs[CurFile]++; + return (-1); + } + else if (!WriteBinaryInt32(BlckFile[CurFile], BndryConnCount)) + Result = -1; + } + if (BndryConnCount != TotalNumFaceBndryConns[CurFile]) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECPOLY112) Invalid number of boundary connections:\n"); + PRINT2(" number of boundary connections written = %d, total number of boundary connections = %d.", + BndryConnCount, TotalNumFaceBndryConns[CurFile]); + #endif + NumErrs[CurFile]++; + return (-1); + } + + /* Write the boundary connection elements but convert 1-based to 0-based. */ + BndryConnCount = 0; + for (Index = 0; (Result == 0) && (Index < TotalNumFaceBndryFaces[CurFile]); Index++) + { + for (LgIndex_t BIndex = 0; (Result == 0) && (BIndex < FaceBndryConnectionCounts[Index]); BIndex++) + { + if (BIndex > 0 && + FaceBndryConnectionElems[BndryConnCount] == TECIO_NO_NEIGHBORING_ELEM) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECPOLY112) Partially obscured faces must specify no neighboring element first. See boundary connections for face %d.\n", Index + 1); + #endif + NumErrs[CurFile]++; + return (-1); + } + if (FaceBndryConnectionElems[BndryConnCount] < TECIO_NO_NEIGHBORING_ELEM) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECPOLY112) Invalid boundary element value at boundary connections for face %d:\n", Index + 1); + #endif + NumErrs[CurFile]++; + return (-1); + } + if (FaceBndryConnectionElems[BndryConnCount] == TECIO_NO_NEIGHBORING_ELEM && + FaceBndryConnectionZones[BndryConnCount] != TECIO_NO_NEIGHBORING_ZONE) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECPOLY112) Invalid boundary element/zone pair at boundary connections for face %d:\n", Index + 1); + PRINT0(" Boundary elements specified as no neighboring element must also specify no neighboring zone.\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + else if (!WriteBinaryInt32(BlckFile[CurFile], FaceBndryConnectionElems[BndryConnCount] - 1)) + Result = -1; + BndryConnCount++; + } + } + + /* Write the boundary connection zones but convert 1-based to 0-based. */ + BndryConnCount = 0; + for (Index = 0; (Result == 0) && (Index < TotalNumFaceBndryFaces[CurFile]); Index++) + { + for (LgIndex_t BIndex = 0; (Result == 0) && (BIndex < FaceBndryConnectionCounts[Index]); BIndex++) + { + if (FaceBndryConnectionZones[BndryConnCount] < TECIO_NO_NEIGHBORING_ZONE) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECPOLY112) Invalid boundary zone value at boundary connections for face %d:\n", Index + 1); + #endif + NumErrs[CurFile]++; + return (-1); + } + else if (!WriteBinaryInt32(BlckFile[CurFile], FaceBndryConnectionZones[BndryConnCount] - 1)) + Result = -1; + BndryConnCount++; + } + } + } + if (Result != 0) + { + Result = -1; + WriteErr("TECPOLY112"); + } + + return Result; +} + +#if !defined INDEX_16_BIT // not supported in this test-only mode +LIBFUNCTION INTEGER4 LIBCALL TECPOLY111(INTEGER4 *FaceNodeCounts, + INTEGER4 *FaceNodes, + INTEGER4 *FaceLeftElems, + INTEGER4 *FaceRightElems, + INTEGER4 *FaceBndryConnectionCounts, + INTEGER4 *FaceBndryConnectionElems, + INTEGER2 *FaceBndryConnectionZones) +{ + INTEGER4 Result = 0; + EntIndex_t *FBCZones = NULL; + + if (TotalNumFaceBndryConns[CurFile] > 0) + { + ALLOC_ARRAY(TotalNumFaceBndryConns[CurFile], EntIndex_t, "32-bit FaceBndryConnectionZones"); + + if (FBCZones != NULL) + { + for (LgIndex_t ZoneI = 0; ZoneI < TotalNumFaceBndryFaces[CurFile]; ZoneI++) + FBCZones[ZoneI] = (EntIndex_t)FaceBndryConnectionZones[ZoneI]; + } + else + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECPOLY111) Out of memory allocating temporary data.\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + } + + Result = TECPOLY112(FaceNodeCounts, + FaceNodes, + FaceLeftElems, + FaceRightElems, + FaceBndryConnectionCounts, + FaceBndryConnectionElems, + FBCZones); + + if (FBCZones != NULL) + FREE_ARRAY(FBCZones, "32-bit FaceBndryConnectionZones"); + + return Result; +} +#endif // INDEX_16_BIT -- not supported in this test-only mode + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecpoly112_(INTEGER4 *FaceNodeCounts, + INTEGER4 *FaceNodes, + INTEGER4 *FaceLeftElems, + INTEGER4 *FaceRightElems, + INTEGER4 *FaceBndryConnectionOffsets, + INTEGER4 *FaceBndryConnectionElems, + INTEGER4 *FaceBndryConnectionZones) +{ + return TECPOLY112(FaceNodeCounts, + FaceNodes, + FaceLeftElems, + FaceRightElems, + FaceBndryConnectionOffsets, + FaceBndryConnectionElems, + FaceBndryConnectionZones); +} + +LIBFUNCTION INTEGER4 LIBCALL tecpoly111_(INTEGER4 *FaceNodeCounts, + INTEGER4 *FaceNodes, + INTEGER4 *FaceLeftElems, + INTEGER4 *FaceRightElems, + INTEGER4 *FaceBndryConnectionOffsets, + INTEGER4 *FaceBndryConnectionElems, + INTEGER2 *FaceBndryConnectionZones) +{ + return TECPOLY111(FaceNodeCounts, + FaceNodes, + FaceLeftElems, + FaceRightElems, + FaceBndryConnectionOffsets, + FaceBndryConnectionElems, + FaceBndryConnectionZones); +} +#endif + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio2009.zip b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio2009.zip new file mode 100644 index 0000000000000000000000000000000000000000..cf5c035ce90eb3b71fd8fdc94d874a6cf1b5abbf Binary files /dev/null and b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio2009.zip differ