diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/Runmake b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/Runmake index 94564a255..b21af93a7 100755 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/Runmake +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/Runmake @@ -1,4 +1,3 @@ -#!/bin/sh MAKEWHAT= EXTRAFLAGS= @@ -8,14 +7,14 @@ skipcompile=n if test $# -ge 1 ; then Platname=$1 shift - while test $# -ge 1 + 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 + MAKEWHAT=libtecio.a else EXTRAFLAGS="$EXTRAFLAGS $1" fi @@ -25,7 +24,7 @@ else echo "Choose platform:" echo " " echo " macux.104" - echo " macix64.105" + echo " macix64.106" echo " sgix.62" echo " sgix3.62" echo " sgix.65" @@ -45,23 +44,24 @@ else echo " hp7xx64.11" echo " hpi64.11" echo " linux.24" - echo " linuxi64.24" + echo " linux64.26" echo " linux.22" echo " linuxa.22" - echo " linuxg248x64.26" - echo " linuxg27x64.26" + echo " linux32-centos4.8" + echo " linux64-sled10.4" + echo " linuxg29x64.26" echo " crayc90" echo "->\c" read Platname echo "Choose:" - echo " 1. Make tecio.a only" - echo " 2. Make tecio.a and pltview" + echo " 1. Make libtecio.a only" + echo " 2. Make libtecio.a and pltview" read choice - if test $choice -eq 1 ;then - MAKEWHAT=tecio.a + if test $choice -eq 1 ;then + MAKEWHAT=libtecio.a fi fi @@ -72,18 +72,32 @@ AR=ar ARFLAGS=qv DISTSUBDIR2= +# +# The blah-64 platforms are 64-bit builds of tecio, typically on 32-bit +# platforms. +# case $Platname in - mac*) CCOMP=g++ - FINALCFLAGS="-arch ppc -arch i386 -arch ppc64 -arch x86_64 -DDARWIN -DLONGIS64 -I/usr/X11R6/include" + macix64*) CCOMP=g++ + FINALCFLAGS="-arch x86_64 -DDARWIN -DMAC64 -I/usr/X11R6/include" STRIPFLAG=-Wl,-x - LINKFLAGS="-arch ppc -arch i386 -arch ppc64 -arch x86_64" + LINKFLAGS="-arch x86_64" + ;; + macux*-64) CCOMP=g++ + FINALCFLAGS="-arch ppc64 -arch x86_64 -DDARWIN -DMAC64 -I/usr/X11R6/include" + STRIPFLAG=-Wl,-x + LINKFLAGS="-arch ppc64 -arch x86_64" + ;; + macux*) CCOMP=g++ + FINALCFLAGS="-arch ppc -arch i386 -DDARWIN -I/usr/X11R6/include" + STRIPFLAG=-Wl,-x + LINKFLAGS="-arch ppc -arch i386" ;; sgix.65-64) CCOMP=CC - FINALCFLAGS="-DIRISX -DLONGIS64 -mips4 -64" + FINALCFLAGS="-DIRISX -mips4 -64" LINKFLAGS="-mips4 -64" ;; sgix64.65) CCOMP=CC - FINALCFLAGS="-DIRISX -DLONGIS64 -mips4 -64" + FINALCFLAGS="-DIRISX -mips4 -64" LINKFLAGS="-mips4 -64" ;; sgix.65) CCOMP=CC @@ -95,7 +109,7 @@ case $Platname in LINKFLAGS="-o32" ;; sgix.62-64) CCOMP=CC - FINALCFLAGS="-DIRISX -DIRIX62 -DLONGIS64 -mips4 -64" + FINALCFLAGS="-DIRISX -DIRIX62 -mips4 -64" LINKFLAGS="-mips4 -64" ;; sgix.62) CCOMP=CC @@ -114,42 +128,45 @@ case $Platname in FINALCFLAGS=-DIBMRS6000X ;; ibmx64.*) CCOMP=xlC - FINALCFLAGS="-DIBMRS6000X -DLONGIS64 -q64" + FINALCFLAGS="-DIBMRS6000X -q64" ARFLAGS="-X64 qv" ;; compaq.51) CCOMP=cxx - FINALCFLAGS="-DCOMPAQX -I/usr/include -ieee_with_inexact" + FINALCFLAGS="-DCOMPAQX -I/usr/include -ieee_with_inexact" ;; decalpha.32)CCOMP=cc - FINALCFLAGS="-DDECALPHAX -I/usr/include -ieee_with_inexact" + 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" + FINALCFLAGS="+DD64 +DS2.0 -AA -DHPX -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" + FINALCFLAGS="+DA2.0W +DD64 +DS2.0W -AA -DHPX -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" + FINALCFLAGS="+DD64 -AA -DHPX -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" + FINALCFLAGS="+DAportable -AA -DHPX -I/usr/include/X11R6 -I/usr/include/Motif2.1" LINKFLAGS="+DAportable" ;; crayc90) CCOMP=cc - FINALCFLAGS="-DCRAY -DUNIXX" + FINALCFLAGS="-DCRAY -DUNIXX" ;; - linux*i64.*)CCOMP=g++ - FINALCFLAGS="-fPIC -DLINUX -DLINUXI64" - ;; - linux*64.*) CCOMP=g++ - FINALCFLAGS="-fPIC -DLINUX -DLINUX64" +linux.64-gcc4.2.4.26) # + # Special custom build for synopsys. Run Runmake directly on satsop. + # + CCOMP=/usr/local/gcc-4.2.2/bin/g++ + FINALCFLAGS="-fPIC -DLINUX -DLINUX64" + ;; + linux*64*) CCOMP=g++ + FINALCFLAGS="-fPIC -DLINUX -DLINUX64" ;; linux*) CCOMP=g++ - FINALCFLAGS="-fPIC -DLINUX" + 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" @@ -173,28 +190,28 @@ case $Platname in 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" + FINALCFLAGS="-DSUNSOLARISX -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" + FINALCFLAGS="-DSUNSOLARISX -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" + FINALCFLAGS="-DSUNSOLARISX -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" + FINALCFLAGS="-DSUN -DSUNSOLARISX -I/usr/openwin/include -I/usr/dt/include" MAKECMD=/usr/ccs/bin/make AR=/opt/SUNWspro/bin/CC ARFLAGS="-xar -o" @@ -223,7 +240,7 @@ 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" +# $MAKECMD $MAKEWHAT AR=$AR CC=$CCOMP LINKFLAGS="$LINKFLAGS" STRIPFLAG=$STRIPFLAG CFLAGS="$EXTRAFLAGS -DUSEENUM -DTHREED $FINALCFLAGS" # # # @@ -260,18 +277,18 @@ 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; +echo "$AR $ARFLAGS libtecio.a $OBJLIST" +$AR $ARFLAGS libtecio.a $OBJLIST +if test -f /bin/ranlib ; then + /bin/ranlib libtecio.a; +elif test -f /usr/bin/ranlib ; then + /usr/bin/ranlib libtecio.a; +elif test -f /usr/ucb/ranlib ; then + /usr/ucb/ranlib libtecio.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 +echo "$CCOMP $FINALCFLAGS pltview.o libtecio.a $LINKFLAGS $LINKLIBS $STRIPFLAG -lm -o pltview" +$CCOMP $FINALCFLAGS pltview.o libtecio.a $LINKFLAGS $LINKLIBS $STRIPFLAG -lm -o pltview diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/Makefile deleted file mode 100644 index 3fa4b11f3..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# 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 index 432022be5..0fdc9a22e 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/arrow.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/arrow/arrow.cpp @@ -31,10 +31,8 @@ int main() &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 @@ -106,7 +104,6 @@ int main() ValueLocation, NULL, &SharConn); - /* DOCEND */ /* DOCSTART:arrow_tecdat_rect.txt*/ @@ -137,7 +134,6 @@ int main() P_Rect[0] = 10; - INTEGER4 IsDouble = 1; I = TECDAT112(&NumPts_Rect, X_Rect, &IsDouble); I = TECDAT112(&NumPts_Rect, Y_Rect, &IsDouble); @@ -146,7 +142,6 @@ int main() /* 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 @@ -160,21 +155,21 @@ int main() 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. - * ------------ - */ + * 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]; @@ -202,7 +197,7 @@ int main() FaceNodes_Rect[14] = 7; FaceNodes_Rect[15] = 3; -//Nodes for Face 5 + //Nodes for Face 5 FaceNodes_Rect[16] = 6; FaceNodes_Rect[17] = 2; FaceNodes_Rect[18] = 1; @@ -247,6 +242,12 @@ int main() * in Zone 5. */ FaceLeftElems_Rect[3] = -1; + + I = TECPOLYFACE112(&NumFaces_Rect, + FaceNodeCounts_Rect, + FaceNodes_Rect, + FaceLeftElems_Rect, + FaceRightElems_Rect); /* DOCEND */ /* DOCSTART:arrow_tecpoly_rect.txt*/ @@ -276,13 +277,10 @@ int main() FaceBndryConnElems_Rect[0] = 1; FaceBndryConnZones_Rect[0] = 2; - I = TECPOLY112(FaceNodeCounts_Rect, - FaceNodes_Rect, - FaceLeftElems_Rect, - FaceRightElems_Rect, - FaceBndryConnCounts_Rect, - FaceBndryConnElems_Rect, - FaceBndryConnZones_Rect); + I = TECPOLYBCONN112(&NumConnBndryFaces_Rect, + FaceBndryConnCounts_Rect, + FaceBndryConnElems_Rect, + FaceBndryConnZones_Rect); /* cleanup */ delete X_Rect; @@ -359,13 +357,10 @@ int main() /* 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++) @@ -438,7 +433,7 @@ int main() FaceNodes_Prism[13] = 4; FaceNodes_Prism[14] = 6; -//Nodes for Face 5 + //Nodes for Face 5 FaceNodes_Prism[15] = 1; FaceNodes_Prism[16] = 2; FaceNodes_Prism[17] = 3; @@ -470,10 +465,15 @@ int main() * element and zone for a face. */ FaceLeftElems_Prism[0] = -1; + + I = TECPOLYFACE112(&NumFaces_Prism, + FaceNodeCounts_Prism, + FaceNodes_Prism, + FaceLeftElems_Prism, + FaceRightElems_Prism); /* DOCEND */ /* DOCSTART:arrow_tecpoly_prism.txt*/ - INTEGER4 *FaceBndryConnCounts_Prism = new INTEGER4[NumConnBndryFaces_Prism]; FaceBndryConnCounts_Prism[0] = 2; @@ -500,13 +500,10 @@ int main() FaceBndryConnElems_Prism[1] = 1; FaceBndryConnZones_Prism[1] = 1; - I = TECPOLY112(FaceNodeCounts_Prism, - FaceNodes_Prism, - FaceLeftElems_Prism, - FaceRightElems_Prism, - FaceBndryConnCounts_Prism, - FaceBndryConnElems_Prism, - FaceBndryConnZones_Prism); + I = TECPOLYBCONN112(&NumConnBndryFaces_Prism, + FaceBndryConnCounts_Prism, + FaceBndryConnElems_Prism, + FaceBndryConnZones_Prism); /* cleanup */ delete X_Prism; diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/Makefile deleted file mode 100644 index 2c6009b07..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# 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.f b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.f index 6e6829a6e..21f2b045f 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.f +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.f @@ -1,8 +1,8 @@ -C +C C Complex example FORTRAN program to write a C binary data file for Tecplot. This example C does the following: -C +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 @@ -16,12 +16,17 @@ 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 +C Program ComplexTest +C This code was written for FORTRAN77 compilers. If you are using a +C FORTRAN90/95 compiler, we recommend using the .f90 source code files. +C Otherwise, you will need to alter the include statement below to include +C tecio.for instead of tecio.inc. + Include "tecio.inc" - REAL*4 X(4,5), Y(4,5), P(4,5) + 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)) @@ -56,7 +61,7 @@ C NullPtr = 0 C C Open field.plt and write the header information. -C +C I = TECINI112('DATASET WITH 1 ORDERED ZONE, '// & '1 QUAD ZONE OVER 2 TIME STEPS'//NULCHAR, & 'X Y P'//NULCHAR, @@ -65,9 +70,9 @@ C & FileType, & Debug, & VIsDouble) -C +C C Open line.plt and write the header information. -C +C VIsDouble = 1 I = TECINI112('DATASET WITH ONE I-ORDERED ZONE'//NULCHAR, & 'X Y'//NULCHAR, @@ -77,9 +82,9 @@ C & Debug, & VIsDouble) -C +C C Calculate values for the field variables. -C +C Do 10 J = 1,5 Do 10 I = 1,4 X(I,J) = I @@ -87,15 +92,15 @@ C P(I,J) = I*J 10 Continue -C +C C Make sure writing to file #1. -C +C III = 1 I = TECFIL112(III) -C +C C Write the zone header information for the ordered zone. -C +C IMax = 4 JMax = 5 KMax = 1 @@ -124,31 +129,31 @@ C & Null, ! ShareVarFromZone & 0) ! ShareConnectivityFromZone) -C +C C Write out the field data for the ordered zone. -C +C III = IMax*JMax I = TECDAT112(III,X,DIsDouble) I = TECDAT112(III,Y,DIsDouble) I = TECDAT112(III,P,DIsDouble) -C +C C Calculate values for the I-ordered zone. -C +C Do 20 I = 1,50 XL(I) = I YL(I) = sin(I/20.0) 20 Continue -C +C C Switch to the 'line.plt' file (file number 2) C and write out the line plot data. -C +C III = 2 I = TECFIL112(III) -C +C C Write the zone header information for the XY-data. -C +C IMax = 50 JMax = 1 KMax = 1 @@ -175,18 +180,18 @@ C & Null, & Null, & 0) -C +C C Write out the line plot. -C +C DIsDouble = 1 III = IMax I = TECDAT112(III,XLDummy,DIsDouble) I = TECDAT112(III,YLDummy,DIsDouble) -C +C C Switch back to the field plot file and write out C the finite-element zone. -C +C III = 1 I = TECFIL112(III) C @@ -198,12 +203,12 @@ C Y(I,J) = J P(I,J) = I*J 30 Continue -C +C C Write the zone header information for the finite-element zone. -C - NPts = 20 - NElm = 12 - KMax = 1 +C + NPts = 20 + NElm = 12 + KMax = 1 SolTime = 10.0 StrandID = 2 I = TECZNE112('Finite Zone 1'//NULCHAR, @@ -227,9 +232,9 @@ C & Null, & Null, & 0) -C +C C Write out the field data for the finite-element zone. -C +C IMax = 4 JMax = 5 III = IMax*JMax @@ -238,11 +243,11 @@ C I = TECDAT112(III,Y,DIsDouble) I = TECDAT112(III,P,DIsDouble) -C +C C Calculate and then write out the connectivity list. C Note: The NM array references cells starting with C offset of 1. -C +C Do 40 I = 1,IMax-1 Do 40 J = 1,JMax-1 @@ -348,30 +353,30 @@ C DIsDouble = 0 I = TECDAT112(III,P,DIsDouble) -C +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 +C + XP = 50 + YP = 50 FH = 5 - Scope = 1 + Scope = 1 Clipping = 0 - PositionCoordSys = 1 - FontType = 1 - HeightUnits = 1 + PositionCoordSys = 1 + FontType = 1 + HeightUnits = 1 AttachToZone = 0 Zone = 0 - BoxType = 0 + BoxType = 0 BoxMargin = 5.0 BoxLineThickness = 0.5 BoxColor = 3 BoxFillColor = 7 TextAngle = 0.0 - Anchor = 0 + Anchor = 0 LineSpacing = 1.5 - TextColor = 0 - + TextColor = 0 + III = TECTXT112(XP, & YP, & 0.0d0, @@ -395,11 +400,11 @@ C & 'Hi Mom'//NULCHAR, & NULCHAR) -C -C Prepare to write out geometry record (circle). Circle is +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 +C XP = 25 @@ -408,8 +413,8 @@ C IsFilled = 0 Color = 0 FillColor = 7 - GeomType = 2 - LinePattern = 1 + GeomType = 2 + LinePattern = 1 LineThickness = 0.3 PatternLength = 1 NumEllipsePts = 72 @@ -419,12 +424,12 @@ C ArrowheadAngle = 15.0 NumSegments = 1 NumSegPts(1) = 1 - + XGeomData(1) = 30 YGeomData(1) = 0.0 ZGeomData(1) = 0.0 - - + + III = TECGEO112(XP, & YP, & ZP, @@ -451,17 +456,17 @@ C & YGeomData, & ZGeomData, & NULCHAR) - -C + +C C Close out file 1. -C - I = TECEND112() +C + I = TECEND112() -C +C C Close out file 2. -C +C III = 2 I = TECFIL112(III) - I = TECEND112() + 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 index e4ea70982..56b3d560c 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.f90 +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtest.f90 @@ -1,8 +1,8 @@ -! +! ! 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 @@ -16,19 +16,19 @@ ! 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*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 IMax,JMax,KMax,NM(4,12) INTEGER*4 StrandID,ParentZn INTEGER*4 SharingZone(3) REAL*8 XP, YP, ZP, FH, LineSpacing, PatternLength @@ -56,7 +56,7 @@ 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, & @@ -65,9 +65,9 @@ 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, & @@ -77,9 +77,9 @@ Debug, & VIsDouble) -! +! ! Calculate values for the field variables. -! +! Do 10 J = 1,5 Do 10 I = 1,4 X(I,J) = I @@ -87,22 +87,22 @@ 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, & + I = TECZNE112('Ordered Zone 1'//NULCHAR, & 0, & ! ZONETYPE IMax, & JMax, & @@ -124,31 +124,31 @@ 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 @@ -175,18 +175,18 @@ 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) ! @@ -198,12 +198,12 @@ 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 +! + NPts = 20 + NElm = 12 + KMax = 1 SolTime = 10.0 StrandID = 2 I = TECZNE112('Finite Zone 1'//NULCHAR, & @@ -227,9 +227,9 @@ Null, & Null, & 0) -! +! ! Write out the field data for the finite-element zone. -! +! IMax = 4 JMax = 5 III = IMax*JMax @@ -238,11 +238,11 @@ 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 @@ -348,30 +348,30 @@ 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 +! + XP = 50 + YP = 50 FH = 5 - Scope = 1 + Scope = 1 Clipping = 0 - PositionCoordSys = 1 - FontType = 1 - HeightUnits = 1 + PositionCoordSys = 1 + FontType = 1 + HeightUnits = 1 AttachToZone = 0 Zone = 0 - BoxType = 0 + BoxType = 0 BoxMargin = 5.0 BoxLineThickness = 0.5 BoxColor = 3 BoxFillColor = 7 TextAngle = 0.0 - Anchor = 0 + Anchor = 0 LineSpacing = 1.5 - TextColor = 0 - + TextColor = 0 + III = TECTXT112(XP, & YP, & 0.0d0, & @@ -395,11 +395,11 @@ 'Hi Mom'//NULCHAR, & NULCHAR) -! -! Prepare to write out geometry record (circle). Circle is +! +! 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 @@ -408,8 +408,8 @@ IsFilled = 0 Color = 0 FillColor = 7 - GeomType = 2 - LinePattern = 1 + GeomType = 2 + LinePattern = 1 LineThickness = 0.3 PatternLength = 1 NumEllipsePts = 72 @@ -419,12 +419,12 @@ ArrowheadAngle = 15.0 NumSegments = 1 NumSegPts(1) = 1 - + XGeomData(1) = 30 YGeomData(1) = 0.0 ZGeomData(1) = 0.0 - - + + III = TECGEO112(XP, & YP, & ZP, & @@ -451,17 +451,17 @@ YGeomData, & ZGeomData, & NULCHAR) - -! + +! ! Close out file 1. -! - I = TECEND112() +! + I = TECEND112() -! +! ! Close out file 2. -! +! III = 2 I = TECFIL112(III) - I = TECEND112() + 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 index 502224310..23da375e8 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtestc.vcproj +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtestc.vcproj @@ -1,346 +1,346 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtestf.vfproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtestf.vfproj index dc894475f..14510fbcf 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtestf.vfproj +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/comtest/comtestf.vfproj @@ -6,19 +6,19 @@ - + - + - + - + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/Makefile deleted file mode 100644 index cc8b9bf18..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/faceneighbors/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# 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/gridsolution/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/Makefile deleted file mode 100644 index d901ed95c..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# 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 index f96035715..03b32e9c3 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/gridsolution.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/gridsolution.cpp @@ -89,7 +89,6 @@ int main() /* DOCEND */ /* DOCSTART:gridsolution_grid_tecdat.txt*/ - /* TECDAT Parameters */ double Phi = 0.5 * (1.0 + sqrt(5.0)); double Pi = 3.141592653578; @@ -105,8 +104,8 @@ int main() Z[Count] = Phi + 1.0; Count++; - X[Count] = -X[Count - 1]; - Y[Count] = -Y[Count - 1]; + X[Count] = -X[Count - 1]; + Y[Count] = -Y[Count - 1]; Z[Count] = -Z[Count - 1]; Count++; @@ -115,26 +114,25 @@ int main() Z[Count] = Phi - 1.0; Count++; - X[Count] = -X[Count - 1]; - Y[Count] = -Y[Count - 1]; + 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 */ + /* TecPolyFace Parameters */ /* Create a FaceNodes array, dimensioned by the total number * of face nodes in the zone. @@ -225,7 +223,6 @@ int main() FaceNodes[n++] = 9; FaceNodes[n++] = 13; FaceNodes[n++] = 17; - /* DOCEND */ /* Specify the number of nodes for each face, and the right and @@ -277,21 +274,17 @@ int main() FaceLeftElems[10] = 0; FaceLeftElems[11] = 1; - I = TECPOLY112(FaceNodeCounts, - FaceNodes, - FaceLeftElems, - FaceRightElems, - NULL, /* No boundary connections. */ - NULL, - NULL); + I = TECPOLYFACE112(&NumFaces, + FaceNodeCounts, + FaceNodes, + FaceLeftElems, + FaceRightElems); delete FaceNodes; delete FaceLeftElems; delete FaceRightElems; - /* DOCEND */ - /* DOCSTART:gridsolution_grid_tecend.txt*/ I = TECEND112(); /* DOCEND */ @@ -348,7 +341,6 @@ int main() /* DOCEND */ /* DOCSTART:gridsolution_solution_tecdat.txt*/ - /* TECDAT Parameters */ double *P = new double[NumPts]; double *T = new double[NumPts]; @@ -364,13 +356,12 @@ int main() 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 index f18aecfae..7e333fd22 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/gridsolution.vcproj +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/gridsolution/gridsolution.vcproj @@ -1,321 +1,321 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/Makefile deleted file mode 100644 index 90411d11e..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/ij_ordered/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# 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/multiplefiles/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/Makefile deleted file mode 100644 index d55d2ee04..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplefiles/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# 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/multiplepolygons/HexagonsAndOctagon.plt b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/HexagonsAndOctagon.plt index 3b4f3042c..90bf00c6d 100644 Binary files a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/HexagonsAndOctagon.plt 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 deleted file mode 100644 index d11ec5afd..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# 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 index 25632634f..5b2bc6ffd 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/multiplepolygons.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/multiplepolygons/multiplepolygons.cpp @@ -1,6 +1,6 @@ -/* 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 +/* This example illustrates using TecPolyFace and TecPolyBConn 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. */ @@ -38,12 +38,12 @@ int main() /* TECZNE Parameters */ INTEGER4 ZoneType = 6; /* FE Polygon */ INTEGER4 NumPts_Z1 = 13; /* the number of unique - * nodes in the zone. - */ + * nodes in the zone. + */ INTEGER4 NumElems_Z1 = 3; INTEGER4 NumFaces_Z1 = 15; /* the number of unique - * faces in the zone. - */ + * faces in the zone. + */ INTEGER4 ICellMax = 0; /* not used */ INTEGER4 JCellMax = 0; /* not used */ INTEGER4 KCellMax = 0; /* not used */ @@ -71,13 +71,13 @@ int main() 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). - */ + * 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 @@ -110,7 +110,6 @@ int main() /* DOCEND */ /* DOCSTART:hexagons_zone1_tecdat.txt*/ - /* TECDAT Parameters */ double *X_Z1 = new double[NumPts_Z1]; double *Y_Z1 = new double[NumPts_Z1]; @@ -154,13 +153,11 @@ int main() 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); @@ -171,7 +168,7 @@ int main() /* DOCEND */ /* DOCSTART:hexagons_zone1_facenodes.txt*/ - /* TecPoly Parameters */ + /* TecPolyFace Parameters */ /* Create a FaceNodes array, dimensioned by the total number * of face nodes in the zone. @@ -225,7 +222,6 @@ int main() FaceNodes_Z1[28] = 13; FaceNodes_Z1[29] = 5; - /* DOCEND */ /* Specify the right and left neighboring elements. @@ -259,7 +255,7 @@ int main() FaceLeftElems_Z1[7] = 0; FaceLeftElems_Z1[8] = -1; FaceLeftElems_Z1[9] = -2; - FaceLeftElems_Z1[10] = 2; + FaceLeftElems_Z1[10] = 3; /* Left Face Elems for Element 3 */ FaceLeftElems_Z1[11] = -3; @@ -274,14 +270,25 @@ int main() for (INTEGER4 ii = 0; ii < 6; ii++) FaceRightElems_Z1[ii] = 1; - for (INTEGER4 ii = 6; ii < 10; ii++) + for (INTEGER4 ii = 6; ii < 11; ii++) FaceRightElems_Z1[ii] = 2; - for (INTEGER4 ii = 10; ii <= 14; ii++) + for (INTEGER4 ii = 11; ii <= 14; ii++) FaceRightElems_Z1[ii] = 3; + + I = TECPOLYFACE112(&NumFaces_Z1, + NULL, /* Not used for polygon zones */ + FaceNodes_Z1, + FaceLeftElems_Z1, + FaceRightElems_Z1); + + delete FaceNodes_Z1; + delete FaceLeftElems_Z1; + delete FaceRightElems_Z1; /* DOCEND */ /* DOCSTART:hexagons_zone1_tecpoly.txt */ + /* TecPolyBConn Parameters */ /* The FaceBndryConnectionCounts array is used to define the * number of boundary connections for each face that has a @@ -308,31 +315,22 @@ int main() 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; - + I = TECPOLYBCONN112(&TotalNumBndryFaces_Z1, + FaceBndryConnectionCounts_Z1, + FaceBndryConnectionElems_Z1, + FaceBndryConnectionZones_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 - */ + * nodes in the zone + */ INTEGER4 NumElems_Z2 = 2; INTEGER4 NumFaces_Z2 = 13; /* number of unique - * faces in the zone - */ + * faces in the zone + */ INTEGER4 NumFaceConnections_Z2 = 0; /* In polygonal zones, each face has exactly two nodes */ INTEGER4 TotalNumFaceNodes_Z2 = NumFaces_Z2 * 2; @@ -397,7 +395,6 @@ int main() X_Z2[5] = 4; Y_Z2[5] = 3; - X_Z2[6] = 3; Y_Z2[6] = 3; @@ -433,7 +430,7 @@ int main() delete P_Z2; /* DOCEND */ - /* TecPoly Parameters */ + /* TecPolyFace Parameters */ /* DOCSTART:hexagons_zone2_facemap.txt*/ INTEGER4 *FaceNodes_Z2; FaceNodes_Z2 = new INTEGER4[TotalNumFaceNodes_Z2]; @@ -457,7 +454,6 @@ int main() FaceNodes_Z2[10] = 6; FaceNodes_Z2[11] = 1; - /* Face Nodes for Element 2 */ FaceNodes_Z2[12] = 7; FaceNodes_Z2[13] = 6; @@ -481,8 +477,7 @@ int main() FaceNodes_Z2[25] = 7; /* DOCEND */ - - /* DOCSTART:hexagons_zone2_tecpoly.txt*/ + /* DOCSTART:hexagons_zone2_tecpolyface.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 @@ -525,6 +520,16 @@ int main() for (INTEGER4 ii = 6; ii < 13; ii++) FaceRightElems_Z2[ii] = 2; + + I = TECPOLYFACE112(&NumFaces_Z2, + NULL, + FaceNodes_Z2, + FaceLeftElems_Z2, + FaceRightElems_Z2); + + delete FaceNodes_Z2; + delete FaceLeftElems_Z2; + delete FaceRightElems_Z2; /* DOCEND */ /* DOCSTART:hexagons_zone2_tecpoly.txt*/ @@ -548,17 +553,10 @@ int main() 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; + I = TECPOLYBCONN112(&TotalNumBndryFaces_Z2, + FaceBndryConnectionCounts_Z2, + FaceBndryConnectionElems_Z2, + FaceBndryConnectionZones_Z2); /* DOCEND */ /* DOCSTART:hexagons_tecend.txt*/ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/Makefile deleted file mode 100644 index b1a061516..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# 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.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/octagon.cpp index c9d64aece..def486c8d 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/octagon.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/octagon/octagon.cpp @@ -90,9 +90,9 @@ int main() &NumBConnections, NULL, NULL, /* When Value Location is not specified, - * Tecplot will treat all variables as - * nodal variables. - */ + * Tecplot will treat all variables as + * nodal variables. + */ NULL, &ShrConn); /* DOCEND */ @@ -110,7 +110,7 @@ int main() * 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 @@ -195,7 +195,6 @@ int main() FaceNodes[2*ii+1] = ii + 2; } FaceNodes[15] = 1; - /* DOCEND */ /* Define the right and left elements of each face. @@ -228,13 +227,11 @@ int main() /* DOCEND */ /* Write the polyhedral data to the file. */ /* DOCSTART:octagon_tecpoly.txt*/ - I = TECPOLY112(NULL, - FaceNodes, - FaceLeftElems, - FaceRightElems, - NULL, - NULL, - NULL); + I = TECPOLYFACE112(&NumFaces, + NULL, + FaceNodes, + FaceLeftElems, + FaceRightElems); delete FaceNodes; delete FaceLeftElems; diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/Makefile deleted file mode 100644 index 38cb009fc..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# 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 index 864bb754b..45186a9be 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/pyramid.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/pyramid/pyramid.cpp @@ -20,7 +20,6 @@ int main() &(Debug), &(VIsDouble)); - /* Call TECZNE112 */ INTEGER4 ZoneType = 7; /* 7 for FEPolyhedron */ INTEGER4 NumNodes = 5; /* number of unique nodes */ @@ -117,7 +116,7 @@ int main() 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 @@ -201,14 +200,12 @@ int main() 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 */ + /* Write the face map (created above) using TECPOLYFACE112. */ + I = TECPOLYFACE112(&NumFaces, + FaceNodeCounts, /* The face node counts array */ + FaceNodes, /* The face nodes array */ + FaceLeftElems, /* The left elements array */ + FaceRightElems); /* The right elements array */ delete FaceNodeCounts; delete FaceNodes; @@ -218,5 +215,4 @@ int main() I = TECEND112(); return 0; } - /* DOCEND */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/Makefile deleted file mode 100644 index 9e40ebe34..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# 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.f b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.f index ce7cbf730..86068c893 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.f +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.f @@ -11,6 +11,11 @@ C C program test +C This code was written for FORTRAN77 compilers. If you are using a +C FORTRAN90/95 compiler, we recommend using the .f90 source code files. +C Otherwise, you will need to alter the include statement below to include +C tecio.for instead of tecio.inc. + INCLUDE 'tecio.inc' character*1 NULLCHR @@ -44,7 +49,7 @@ C FNMode = 0 ShrConn = 0 C -C... Open the file and write the tecplot datafile +C... Open the file and write the tecplot datafile C... header information. C I = TecIni112('SIMPLE DATASET'//NULLCHR, diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.f90 b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.f90 index d6c6e62f0..1706de598 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.f90 +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtest.f90 @@ -44,7 +44,7 @@ FNMode = 0 ShrConn = 0 ! -!... Open the file and write the tecplot datafile +!... Open the file and write the tecplot datafile !... header information. ! I = TecIni112('SIMPLE DATASET'//NULLCHR, & diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestc.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestc.vcproj index 22a848011..814cc761f 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestc.vcproj +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestc.vcproj @@ -1,346 +1,346 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestf.vfproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestf.vfproj index 2b20da05b..b22235e5a 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestf.vfproj +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/simtest/simtestf.vfproj @@ -7,18 +7,18 @@ - + - + - + - + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/Makefile deleted file mode 100644 index 120b910d6..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/squares/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# 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/text/Makefile b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/Makefile deleted file mode 100644 index 415b65fd1..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/examples/text/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# 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/pltview.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/pltview.cpp index a2c60aa9a..2ab9ce959 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/pltview.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/pltview.cpp @@ -1,26 +1,3 @@ -/* - * 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/ - * - */ /* ***************************************************************** ***************************************************************** @@ -66,7 +43,7 @@ END CODELOG #if defined ADDON #include "TECADDON.h" #include "GUIDEFS.h" -#include "GUI.h" +#include "TECGUI.h" #define READTEC TecUtilReadBinaryData #define SHOWINFO(S) TecGUITextAppendString(Output_T_D1,S); #define ERRMSG(S) TecUtilDialogErrMsg(S) @@ -75,6 +52,12 @@ END CODELOG #define STRINGLISTGETSTRING(S,N) TecUtilStringListGetString(S,N) #define STRINGLISTGETCOUNT(S) TecUtilStringListGetCount(S) #define STRINGLISTDEALLOC(S) TecUtilStringListDealloc(S) + +#define AUXDATADEALLOC(S) TecUtilAuxDataDealloc(S) +#define AUXDATAGETNUMITEMS(S) TecUtilAuxDataGetNumItems(S) +#define AUXDATAGETITEMBYINDEX(S,Index,Name,Value,Type,Retain) \ + TecUtilAuxDataGetItemByIndex(S,(Index),Name,Value,Type,Retain) + #else #include "MASTER.h" #include "GLOBAL.h" @@ -83,22 +66,21 @@ END CODELOG #define FREE_ARRAY(N,S) TecFree((void *)N) #include "ARRLIST.h" #include "STRLIST.h" +#include "AUXDATA.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 + +#define AUXDATADEALLOC(S) AuxDataDealloc(S) +#define AUXDATAGETNUMITEMS(S) AuxDataGetNumItems(S) +#define AUXDATAGETITEMBYINDEX(S,Index,Name,Value,Type,Retain) \ + AuxDataGetItemByIndex(S,(Index)-1,Name,Value,Type,Retain) + #endif @@ -144,7 +126,8 @@ static void DeallocHeaderInfo(char **DataSetTitle, LgIndex_t **NumPtsJ, LgIndex_t **NumPtsK, ZoneType_e **ZoneType, - StringList_pa *UserRec) + StringList_pa *UserRec, + AuxData_pa *DatasetAuxData) { if (*DataSetTitle) FREE_ARRAY(*DataSetTitle, "data set title"); @@ -162,6 +145,8 @@ static void DeallocHeaderInfo(char **DataSetTitle, FREE_ARRAY(*ZoneType, "ZoneType Array"); if (*UserRec) STRINGLISTDEALLOC(UserRec); + if (*DatasetAuxData) + AUXDATADEALLOC(DatasetAuxData); *DataSetTitle = NULL; *VarNames = NULL; @@ -173,10 +158,56 @@ static void DeallocHeaderInfo(char **DataSetTitle, *UserRec = NULL; } - - #define MAXCHARSINFOLINE 5000 +void ShowDatasetAuxData(AuxData_pa DatasetAuxData, char* InfoLine) +{ + REQUIRE(VALID_REF(InfoLine)); + if (DatasetAuxData != NULL) + { + SHOWINFO("Dataset Auxiliary Data:\n"); + SHOWINFO("-----------------------\n"); + LgIndex_t NumItems = AUXDATAGETNUMITEMS(DatasetAuxData); + for (LgIndex_t ii = 0; ii < NumItems; ++ii) + { +#if defined ADDON + char* Name; +#else + const char* Name; +#endif + ArbParam_t Value; + AuxDataType_e Type; + Boolean_t Retain; + AUXDATAGETITEMBYINDEX(DatasetAuxData, + ii+1, + &Name, + &Value, + &Type, + &Retain); + sprintf(InfoLine, " Name: %s\n", Name); + SHOWINFO(InfoLine); +#if defined ADDON + // The TecUtil layer returns copies which must be deallocated + TecUtilStringDealloc(&Name); +#endif + if (Type == AuxDataType_String) + { + char* ValueString = reinterpret_cast(Value); + sprintf(InfoLine, " Value : %s\n", ValueString); + SHOWINFO(InfoLine); + SHOWINFO(" Type : String\n"); +#if defined ADDON + // The TecUtil layer returns copies which must be deallocated + TecUtilStringDealloc(&ValueString); +#endif + } + sprintf(InfoLine, " Retain: %s\n", Retain ? "True" : "False"); + SHOWINFO(InfoLine); + } + SHOWINFO("\n"); + } +} + void ReportFileInfo(char *FName, Boolean_t LoadRawData, @@ -185,14 +216,15 @@ void ReportFileInfo(char *FName, 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; + 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; + AuxData_pa DatasetAuxData = NULL; int CZ, CV; char InfoLine[MAXCHARSINFOLINE+1]; double **VDataBase = NULL; @@ -215,6 +247,7 @@ void ReportFileInfo(char *FName, &NumPtsK, &ZoneType, &UserRec, + &DatasetAuxData, FALSE, (NodeMap_t ***)NULL, (double ***)NULL)) @@ -272,7 +305,8 @@ void ReportFileInfo(char *FName, &NumPtsJ, &NumPtsK, &ZoneType, - &UserRec); + &UserRec, + &DatasetAuxData); /* * Reread the datafile. This time load in the header AND the raw data @@ -292,6 +326,7 @@ void ReportFileInfo(char *FName, &NumPtsK, &ZoneType, &UserRec, + &DatasetAuxData, AllocateRawDataSpaceLocally, &NodeMap, &VDataBase)) @@ -368,6 +403,9 @@ void ReportFileInfo(char *FName, sprintf(InfoLine, "DataSetTitle: %s\n", DataSetTitle ? DataSetTitle : " "); SHOWINFO(InfoLine); + + ShowDatasetAuxData(DatasetAuxData, InfoLine); + sprintf(InfoLine, "NumZones : %d\n", (int)NumZones); SHOWINFO(InfoLine); sprintf(InfoLine, "NumVars : %d\n", (int)NumVars); @@ -534,7 +572,8 @@ void ReportFileInfo(char *FName, &NumPtsJ, &NumPtsK, &ZoneType, - &UserRec); + &UserRec, + &DatasetAuxData); } } diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/readme.txt b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/readme.txt index 8c6f468b8..70e6531f5 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/readme.txt +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/readme.txt @@ -2,10 +2,10 @@ ** README ** *********************************************** -To build the TecIO library and/or the pltview utility +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 +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 @@ -18,34 +18,13 @@ 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 +The ReadTec() function 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 +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/ - * - */ +field data from a file. + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ALLOC.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ALLOC.h index 8ea1db45f..eea2291bb 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ALLOC.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ALLOC.h @@ -1,31 +1,8 @@ -/* - * 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. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -69,7 +46,7 @@ extern void getMemoryUsage(size_t* memoryInUse, * 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 +#if defined MSWIN && defined _DEBUG && defined TRACK_MEMORY_USAGE template inline T *nonExceptionNew(size_t numItems, const char* fileName, @@ -88,7 +65,7 @@ inline T *nonExceptionNew(size_t numItems, #endif result = new(fileName, lineNumber) T[numItems]; #ifdef USING_DEBUG_NEW -#define new DEBUG_NEW +//#define new DEBUG_NEW #undef USING_DEBUG_NEW #endif #else @@ -172,7 +149,7 @@ inline void nonExceptionDelete(T* &ptr) * 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; + ptr = static_cast(reinterpret_cast(0xFFFF)); #endif } #define FREE_ARRAY(ptr,str) nonExceptionDelete((ptr)) diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ARRLIST.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ARRLIST.h index 8ee300be5..418f1f286 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ARRLIST.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/ARRLIST.h @@ -1,31 +1,10 @@ -/* - * 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" /* ***************************************************************** ***************************************************************** ******* ******** -****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** @@ -42,6 +21,10 @@ # define EXTERN extern #endif +#if !defined TECPLOTKERNEL +typedef struct _ArrayList_s* ArrayList_pa; +#endif + typedef enum { ArrayListType_UnsignedChar, @@ -85,52 +68,45 @@ typedef enum 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; + 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; +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif /** * Visitor for traversing an array list. An iterator may not perform any @@ -147,7 +123,7 @@ EXTERN ArrayListItem_u ArrayListNullItem; * TRUE to continue visiting items, otherwise * FALSE to discontinue visiting */ -typedef Boolean_t (*ArrayListItemVisitor_pf)(void *ItemRef, +typedef Boolean_t (*ArrayListItemVisitor_pf)(void* ItemRef, ArbParam_t ClientData); #if 0 /* use this stub as a starting place */ { @@ -155,7 +131,7 @@ typedef Boolean_t (*ArrayListItemVisitor_pf)(void *ItemRef, REQUIRE(VALID_REF(*TypeRef) || *TypeRef == NULL); Boolean_t DoContinue = TRUE; - *TypeRef = ( *)ItemRef; + * TypeRef = static_cast<*>(ItemRef); ENSURE(VALID_BOOLEAN(DoContinue)); return DoContinue; @@ -200,8 +176,8 @@ typedef ArrayListItemVisitor_pf ArrayListItemDestructor_pf; * is the client's responsibility to cleanup any * partial duplication */ -typedef Boolean_t (*ArrayListItemDuplicator_pf)(void *TargetItemRef, - void *SourceItemRef, +typedef Boolean_t (*ArrayListItemDuplicator_pf)(void* TargetItemRef, + void* SourceItemRef, ArbParam_t ClientData); #if 0 /* use this stub as a starting place */ { @@ -210,8 +186,8 @@ typedef Boolean_t (*ArrayListItemDuplicator_pf)(void *TargetItemRef, REQUIRE(VALID_REF(*SourceTypeRef) || *SourceTypeRef == NULL); Boolean_t IsOk = TRUE; - *TargetTypeRef = ( *)TargetItemRef; - *SourceTypeRef = ( *)SourceItemRef; + * TargetTypeRef = static_cast<*>(TargetItemRef); + * SourceTypeRef = static_cast<*>(SourceItemRef); ENSURE(VALID_BOOLEAN(IsOk)); return IsOk; @@ -260,7 +236,7 @@ typedef LgIndex_t (*ArrayListCapacityRequestAdjuster_pf)(ArrayList_pa ArrayList, /* private ArrayList structure: only exposed so STRUTIL can use it */ typedef struct _ArrayList_s { - char *Array; /* byte array for holding the items */ + 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 */ @@ -297,23 +273,24 @@ 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); + ArrayListCapacityRequestAdjuster_pf CapacityRequestAdjuster = 0, + ArbParam_t CapacityRequestAdjusterClientData = 0); +EXTERN void ArrayListDealloc(ArrayList_pa* ArrayList, + ArrayListItemDestructor_pf ItemDestructor = 0, + ArbParam_t ClientData = 0); +EXTERN void ArrayListClear(ArrayList_pa ArrayList); EXTERN void ArrayListDeleteAllItems(ArrayList_pa ArrayList, - ArrayListItemDestructor_pf ItemDestructor, - ArbParam_t ClientData); + ArrayListItemDestructor_pf ItemDestructor = 0, + ArbParam_t ClientData = 0); EXTERN void ArrayListDeleteItems(ArrayList_pa ArrayList, LgIndex_t ItemOffset, LgIndex_t Count, - ArrayListItemDestructor_pf ItemDestructor, - ArbParam_t ClientData); + ArrayListItemDestructor_pf ItemDestructor = 0, + ArbParam_t ClientData = 0); EXTERN void ArrayListDeleteItem(ArrayList_pa ArrayList, LgIndex_t ItemOffset, - ArrayListItemDestructor_pf ItemDestructor, - ArbParam_t ClientData); + ArrayListItemDestructor_pf ItemDestructor = 0, + ArbParam_t ClientData = 0); EXTERN ArrayList_pa ArrayListRemoveItems(ArrayList_pa ArrayList, LgIndex_t ItemOffset, LgIndex_t Count); @@ -338,35 +315,32 @@ EXTERN ArrayListItem_u ArrayListGetItem(ArrayList_pa ArrayList, EXTERN Boolean_t ArrayListSetItem(ArrayList_pa ArrayList, LgIndex_t ItemOffset, ArrayListItem_u Item, - ArrayListItemDestructor_pf ItemDestructor, - ArbParam_t ClientData); + ArrayListItemDestructor_pf ItemDestructor = 0, + ArbParam_t ClientData = 0); 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 = 0, + ArbParam_t ClientData = 0); +EXTERN void* ArrayListToArray(ArrayList_pa ArrayList, ArrayListItemDuplicator_pf ItemDuplicator, ArbParam_t ClientData); -EXTERN ArrayList_pa ArrayListFromArray(void *Source, +EXTERN ArrayList_pa ArrayListFromArray(void* Source, LgIndex_t Count, ArrayListType_e Type, - ArrayListItemDuplicator_pf ItemDuplicator, - ArbParam_t ClientData); + ArrayListItemDuplicator_pf ItemDuplicator = 0, + ArbParam_t ClientData = 0); #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); +EXTERN Boolean_t ArrayListBSearch(ArrayList_pa ArrayList, + ArrayListItem_u Item, + ArrayListItemComparator_pf Comparator, + ArbParam_t ClientData, + LgIndex_t* ItemIndex = 0); #if defined USE_MACROS_FOR_FUNCTIONS /** @@ -429,76 +403,76 @@ EXTERN Boolean_t ArrayListBSearch(ArrayList_pa ArrayList, # 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 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))) +# define ArrayListGetUnsignedChar(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetUnsignedShort(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetUnsignedInt(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetUnsignedLong(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetInt64(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetChar(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetShort(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetInt(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetLong(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetFloat(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetDouble(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetLgIndex(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetEntIndex(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetSmInteger(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetBoolean(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetArbParam(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetUnsignedCharPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetUnsignedShortPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetUnsignedIntPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetUnsignedLongPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetInt64Ptr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetCharPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetShortPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetIntPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetLongPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetFloatPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetDoublePtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetLgIndexPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetEntIndexPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetSmIntegerPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetBooleanPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetArbParamPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetVoidPtr(ArrayList, ItemOffset) (*(static_cast(const_cast(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))))) +# define ArrayListGetFunctionPtr(ArrayList, ItemOffset) (*(static_cast<**(void)*>(const_cast(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, +EXTERN void const* ArrayListGetInternalRef_FUNC(ArrayList_pa ArrayList); +EXTERN void const* 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 ArrayListGetInternalRef_MACRO(ArrayList) static_cast((ArrayList)->Array) +#define ArrayListGetItemInternalRef_MACRO(ArrayList, ItemOffset) static_cast(&((ArrayList)->Array[(ItemOffset)*(ArrayList)->ItemSize])) #define ArrayListGetCount_MACRO(ArrayList) ((ArrayList)->Count) -#define ArrayListGetTypedArrayRef(ArrayList, NativeType) ((NativeType *)((ArrayList)->Array)) +#define ArrayListGetTypedArrayRef(ArrayList, NativeType) reinterpret_cast((ArrayList)->Array) #define ArrayListGetTypedItem(ArrayList, ItemOffset, NativeType) (ArrayListGetTypedArrayRef(ArrayList,NativeType)[ItemOffset]) /** @@ -542,85 +516,112 @@ EXTERN LgIndex_t ArrayListGetCount_FUNC(ArrayList_pa ArrayList); #define ArrayListSetTypedItem(ArrayList, ItemOffset, Item, NativeType) \ ((ArrayListOffsetWithinCapacity((ArrayList), (ItemOffset)) || \ ArrayListEnlargeCapacity((ArrayList), (ItemOffset)+1)) \ - ? (((((NativeType *)((ArrayList)->Array))[(ItemOffset)]) = (Item)), \ + ? ((void)((ArrayListGetTypedArrayRef((ArrayList),NativeType)[(ItemOffset)]) = (Item)), \ (((ItemOffset)+1 > (ArrayList)->Count) \ ? (((ArrayList)->Count = (ItemOffset)+1), TRUE) \ : (TRUE))) \ : (FALSE)) +/** + * Appends the item to the end of the list. This is similar to ArrayListSetTypedItem however it + * needs not perform a bounds check which is always one beyond the end. This macro was added + * primarily to remove compiler warnings caused by a comparison of the array list ArrayList->Count+1 + * always returning true when tested if larger than ArrayList->Count which occurs if you use the + * ArrayListSetTypedItem as ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, NativeType). + * + * This is the workhorse of the append convenience macros that follow. + * + * param ArrayList + * Array list target in which to set the item. + * param Item + * Item to append to the end of the array. Its native type must + * match 'NativeType' + * param NativeType + * Native type of 'Item'. + * + * return + * TRUE if sufficient memory permitted the operation, otherwise FALSE. + */ +#define ArrayListAppendTypedItem(ArrayList, Item, NativeType) \ + ((ArrayListOffsetWithinCapacity((ArrayList), (ArrayList)->Count) || \ + ArrayListEnlargeCapacity((ArrayList), (ArrayList)->Count+1)) \ + ? ((void)((ArrayListGetTypedArrayRef((ArrayList),NativeType)[(ArrayList)->Count]) = (Item)), \ + (((ArrayList)->Count = (ArrayList)->Count+1), 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 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)) +#define ArrayListAppendUnsignedChar(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned char) +#define ArrayListAppendUnsignedShort(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned short) +#define ArrayListAppendUnsignedInt(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned int) +#define ArrayListAppendUnsignedLong(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned long) +#define ArrayListAppendInt64(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),Int64_t) +#define ArrayListAppendChar(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),char) +#define ArrayListAppendShort(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),short) +#define ArrayListAppendInt(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),int) +#define ArrayListAppendLong(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),long) +#define ArrayListAppendFloat(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),float) +#define ArrayListAppendDouble(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),double) +#define ArrayListAppendLgIndex(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),LgIndex_t) +#define ArrayListAppendEntIndex(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),EntIndex_t) +#define ArrayListAppendSmInteger(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),SmInteger_t) +#define ArrayListAppendBoolean(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),Boolean_t) +#define ArrayListAppendArbParam(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),ArbParam_t) +#define ArrayListAppendUnsignedCharPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned char*) +#define ArrayListAppendUnsignedShortPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned short*) +#define ArrayListAppendUnsignedIntPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned int*) +#define ArrayListAppendUnsignedLongPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned long*) +#define ArrayListAppendInt64Ptr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),Int64_t*) +#define ArrayListAppendCharPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),char*) +#define ArrayListAppendShortPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),short*) +#define ArrayListAppendIntPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),int*) +#define ArrayListAppendLongPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),long*) +#define ArrayListAppendFloatPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),float*) +#define ArrayListAppendDoublePtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),double*) +#define ArrayListAppendLgIndexPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),LgIndex_t*) +#define ArrayListAppendEntIndexPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),EntIndex_t*) +#define ArrayListAppendSmIntegerPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),SmInteger_t*) +#define ArrayListAppendBooleanPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),Boolean_t*) +#define ArrayListAppendArbParamPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),ArbParam_t*) +#define ArrayListAppendVoidPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),void*) +#define ArrayListAppendFunctionPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(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 index 652d7ba24..19822a2dd 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/AUXDATA.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/AUXDATA.h @@ -1,31 +1,8 @@ -/* - * 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. ******* + ****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** @@ -42,6 +19,27 @@ # define EXTERN extern #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 AuxData functions + * in the future, they can be added to the dll + * by adding LIBFUNCTION & LIBCALL as in + * AuxDataDealloc(), etc. below. + * + * When building the tecplot kernel, LIBFUNCTION + * and LIBCALL are nop's. + * + */ +#include "TECXXX.h" + /** */ EXTERN Boolean_t AuxDataIsValidNameChar(char Char, @@ -52,11 +50,11 @@ EXTERN Boolean_t AuxDataIsValidName(const char *Name); /** */ -EXTERN AuxData_pa AuxDataAlloc(void); +EXTERN AuxData_pa AuxDataAlloc(ArbParam_t Owner); /** */ -EXTERN void AuxDataDealloc(AuxData_pa *AuxData); +LIBFUNCTION void LIBCALL AuxDataDealloc(AuxData_pa *AuxData); /** */ @@ -69,7 +67,7 @@ EXTERN AuxData_pa AuxDataCopy(AuxData_pa AuxData, /** */ -EXTERN LgIndex_t AuxDataGetNumItems(AuxData_pa AuxData); +LIBFUNCTION LgIndex_t LIBCALL AuxDataGetNumItems(AuxData_pa AuxData); /** */ @@ -78,12 +76,12 @@ EXTERN Boolean_t AuxDataGetItemIndex(AuxData_pa AuxData, LgIndex_t *ItemIndex); /** */ -EXTERN void AuxDataGetItemByIndex(AuxData_pa AuxData, - LgIndex_t Index, - const char **Name, - ArbParam_t *Value, - AuxDataType_e *Type, - Boolean_t *Retain); +LIBFUNCTION void LIBCALL AuxDataGetItemByIndex(AuxData_pa AuxData, + LgIndex_t Index, + const char **Name, + ArbParam_t *Value, + AuxDataType_e *Type, + Boolean_t *Retain); /** */ @@ -104,7 +102,7 @@ EXTERN Boolean_t AuxDataGetBooleanItemByName(AuxData_pa AuxData, /** */ EXTERN Boolean_t AuxDataSetItem(AuxData_pa AuxData, - const char *Name, + char const* Name, ArbParam_t Value, AuxDataType_e Type, Boolean_t Retain); diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/CHARTYPE.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/CHARTYPE.h new file mode 100644 index 000000000..8c138d330 --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/CHARTYPE.h @@ -0,0 +1,254 @@ +#ifndef TECPLOT_CHARTYPE +#define TECPLOT_CHARTYPE +/* +****************************************************************** +****************************************************************** +******* ******** +****** (C) 1988-2010 Tecplot, Inc. ******* +******* ******** +****************************************************************** +****************************************************************** +*/ + +#if defined EXTERN +#undef EXTERN +#endif +#if defined CHARTYPEMODULE +#define EXTERN +#else +#define EXTERN extern +#endif + + +/** + */ +namespace tecplot +{ + +/** + * Same as std::isspace() with the classic default C locale for portable + * comparisons. + */ +template +inline bool isspace(CHAR_TYPE ch, + std::locale const& loc = std::locale::classic()) +{ + #if defined SUNX + REQUIRE(loc == std::locale::classic()); + return ::isspace(static_cast(ch)); + #else + REQUIRE(std::has_facet >(loc)); + return std::use_facet >(loc).is(std::ctype_base::space, static_cast(ch)); + #endif +} + +/** + * Same as std::isprint() with the classic default C locale for portable + * comparisons. + */ +template +inline bool isprint(CHAR_TYPE ch, + std::locale const& loc = std::locale::classic()) +{ + #if defined SUNX + REQUIRE(loc == std::locale::classic()); + return ::isprint(static_cast(ch)); + #else + REQUIRE(std::has_facet >(loc)); + return std::use_facet >(loc).is(std::ctype_base::print, static_cast(ch)); + #endif +} + +/** + * Same as std::iscntrl() with the classic default C locale for portable + * comparisons. + */ +template +inline bool iscntrl(CHAR_TYPE ch, + std::locale const& loc = std::locale::classic()) +{ + #if defined SUNX + REQUIRE(loc == std::locale::classic()); + return ::iscntrl(static_cast(ch)); + #else + REQUIRE(std::has_facet >(loc)); + return std::use_facet >(loc).is(std::ctype_base::cntrl, static_cast(ch)); + #endif +} + +/** + * Same as std::isupper() with the classic default C locale for portable + * comparisons. + */ +template +inline bool isupper(CHAR_TYPE ch, + std::locale const& loc = std::locale::classic()) +{ + #if defined SUNX + REQUIRE(loc == std::locale::classic()); + return ::isupper(static_cast(ch)); + #else + REQUIRE(std::has_facet >(loc)); + return std::use_facet >(loc).is(std::ctype_base::upper, static_cast(ch)); + #endif +} + +/** + * Same as std::islower() with the classic default C locale for portable + * comparisons. + */ +template +inline bool islower(CHAR_TYPE ch, + std::locale const& loc = std::locale::classic()) +{ + #if defined SUNX + REQUIRE(loc == std::locale::classic()); + return ::islower(static_cast(ch)); + #else + REQUIRE(std::has_facet >(loc)); + return std::use_facet >(loc).is(std::ctype_base::lower, static_cast(ch)); + #endif +} + +/** + * Same as std::isalpha() with the classic default C locale for portable + * comparisons. + */ +template +inline bool isalpha(CHAR_TYPE ch, + std::locale const& loc = std::locale::classic()) +{ + #if defined SUNX + REQUIRE(loc == std::locale::classic()); + return ::isalpha(static_cast(ch)); + #else + REQUIRE(std::has_facet >(loc)); + return std::use_facet >(loc).is(std::ctype_base::alpha, static_cast(ch)); + #endif +} + +/** + * Same as std::isdigit() with the classic default C locale for portable + * comparisons. + */ +template +inline bool isdigit(CHAR_TYPE ch, + std::locale const& loc = std::locale::classic()) +{ + #if defined SUNX + REQUIRE(loc == std::locale::classic()); + return ::isdigit(static_cast(ch)); + #else + REQUIRE(std::has_facet >(loc)); + return std::use_facet >(loc).is(std::ctype_base::digit, static_cast(ch)); + #endif +} + +/** + * Same as std::ispunct() with the classic default C locale for portable + * comparisons. + */ +template +inline bool ispunct(CHAR_TYPE ch, + std::locale const& loc = std::locale::classic()) +{ + #if defined SUNX + REQUIRE(loc == std::locale::classic()); + return ::ispunct(static_cast(ch)); + #else + REQUIRE(std::has_facet >(loc)); + return std::use_facet >(loc).is(std::ctype_base::punct, static_cast(ch)); + #endif +} + +/** + * Same as std::isxdigit() with the classic default C locale for portable + * comparisons. + */ +template +inline bool isxdigit(CHAR_TYPE ch, + std::locale const& loc = std::locale::classic()) +{ + #if defined SUNX + REQUIRE(loc == std::locale::classic()); + return ::isxdigit(static_cast(ch)); + #else + REQUIRE(std::has_facet >(loc)); + return std::use_facet >(loc).is(std::ctype_base::xdigit, static_cast(ch)); + #endif +} + +/** + * Same as std::isalnum() with the classic default C locale for portable + * comparisons. + */ +template +inline bool isalnum(CHAR_TYPE ch, + std::locale const& loc = std::locale::classic()) +{ + #if defined SUNX + REQUIRE(loc == std::locale::classic()); + return ::isalnum(static_cast(ch)); + #else + REQUIRE(std::has_facet >(loc)); + return std::use_facet >(loc).is(std::ctype_base::alnum, static_cast(ch)); + #endif +} + +/** + * Same as std::isgraph() with the classic default C locale for portable + * comparisons. + */ +template +inline bool isgraph(CHAR_TYPE ch, + std::locale const& loc = std::locale::classic()) +{ + #if defined SUNX + REQUIRE(loc == std::locale::classic()); + return ::isgraph(static_cast(ch)); + #else + REQUIRE(std::has_facet >(loc)); + return std::use_facet >(loc).is(std::ctype_base::graph, static_cast(ch)); + #endif +} + +/** + * Same as std::toupper() with the classic default C locale for portable + * comparisons. + */ +template +inline CHAR_TYPE toupper(CHAR_TYPE ch, + std::locale const& loc = std::locale::classic()) +{ + #if defined SUNX + REQUIRE(loc == std::locale::classic()); + return static_cast(::toupper(static_cast(ch))); + #else + REQUIRE(std::has_facet >(loc)); + return static_cast( + std::use_facet >(loc).toupper(static_cast(ch))); + #endif +} + +/** + * Same as std::tolower() with the classic default C locale for portable + * comparisons. + */ +template +inline CHAR_TYPE tolower(CHAR_TYPE ch, + std::locale const& loc = std::locale::classic()) +{ + #if defined SUNX + REQUIRE(loc == std::locale::classic()); + return static_cast(::tolower(static_cast(ch))); + #else + REQUIRE(std::has_facet >(loc)); + return static_cast( + std::use_facet >(loc).tolower(static_cast(ch))); + #endif +} + +} + +#endif + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO.h index 49ad0df58..ffad2dc50 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO.h @@ -1,26 +1,3 @@ -/* - * 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 @@ -47,6 +24,7 @@ EXTERN Boolean_t ReadDataFileHeader(FileStream_s *FileStream, StringList_pa **CustomLabelBase, StringList_pa *UserRec, AuxData_pa *DataSetAuxData, + ArbParam_t AuxDataOwner, Set_pa **IsVarCellCentered, Boolean_t *HasText, Boolean_t *HasGeoms, diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO4.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO4.h index 467ca65ba..5bf968fd1 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO4.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAIO4.h @@ -1,33 +1,10 @@ -/* - * 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. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -117,6 +94,7 @@ EXTERN Boolean_t ReadInZoneHeader(FileStream_s *FileStream, ZoneSpec_s *ZoneSpec, Set_pa IsVarCellCentered, EntIndex_t NumVars, + ArbParam_t AuxDataOwner, Boolean_t *IsRawFNAvailable, LgIndex_t *FNNumBndryConns); EXTERN Boolean_t ReadInCustomLabels(FileStream_s *FileStream, diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET.h index 37ef3cc01..99dfe7934 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET.h @@ -1,26 +1,3 @@ -/* - * 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__ @@ -28,7 +5,7 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -76,11 +53,11 @@ void SetZoneSpecDefaults(ZoneSpec_s *ZoneSpec); #endif #endif -#define GetZoneSpec(ZoneSpecList,Zone) ((ZoneSpec_s *)ArrayListGetVoidPtr(ZoneSpecList,Zone)) +#define GetZoneSpec(ZoneSpecList,Zone) (static_cast(ArrayListGetVoidPtr(ZoneSpecList,Zone))) #define GetZoneAuxData(DataSet, Zone) (GetZoneSpec((DataSet)->ZoneSpecList, (Zone))->AuxData) -#define GetVarSpec(VarSpecList,Var) ((VarSpec_s *)ArrayListGetVoidPtr(VarSpecList,Var)) +#define GetVarSpec(VarSpecList,Var) (static_cast(ArrayListGetVoidPtr(VarSpecList,Var))) #define GetVarAuxData(DataSet, Var) (GetVarSpec((DataSet)->VarSpecList, (Var))->AuxData) -#define GetStrandInfo(StrandInfoList, StrandID) ((StrandInfo_s *)ArrayListGetVoidPtr(StrandInfoList,StrandID)) +#define GetStrandInfo(StrandInfoList, StrandID) (static_cast(ArrayListGetVoidPtr(StrandInfoList,StrandID))) #if defined TECPLOTKERNEL diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET0.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET0.h index 5bae65ce3..c299ff23e 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET0.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASET0.h @@ -1,26 +1,3 @@ -/* - * 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 @@ -34,19 +11,20 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + namespace tecplot { -namespace io -{ class File; } -} EXTERN void OutOfMemoryMsg(void); @@ -64,22 +42,23 @@ EXTERN void OutOfMemoryMsg(void); struct _FieldData_a { void *Data; /* ...placed first in the structure for fastest access */ -# if defined TECPLOTKERNEL + #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ -# else + #else void *GetValueCallback[1]; /* ...this field is for TecIO only */ void *SetValueCallback[1]; /* ...this field is for TecIO only */ -# endif + #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. */ + #if defined TECPLOTKERNEL /* TecIO doesn't require these features yet. */ /* CORE SOURCE CODE REMOVED */ -# endif + #endif + LgIndex_t NumValues; + #if defined TECPLOTKERNEL /* TecIO doesn't require these features yet. */ +/* CORE SOURCE CODE REMOVED */ + #endif }; @@ -119,8 +98,8 @@ struct _FieldData_a #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]) +#define GetFieldDataGetFunction_MACRO(FieldData) (reinterpret_cast((FieldData)->GetValueCallback[0])) +#define GetFieldDataSetFunction_MACRO(FieldData) (reinterpret_cast((FieldData)->SetValueCallback[0])) #endif #define GetFieldDataNumValues_MACRO(FieldData) ((FieldData)->NumValues) #define GetFieldDataValueLocation_MACRO(FieldData) ((FieldData)->ValueLocation) @@ -202,21 +181,21 @@ typedef UInt64_t Int64Rev_t; #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*/ +#define GetFieldDataFloatPtr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldDataFloatRevPtr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldDataDoublePtr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldDataDoubleRevPtr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldDataInt64Ptr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldDataInt64RevPtr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldDataInt32Ptr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldDataInt32RevPtr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldDataInt16Ptr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldDataInt16RevPtr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldDataBytePtr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldData2BytePtr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldData4BytePtr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldData8BytePtr_MACRO(FieldData) (static_cast((FieldData)->Data)) +#define GetFieldDataVoidPtr_MACRO(FieldData) (static_cast((FieldData)->Data)) /*danger:see above*/ #if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS EXTERN float *GetFieldDataFloatPtr_FUNC(FieldData_pa fd); @@ -296,6 +275,8 @@ EXTERN void SwapBytesInUnalignedTypedValueArray(FieldDataType_e ValueType, /* * Copies values from "src" to "dst". "src" or "dst" may * be differing types. Either or both may be V3D data pointers. + * + * NOTE: We allow src_end to be one less than src_start and is treated as a noop. */ EXTERN void CopyFieldDataRange(FieldData_pa dst, LgIndex_t dst_start, @@ -317,6 +298,9 @@ EXTERN void CopyFieldValue(FieldData_pa dst, FieldData_pa src, LgIndex_t srcindex); +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASHR.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASHR.h deleted file mode 100644 index 776440947..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATASHR.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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 index e76c977ca..24f2d5fe8 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAUTIL.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/DATAUTIL.h @@ -1,26 +1,3 @@ -/* - * 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 @@ -76,6 +53,10 @@ extern void InitInputSpecs(void); * @param UserRec * Allocates space for and returns the user records. * + * @param DatasetAuxData + * Allocates space for and returns Dataset Auxiliary Data. This must be + * deallocated with AuxDataDealloc. + * * @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. @@ -104,6 +85,7 @@ LIBFUNCTION Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly, LgIndex_t **NumPtsK, ZoneType_e **ZoneType, StringList_pa *UserRec, + AuxData_pa *DatasetAuxData, Boolean_t RawDataspaceAllocated, NodeMap_t ***NodeMap, double ***VDataBase); diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FACE.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FACE.h index 487b1c6c7..87b3cf3d4 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FACE.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FACE.h @@ -1,31 +1,8 @@ -/* - * 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. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -112,7 +89,8 @@ EXTERN FaceObscuration_e GetFaceObscuration(CZInfo_s const* CZInfo, LgIndex_t FOffset, Boolean_t ConsiderValueBlanking, Boolean_t ConsiderIJKBlanking, - Boolean_t ConsiderDepthBlanking); + Boolean_t ConsiderDepthBlanking, + Boolean_t ConsiderClipBlanking); EXTERN EntIndex_t GetNodesPerElementFace(ZoneType_e ZoneType); @@ -121,6 +99,20 @@ EXTERN EntIndex_t GetFacesPerElement(ZoneType_e ZoneType, LgIndex_t JMax, LgIndex_t KMax); +/** + * @param Points must have MAX_NODES_PER_FACE elements. + * @param UniquePoints must have MAX_NODES_PER_FACE elements. + * This array is populated with the unique points + * from the input Points array. Values beyond NumUniquePoints-1 may + * be uninitialized and should not be accessed. + * @param NumUniquePoints - This value is populated the number of unique + * points that were placed in the UniquePoints array. + * @param Is3D is used to help determine if two points are coincident. + */ +EXTERN void GetUniquePoints(XYZ_s const Points[], + XYZ_s UniquePoints[], + SmInteger_t& NumUniquePoints, + Boolean_t Is3D); EXTERN CollapsedStatus_e GetSurfaceCellCollapsedStatus(CZInfo_s const* CZInfo, CZData_s const* CZData, tecplot::kernel::SubElemValueProducerInterface* SubElemValueProducer); diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FILESTREAM.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FILESTREAM.h index 65b6f5b93..af6578ef9 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FILESTREAM.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/FILESTREAM.h @@ -1,31 +1,8 @@ -/* - * 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. ******* + ****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM.h index e470744c6..88e1cba28 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM.h @@ -1,31 +1,8 @@ -/* - * 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. ******* +****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM2.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM2.h index 0a8078e96..55ab64aa5 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM2.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GEOM2.h @@ -1,31 +1,8 @@ -/* - * 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. ******* +****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GLOBAL.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GLOBAL.h index 6c467de12..526c377a0 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GLOBAL.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/GLOBAL.h @@ -1,26 +1,3 @@ -/* - * 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 @@ -33,7 +10,7 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -95,8 +72,8 @@ #undef TRUNC #endif -#define TRUE ((Boolean_t)1) -#define FALSE ((Boolean_t)0) +#define TRUE (static_cast(1)) +#define FALSE (static_cast(0)) /**************************************************************** * * @@ -107,11 +84,11 @@ #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 ROUND_TO_BYTE(X) (static_cast((X)+0.499)) +#define ROUNDS(X) (static_cast((X)+0.499)) +#define ROUNDL(X) (static_cast((X)+0.499)) +#define ROUND2(X) ((X) >= 0 ? (static_cast((X)+0.499)) : (static_cast((X)-0.499))) +#define TRUNC(X) (static_cast((X))) #define RAD_TO_DEG(rad) (180.*(rad)/PI) #define DEG_TO_RAD(deg) (PI*(deg)/180.) @@ -122,7 +99,7 @@ #if defined TECPLOTKERNEL && defined MSWIN /* CORE SOURCE CODE REMOVED */ #else -#define ISEMPTYSTRING(S) ( ((const char*)(S))[0] == '\0' ) +#define ISEMPTYSTRING(S) ( (static_cast((S)))[0] == '\0' ) #endif #define ISWHITESPACE(C) ((C == ' ') || (C == '\t') || (C == '\n')) @@ -130,7 +107,7 @@ /* 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)) +#define INTEGER_DIVIDE_AND_ROUND_UP(n, d) ((static_cast(n)+static_cast(d)-1)/static_cast(d)) /* BEGINREMOVEFROMADDON */ /** @@ -188,7 +165,7 @@ /* */ #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 FPRINTFOK(x) static_cast((x) > 0) #define GRAPHICSARE3D(F) ((F->PlotType == PlotType_Cartesian3D)) /* convenience macros for implication, P -> Q, and equivalence, P <-> Q. */ @@ -199,7 +176,7 @@ #if defined UNUSED #undef UNUSED #endif -#define UNUSED(param) (void)param +#define UNUSED(param) static_cast(param) /** * Converts a double into a float value @@ -210,15 +187,15 @@ #define CONVERT_DOUBLE_TO_FLOAT(val) \ ( (val) >= SMALLFLOAT \ ? ( (val) < LARGEFLOAT \ - ? (float)(val) \ - : (float)LARGEFLOAT \ + ? static_cast((val)) \ + : static_cast(LARGEFLOAT) \ ) \ : ( (val) <= -SMALLFLOAT \ ? ( (val) > -LARGEFLOAT \ - ? (float)(val) \ - : (float)-LARGEFLOAT \ + ? static_cast((val)) \ + : static_cast(-LARGEFLOAT) \ ) \ - : (float)0.0 \ + : static_cast(0.0) \ ) \ ) @@ -232,15 +209,15 @@ #define CLAMP_DOUBLE(val) \ ( (val) >= SMALLDOUBLE \ ? ( (val) < LARGEDOUBLE \ - ? (double)(val) \ - : (double)LARGEDOUBLE \ + ? static_cast((val)) \ + : static_cast(LARGEDOUBLE) \ ) \ : ( (val) <= -SMALLDOUBLE \ ? ( (val) > -LARGEDOUBLE \ - ? (double)(val) \ - : (double)-LARGEDOUBLE \ + ? static_cast((val)) \ + : static_cast(-LARGEDOUBLE) \ ) \ - : (double)0.0 \ + : static_cast(0.0) \ ) \ ) @@ -254,15 +231,15 @@ #define CONVERT_DOUBLE_TO_INT32(val) \ ( (val) >= 1.0 \ ? ( (val) < MAXINT32 \ - ? (Int32_t)(val) \ - : (Int32_t)MAXINT32 \ + ? static_cast((val)) \ + : static_cast(MAXINT32) \ ) \ : ( (val) <= -1.0 \ - ? ( (val) > (Int32_t)-MAXINT32 \ - ? (Int32_t)(val) \ - : (Int32_t)-MAXINT32 \ + ? ( (val) > static_cast(-MAXINT32) \ + ? static_cast((val)) \ + : static_cast(-MAXINT32) \ ) \ - : (Int32_t)0.0 \ + : static_cast(0.0) \ ) \ ) @@ -276,15 +253,15 @@ #define CONVERT_DOUBLE_TO_INT16(val) \ ( (val) >= 1.0 \ ? ( (val) < MAXINT16 \ - ? (Int16_t)(val) \ - : (Int16_t)MAXINT16 \ + ? static_cast((val)) \ + : static_cast(MAXINT16) \ ) \ : ( (val) <= -1.0 \ - ? ( (val) > (Int16_t)-MAXINT16 \ - ? (Int16_t)(val) \ - : (Int16_t)-MAXINT16 \ + ? ( (val) > static_cast(-MAXINT16) \ + ? static_cast((val)) \ + : static_cast(-MAXINT16) \ ) \ - : (Int16_t)0.0 \ + : static_cast(0.0) \ ) \ ) @@ -301,8 +278,8 @@ 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]; \ + (reinterpret_cast((DstBuffer)))[0] = (reinterpret_cast((SrcBuffer)))[0]; \ + (reinterpret_cast((DstBuffer)))[1] = (reinterpret_cast((SrcBuffer)))[1]; \ } while (FALSE) /** @@ -318,8 +295,8 @@ 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]; \ + (reinterpret_cast((DstBuffer)))[0] = (reinterpret_cast((SrcBuffer)))[1]; \ + (reinterpret_cast((DstBuffer)))[1] = (reinterpret_cast((SrcBuffer)))[0]; \ } while (FALSE) /** @@ -335,10 +312,10 @@ 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]; \ + (reinterpret_cast((DstBuffer)))[0] = (reinterpret_cast((SrcBuffer)))[0]; \ + (reinterpret_cast((DstBuffer)))[1] = (reinterpret_cast((SrcBuffer)))[1]; \ + (reinterpret_cast((DstBuffer)))[2] = (reinterpret_cast((SrcBuffer)))[2]; \ + (reinterpret_cast((DstBuffer)))[3] = (reinterpret_cast((SrcBuffer)))[3]; \ } while (FALSE) /** @@ -354,10 +331,10 @@ 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]; \ + (reinterpret_cast((DstBuffer)))[0] = (reinterpret_cast((SrcBuffer)))[3]; \ + (reinterpret_cast((DstBuffer)))[1] = (reinterpret_cast((SrcBuffer)))[2]; \ + (reinterpret_cast((DstBuffer)))[2] = (reinterpret_cast((SrcBuffer)))[1]; \ + (reinterpret_cast((DstBuffer)))[3] = (reinterpret_cast((SrcBuffer)))[0]; \ } while (FALSE) /** @@ -373,14 +350,14 @@ 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]; \ + (reinterpret_cast((DstBuffer)))[0] = (reinterpret_cast((SrcBuffer)))[0]; \ + (reinterpret_cast((DstBuffer)))[1] = (reinterpret_cast((SrcBuffer)))[1]; \ + (reinterpret_cast((DstBuffer)))[2] = (reinterpret_cast((SrcBuffer)))[2]; \ + (reinterpret_cast((DstBuffer)))[3] = (reinterpret_cast((SrcBuffer)))[3]; \ + (reinterpret_cast((DstBuffer)))[4] = (reinterpret_cast((SrcBuffer)))[4]; \ + (reinterpret_cast((DstBuffer)))[5] = (reinterpret_cast((SrcBuffer)))[5]; \ + (reinterpret_cast((DstBuffer)))[6] = (reinterpret_cast((SrcBuffer)))[6]; \ + (reinterpret_cast((DstBuffer)))[7] = (reinterpret_cast((SrcBuffer)))[7]; \ } while (FALSE) /** @@ -396,14 +373,14 @@ 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]; \ + (reinterpret_cast((DstBuffer)))[0] = (reinterpret_cast((SrcBuffer)))[7]; \ + (reinterpret_cast((DstBuffer)))[1] = (reinterpret_cast((SrcBuffer)))[6]; \ + (reinterpret_cast((DstBuffer)))[2] = (reinterpret_cast((SrcBuffer)))[5]; \ + (reinterpret_cast((DstBuffer)))[3] = (reinterpret_cast((SrcBuffer)))[4]; \ + (reinterpret_cast((DstBuffer)))[4] = (reinterpret_cast((SrcBuffer)))[3]; \ + (reinterpret_cast((DstBuffer)))[5] = (reinterpret_cast((SrcBuffer)))[2]; \ + (reinterpret_cast((DstBuffer)))[6] = (reinterpret_cast((SrcBuffer)))[1]; \ + (reinterpret_cast((DstBuffer)))[7] = (reinterpret_cast((SrcBuffer)))[0]; \ } while (FALSE) /** @@ -414,17 +391,17 @@ */ #define REVERSE_2_BYTES_1_AT_A_TIME(Buffer) \ do { \ - Byte_t Byte0 = ((Byte_t *)(Buffer))[0]; \ + Byte_t Byte0 = (reinterpret_cast((Buffer)))[0]; \ CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==2); \ - ((Byte_t *)(Buffer))[0] = ((Byte_t *)(Buffer))[1]; \ - ((Byte_t *)(Buffer))[1] = Byte0; \ + (reinterpret_cast((Buffer)))[0] = (reinterpret_cast((Buffer)))[1]; \ + (reinterpret_cast((Buffer)))[1] = Byte0; \ } while (FALSE) #define REVERSE_2_BYTES_2_AT_A_TIME(Buffer) \ do { \ - UInt16_t data_bits = ((UInt16_t *)(Buffer))[0]; \ + UInt16_t data_bits = (reinterpret_cast((Buffer)))[0]; \ CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==2); \ - ((UInt16_t *)(Buffer))[0] = (((data_bits)<<8) | \ + (reinterpret_cast((Buffer)))[0] = (((data_bits)<<8) | \ ((data_bits&0xff))); \ } while (FALSE) @@ -458,20 +435,20 @@ */ #define REVERSE_4_BYTES_1_AT_A_TIME(Buffer) \ do { \ - Byte_t Byte0 = ((Byte_t *)(Buffer))[0]; \ - Byte_t Byte1 = ((Byte_t *)(Buffer))[1]; \ + Byte_t Byte0 = (reinterpret_cast((Buffer)))[0]; \ + Byte_t Byte1 = (reinterpret_cast((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; \ + (reinterpret_cast((Buffer)))[0] = (reinterpret_cast((Buffer)))[3]; \ + (reinterpret_cast((Buffer)))[1] = (reinterpret_cast((Buffer)))[2]; \ + (reinterpret_cast((Buffer)))[2] = Byte1; \ + (reinterpret_cast((Buffer)))[3] = Byte0; \ } while (FALSE) #define REVERSE_4_BYTES_4_AT_A_TIME(Buffer) \ do { \ - UInt32_t data_bits = *((UInt32_t *)(Buffer)); \ + UInt32_t data_bits = *(reinterpret_cast((Buffer))); \ CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==4); \ - *((UInt32_t *)(Buffer)) = (((data_bits)<<24) | \ + *(reinterpret_cast((Buffer))) = (((data_bits)<<24) | \ ((data_bits&0x0000ff00)<<8) | \ ((data_bits&0x00ff0000)>>8) | \ ((data_bits)>>24)); \ @@ -495,48 +472,48 @@ */ #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]; \ + Byte_t Byte0 = (reinterpret_cast((Buffer)))[0]; \ + Byte_t Byte1 = (reinterpret_cast((Buffer)))[1]; \ + Byte_t Byte2 = (reinterpret_cast((Buffer)))[2]; \ + Byte_t Byte3 = (reinterpret_cast((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; \ + (reinterpret_cast((Buffer)))[0] = (reinterpret_cast((Buffer)))[7]; \ + (reinterpret_cast((Buffer)))[1] = (reinterpret_cast((Buffer)))[6]; \ + (reinterpret_cast((Buffer)))[2] = (reinterpret_cast((Buffer)))[5]; \ + (reinterpret_cast((Buffer)))[3] = (reinterpret_cast((Buffer)))[4]; \ + (reinterpret_cast((Buffer)))[4] = Byte3; \ + (reinterpret_cast((Buffer)))[5] = Byte2; \ + (reinterpret_cast((Buffer)))[6] = Byte1; \ + (reinterpret_cast((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]; \ + UInt16_t data_bits_0 = (reinterpret_cast((Buffer)))[0]; \ + UInt16_t data_bits_1 = (reinterpret_cast((Buffer)))[1]; \ + UInt16_t data_bits_2 = (reinterpret_cast((Buffer)))[2]; \ + UInt16_t data_bits_3 = (reinterpret_cast((Buffer)))[3]; \ CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==8); \ - ((UInt16_t *)(Buffer))[0] = (((data_bits_3)<<8) | \ + (reinterpret_cast((Buffer)))[0] = (((data_bits_3)<<8) | \ ((data_bits_3&0xff))); \ - ((UInt16_t *)(Buffer))[1] = (((data_bits_2)<<8) | \ + (reinterpret_cast((Buffer)))[1] = (((data_bits_2)<<8) | \ ((data_bits_2&0xff))); \ - ((UInt16_t *)(Buffer))[2] = (((data_bits_1)<<8) | \ + (reinterpret_cast((Buffer)))[2] = (((data_bits_1)<<8) | \ ((data_bits_1&0xff))); \ - ((UInt16_t *)(Buffer))[3] = (((data_bits_0)<<8) | \ + (reinterpret_cast((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]; \ + UInt32_t data_bits_0 = (reinterpret_cast((Buffer)))[0]; \ + UInt32_t data_bits_1 = (reinterpret_cast((Buffer)))[1]; \ CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==8); \ - ((UInt32_t *)(Buffer))[0] = (((data_bits_1)<<24) | \ + (reinterpret_cast((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) | \ + (reinterpret_cast((Buffer)))[1] = (((data_bits_0)<<24)| \ ((data_bits_0&0x0000ff00)<<8) | \ ((data_bits_0&0x00ff0000)>>8) | \ ((data_bits_0)>>24)); \ @@ -544,9 +521,9 @@ #define REVERSE_8_BYTES_8_AT_A_TIME(Buffer) \ do { \ - UInt64_t data_bits = *((UInt64_t *)(Buffer)); \ + UInt64_t data_bits = *(reinterpret_cast((Buffer))); \ CHECK(sizeof(*(Buffer))==1 || sizeof(*(Buffer))==8); \ - *((UInt64_t *)(Buffer)) = (((data_bits)<<56) | \ + *(reinterpret_cast((Buffer))) = (((data_bits)<<56) | \ ((data_bits&0x000000000000ff00)<<40) | \ ((data_bits&0x0000000000ff0000)<<24) | \ ((data_bits&0x00000000ff000000)<<8) | \ @@ -586,7 +563,7 @@ #endif /* __cplusplus */ #if defined MSWIN -#if defined AMTEC_INTERNAL_MAKELIBTEC || defined TECPLOTKERNEL +#if defined AMTEC_INTERNAL_MAKELIBTEC || defined TECPLOTKERNEL || defined ENGINE_INTERNAL_EXPORT /* CORE SOURCE CODE REMOVED */ # else # define TECPLOT_DLLAPI _declspec ( dllimport ) @@ -645,11 +622,12 @@ #if defined DECALPHA || \ defined LINUXALPHA || \ - defined LINUXI64 || \ defined LINUX64 || \ defined MAC64 || \ - defined COMPAQALPHA || \ - defined darwin + defined IBMRS6000 || \ + defined SUN || \ + defined HP || \ + defined COMPAQALPHA #define LONGIS64 #endif @@ -658,7 +636,7 @@ * HARD CONSTANTS * * * ****************************************************************/ -#define LARGEMEMORY ((size_t)-1) +#define LARGEMEMORY (static_cast(-1)) /* BEGINREMOVEFROMADDON */ /* Tclinterp add-on barfs on these huge integer constants */ @@ -672,14 +650,14 @@ /* BEGINREMOVEFROMADDON */ #define LARGEUINT64 18446744073709551614ULL /* ENDREMOVEFROMADDON */ -#define LARGEUINT32 4294967294 -#define LARGEUINT16 65534 -#define LARGEUINT8 254 +#define LARGEUINT32 4294967294U +#define LARGEUINT16 65534U +#define LARGEUINT8 254U #ifdef INDEX_16_BIT -#define MAXINDEX ((LgIndex_t)LARGEINT16) +#define MAXINDEX (static_cast(LARGEINT16)) #else -#define MAXINDEX ((LgIndex_t)LARGEINT32) +#define MAXINDEX (static_cast(LARGEINT32)) #endif #define MAXZONEMAP MAXINDEX #define LARGEDOUBLE 1.0e+150 @@ -723,7 +701,7 @@ #define FONTMOVEMARK 192 #define FONTDECISIONMARK 128 #define FONTLINEMARK 64 -#define BAD_SET_VALUE ((SetIndex_t)-1) +#define BAD_SET_VALUE (static_cast(-1)) #define MENU_POSITION_FIRST (0) #define MENU_POSITION_LAST (-1) #define INVALID_UNIQUE_ID 0 @@ -744,6 +722,8 @@ */ #define MAX_ALLOWABLE_CLIPPASSES 1 #define MAX_ALLOWABLE_CLIPPLANES 6 +#define INVALID_CLIP_PLANE -1 +#define VALID_CLIP_PLANE(clipPlane) (0 <= clipPlane && clipPlane < MAX_ALLOWABLE_CLIPPLANES) /* BEGINREMOVEFROMADDON */ #if defined TECPLOTKERNEL @@ -774,31 +754,22 @@ * 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 TecplotBinaryFileVersion 112 /* NOTE: only change this when we change the binary file format */ -#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 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 MaxIsoSurfaceSpecificLevels 3 +#define MaxSliceGroups 8 #define MaxColorMapGroups 8 #define DefaultNumContLevels 15 @@ -812,6 +783,7 @@ #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))) +#define MAX_AUTO_COLOR_SEQUENCE_VALUES 6 /* @@ -945,88 +917,88 @@ 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 Black_C (static_cast(0)) +#define Red_C (static_cast(1)) +#define Green_C (static_cast(2)) +#define Blue_C (static_cast(3)) +#define Cyan_C (static_cast(4)) +#define Yellow_C (static_cast(5)) +#define Purple_C (static_cast(6)) +#define White_C (static_cast(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 Custom1_C (static_cast(8)) +#define Custom2_C (static_cast(9)) +#define Custom3_C (static_cast(10)) +#define Custom4_C (static_cast(11)) +#define Custom5_C (static_cast(12)) +#define Custom6_C (static_cast(13)) +#define Custom7_C (static_cast(14)) +#define Custom8_C (static_cast(15)) +#define Custom9_C (static_cast(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 Custom10_C (static_cast(17)) +#define Custom11_C (static_cast(18)) +#define Custom12_C (static_cast(19)) +#define Custom13_C (static_cast(20)) +#define Custom14_C (static_cast(21)) +#define Custom15_C (static_cast(22)) +#define Custom16_C (static_cast(23)) +#define Custom17_C (static_cast(24)) +#define Custom18_C (static_cast(25)) +#define Custom19_C (static_cast(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 Custom20_C (static_cast(27)) +#define Custom21_C (static_cast(28)) +#define Custom22_C (static_cast(29)) +#define Custom23_C (static_cast(30)) +#define Custom24_C (static_cast(31)) +#define Custom25_C (static_cast(32)) +#define Custom26_C (static_cast(33)) +#define Custom27_C (static_cast(34)) +#define Custom28_C (static_cast(35)) +#define Custom29_C (static_cast(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 Custom30_C (static_cast(37)) +#define Custom31_C (static_cast(38)) +#define Custom32_C (static_cast(39)) +#define Custom33_C (static_cast(40)) +#define Custom34_C (static_cast(41)) +#define Custom35_C (static_cast(42)) +#define Custom36_C (static_cast(43)) +#define Custom37_C (static_cast(44)) +#define Custom38_C (static_cast(45)) +#define Custom39_C (static_cast(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 Custom40_C (static_cast(47)) +#define Custom41_C (static_cast(48)) +#define Custom42_C (static_cast(49)) +#define Custom43_C (static_cast(50)) +#define Custom44_C (static_cast(51)) +#define Custom45_C (static_cast(52)) +#define Custom46_C (static_cast(53)) +#define Custom47_C (static_cast(54)) +#define Custom48_C (static_cast(55)) +#define Custom49_C (static_cast(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 Custom50_C (static_cast(57)) +#define Custom51_C (static_cast(58)) +#define Custom52_C (static_cast(59)) +#define Custom53_C (static_cast(60)) +#define Custom54_C (static_cast(61)) +#define Custom55_C (static_cast(62)) +#define Custom56_C (static_cast(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 MultiColor_C (static_cast(-1)) +#define NoColor_C (static_cast(-2)) +#define MultiColor2_C (static_cast(-3)) +#define MultiColor3_C (static_cast(-4)) +#define MultiColor4_C (static_cast(-5)) +#define RGBColor_C (static_cast(-6)) +#define MultiColor5_C (static_cast(-7)) +#define MultiColor6_C (static_cast(-8)) +#define MultiColor7_C (static_cast(-9)) +#define MultiColor8_C (static_cast(-10)) +#define InvalidColor_C (static_cast(-255)) #define FirstCustomColor Custom1_C #define LastCustomColor Custom56_C @@ -1042,7 +1014,7 @@ * 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) +#define OldMultiColor_C (static_cast(255)) /* * Gray is only used in the interface for workspace background and * for insensitive buttons in Motif. @@ -1063,23 +1035,27 @@ #define BasicColorOffset (0) #define InterfaceColorOffset (NumBasicColors) #define ContourColorOffset (NumBasicColors+NumInterfaceColors) +/* ENDREMOVEFROMADDON */ -#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 +#define KeyCode_BadKey static_cast(31) +#define KeyCode_RetKey static_cast(13) +#define KeyCode_Esc static_cast(27) +#define KeyCode_BackSpace static_cast(8) +#define KeyCode_DeleteKey static_cast(127) +#define KeyCode_LeftArrow static_cast(29) +#define KeyCode_RightArrow static_cast(30) +#define KeyCode_UpArrow static_cast(11) +#define KeyCode_DownArrow static_cast(10) +#define KeyCode_Plus static_cast(43) +#define KeyCode_Minus static_cast(45) +/* BEGINREMOVEFROMADDON */ +// The following key codes are supplied by Tecplot 360(MFC and Motif) and won't be needed once +// the migration to 360Qt is completed. +#define KeyCode_ShiftDelete static_cast(128) /*deprecated*/ +#define KeyCode_Toggle static_cast(19) /*deprecated*/ +#define KeyCode_RegFrame static_cast(18) /*deprecated*/ +#define KeyCode_DoBitDump static_cast(2) /*deprecated*/ /* File Markers */ #define ZoneMarker 299.0 @@ -1099,13 +1075,14 @@ #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 +#define MarkerGridPen Custom8_C+4 +#define StreamlinePen Custom8_C+5 +#define ColoredLinePen Custom8_C+6 +#define BoundaryPen Custom8_C+7 +#define LabelPen Custom8_C+8 +#define NumPlotterPens Custom8_C+9 /* AutoSelectPen will select the correct pen from Black_C thru Custom8_C or ColoredLinePen */ -#define AutoSelectPen Custom8_C+9 +#define AutoSelectPen Custom8_C+10 #define InvalidPen Custom8_C+99 #define FirstObjectPen AxisPen @@ -1153,22 +1130,34 @@ /* 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 +/* ENDREMOVEFROMADDON */ + #define TP_FREAD fread + #define TP_FWRITE fwrite +/* BEGINREMOVEFROMADDON */ +#endif +/* ENDREMOVEFROMADDON */ + +#if defined MSWIN +#define TP_FFLUSH fflush +#define TP_FCLOSE fclose + +/* BEGINREMOVEFROMADDON */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else +/* ENDREMOVEFROMADDON */ #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 +/* BEGINREMOVEFROMADDON */ #endif /* TECPLOTKERNEL */ +/* ENDREMOVEFROMADDON */ #if defined _WIN64 #define TP_FSEEK(stream,offset,whence) _fseeki64((stream),(__int64)(offset),(whence)) @@ -1184,16 +1173,13 @@ #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 _stat stat /* ...make the UNIXX and MSWIN platforms have the same syntax to use "struct _stat" */ #define TP_GETENV getenv #endif -/* ENDREMOVEFROMADDON */ /**************************************************************** * * @@ -1258,7 +1244,7 @@ typedef long HgIndex_t; #elif defined LONGIS64 typedef long ArbParam_t; typedef long HgIndex_t; -#elif defined MSWIN && (defined _M_IA64 || defined _M_AMD64) +#elif defined MSWIN typedef INT_PTR ArbParam_t; typedef INT_PTR HgIndex_t; #else @@ -1282,7 +1268,15 @@ typedef UInt64_t MemMapOffset_t; typedef unsigned char Byte_t; typedef short SmInteger_t; + +/** + * A number of color index constants are \#defined. These include Black_C, Red_C, + * Green_C, Blue_C, Cyan_C, Yellow_C, Purple_C, White_C, Custom1_C through + * Custom56_C, MultiColor_C, NoColor_C, MulitiColor2_C through MulitiColor8_C, + * RGBColor_C, and InvalidColor_C. + */ typedef SmInteger_t ColorIndex_t; + #ifdef INDEX_16_BIT typedef Int16_t EntIndex_t; #else @@ -1301,7 +1295,7 @@ typedef LgIndex_t SegPtsArray_t[MaxGeoSegments]; typedef double BasicSize_t[MaxBasicSizes]; typedef double *VarList_t; -typedef long SetIndex_t; +typedef HgIndex_t SetIndex_t; typedef unsigned long SetData_t; typedef SetData_t *SetData_pt; @@ -1691,6 +1685,7 @@ typedef enum StateChange_NewTopPage, StateChange_NewActiveFrame, StateChange_FrameOrderChanged, + StateChange_NewUndoState, END_StateChange_e, StateChange_Invalid = BadEnumValue, /* deprecated values */ @@ -1892,6 +1887,10 @@ typedef enum Dialog_ThreeDEdge, Dialog_TimeDetails, Dialog_Performance, + Dialog_HelpTecplotLicensing, + Dialog_GeomDetails, + Dialog_BasicColorLegend, + Dialog_FourierTransform, END_Dialog_e, Dialog_Invalid = BadEnumValue, /* deprecated values */ @@ -2231,7 +2230,7 @@ typedef enum /* * View_SetMagnification added 02/24/03 so all plot types - * can behave the same way "do a 'centered' magnifacation change". + * can behave the same way "do a 'centered' magnification change". * Line plots will still accept View_Scale option and zoom towards * the corner so old macros/addons still work. */ @@ -2412,6 +2411,7 @@ typedef enum PickObjects_IsoSurfaceCOB, PickObjects_RGBLegend, PickObjects_LineMapping, + PickObjects_BasicColorLegend, END_PickObjects_e, PickObjects_Invalid = BadEnumValue, /* deprecated values */ @@ -2453,15 +2453,6 @@ typedef enum } SingleEditState_e; -typedef enum -{ - AxisSubObject_GridArea, - AxisSubObject_AxisLine, - AxisSubObject_Title, - END_AxisSubObject_e, - AxisSubObject_Invalid = BadEnumValue -} AxisSubObject_e; - typedef enum { AxisSubPosition_GridMinBorder, @@ -2479,6 +2470,15 @@ typedef enum } AxisSubPosition_e; /* ENDREMOVEFROMADDON */ +typedef enum +{ + AxisSubObject_GridArea, + AxisSubObject_AxisLine, + AxisSubObject_Title, + END_AxisSubObject_e, + AxisSubObject_Invalid = BadEnumValue +} AxisSubObject_e; + /* * NOTE: The _NoOp value is not at the top so this * enumeration aligns with the old AltMouseButtonMode_e @@ -2502,7 +2502,7 @@ typedef enum MouseButtonDrag_ZoomData, MouseButtonDrag_TranslateData, MouseButtonDrag_RlrBallRtatData, - MouseButtonDrag_SpherRtatData, + MouseButtonDrag_SpherZRtatData, /* Was SpherRtatData*/ MouseButtonDrag_XRotateData, MouseButtonDrag_YRotateData, MouseButtonDrag_ZRotateData, @@ -2510,13 +2510,20 @@ typedef enum MouseButtonDrag_ZoomViewer, MouseButtonDrag_TranslateViewer, MouseButtonDrag_RlrBallRtatVwr, - MouseButtonDrag_SpherRotateVwr, + MouseButtonDrag_SpherZRotateVwr, /* Was SpherRotateVwr*/ MouseButtonDrag_XRotateViewer, MouseButtonDrag_YRotateViewer, MouseButtonDrag_ZRotateViewer, MouseButtonDrag_TwistRotateViewer, + MouseButtonDrag_SpherXRtatData, + MouseButtonDrag_SpherYRtatData, + MouseButtonDrag_SpherXRotateVwr, + MouseButtonDrag_SpherYRotateVwr, END_MouseButtonDrag_e, - MouseButtonDrag_Invalid = BadEnumValue + MouseButtonDrag_Invalid = BadEnumValue, + /* deprecated values */ + MouseButtonDrag_SpherRtatData = MouseButtonDrag_SpherZRtatData, + MouseButtonDrag_SpherRotateVwr = MouseButtonDrag_SpherZRotateVwr } MouseButtonDrag_e; @@ -2568,7 +2575,7 @@ typedef enum MouseButtonMode_GeomEllipse, MouseButtonMode_GeomSpline, MouseButtonMode_CreateFrame, - MouseButtonMode_RotateSpherical, + MouseButtonMode_RotateSphericalZ, /* Was MouseButtonMode_RotateSpherical */ MouseButtonMode_RotateRollerBall, MouseButtonMode_RotateTwist, MouseButtonMode_RotateXAxis, @@ -2589,9 +2596,13 @@ typedef enum MouseButtonMode_User2, MouseButtonMode_User3, MouseButtonMode_User4, + MouseButtonMode_RotateSphericalX, + MouseButtonMode_RotateSphericalY, + MouseButtonMode_AdvancedAdjust, END_MouseButtonMode_e, MouseButtonMode_Invalid = BadEnumValue, /* deprecated values */ + MouseButtonMode_RotateSpherical = MouseButtonMode_RotateSphericalZ, Mouse_NoMode = MouseButtonMode_NoMode, /* deprecated */ Mouse_Select = MouseButtonMode_Select, /* deprecated */ Mouse_Adjust = MouseButtonMode_Adjust, /* deprecated */ @@ -2606,7 +2617,7 @@ typedef enum Mouse_GeomEllipse = MouseButtonMode_GeomEllipse, /* deprecated */ Mouse_GeomSpline = MouseButtonMode_GeomSpline, /* deprecated */ Mouse_CreateFrame = MouseButtonMode_CreateFrame, /* deprecated */ - Mouse_RotateSpherical = MouseButtonMode_RotateSpherical, /* deprecated */ + Mouse_RotateSpherical = MouseButtonMode_RotateSphericalZ, /* deprecated */ Mouse_RotateRollerBall = MouseButtonMode_RotateRollerBall, /* deprecated */ Mouse_RotateTwist = MouseButtonMode_RotateTwist, /* deprecated */ Mouse_RotateXAxis = MouseButtonMode_RotateXAxis, /* deprecated */ @@ -3304,6 +3315,9 @@ typedef enum ExportFormat_Flash, ExportFormat_X3D, ExportFormat_TecplotViewer, + ExportFormat_FLV, + ExportFormat_MPEG4, + ExportFormat_WMV, END_ExportFormat_e, ExportFormat_Invalid = BadEnumValue } ExportFormat_e; @@ -3323,6 +3337,9 @@ typedef enum AnimationDest_AVI, AnimationDest_RM, AnimationDest_Flash, + AnimationDest_FLV, + AnimationDest_MPEG4, + AnimationDest_WMV, END_AnimationDest_e, AnimationDest_Invalid = BadEnumValue } AnimationDest_e; @@ -3387,14 +3404,22 @@ typedef enum typedef enum { - Paper_Letter, - Paper_Double, - Paper_A4, - Paper_A3, - Paper_Custom1, - Paper_Custom2, + PaperSize_Letter, + PaperSize_Double, + PaperSize_A4, + PaperSize_A3, + PaperSize_Custom1, + PaperSize_Custom2, END_PaperSize_e, - Paper_Invalid = BadEnumValue + PaperSize_Invalid = BadEnumValue, + /* deprecated values */ + Paper_Letter = PaperSize_Letter, /* deprecated */ + Paper_Double = PaperSize_Double, /* deprecated */ + Paper_A4 = PaperSize_A4, /* deprecated */ + Paper_A3 = PaperSize_A3, /* deprecated */ + Paper_Custom1 = PaperSize_Custom1, /* deprecated */ + Paper_Custom2 = PaperSize_Custom2, /* deprecated */ + Paper_Invalid = PaperSize_Invalid /* deprecated */ } PaperSize_e; @@ -3475,6 +3500,7 @@ typedef enum CoordSys_Screen, CoordSys_Hardcopy, CoordSys_Grid3D, + CoordSys_Workspace, END_CoordSys_e, CoordSys_Invalid = BadEnumValue } CoordSys_e; @@ -3612,10 +3638,21 @@ typedef enum Font_TimesItalicBold, Font_Courier, Font_CourierBold, + Font_Extended, END_Font_e, Font_Invalid = BadEnumValue } Font_e; +typedef enum +{ + FontStyle_Regular, + FontStyle_Italic, + FontStyle_Bold, + FontStyle_BoldItalic, + END_FontStyle_e, + FontStyle_Invalid = BadEnumValue +} FontStyle_e; + typedef enum { TwoDDrawOrder_ByZone, @@ -3660,6 +3697,16 @@ typedef enum StreamDir_Invalid = BadEnumValue } StreamDir_e; +typedef enum +{ + DistributionRegion_Point, + DistributionRegion_Rake, + DistributionRegion_SurfacesOfActiveZones, + DistributionRegion_SurfacesOfSelectedObjects, + END_DistributionRegion_e, + DistributionRegion_Invalid = BadEnumValue +} DistributionRegion_e; + typedef enum { IsoSurfaceSelection_AllContourLevels, @@ -4022,18 +4069,55 @@ typedef enum ContourColorMap_UserDef, ContourColorMap_TwoColor, ContourColorMap_RawUserDef, + ContourColorMap_DivBuRd, + ContourColorMap_DivBuYlRd, + ContourColorMap_DivBrBG, + ContourColorMap_DivOrPu, + ContourColorMap_DivPiYG, + ContourColorMap_DivPRGn, + ContourColorMap_Doppler, + ContourColorMap_ElevAboveGrnd, + ContourColorMap_ElevAbsolute, + ContourColorMap_HotMetal, + ContourColorMap_Magma, + ContourColorMap_DkRainbow, + ContourColorMap_MdRainbow, + ContourColorMap_QualAccent, + ContourColorMap_QualDark1, + ContourColorMap_QualDark2, + ContourColorMap_QualPaired, + ContourColorMap_QualPastel1, + ContourColorMap_QualPastel2, + ContourColorMap_QualPastel3, + ContourColorMap_SeqBlue, + ContourColorMap_SeqBuGn, + ContourColorMap_SeqBuPu, + ContourColorMap_SeqGreen, + ContourColorMap_SeqGnBu, + ContourColorMap_SeqOrange, + ContourColorMap_SeqOrRd, + ContourColorMap_SeqPiPu, + ContourColorMap_SeqPurple, + ContourColorMap_SeqPuBu, + ContourColorMap_SeqPuBuGn, + ContourColorMap_SeqPuRd, + ContourColorMap_SeqRed, + ContourColorMap_SeqYlGn, + ContourColorMap_SeqYlGnBu, + ContourColorMap_SeqYlOrBr, + ContourColorMap_SeqYlOrRd, 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 */ + 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; @@ -4255,6 +4339,16 @@ typedef enum Transform_Invalid = BadEnumValue } Transform_e; +typedef enum +{ + WindowFunction_Rectangular, + WindowFunction_Triangular, + WindowFunction_Hann, + WindowFunction_Hamming, + END_WindowFunction_e, + WindowFunction_Invalid = BadEnumValue +} WindowFunction_e; + typedef enum { LaunchDialogMode_ModalSync, @@ -4576,6 +4670,50 @@ typedef enum ConditionAwakeReason_Invalid = BadEnumValue } ConditionAwakeReason_e; +typedef enum +{ + ProbeStatus_Normal, + ProbeStatus_Terminated, + ProbeStatus_Exited, + END_ProbeStatus_e, + ProbeStatus_Invalid = BadEnumValue +} ProbeStatus_e; + +typedef enum +{ + FrameSizePosUnits_Paper, + FrameSizePosUnits_Workspace, + END_FrameSizePosUnits_e, + FrameSizePosUnits_Invalid = BadEnumValue +} FrameSizePosUnits_e; + +typedef enum +{ + Gridline_Major, + Gridline_Minor, + Gridline_Marker, + END_Gridline_e, + Gridline_Invalid = BadEnumValue +} Gridline_e; + +/* Used by MarkerGridlineDetail */ +typedef enum +{ + PositionMarkerBy_SolutionTime, + PositionMarkerBy_Constant, + END_PositionMarkerBy_e, + PositionMarkerBy_Invalid = BadEnumValue +} PositionMarkerBy_e; + +/* Used by TecUtilImportAddLoaderX */ +typedef enum +{ + LoaderSelectedCallbackVersion_V1, + LoaderSelectedCallbackVersion_V2, + END_LoaderSelectedCallbackVersion_e, + LoaderSelectedCallbackVersion_Invalid = BadEnumValue +} LoaderSelectedCallbackVersion_e; + /**************************************************************** * * * STRUCTURE TYPEDEFS * @@ -4587,6 +4725,8 @@ typedef enum */ typedef struct _Mutex_a* Mutex_pa; +typedef struct _SpinLock_a* SpinLock_pa; /* NOTE: some platforms may not have spin locks; see use of HAVE_SPINLOCKS define */ + typedef void*(STDCALL *ThreadFunction_pf)(ArbParam_t ThreadData); typedef struct _Condition_a* Condition_pa; @@ -4608,6 +4748,7 @@ typedef struct _Menu_s *Menu_pa; /* BEGINREMOVEFROMADDON */ typedef struct _ArrayList_s *ArrayList_pa; /* ENDREMOVEFROMADDON */ +typedef struct _LineSegmentProbeResult_s *LineSegProbeResult_pa; typedef enum { @@ -4660,6 +4801,18 @@ typedef struct /* BEGINREMOVEFROMADDON */ +typedef struct +{ + double Psi; + double Theta; + double Alpha; +} PTA_s; + +namespace tecplot +{ + class Typeface; +} + typedef struct _Generic3Var_s { double V1; @@ -4674,7 +4827,7 @@ typedef struct _ThetaR_s } ThetaR_s; /* - * This union is designed to allow different plottypes + * This union is designed to allow different plot types * 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 @@ -4952,21 +5105,25 @@ typedef struct _IndexRange_s typedef struct _TextShape_s { - Font_e Font; - double Height; - Units_e SizeUnits; +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#else + Font_e Font; +#endif + 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)) +#define AsciiShapeFontIsGreek(S) (((S)->useBaseFont == FALSE) && (FontLibrary::instance().font((S)->typefaceOverride) == Font_Greek)) +#define AsciiShapeFontIsMath(S) (((S)->useBaseFont == FALSE) && (FontLibrary::instance().font((S)->typefaceOverride) == Font_Math)) +#define AsciiShapeFontIsUserDefined(S) (((S)->useBaseFont == FALSE) && (FontLibrary::instance().font((S)->typefaceOverride) == Font_UserDefined)) typedef struct { - Boolean_t UseBaseFont; /* (Default = TRUE) */ - Font_e FontOverride;/* (Default = Font_Math)*/ - SymbolChar_t Char; + Boolean_t useBaseFont; + tecplot::Typeface const* typefaceOverride; + SymbolChar_t Char; } AsciiShape_s; typedef struct _SymbolShape_s @@ -5036,7 +5193,7 @@ typedef enum FaceNeighborMemberArray_Invalid = BadEnumValue } FaceNeighborMemberArray_e; -int const FaceNeighborNumMemberArrays = (int)END_FaceNeighborMemberArray_e; +int const FaceNeighborNumMemberArrays = static_cast(END_FaceNeighborMemberArray_e); /* * Enumerates the face map's array members to make indexed members @@ -5055,7 +5212,7 @@ typedef enum FaceMapMemberArray_Invalid = BadEnumValue } FaceMapMemberArray_e; -const int FaceMapNumMemberArrays = (int)END_FaceMapMemberArray_e; +const int FaceMapNumMemberArrays = static_cast(END_FaceMapMemberArray_e); /* * Enumerates the element to face map's array members to make indexed members @@ -5069,7 +5226,7 @@ typedef enum ElemToFaceMapMemberArray_Invalid = BadEnumValue } ElemToFaceMapMemberArray_e; -const int ElemToFaceMapNumMemberArrays = (int)END_ElemToFaceMapMemberArray_e; +const int ElemToFaceMapNumMemberArrays = static_cast(END_ElemToFaceMapMemberArray_e); /* * Enumerates the element map's array members to make indexed members @@ -5083,7 +5240,7 @@ typedef enum NodeToElemMapMemberArray_Invalid = BadEnumValue } NodeToElemMapMemberArray_e; -const int NodeToElemMapNumMemberArrays = (int)END_NodeToElemMapMemberArray_e; +const int NodeToElemMapNumMemberArrays = static_cast(END_NodeToElemMapMemberArray_e); /* ENDREMOVEFROMADDON */ @@ -5237,12 +5394,12 @@ typedef struct _ZoneSpec_s 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 + 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; @@ -5250,7 +5407,7 @@ typedef struct _ZoneSpec_s /* classic data only */ FaceNeighborMode_e FNMode; - Boolean_t FNAreCellFaceNbrsSupplied; // ...meaning we don't need to update them + Boolean_t FNAreCellFaceNbrsSupplied; /* ...meaning we don't need to update them */ /* polytope data only */ LgIndex_t NumFaceNodes; @@ -5378,6 +5535,8 @@ typedef struct _Geom_s *Geom_pa; #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ + #if defined USE_VBOs + #endif #if defined USE_OOSTYLE #endif #if defined USE_OOSTYLE @@ -5975,6 +6134,22 @@ typedef Boolean_t (STDCALL *TimerCallback_pf)(AddOnTimerCallback_pf TimerCallba UInt32_t Interval, ArbParam_t RegistrationClientData); +/* - NO DOXYGEN COMMENT GENERATION - + * Callback responsible for notifying of a successful open or save layout action. + * + * @since + * 14.1 + * + * @param layoutName + * The name of the MRU layout that was successfully opened or saved. + * @param RegistrationClientData + * Client data that was registered with the callback. + * + * @sa TecEngMRULayoutFilenameRegisterCallback + */ +typedef void (STDCALL *MRULayoutFilenameCallback_pf)(const char* layoutName, + ArbParam_t RegistrationClientData); + /** * This function is called when the user activates a menu item * added via TecUtilMenuInsertOption or TecUtilMenuInsertToggle. @@ -6186,7 +6361,7 @@ typedef void (STDCALL *FieldValueSetFunction_pf)(FieldData_pa FD, * @param FieldData * Field data handle of the variable load. * - * @result + * @return * TRUE if the variable was loaded, FALSE if unable to do so. * * @code @@ -6275,7 +6450,7 @@ typedef Boolean_t (STDCALL *LoadOnDemandVarLoad_pf)(FieldData_pa FieldData); * } * @endcode * - * @result + * @return * 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. @@ -6340,7 +6515,7 @@ typedef void (STDCALL *LoadOnDemandVarCleanup_pf)(FieldData_pa FieldData); * @param NodeMap * Handle of the node mapping. * - * @result + * @return * TRUE if the node mapping was loaded, FALSE if unable to do so. * * @code @@ -6419,7 +6594,7 @@ typedef Boolean_t (STDCALL *LoadOnDemandNodeMapLoad_pf)(NodeMap_pa NodeMap); * } * @endcode * - * @result + * @return * 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. @@ -6483,7 +6658,7 @@ typedef void (STDCALL *LoadOnDemandNodeMapCleanup_pf)(NodeMap_pa NodeMap); * @param FaceNeighbor * Handle of the face neighbors. * - * @result + * @return * TRUE if the face neighbors was loaded, FALSE if unable to do so. * * @code @@ -6562,7 +6737,7 @@ typedef Boolean_t (STDCALL *LoadOnDemandFaceNeighborLoad_pf)(FaceNeighbor_pa Fac * } * @endcode * - * @result + * @return * 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. @@ -6626,7 +6801,7 @@ typedef void (STDCALL *LoadOnDemandFaceNeighborCleanup_pf)(FaceNeighbor_pa FaceN * @param FaceMap * Handle of the face mapping. * - * @result + * @return * TRUE if the face mapping was loaded, FALSE if unable to do so. * * @code @@ -6705,7 +6880,7 @@ typedef Boolean_t (STDCALL *LoadOnDemandFaceMapLoad_pf)(FaceMap_pa FaceMap); * } * @endcode * - * @result + * @return * 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. @@ -6888,8 +7063,19 @@ typedef Boolean_t (STDCALL *DataSetConverter_pf)(char* DataFName, */ typedef Boolean_t (STDCALL *DataSetLoader_pf)(StringList_pa Instructions); - - +/** + * Callback registered by your addon ... + * + * @param SelectedFiles + * + * @param AdvancedOptionsSelected + * + * @param ClientData + * + */ +typedef void (STDCALL * DataLoaderCallbackV2_pf)(StringList_pa SelectedFiles, + Boolean_t AdvancedOptionsSelected, + ArbParam_t ClientData); /** @@ -7241,6 +7427,52 @@ typedef void (STDCALL *OnIdleCallback_pf)(ArbParam_t ClientData); typedef Boolean_t (STDCALL *ScriptExecCallback_pf)(const char *ScriptFileName, ArbParam_t ClientData); +/** + * This callback is called by TecUtilLineSegProbe() each time a cell face + * is about to be passed through in the course of a probe. + * + * @return + * Return FALSE if you want to stop the probe at the current face. + * Return TRUE if you want the probe to progress through the face toward + * the specified end point. + * + * @param WhichEndingPosition + * Which ending position of the call to TecUtilLineSegProbe() is currently + * being probed. It will be between 1 and NumEndingPositions, inclusive, where + * NumEndingPositions is the number of ending positions passed into + * TecUtilLineSegProbe(). + * + * @param Zone + * The zone that the probe is currently passing through. + * + * @param Cell + * The number of the cell that the probe is currently passing through. + * + * @param Face + * The face number of the face that the probe is about to pass through. + * For ordered and classic finite-element zones, this will be between + * 1 and the number of faces per cell, inclusive. For polygonal and + * polyhedral zones, this is the overall zone face number, and will be + * between 1 and the total number of faces in the zone, inclusive. + * + * @param Position + * An array contining the X, Y, Z location of the point at which the + * probe trajectory has intercepted the face. In 2-D, it contains X and Y. + * + * @param ClientData + * The client data that was passed into TecUtilLineSegProbe(). + * + * + * INTEGER*4 FUNCTION LineSegProbeCallback() + * + */ +typedef Boolean_t (STDCALL * LineSegProbeCallback_pf)(LgIndex_t WhichEndingPosition, + EntIndex_t Zone, + LgIndex_t Cell, + LgIndex_t Face, + TP_GIVES double * Position, + ArbParam_t ClientData); + /* BEGINREMOVEFROMADDON */ #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ @@ -7268,5 +7500,7 @@ typedef Boolean_t (STDCALL *ScriptExecCallback_pf)(const char *ScriptFileName, struct _ViewState_a; typedef struct _ViewState_a *SavedView_pa, *ViewState_pa; +/* define Tecplot support email address in one place */ +static char const* const tecplotSupportEmailAddress = "support@tecplot.com"; #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 index 74882c3e4..929a6d9c3 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/INPUT.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/INPUT.h @@ -1,31 +1,8 @@ -/* - * 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. ******* +****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** @@ -85,6 +62,7 @@ EXTERN InputSpec_s /*X*/ AboveZeroElapsedTimeInputSpec; EXTERN InputSpec_s /*X*/ SurfaceTranslucencyInputSpec; EXTERN InputSpec_s /*X*/ MaxDepthBufferSizeInputSpec; EXTERN InputSpec_s /*X*/ MaxMultiSamplesInputSpec; +EXTERN InputSpec_s /*X*/ MaxAccumBufferSizeInputSpec; EXTERN InputSpec_s /*X*/ MinBitsPerRGBPlaneInputSpec; EXTERN InputSpec_s /*X*/ AnimationSpeedInputSpec; EXTERN InputSpec_s /*X*/ AnimationNumStepsInputSpec; diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/MASTER.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/MASTER.h index e833697bd..c3c05faf4 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/MASTER.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/MASTER.h @@ -1,30 +1,7 @@ -/* - * 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. ******* + ****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** *****************************************************************/ @@ -195,8 +172,8 @@ #define TP_GIVES #define TP_RECEIVES #define TP_RECEIVES_GIVES - #define TP_ARRAY_GIVES - #define TP_ARRAY_RECEIVES + #define TP_ARRAY_GIVES + #define TP_ARRAY_RECEIVES #define TP_ARRAY_RECEIVES_GIVES #endif @@ -220,8 +197,8 @@ #include "stdafx.h" -#if defined MSWIN -#include "W__BASE.h" +#if defined MSWIN && defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ #endif #include @@ -271,8 +248,8 @@ #if defined NO_ASSERTS #undef NO_ASSERTS #endif -#if defined NDEBUG -#undef NDEBUG +#if !defined NDEBUG +#define NDEBUG #endif #else /* RELEASE */ #if !defined NDEBUG @@ -373,7 +350,7 @@ #define SYSV #endif -#if defined DECX || defined LINUX || defined IBMRS6000X || defined COMPAQX || defined DARWIN || defined darwin +#if defined DECX || defined LINUX || defined IBMRS6000X || defined COMPAQX || defined DARWIN #define UNIXX #endif @@ -413,18 +390,18 @@ #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, +#pragma warning(disable: 4146) // unary minus operator applied to unsigned type, // result still unsigned -#pragma warning(disable: 4244) // 'conversion' conversion from 'type1' to 'type2', +#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 +#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 +#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 +#pragma warning(disable: 4786) // identifier was truncated to 'number' characters // in the debug information #endif @@ -505,6 +482,10 @@ /* OPENGL currently a must have */ #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ +#if 0 /* including GLEW header file is currently defining GLAPI to "extern" which causes problems with a kludged Mesa header GLwDrawA.h external glwMDrawingAreaWidgetClass */ + #if defined USE_VBOs + #endif +#endif # if !defined ENGINE # if defined UNIXX # endif @@ -524,11 +505,7 @@ # if XmVERSION == 1 && XmREVISION == 0 # endif # else -# ifndef darwin -# include -# else - typedef void *Widget; -# endif +# include # endif #endif @@ -658,12 +635,14 @@ typedef Widget GridWidget_t; * also be a release build (NDEBUG) */ #if defined MSWIN && defined CHECKED_BUILD && !defined NDEBUG -# error "CHECKED_BUILDS must also be release builds" +# error "CHECKED_BUILDS must also be release builds! NDEBUG should be defined but isn't." #endif #if defined NO_ASSERTS -# define USE_MACROS_FOR_FUNCTIONS +# if !defined USE_MACROS_FOR_FUNCTIONS +# define USE_MACROS_FOR_FUNCTIONS +# endif #endif /* ENDREMOVEFROMADDON */ @@ -683,6 +662,21 @@ typedef Widget GridWidget_t; #define DISALLOW_OFFSCREEN_EXPORT_IN_BATCH #endif +/* indentify the platforms capable of using FFMPEG for encoding video formats */ +#if defined MSWIN || defined LINUX || defined DARWIN + #define HAVE_FFMPEG +#endif /* ENDREMOVEFROMADDON */ +/* In windows min and max are being redefined in windef.h. + * As we want to use the ones provided by the STL we undefined them + */ +#if defined MSWIN && defined max +# undef max +#endif + +#if defined MSWIN && defined min +# undef min +#endif + #endif /* _MASTER_H_ */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_MSG.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_MSG.h index 04eebd5b7..a42eb12e2 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_MSG.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_MSG.h @@ -1,33 +1,10 @@ -/* - * 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. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -47,12 +24,12 @@ EXTERN Boolean_t WrapString(const char *OldString, char **NewString); -EXTERN void Warning(tecplot::strutil::TranslatedString Format, +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, +EXTERN void ErrMsg(tecplot::strutil::TranslatedString format, ...); /* zero or more arguments */ #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_UNICODE.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_UNICODE.h index c11d30f09..488640fe0 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_UNICODE.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/Q_UNICODE.h @@ -1,31 +1,8 @@ -/* - * 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. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -50,40 +27,44 @@ namespace strutil { // functions -Boolean_t IsValidUtf8LeadByte(Byte_t ch); -Boolean_t IsValidUtf8ContinuingByte(Byte_t ch); -Boolean_t IsValidUtf8Byte(Byte_t ch); +EXTERN Boolean_t IsValidUtf8LeadByte(Byte_t ch); +EXTERN Boolean_t IsValidUtf8ContinuingByte(Byte_t ch); +EXTERN Boolean_t IsValidUtf8Byte(Byte_t ch); -Boolean_t IsValidUtf8String(const char *str); -Boolean_t ShouldConvertWideStringToUtf8String(const wchar_t *str); -void InitTranslatedStrings(); -void CleanUpTranslatedStrings(); +EXTERN Boolean_t IsPrintable8BitAsciiChar(wchar_t wChar); -Boolean_t IsNullOrZeroLengthString(const char *S); -Boolean_t IsNullOrZeroLengthString(tecplot::strutil::TranslatedString TS); +EXTERN Boolean_t IsValidUtf8String(const char *str); +EXTERN Boolean_t ShouldConvertWideStringToUtf8String(const wchar_t *str); +EXTERN void InitTranslatedStrings(); +EXTERN void CleanUpTranslatedStrings(); -Boolean_t IsEmptyString(const char *S); -Boolean_t IsEmptyString(tecplot::strutil::TranslatedString S); -Boolean_t IsEmptyString(const wchar_t* S); +EXTERN Boolean_t IsNullOrZeroLengthString(const char *S); +EXTERN Boolean_t IsNullOrZeroLengthString(tecplot::strutil::TranslatedString TS); + +EXTERN Boolean_t IsEmptyString(const char *S); +EXTERN Boolean_t IsEmptyString(tecplot::strutil::TranslatedString S); +EXTERN Boolean_t IsEmptyString(const wchar_t* S); + +EXTERN std::string AsciiToUtf8String(unsigned char asciiChar); #if defined MSWIN -std::string LookUpTranslation(std::string& strEnglish); -void MsWinInitTranslatedStrings(); +EXTERN std::string LookUpTranslation(std::string& strEnglish); +EXTERN void MsWinInitTranslatedStrings(); -std::string WStringToString(std::wstring str); -std::wstring StringToWString(std::string str); +EXTERN std::string WStringToString(std::wstring str); +EXTERN std::wstring StringToWString(std::string str); -std::wstring MultiByteToWideChar(const char *Utf8Str, - unsigned int CodePage); +EXTERN std::wstring MultiByteToWideChar(const char* Utf8Str, + unsigned int CodePage); -std::string WideCharToMultiByte(const wchar_t *WideStr, - unsigned int CodePage); +EXTERN 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); +EXTERN std::string WideCharToUtf8(const wchar_t* str); +EXTERN std::wstring Utf8ToWideChar(const char *str); +EXTERN char *getenv(const char *str); #endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SET.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SET.h index 8fd926ead..f3d12f3de 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SET.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SET.h @@ -1,26 +1,3 @@ -/* - * 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 @@ -37,15 +14,18 @@ ***************************************************************** ***************************************************************** ******* ******** -****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** */ -#define PadOut(X,Y) ((int)(((X)-1)/(Y)+1)*(Y)) +#include +#include + +#define PadOut(X,Y) (static_cast(((X)-1)/(Y)+1)*(Y)) #define SetBitSize (8*sizeof(SetData_t)) -#define SetLastBit (((unsigned long)1)<<(SetBitSize-1)) +#define SetLastBit ((static_cast(1))<<(SetBitSize-1)) #if defined _DEBUG # define USE_FUNCTIONS_FOR_SETS @@ -150,7 +130,7 @@ inline Boolean_t AddToSet(Set_pa Set, ExpandSet(Set, member + 1, show_error_msg))) { SetIndex_t word = member / SetBitSize; - SetData_t bit = (SetData_t)1 << (member % SetBitSize); + SetData_t bit = static_cast(1) << (member % SetBitSize); Set->data[word] |= bit; return TRUE; } @@ -193,7 +173,7 @@ inline Boolean_t InSet(Set_pa Set, if (Set && (0 <= member && member < Set->size)) { SetIndex_t word = member / SetBitSize; - SetData_t bit = (SetData_t)1 << (member % SetBitSize); + SetData_t bit = static_cast(1) << (member % SetBitSize); return (Set->data[word]&bit) != 0; } else @@ -280,4 +260,76 @@ EXTERN void ShiftSet(Set_pa Set, Member != BAD_SET_VALUE; \ Member = GetPrevMember((Set), (Member))) +namespace tecplot +{ + +/** + * Converts a set into a vector of set offsets. + * @templateparam T + * Type item in the set. + * @param itemSet + * Set of items to convert into a vector of set offsets. + * @return + * Vector of set offsets. + * @throws std::bad_alloc if insufficient resources are available to made the copy + */ +template +std::vector toVector(Set_pa itemSet) +{ + REQUIRE(VALID_REF(itemSet) || itemSet == 0); + + std::vector result; + size_t const count = MemberCount(itemSet); + if (count != 0) + { + result.reserve(count); + SetIndex_t item; + ForAllMembersInSet(item,itemSet) + result.push_back(static_cast(item)); + } + + return result; +} + +/** + * Converts a vector into a set offsets. + * @templateparam T + * Type item in the set. + * @param items + * Vector of elements of type T to convert to the set of offsets. + * @return + * Allocated Set of items with the elements converted from the vector. + * @throws std::bad_alloc if insufficient resources are available to made the copy + */ +template +Set_pa toSet(std::vector const& items) +{ + Set_pa result = AllocSet(FALSE); + if (result == NULL) + throw std::bad_alloc(); + + if (!items.empty()) + { + // locate the largest element, O(n) + typename std::vector::const_iterator largest = std::max_element(items.begin(), items.end()); + + if (!ExpandSet(result, *largest + 1, FALSE)) + { + DeallocSet(&result); + throw std::bad_alloc(); + } + + for (typename std::vector::const_iterator item = items.begin();item != items.end();++item) + { + if (!AddToSet(result,static_cast(*item),FALSE)) + throw std::bad_alloc(); + } + } + + ENSURE(VALID_REF(result)); + return result; +} + +} + #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 index b1cb38c0b..e9fc8f7ea 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/STRLIST.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/STRLIST.h @@ -1,31 +1,8 @@ -/* - * 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. ******* +****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** @@ -59,7 +36,7 @@ * by adding LIBFUNCTION & LIBCALL as in * StringListDealloc(), etc. below. * - * When building the tecplot kernal, LIBFUNCTION + * When building the tecplot kernel, LIBFUNCTION * and LIBCALL are nop's. * */ @@ -72,13 +49,13 @@ EXTERN void StringListRemoveStrings(StringList_pa StringList, LgIndex_t Count); EXTERN void StringListRemoveString(StringList_pa StringList, LgIndex_t StringOffset); -LIBFUNCTION void LIBCALL StringListDealloc(StringList_pa *StringList); +LIBFUNCTION void LIBCALL StringListDealloc(StringList_pa* StringList); EXTERN StringList_pa StringListAlloc(void); EXTERN Boolean_t StringListAppendString(StringList_pa StringList, - const char *String); + char const* String); LIBFUNCTION LgIndex_t LIBCALL StringListCount(StringList_pa StringList); -LIBFUNCTION char * LIBCALL StringListGetString(StringList_pa StringList, - LgIndex_t StringOffset); +LIBFUNCTION char* LIBCALL StringListGetString(StringList_pa StringList, + LgIndex_t StringOffset); #if defined USE_MACROS_FOR_FUNCTIONS # define StringListGetStringRef StringListGetStringRef_MACRO @@ -87,36 +64,36 @@ LIBFUNCTION char * LIBCALL StringListGetString(StringList_pa StringList, #endif #if !defined USE_MACROS_FOR_FUNCTIONS -EXTERN const char * StringListGetStringRef_FUNC(StringList_pa StringList, - LgIndex_t StringOffset); +EXTERN char const* 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 + * (char const*) to minimize the risk of users passing the result * to FREE_ARRAY. */ #define StringListGetStringRef_MACRO(StringList, StringOffset) \ - ((const char *)ArrayListGetCharPtr((ArrayList_pa)(StringList), StringOffset)) + static_cast(ArrayListGetCharPtr(reinterpret_cast(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 Boolean_t StringListSetString(StringList_pa StringList, + LgIndex_t StringOffset, + char const* String); +EXTERN Boolean_t StringListInsertString(StringList_pa StringList, + LgIndex_t StringOffset, + char const* 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, +EXTERN char* StringListToNLString(StringList_pa StringList); +EXTERN StringList_pa StringListFromNLString(char const* String); +EXTERN char** StringListToArray(StringList_pa StringList); +EXTERN StringList_pa StringListFromArray(char const** 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); +EXTERN StringList_pa StringListFromCompound(char const* String); +EXTERN char* StringListToCompound(StringList_pa StringList, + char GroupJoinCharacter, + char const* CharsToEscape); +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/STRUTIL.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/STRUTIL.h index 00a4f89d1..8b07ca875 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/STRUTIL.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/STRUTIL.h @@ -1,31 +1,10 @@ -/* - * 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 TECPLOT_STRUTIL +#define TECPLOT_STRUTIL /* ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -136,8 +115,6 @@ 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); @@ -148,6 +125,11 @@ EXTERN int ustrncmp(const char *s1, size_t Len); EXTERN int ustrcmp(const char *s1, const char *s2); + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + /* public access */ /* InternalResetString should not be used directly (use ResetString macro) */ #if !defined NO_ASSERTS @@ -216,3 +198,5 @@ inline char const* EndOfString(char const* str) { return str + strlen(str); }; + +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SYSTEM.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SYSTEM.h index 8b719596e..a6f4a073b 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SYSTEM.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/SYSTEM.h @@ -1,31 +1,11 @@ -/* - * 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 TECPLOT_SYSTEM_H +#define TECPLOT_SYSTEM_H + /* ***************************************************************** ***************************************************************** ******* ******** -****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** @@ -39,6 +19,15 @@ #define EXTERN extern #endif +/* + * Windows has trouble with large chunks across SAMBA mounted file systems (not sure + * where the limit is). + */ +#define MAX_BYTES_PER_CHUNK 131072L // ...== 2^17 + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ #endif @@ -48,7 +37,6 @@ 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, @@ -65,3 +53,4 @@ EXTERN Boolean_t Open_File(FILE **F, Boolean_t ShowErr, Boolean_t IsAscii); +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TASSERT.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TASSERT.h index 33da2a4e9..2578b31da 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TASSERT.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TASSERT.h @@ -1,31 +1,10 @@ -/* - * 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 TASSERT_H +#define TASSERT_H /* ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -76,8 +55,7 @@ * builds and always fails at compile time for release * builds. */ -#if !defined TASSERT_H -#define TASSERT_H + #if defined (MSWIN) # include @@ -125,8 +103,12 @@ #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 ) +# if !defined VALID_REF +# define VALID_REF(p) ( (p) != NULL ) +# endif +# if !defined VALID_FN_REF +# define VALID_FN_REF(fp) ( (fp) != NULL ) +# endif /* BEGINREMOVEFROMADDON */ #endif /* !defined TECPLOTKERNAL */ /* ENDREMOVEFROMADDON */ @@ -147,11 +129,19 @@ #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) +# if !defined VALID_REF +# define VALID_REF(p) ((p) != NULL) +# endif +# if !defined VALID_FN_REF +# define VALID_FN_REF(pf) ((pf) != NULL) +# endif #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*))) +# if !defined VALID_REF +# define VALID_REF(p) ((p) != NULL && !IsBadReadPtr((const void *)(p), 1)) +# endif +# if !defined VALID_FN_REF +# define VALID_FN_REF(pf) ((pf) != NULL && !IsBadReadPtr((const void *)(pf),(UINT_PTR)sizeof(const void*))) +# endif #endif /* BEGINREMOVEFROMADDON */ @@ -178,13 +168,21 @@ /* ENDREMOVEFROMADDON */ /* other useful validity checks */ -#define VALID_BOOLEAN(b) ((b) == TRUE || (b) == FALSE) -#define VALID_ENUM(value, type) (0 <= (value) && \ - (value) < END_##type) +#if !defined VALID_BOOLEAN +# define VALID_BOOLEAN(b) ((b) == TRUE || (b) == FALSE) +#endif +#if !defined VALID_ENUM +# define VALID_ENUM(value, type) (0 <= static_cast((value)) && \ + static_cast((value)) < END_##type) +#endif /* 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)) +#if !defined VALID_REF_OR_NULL +# define VALID_REF_OR_NULL(ptr) IMPLICATION((ptr) != NULL, VALID_REF(ptr)) +#endif +#if !defined VALID_FN_REF_OR_NULL +# define VALID_FN_REF_OR_NULL(ptr) IMPLICATION((ptr) != NULL, VALID_FN_REF(ptr)) +#endif /* BEGINREMOVEFROMADDON */ #define VALID_TRANSLATED_STRING(ts) (!(ts).isNull()) @@ -267,23 +265,29 @@ /* 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)) +#if !defined VALID_NON_ZERO_LEN_STR +# 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) && \ - !IsBadReadPtr((const void*)(str),(UINT_PTR)(1+strlen((const char*)(str)))) && \ - !ISEMPTYSTRING(str)) +# define VALID_NON_ZERO_LEN_STR(str) (VALID_REF(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) +#if !defined VALID_SET_INDEX +# define VALID_SET_INDEX(setIndex) (((SetIndex_t)setIndex)>=(SetIndex_t)1) +#endif /* Check for valid stdio file handle */ -#define VALID_FILE_HANDLE(stream) ((stream) != NULL) +#if !defined VALID_FILE_HANDLE +# define VALID_FILE_HANDLE(stream) ((stream) != NULL) +#endif /* To check colors and pen numbers */ /* BEGINREMOVEFROMADDON */ @@ -333,7 +337,7 @@ #define VALID_NAME(Name, MaxLength) \ (VALID_REF(Name) && \ (ISEMPTYSTRING(Name) || \ - (!isspace((Name)[0]) && !isspace((Name)[strlen(Name)-1]))) && \ + (!tecplot::isspace((Name)[0]) && !tecplot::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) @@ -366,41 +370,76 @@ extern TAssertFailureNotifyFunc InstallTAssertFailureNotify( /* BEGINREMOVEFROMADDON */ # define TASSERT(EXPR) /* ENDREMOVEFROMADDON */ -# define INVARIANT(EXPR) -# define REQUIRE(EXPR) -# define ENSURE(EXPR) -# define CHECK(EXPR) +# if !defined INVARIANT +# define INVARIANT(EXPR) +# endif +# if !defined REQUIRE +# define REQUIRE(EXPR) +# endif +# if !defined ENSURE +# define ENSURE(EXPR) +# endif +# if !defined CHECK +# define CHECK(EXPR) +# endif # ifdef VERIFY # undef VERIFY # endif # define VERIFY(EXPR) ((void)(EXPR)) + +/* + * If a project is compiled with "warnings treated as errors" we need a way to + * to remove parameters that are only used for assertions if assertions are + * turned off. + * + * This macro is used in the implementation as follows: + * + * void someFunction(int const ASSERT_ONLY(paramOnlyUsedInAssertions)) + * { + * ... + * } + */ +# if !defined ASSERT_ONLY +# define ASSERT_ONLY(PARAMETER) +# endif + /* * 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 +# if !defined NOT_IMPLEMENTED +# 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 */ +# define NOT_IMPLEMENTED(x) TAssert("Not Implemented", __FILE__, __LINE__) +# endif +# if defined UNIXX +# define NOT_IMPLEMENTED() not implemented /* intentionally break the compile */ +# endif # 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) +# if !defined INVARIANT +# define INVARIANT(EXPR) assert(EXPR) +# endif +# if !defined REQUIRE +# define REQUIRE(EXPR) assert(EXPR) +# endif +# if !defined ENSURE +# define ENSURE(EXPR) assert(EXPR) +# endif +# if !defined CHECK +# define CHECK(EXPR) assert(EXPR) +# endif # ifdef VERIFY # undef VERIFY # endif @@ -411,7 +450,15 @@ extern TAssertFailureNotifyFunc InstallTAssertFailureNotify( # define VERIFY(EXPR) assert(EXPR) # endif # endif /* VERIFY */ -# define NOT_IMPLEMENTED() assert(!("Not Implemented")) +# if !defined NOT_IMPLEMENTED +# define NOT_IMPLEMENTED() assert(!("Not Implemented")) +# endif + /* + * See note above for this macro. + */ +# if !defined ASSERT_ONLY +# define ASSERT_ONLY(PARAMETER) PARAMETER +# endif #else /* BEGINREMOVEFROMADDON */ #if defined (MSWIN) @@ -441,7 +488,7 @@ extern void TWinCheckedFailedLine(const char *Expr, #define TASSERT(EXPR)\ do { if (!(EXPR)) { TWinCheckedFailedLine(#EXPR,__FILE__,__LINE__); } } while (0) #else -#define TASSERT(EXPR) ASSERT(EXPR) /* MFC assert. +#define TASSERT(EXPR) ASSERT(EXPR) /* MFC assert. Works in both release & debug builds */ #endif /* CHECKED_BUILD */ #else @@ -486,9 +533,23 @@ Works in both release & debug builds */ # define NOT_IMPLEMENTED() NiceNotImplemented() # else # define NOT_IMPLEMENTED() TASSERT(!("Not Implemented")) +# endif + /* + * See note above for this macro. + */ +# if !defined ASSERT_ONLY +# define ASSERT_ONLY(PARAMETER) PARAMETER # endif /* ENDREMOVEFROMADDON */ #endif + +/** + * @deprecated use ASSERT_ONLY instead + */ +#if !defined ASSERT_ONLY_PARAM && defined ASSERT_ONLY +# define ASSERT_ONLY_PARAM(PARAMETER) ASSERT_ONLY(PARAMETER) +#endif + /* BEGINREMOVEFROMADDON */ #if !defined STD_ASSERTS extern void TecplotMopupOnAssert(void); @@ -500,8 +561,12 @@ extern void NiceNotImplemented(void); /* ENDREMOVEFROMADDON */ /* convenience macros for implication, P -> Q, and equivalence, P <-> Q. */ -#define IMPLICATION(P,Q) (!(P) || (Q)) -#define EQUIVALENCE(P,Q) ((P) == (Q)) +#if !defined IMPLICATION +# define IMPLICATION(P,Q) (!(P) || (Q)) +#endif +#if !defined EQUIVALENCE +# define EQUIVALENCE(P,Q) ((P) == (Q)) +#endif /* BEGINREMOVEFROMADDON */ #if defined RLM diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TECIO.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TECIO.h index 3dd9751f9..c2007973b 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TECIO.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TECIO.h @@ -1,24 +1 @@ -/* - * 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 index 5c955cd0d..368f02150 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TECXXX.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TECXXX.h @@ -1,28 +1,5 @@ /* - * 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. + * TECXXX.h: Copyright (C) 1988-2010 Tecplot, Inc. */ #if !defined TECXXX_H_ @@ -34,6 +11,7 @@ # define TECZNE112 teczne112 # define TECDAT112 tecdat112 # define TECNOD112 tecnod112 +# define TECNODE112 tecnode112 # define TECGEO112 tecgeo112 # define TECTXT112 tectxt112 # define TECLAB112 teclab112 @@ -45,6 +23,8 @@ # define TECVAUXSTR112 tecvauxstr112 # define TECFACE112 tecface112 # define TECPOLY112 tecpoly112 +# define TECPOLYFACE112 tecpolyface112 +# define TECPOLYBCONN112 tecpolybconn112 # define TECFOREIGN111 tecforeign111 # define TECINI111 tecini111 @@ -156,9 +136,14 @@ #if defined (TECPLOTKERNEL) /* CORE SOURCE CODE REMOVED */ -#else /* !TECPLOTKERNAL && !MAKEARCHIVE */ -# define LIBCALL STDCALL -# define LIBFUNCTION EXTERNC DLLIMPORT +#else + #if defined (MAKEARCHIVE) + #define LIBCALL STDCALL + #define LIBFUNCTION EXTERNC DLLEXPORT + #else /* !TECPLOTKERNAL && !MAKEARCHIVE */ + #define LIBCALL STDCALL + #define LIBFUNCTION EXTERNC DLLIMPORT + #endif #endif /* @@ -203,6 +188,9 @@ LIBFUNCTION INTEGER4 LIBCALL TECDAT112(INTEGER4 *N, LIBFUNCTION INTEGER4 LIBCALL TECNOD112(INTEGER4 *NData); +LIBFUNCTION INTEGER4 LIBCALL TECNODE112(INTEGER4 *N, + INTEGER4 *NData); + LIBFUNCTION INTEGER4 LIBCALL TECEND112(void); LIBFUNCTION INTEGER4 LIBCALL TECLAB112(char *S); @@ -281,6 +269,17 @@ LIBFUNCTION INTEGER4 LIBCALL TECPOLY112(INTEGER4 *FaceNodeCounts, INTEGER4 *FaceBndryConnectionElems, INTEGER4 *FaceBndryConnectionZones); +LIBFUNCTION INTEGER4 LIBCALL TECPOLYFACE112(INTEGER4 *NumFaces, + INTEGER4 *FaceNodeCounts, + INTEGER4 *FaceNodes, + INTEGER4 *FaceLeftElems, + INTEGER4 *FaceRightElems); + +LIBFUNCTION INTEGER4 LIBCALL TECPOLYBCONN112(INTEGER4 *NumBndryFaces, + INTEGER4 *FaceBndryConnectionCounts, + INTEGER4 *FaceBndryConnectionElems, + INTEGER4 *FaceBndryConnectionZones); + /* * V11.1 tecio functions TODO (JN): Tecplot's version is still in flux so the .1 may change */ diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TEXT.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TEXT.h index fae5080fc..68ccd1960 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TEXT.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TEXT.h @@ -1,31 +1,8 @@ -/* - * 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. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.cpp index 5077bf2c9..8af7af826 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.cpp @@ -1,26 +1,3 @@ -/* - * 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 @@ -28,7 +5,7 @@ ***************************************************************** ***************************************************************** ******* ******** -****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** @@ -147,7 +124,7 @@ void TranslatedString::init(TranslatedString::Mode mode, */ TranslatedString::TranslatedString() { - init(DontTranslate, (const char*)NULL, (const char*)NULL); + init(DontTranslate, static_cast(NULL), static_cast(NULL)); ENSURE(this->isValid()); } diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.h index 8e28a045f..f8ed309d4 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/TranslatedString.h @@ -1,31 +1,8 @@ -/* - * 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. ******* +****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/VERSION.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/VERSION.h index 477479ff6..f17c2885d 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/VERSION.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/VERSION.h @@ -1,23 +1,5 @@ /* - * 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 "TecplotVersion.h" +#define ADDON_VERSION TecVersionId diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/W__BASE.h b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/W__BASE.h deleted file mode 100644 index 641c91b95..000000000 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/W__BASE.h +++ /dev/null @@ -1,105 +0,0 @@ -/* -****************************************************************** -****************************************************************** -******* ******** -****** (C) 1988-2010 Tecplot, Inc. ******* -******* ******** -****************************************************************** -****************************************************************** -*/ -#ifndef _W__BASE_h -#define _W__BASE_h - -#if defined TECPLOTKERNEL - -#include "C__BASE.h" - -typedef ULONG_PTR Widget; -#define NULLWIDGET ((unsigned long)0) - -extern BOOL MSWinIsLargeFont; -extern CWnd *(TPClassArray[TPNUMCLASSES]); - -typedef struct -{ - CRect Rect; - BOOL RectSet; - CRect MinRect; // Only used for resizable dialogs - BOOL MinRectSet; // Only used for resizable dialogs -} TPDialogRect_s; - -extern TPDialogRect_s TPDialogRect[TPNUMCLASSES]; - -#define WindowIsResizable(wnd) ((wnd)->GetStyle() & WS_THICKFRAME) - -/* - * NOTE: C = class number in TPClassArray (see C__BASE.h) - * 0=no class - * 1=TPMAINWND - * O = offset within container - * 0 means the container itself - * any other number is the offset within control (starting at 1) - * I = control number/id - * 0 = class itself - * for bitmap button groups, this is the container id - * for all other controls, this is the control id - * WidgetValue 0 is the NULL widget. - */ - -//#define MAKEWIDGET(C,I,O) ((Widget)((((C)&0xFFFF)<<16)|(((O)&0xFF)<<8)|((I)&0xFF))) - -#define CLASS_NUM_BITS 10 -#define ITEM_ID_BITS 16 /* must be at least 16-bits to fit in the workarea */ -#define ITEM_OFFSET_BITS 6 - -/* The FILTER is also the maximum value. */ -#define CLASS_NUM_FILTER ((1<> ITEM_ID_BITS) >> ITEM_OFFSET_BITS; -} -inline INT_PTR GetItemID(Widget W) -{ - return (W >> ITEM_OFFSET_BITS) & ITEM_ID_FILTER; -} -inline INT_PTR GetItemOffset(Widget W) -{ - return W & ITEM_OFFSET_FILTER; -} - -/* - * We cannot use Boolean_t here because it is not defined yet. - */ -extern CWnd *GetWindowFromWidget(Widget); -extern CWnd *GetParentWndFromWidget(Widget); -extern Widget GetWidgetFromWindow(CWnd *); -extern BOOL WidgetExists(Widget W); -extern BOOL TPEnableDialog(CWnd *wnd, - BOOL bEnable); -extern void TPEnableAllDialogs(BOOL bEnable); -extern TPDialogRect_s* GetDialogRectFromWidget(Widget); -extern TPDialogRect_s* GetDialogRectFromWindow(CWnd* pWnd); - - -#endif /* TECPLOTKERNEL */ - -/* - * This is the start of the translated string ID's - * in the resource file - */ -#define TP_TRANSLATED_STRING_START_ID 20000 - -#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/alloc.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/alloc.cpp index 19ac3e0a0..c81508cf7 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/alloc.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/alloc.cpp @@ -1,26 +1,3 @@ -/* - * 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" @@ -30,7 +7,7 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/arrlist.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/arrlist.cpp index e7a43c097..1c613b89d 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/arrlist.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/arrlist.cpp @@ -1,26 +1,3 @@ -/* - * 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 @@ -29,7 +6,7 @@ ***************************************************************** ***************************************************************** ******* ******** - ****** Copyright (C) 1988-2008 Tecplot, Inc. ******** + ****** Copyright (C) 1988-2010 Tecplot, Inc. ******** ******* All Rights Reserved. ******** ******* ******** ***************************************************************** @@ -40,11 +17,7 @@ #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 @@ -93,12 +66,12 @@ * 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) +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); @@ -106,11 +79,11 @@ static void CopyArrayItems(char *TargetArray, REQUIRE(SourceOffset >= 0); REQUIRE(&TargetArray[TargetOffset] != &SourceArray[SourceOffset]); REQUIRE(Count >= 1); - REQUIRE(1 <= ItemSize && ItemSize <= (SmInteger_t)sizeof(ArrayListItem_u)); + REQUIRE(1 <= ItemSize && ItemSize <= static_cast(sizeof(ArrayListItem_u))); void* TargetPtr = &TargetArray[TargetOffset * ItemSize]; void* SourcePtr = &SourceArray[SourceOffset * ItemSize]; - memmove(TargetPtr, SourcePtr, ((size_t)Count) * ItemSize); + memmove(TargetPtr, SourcePtr, static_cast(Count) * ItemSize); } @@ -134,17 +107,17 @@ static void CopyArrayItems(char *TargetArray, * 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, +static LgIndex_t AdjustCapacityRequest(ArrayList_pa ASSERT_ONLY(ArrayList), LgIndex_t CurrentCapacity, LgIndex_t RequestedCapacity, ArbParam_t ClientData) { - LgIndex_t Result; - REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE((RequestedCapacity == 0 && CurrentCapacity == 0) || RequestedCapacity > CurrentCapacity); + UNUSED(ClientData); + LgIndex_t Result; if (RequestedCapacity != 0 && CurrentCapacity == 0) { /* first allocation; assume the request is the desired capacityy */ @@ -152,7 +125,7 @@ static LgIndex_t AdjustCapacityRequest(ArrayList_pa ArrayList, } else { - const LgIndex_t DEFAULT_CAPACITY = 32; + LgIndex_t const DEFAULT_CAPACITY = 32; LgIndex_t BlockSize = MAX(DEFAULT_CAPACITY, CurrentCapacity / 2); if (RequestedCapacity == 0) Result = DEFAULT_CAPACITY; @@ -176,118 +149,117 @@ static LgIndex_t AdjustCapacityRequest(ArrayList_pa ArrayList, */ static SmInteger_t GetElementSize(ArrayListType_e Type) { - SmInteger_t Result; - REQUIRE(VALID_ENUM(Type, ArrayListType_e)); + SmInteger_t Result; switch (Type) { case ArrayListType_UnsignedChar: - Result = (SmInteger_t)sizeof(unsigned char); + Result = static_cast(sizeof(unsigned char)); break; case ArrayListType_UnsignedShort: - Result = (SmInteger_t)sizeof(unsigned short); + Result = static_cast(sizeof(unsigned short)); break; case ArrayListType_UnsignedInt: - Result = (SmInteger_t)sizeof(unsigned int); + Result = static_cast(sizeof(unsigned int)); break; case ArrayListType_UnsignedLong: - Result = (SmInteger_t)sizeof(unsigned long); + Result = static_cast(sizeof(unsigned long)); break; case ArrayListType_Int64: - Result = (SmInteger_t)sizeof(Int64_t); + Result = static_cast(sizeof(Int64_t)); break; case ArrayListType_Char: - Result = (SmInteger_t)sizeof(char); + Result = static_cast(sizeof(char)); break; case ArrayListType_Short: - Result = (SmInteger_t)sizeof(short); + Result = static_cast(sizeof(short)); break; case ArrayListType_Int: - Result = (SmInteger_t)sizeof(int); + Result = static_cast(sizeof(int)); break; case ArrayListType_Long: - Result = (SmInteger_t)sizeof(long); + Result = static_cast(sizeof(long)); break; case ArrayListType_Float: - Result = (SmInteger_t)sizeof(float); + Result = static_cast(sizeof(float)); break; case ArrayListType_Double: - Result = (SmInteger_t)sizeof(double); + Result = static_cast(sizeof(double)); break; case ArrayListType_LgIndex: - Result = (SmInteger_t)sizeof(LgIndex_t); + Result = static_cast(sizeof(LgIndex_t)); break; case ArrayListType_EntIndex: - Result = (SmInteger_t)sizeof(EntIndex_t); + Result = static_cast(sizeof(EntIndex_t)); break; case ArrayListType_SmInteger: - Result = (SmInteger_t)sizeof(SmInteger_t); + Result = static_cast(sizeof(SmInteger_t)); break; case ArrayListType_Boolean: - Result = (SmInteger_t)sizeof(Boolean_t); + Result = static_cast(sizeof(Boolean_t)); break; case ArrayListType_ArbParam: - Result = (SmInteger_t)sizeof(ArbParam_t); + Result = static_cast(sizeof(ArbParam_t)); break; case ArrayListType_UnsignedCharPtr: - Result = (SmInteger_t)sizeof(unsigned char *); + Result = static_cast(sizeof(unsigned char*)); break; case ArrayListType_UnsignedShortPtr: - Result = (SmInteger_t)sizeof(unsigned short *); + Result = static_cast(sizeof(unsigned short*)); break; case ArrayListType_UnsignedIntPtr: - Result = (SmInteger_t)sizeof(unsigned int *); + Result = static_cast(sizeof(unsigned int*)); break; case ArrayListType_UnsignedLongPtr: - Result = (SmInteger_t)sizeof(unsigned long *); + Result = static_cast(sizeof(unsigned long*)); break; case ArrayListType_Int64Ptr: - Result = (SmInteger_t)sizeof(Int64_t *); + Result = static_cast(sizeof(Int64_t*)); break; case ArrayListType_CharPtr: - Result = (SmInteger_t)sizeof(char *); + Result = static_cast(sizeof(char*)); break; case ArrayListType_ShortPtr: - Result = (SmInteger_t)sizeof(short *); + Result = static_cast(sizeof(short*)); break; case ArrayListType_IntPtr: - Result = (SmInteger_t)sizeof(int *); + Result = static_cast(sizeof(int*)); break; case ArrayListType_LongPtr: - Result = (SmInteger_t)sizeof(long *); + Result = static_cast(sizeof(long*)); break; case ArrayListType_FloatPtr: - Result = (SmInteger_t)sizeof(float *); + Result = static_cast(sizeof(float*)); break; case ArrayListType_DoublePtr: - Result = (SmInteger_t)sizeof(double *); + Result = static_cast(sizeof(double*)); break; case ArrayListType_LgIndexPtr: - Result = (SmInteger_t)sizeof(LgIndex_t *); + Result = static_cast(sizeof(LgIndex_t*)); break; case ArrayListType_EntIndexPtr: - Result = (SmInteger_t)sizeof(EntIndex_t *); + Result = static_cast(sizeof(EntIndex_t*)); break; case ArrayListType_SmIntegerPtr: - Result = (SmInteger_t)sizeof(SmInteger_t *); + Result = static_cast(sizeof(SmInteger_t*)); break; case ArrayListType_BooleanPtr: - Result = (SmInteger_t)sizeof(Boolean_t *); + Result = static_cast(sizeof(Boolean_t*)); break; case ArrayListType_ArbParamPtr: - Result = (SmInteger_t)sizeof(ArbParam_t *); + Result = static_cast(sizeof(ArbParam_t*)); break; case ArrayListType_VoidPtr: - Result = (SmInteger_t)sizeof(void *); + Result = static_cast(sizeof(void*)); break; case ArrayListType_FunctionPtr: - Result = (SmInteger_t)sizeof(void (*)()); + Result = static_cast(sizeof(void (*)())); break; case ArrayListType_Any: /* allows a mixed bag of items */ - Result = (SmInteger_t)sizeof(ArrayListItem_u); + Result = static_cast(sizeof(ArrayListItem_u)); break; default: @@ -296,7 +268,7 @@ static SmInteger_t GetElementSize(ArrayListType_e Type) break; } - ENSURE(1 <= Result && Result <= (SmInteger_t)sizeof(ArrayListItem_u)); + ENSURE(1 <= Result && Result <= static_cast(sizeof(ArrayListItem_u))); return Result; } @@ -324,24 +296,19 @@ static void DestroyItems(ArrayList_pa ArrayList, 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; + for (LgIndex_t 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 + Boolean_t CHECK_DoContinue; + CHECK_DoContinue = ItemDestructor(static_cast(&ArrayList->Array[ItemIndex]), ClientData); + CHECK(CHECK_DoContinue); /* this is a requirement of ArrayListItemDestructor_pf */ } } @@ -370,35 +337,33 @@ static void DestroyItems(ArrayList_pa ArrayList, * 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) +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)); + ItemSize <= static_cast(sizeof(ArrayListItem_u))); REQUIRE(Count >= 1); REQUIRE(VALID_FN_REF(ItemDuplicator)); - for (Index = 0; + Boolean_t IsOk = TRUE; + for (LgIndex_t 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], + IsOk = ItemDuplicator(static_cast(&TargetArray[TargetItemIndex]), + static_cast(&SourceArray[SourceItemIndex]), ClientData); } @@ -418,17 +383,16 @@ static Boolean_t DuplicateItems(char *TargetArray, */ Boolean_t ArrayListIsValid(ArrayList_pa ArrayList) { - Boolean_t IsValid; + #if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ + #endif - /* 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)); + Boolean_t IsValid = (VALID_REF(ArrayList) && + VALID_ENUM(ArrayList->Type, ArrayListType_e) && + (1 <= ArrayList->ItemSize && + ArrayList->ItemSize <= static_cast(sizeof(ArrayListItem_u))) && + (0 <= ArrayList->Count && + ArrayList->Count <= ArrayList->Capacity)); ENSURE(VALID_BOOLEAN(IsValid)); return IsValid; @@ -446,11 +410,9 @@ Boolean_t ArrayListIsValid(ArrayList_pa ArrayList) */ ArrayListType_e ArrayListGetType(ArrayList_pa ArrayList) { - ArrayListType_e Result; - REQUIRE(ArrayListIsValid(ArrayList)); - Result = ArrayList->Type; + ArrayListType_e Result = ArrayList->Type; ENSURE(VALID_ENUM(Result, ArrayListType_e)); return Result; @@ -465,9 +427,9 @@ ArrayListType_e ArrayListGetType(ArrayList_pa ArrayList) * the RequestedCapacity. * * param ArrayList - * Current capacity used as a helpful hint for the adjustment algorythm. + * Current capacity used as a helpful hint for the adjustment algorithm. * param RequestedCapacity - * Capacity (number ot items) request or zero for default size. + * Capacity (number of items) request or zero for default size. * * return * TRUE if the list could be enlarged (or was large enough), @@ -476,17 +438,14 @@ ArrayListType_e ArrayListGetType(ArrayList_pa ArrayList) 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)); + Boolean_t IsOk; if (RequestedCapacity == 0 || RequestedCapacity > ArrayList->Capacity) { - AdjustedCapacity = + LgIndex_t AdjustedCapacity = ArrayList->CapacityRequestAdjuster(ArrayList, ArrayList->Capacity, RequestedCapacity, @@ -494,6 +453,7 @@ Boolean_t ArrayListEnlargeCapacity(ArrayList_pa ArrayList, CHECK(AdjustedCapacity == 0 || AdjustedCapacity >= RequestedCapacity); + char* EnlargedArray = NULL; /* ...quiet compiler */ IsOk = (AdjustedCapacity != 0); /* ...were we able to meet the request? */ if (IsOk) { @@ -571,12 +531,10 @@ ArrayList_pa ArrayListAlloc(LgIndex_t EstimatedCapacit 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"); + ArrayList_pa Result = ALLOC_ITEM(ArrayList_s, "ArrayList structure"); if (Result != NULL) { Result->Array = NULL; @@ -620,9 +578,9 @@ ArrayList_pa ArrayListAlloc(LgIndex_t EstimatedCapacit * param ClientData * Any client data needed for cleanup. */ -void ArrayListDealloc(ArrayList_pa *ArrayList, - ArrayListItemDestructor_pf ItemDestructor, - ArbParam_t ClientData) +void ArrayListDealloc(ArrayList_pa* ArrayList, + ArrayListItemDestructor_pf ItemDestructor, + ArbParam_t ClientData) { REQUIRE(VALID_REF(ArrayList)); REQUIRE(ArrayListIsValid(*ArrayList) || *ArrayList == NULL); @@ -660,11 +618,9 @@ void ArrayListDealloc(ArrayList_pa *ArrayList, */ LgIndex_t ArrayListGetCount_FUNC(ArrayList_pa ArrayList) { - LgIndex_t Result; - REQUIRE(ArrayListIsValid(ArrayList)); - Result = ArrayListGetCount_MACRO(ArrayList); + LgIndex_t Result = ArrayListGetCount_MACRO(ArrayList); ENSURE(Result >= 0); return Result; @@ -845,14 +801,13 @@ ArrayList_pa ArrayListRemoveItems(ArrayList_pa ArrayList, 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, + ArrayListItem_u Result; + CopyArrayItems(static_cast(&Result.Char), 0, ArrayList->Array, ItemOffset, 1, ArrayList->ItemSize); @@ -883,8 +838,6 @@ 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)); @@ -892,6 +845,8 @@ Boolean_t ArrayListInsert(ArrayList_pa Target, REQUIRE(Target->Type == Source->Type); REQUIRE(!Target->IsVisitingItems); + Boolean_t IsOk = TRUE; + if (Source->Count != 0) { LgIndex_t NeededCapacity; @@ -960,14 +915,14 @@ 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); + Boolean_t IsOk = TRUE; + /* if necessary enlarge the list to accommodate the request */ + LgIndex_t NeededCapacity; if (ItemOffset > ArrayList->Count) NeededCapacity = ItemOffset + 1; else @@ -998,7 +953,7 @@ Boolean_t ArrayListInsertItem(ArrayList_pa ArrayList, /* insert the item */ CopyArrayItems(ArrayList->Array, ItemOffset, - (char *)&Item, 0, + static_cast(&Item.Char), 0, 1, ArrayList->ItemSize); } @@ -1032,23 +987,21 @@ Boolean_t ArrayListVisitItems(ArrayList_pa ArrayList, 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; + Boolean_t IsVisitingItems = ArrayList->IsVisitingItems; ArrayList->IsVisitingItems = TRUE; /* guards against structure changes */ + LgIndex_t Index; + SmInteger_t ItemSize; + Boolean_t DoContinue = TRUE; for (Index = 0, ItemSize = ArrayList->ItemSize; Index < Count && DoContinue; Index++) { LgIndex_t ItemIndex = (Index + ItemOffset) * ItemSize; - DoContinue = ItemVisitor((void *) & ArrayList->Array[ItemIndex], ClientData); + DoContinue = ItemVisitor(static_cast(&ArrayList->Array[ItemIndex]), ClientData); } ArrayList->IsVisitingItems = IsVisitingItems; @@ -1079,15 +1032,13 @@ 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); + ArrayList_pa Result = ArrayListAlloc(Count, ArrayList->Type, + ArrayList->CapacityRequestAdjuster, + ArrayList->CapacityRequestAdjusterClientData); if (Result != NULL) { /* copy the original items into the result */ @@ -1117,12 +1068,11 @@ ArrayList_pa ArrayListGetItems(ArrayList_pa ArrayList, 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, + ArrayListItem_u Result; + CopyArrayItems(static_cast(&Result.Char), 0, ArrayList->Array, ItemOffset, 1, ArrayList->ItemSize); @@ -1150,13 +1100,13 @@ ArrayListItem_u ArrayListGetItem(ArrayList_pa ArrayList, * return * The internal reference to the requested item. */ -const void *ArrayListGetItemInternalRef_FUNC(ArrayList_pa ArrayList, +void const* 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); + void const* Result = ArrayListGetItemInternalRef_MACRO(ArrayList, ItemOffset); ENSURE(Result == NULL || VALID_REF(Result)); return Result; } @@ -1190,14 +1140,14 @@ Boolean_t ArrayListSetItem(ArrayList_pa ArrayList, 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)); + Boolean_t IsOk = TRUE; + /* release the item if a destructor is installed */ if (ItemDestructor != NULL && ItemOffset < ArrayList->Count) DestroyItems(ArrayList, ItemOffset, ArrayList->ItemSize, 1, @@ -1212,7 +1162,7 @@ Boolean_t ArrayListSetItem(ArrayList_pa ArrayList, if (ItemOffset + 1 > ArrayList->Count) ArrayList->Count = ItemOffset + 1; CopyArrayItems(ArrayList->Array, ItemOffset, - (char *)&Item, 0, + static_cast(&Item.Char), 0, 1, ArrayList->ItemSize); } @@ -1237,12 +1187,10 @@ Boolean_t ArrayListSetItem(ArrayList_pa ArrayList, Boolean_t ArrayListAppendItem(ArrayList_pa ArrayList, ArrayListItem_u Item) { - Boolean_t IsOk; - REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(!ArrayList->IsVisitingItems); - IsOk = ArrayListInsertItem(ArrayList, ArrayList->Count, Item); + Boolean_t IsOk = ArrayListInsertItem(ArrayList, ArrayList->Count, Item); ENSURE(ArrayListIsValid(ArrayList)); ENSURE(VALID_BOOLEAN(IsOk)); @@ -1265,15 +1213,13 @@ Boolean_t ArrayListAppendItem(ArrayList_pa ArrayList, 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); + Boolean_t IsOk = ArrayListInsert(Target, Target->Count, Source); ENSURE(ArrayListIsValid(Target)); ENSURE(VALID_BOOLEAN(IsOk)); @@ -1301,14 +1247,12 @@ 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); + ArrayList_pa Result = ArrayListAlloc(ArrayList->Count, ArrayList->Type, + ArrayList->CapacityRequestAdjuster, + ArrayList->CapacityRequestAdjusterClientData); if (Result != NULL && ArrayList->Count != 0) { Boolean_t IsOk = TRUE; @@ -1356,18 +1300,17 @@ ArrayList_pa ArrayListCopy(ArrayList_pa ArrayList, * array (but not the individual members unless a item duplication function * was supplied) when it is no longer needed. */ -void *ArrayListToArray(ArrayList_pa Source, +void* ArrayListToArray(ArrayList_pa Source, ArrayListItemDuplicator_pf ItemDuplicator, ArbParam_t ClientData) { - void *Result; - REQUIRE(ArrayListIsValid(Source)); REQUIRE(VALID_FN_REF(ItemDuplicator) || ItemDuplicator == NULL); + void* Result; if (Source->Count != 0) - Result = (void *)ALLOC_ARRAY(Source->Count * Source->ItemSize, - char, "native array"); + Result = static_cast(ALLOC_ARRAY(Source->Count * Source->ItemSize, + char, "native array")); else Result = NULL; @@ -1376,20 +1319,20 @@ void *ArrayListToArray(ArrayList_pa Source, Boolean_t IsOk = TRUE; if (ItemDuplicator != NULL) /* client defines how the item duplication is performed */ - IsOk = DuplicateItems((char*)Result, 0, + IsOk = DuplicateItems(static_cast(Result), 0, Source->Array, 0, Source->ItemSize, Source->Count, ItemDuplicator, ClientData); else /* copy the original items into the result */ - CopyArrayItems((char *)Result, 0, + CopyArrayItems(static_cast(Result), 0, Source->Array, 0, Source->Count, Source->ItemSize); if (!IsOk) { /* Hack to remove delete warning... */ - char *Tmp = (char *)Result; + char* Tmp = static_cast(Result); FREE_ARRAY(Tmp, "native array"); } } @@ -1421,33 +1364,31 @@ void *ArrayListToArray(ArrayList_pa Source, * 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 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); + ArrayList_pa 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, + static_cast(Source), 0, Result->ItemSize, Count, ItemDuplicator, ClientData); else /* copy the original items into the result */ CopyArrayItems(Result->Array, 0, - (char *)Source, 0, + static_cast(Source), 0, Count, Result->ItemSize); if (IsOk) Result->Count = Count; @@ -1459,122 +1400,10 @@ ArrayList_pa ArrayListFromArray(void *Source, 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 @@ -1598,11 +1427,11 @@ void ArrayListQSort(ArrayList_pa ArrayList, * 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) +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)); @@ -1660,11 +1489,11 @@ Boolean_t ArrayListBSearch(ArrayList_pa ArrayList, * return * Reference to the array list's internal buffer. */ -const void *ArrayListGetInternalRef_FUNC(ArrayList_pa ArrayList) +void const* ArrayListGetInternalRef_FUNC(ArrayList_pa ArrayList) { REQUIRE(ArrayListIsValid(ArrayList)); - const void *Result = ArrayListGetInternalRef_MACRO(ArrayList); + void const* Result = ArrayListGetInternalRef_MACRO(ArrayList); ENSURE(Result == NULL || VALID_REF(Result)); return Result; } diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/auxdata.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/auxdata.cpp index 9b86bbfba..cacd317f7 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/auxdata.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/auxdata.cpp @@ -1,26 +1,3 @@ -/* - * 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 @@ -29,7 +6,7 @@ ***************************************************************** ***************************************************************** ******* ******** - ****** Copyright (C) 1988-2008 Tecplot, Inc. ******** + ****** Copyright (C) 1988-2010 Tecplot, Inc. ******** ******* All Rights Reserved. ******** ******* ******** ***************************************************************** @@ -41,6 +18,7 @@ #include "TASSERT.h" #include "Q_UNICODE.h" #include "ALLOC.h" +#include "CHARTYPE.h" #include "STRUTIL.h" #include "ARRLIST.h" #include "DATASET.h" @@ -58,7 +36,7 @@ using namespace tecplot::strutil; */ typedef struct { - const char *Name; + char const* Name; ArbParam_t Value; AuxDataType_e Type; Boolean_t Retain; @@ -66,15 +44,14 @@ typedef struct /** * Private auxiliary data item container structure. + * INVARIANT: ItemList is case-insensitive sorted by AuxDataItem->Name */ typedef struct _AuxData_s { - /* invariant: ItemList is case-insensitive sorted by AuxDataItem->Name */ + ArbParam_t Owner; /* dataset, frame, or page owner or NULL if no owner */ ArrayList_pa ItemList; /* [dynamic] */ } AuxData_s; -static Mutex_pa AuxDataMutex = NULL; - /** * A valid auxiliary data name character must begin with a '_' or alpha @@ -90,11 +67,11 @@ Boolean_t AuxDataIsValidNameChar(char Char, REQUIRE(VALID_BOOLEAN(IsLeadChar)); IsValidNameChar = (Char == '_' || - isalpha(Char)); + tecplot::isalpha(Char)); if (!IsLeadChar) IsValidNameChar = (IsValidNameChar || Char == '.' || - isdigit(Char)); + tecplot::isdigit(Char)); ENSURE(VALID_BOOLEAN(IsValidNameChar)); return IsValidNameChar; @@ -136,13 +113,13 @@ static void AuxDataItemDealloc(AuxDataItem_s **AuxDataItem) if (*AuxDataItem != NULL) { - char *Name = (char *)(*AuxDataItem)->Name; + char *Name = const_cast((*AuxDataItem)->Name); if (Name != NULL) FREE_ARRAY(Name, "auxiliary name"); if ((*AuxDataItem)->Type == AuxDataType_String) { - char *Value = (char *)(*AuxDataItem)->Value; + char *Value = reinterpret_cast((*AuxDataItem)->Value); if (Value != NULL) FREE_ARRAY(Value, "auxiliary value"); } @@ -161,35 +138,33 @@ static void AuxDataItemDealloc(AuxDataItem_s **AuxDataItem) * * NOTE: Copies are made of the name and value. * - * param Name + * @param Name * Auxiliary data item's name (case insenstive). - * param Value + * @param Value * Auxiliary data item's value. - * param Type + * @param Type * Auxiliary data item's value type. - * param Retain + * @param Retain * Indicates if the auxiliary data item should persist. In other words * copied, saved, etc. * - * return + * @return * A new auxiliary data item or NULL if sufficient memory was not * available. */ -static AuxDataItem_s *AuxDataItemAlloc(const char *Name, +static AuxDataItem_s* AuxDataItemAlloc(char const* 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))); + (VALID_REF(reinterpret_cast(Value)) || + reinterpret_cast(Value) == NULL))); REQUIRE(VALID_ENUM(Type, AuxDataType_e)); REQUIRE(VALID_BOOLEAN(Retain)); - Result = ALLOC_ITEM(AuxDataItem_s, "auxiliary data item"); + AuxDataItem_s* Result = ALLOC_ITEM(AuxDataItem_s, "auxiliary data item"); if (Result != NULL) { Boolean_t IsOk; @@ -200,15 +175,15 @@ static AuxDataItem_s *AuxDataItemAlloc(const char *Name, Result->Value = 0; /* to satisfy some compilers' uninitialized warnings */ if (IsOk && Type == AuxDataType_String) { - char *strValue = (char *)Value; + char *strValue = reinterpret_cast(Value); if (strValue != NULL) { char *strCopy = DupString(dontTranslate(strValue)); - Result->Value = (ArbParam_t)strCopy; + Result->Value = reinterpret_cast(strCopy); IsOk = (strCopy != NULL); } else - Result->Value = (ArbParam_t)NULL; + Result->Value = static_cast(NULL); } else CHECK(FALSE); @@ -236,10 +211,11 @@ static AuxDataItem_s *AuxDataItemAlloc(const char *Name, static Boolean_t AuxDataItemListItemDestructor(void *ItemRef, ArbParam_t ClientData) { - AuxDataItem_s **AuxDataItemRef = (AuxDataItem_s **)ItemRef; + AuxDataItem_s **AuxDataItemRef = static_cast(ItemRef); REQUIRE(VALID_REF(AuxDataItemRef)); REQUIRE(VALID_REF(*AuxDataItemRef) || *AuxDataItemRef == NULL); + UNUSED(ClientData); if (*AuxDataItemRef != NULL) AuxDataItemDealloc(AuxDataItemRef); @@ -263,10 +239,11 @@ static Boolean_t AuxDataItemListItemDestructor(void *ItemRef, Boolean_t AuxDataItemDestructor(void *ItemRef, ArbParam_t ClientData) { - AuxData_pa *AuxDataRef = (AuxData_pa *)ItemRef; + AuxData_pa *AuxDataRef = static_cast(ItemRef); REQUIRE(VALID_REF(AuxDataRef)); REQUIRE(VALID_REF(*AuxDataRef) || *AuxDataRef == NULL); + UNUSED(ClientData); if (*AuxDataRef != NULL) AuxDataDealloc(AuxDataRef); @@ -296,16 +273,16 @@ static Boolean_t AuxDataItemDuplicator(void *TargetItemRef, ArbParam_t ClientData) { Boolean_t IsOk = TRUE; - AuxDataItem_s **TargetAuxDataItemRef = (AuxDataItem_s **)TargetItemRef; - AuxDataItem_s **SourceAuxDataItemRef = (AuxDataItem_s **)SourceItemRef; + AuxDataItem_s **TargetAuxDataItemRef = static_cast(TargetItemRef); + AuxDataItem_s **SourceAuxDataItemRef = static_cast(SourceItemRef); Boolean_t ConsiderRetain; REQUIRE(VALID_REF(TargetAuxDataItemRef)); REQUIRE(VALID_REF(SourceAuxDataItemRef)); REQUIRE(VALID_REF(*SourceAuxDataItemRef) || *SourceAuxDataItemRef == NULL); - REQUIRE(VALID_BOOLEAN((Boolean_t)ClientData)); + REQUIRE(VALID_BOOLEAN(static_cast(ClientData))); - ConsiderRetain = (Boolean_t)ClientData; + ConsiderRetain = static_cast(ClientData); /* duplicate the item */ if (*SourceAuxDataItemRef != NULL && @@ -331,7 +308,7 @@ static Boolean_t AuxDataItemDuplicator(void *TargetItemRef, * param AuxData * Reference to an auxiliary data handle or reference to NULL. */ -void AuxDataDealloc(AuxData_pa *AuxData) +void LIBCALL AuxDataDealloc(AuxData_pa *AuxData) { REQUIRE(VALID_REF(AuxData)); REQUIRE(VALID_REF(*AuxData) || *AuxData == NULL); @@ -349,14 +326,17 @@ void AuxDataDealloc(AuxData_pa *AuxData) /** * Allocates an auxiliary data handle. * - * return + * @param Owner + * Auxiliary data owner, either a dataset, frame, or page or NULL if no owner. + * @return * Auxiliary data handle or NULL if sufficient memory was not available. */ -AuxData_pa AuxDataAlloc(void) +AuxData_pa AuxDataAlloc(ArbParam_t Owner) { AuxData_pa Result = ALLOC_ITEM(AuxData_s, "auxiliary data container"); if (Result != NULL) { + Result->Owner = Owner; Result->ItemList = ArrayListAlloc(0, ArrayListType_VoidPtr, NULL, 0); if (Result->ItemList == NULL) AuxDataDealloc(&Result); @@ -441,7 +421,7 @@ AuxData_pa AuxDataCopy(AuxData_pa AuxData, * return * Number of items maintained by the auxiliary data. */ -LgIndex_t AuxDataGetNumItems(AuxData_pa AuxData) +LgIndex_t LIBCALL AuxDataGetNumItems(AuxData_pa AuxData) { LgIndex_t NumItems; @@ -482,56 +462,31 @@ Boolean_t AuxDataGetItemIndex(AuxData_pa AuxData, 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 + int low, high; + low = 0; + high = NumItems - 1; + Index = 0; + while (low <= high) { - for (Index = 0; Index < NumItems; Index++) + int CompareResult; + Index = (low + high) / 2; + AuxDataItem_s* AuxDataItem = static_cast(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 { - AuxDataItem_s *AuxDataItem = - (AuxDataItem_s *)ArrayListGetVoidPtr(AuxData->ItemList, Index); - int CompareResult = ustrcmp(AuxDataItem->Name, Name); - if (CompareResult >= 0) - { - FoundItem = (CompareResult == 0); - break; - } + FoundItem = TRUE; + 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; @@ -560,12 +515,12 @@ Boolean_t AuxDataGetItemIndex(AuxData_pa AuxData, * 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) +void LIBCALL AuxDataGetItemByIndex(AuxData_pa AuxData, + LgIndex_t Index, + const char **Name, + ArbParam_t *Value, + AuxDataType_e *Type, + Boolean_t *Retain) { AuxDataItem_s *AuxDataItem; @@ -577,7 +532,7 @@ void AuxDataGetItemByIndex(AuxData_pa AuxData, REQUIRE(VALID_REF(Type)); REQUIRE(VALID_REF(Retain)); - AuxDataItem = (AuxDataItem_s *)ArrayListGetVoidPtr(AuxData->ItemList, Index); + AuxDataItem = static_cast(ArrayListGetVoidPtr(AuxData->ItemList, Index)); *Name = AuxDataItem->Name; *Value = AuxDataItem->Value; *Type = AuxDataItem->Type; @@ -585,8 +540,8 @@ void AuxDataGetItemByIndex(AuxData_pa AuxData, ENSURE(VALID_REF(*Name) && AuxDataIsValidName(*Name)); ENSURE(IMPLICATION(*Type == AuxDataType_String, - (VALID_REF((char *)(*Value)) || - (char *)(*Value) == NULL))); + (VALID_REF(reinterpret_cast(*Value)) || + reinterpret_cast(*Value) == NULL))); ENSURE(VALID_ENUM(*Type, AuxDataType_e)); ENSURE(VALID_BOOLEAN(*Retain)); } @@ -639,8 +594,8 @@ Boolean_t AuxDataGetItemByName(AuxData_pa AuxData, ENSURE(VALID_BOOLEAN(FoundItem)); ENSURE(IMPLICATION(FoundItem, IMPLICATION(*Type == AuxDataType_String, - (VALID_REF((char *)(*Value)) || - (char *)(*Value) == NULL)))); + (VALID_REF(reinterpret_cast(*Value)) || + reinterpret_cast(*Value) == NULL)))); ENSURE(IMPLICATION(FoundItem, VALID_ENUM(*Type, AuxDataType_e))); ENSURE(IMPLICATION(FoundItem, @@ -675,13 +630,13 @@ Boolean_t AuxDataGetBooleanItemByName(AuxData_pa AuxData, /* IN */ 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)) + (ustrcmp(reinterpret_cast(strValue), "YES") == 0 || + ustrcmp(reinterpret_cast(strValue), "YEP") == 0 || + ustrcmp(reinterpret_cast(strValue), "Y") == 0 || + ustrcmp(reinterpret_cast(strValue), "TRUE") == 0 || + ustrcmp(reinterpret_cast(strValue), "T") == 0 || + ustrcmp(reinterpret_cast(strValue), "ON") == 0 || + ustrcmp(reinterpret_cast(strValue), "1") == 0)) { *Value = TRUE; } @@ -702,47 +657,44 @@ Boolean_t AuxDataGetBooleanItemByName(AuxData_pa AuxData, /* IN */ * * NOTE: The auxiliary data makes copies of the name and value. * - * param AuxData + * @param AuxData * Auxiliary data handle. - * param Name + * @param Name * Auxiliary data item's name (case insenstive). - * param Value + * @param Value * Auxiliary data item's value. - * param Type + * @param Type * Auxiliary data item's value type. - * param Retain + * @param Retain * Indicates if the auxiliary data item should persist. * - * return + * @return * TRUE if the item was added to the auxiliary data. */ Boolean_t AuxDataSetItem(AuxData_pa AuxData, - const char *Name, + char const* 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))); + (VALID_REF(reinterpret_cast(Value)) || + reinterpret_cast(Value) == NULL))); REQUIRE(VALID_ENUM(Type, AuxDataType_e)); REQUIRE(VALID_BOOLEAN(Retain)); - AuxDataItem = AuxDataItemAlloc(Name, Value, Type, Retain); - IsOk = (AuxDataItem != NULL); + AuxDataItem_s* AuxDataItem = AuxDataItemAlloc(Name, Value, Type, Retain); + Boolean_t IsOk = (AuxDataItem != NULL); if (IsOk) { LgIndex_t ItemIndex; ArrayListItem_u ListItem; /* add or replace the item to the list */ - ListItem.VoidPtr = (void *)AuxDataItem; + ListItem.VoidPtr = static_cast(AuxDataItem); if (!AuxDataGetItemIndex(AuxData, Name, &ItemIndex)) IsOk = ArrayListInsertItem(AuxData->ItemList, ItemIndex, ListItem); else diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio.cpp index bf242bca9..4c94677d6 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio.cpp @@ -1,26 +1,3 @@ -/* - * 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 @@ -29,7 +6,7 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -107,6 +84,7 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream, StringList_pa **CustomLabelBase, StringList_pa *UserRec, AuxData_pa *DataSetAuxData, + ArbParam_t AuxDataOwner, Set_pa **IsVarCellCentered, /* Create an Array dim by zones */ Boolean_t *HasText, Boolean_t *HasGeoms, @@ -235,12 +213,12 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream, if (IsOk && (UserRec != NULL && *UserRec == NULL)) { *UserRec = StringListAlloc(); - IsOk = (Boolean_t)(*UserRec != NULL); + IsOk = static_cast(*UserRec != NULL); } if (IsOk && (DataSetAuxData != NULL && *DataSetAuxData == NULL)) { - *DataSetAuxData = AuxDataAlloc(); - IsOk = (Boolean_t)(*DataSetAuxData != NULL); + *DataSetAuxData = AuxDataAlloc(AuxDataOwner); + IsOk = static_cast(*DataSetAuxData != NULL); } if (IsOk && (VarAuxDataList != NULL && *VarAuxDataList == NULL) && *NumVars > 0) { @@ -267,7 +245,7 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream, * Now allocate a set for each zone */ (*IsVarCellCentered)[Z] = AllocSet(FALSE); - IsOk = (Boolean_t)((*IsVarCellCentered)[Z] != NULL); + IsOk = static_cast((*IsVarCellCentered)[Z] != NULL); } } else @@ -303,13 +281,13 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream, IsOk = ReadInDataFileTypeTitleAndVarNames(FileStream, IVersion, - ((Pass == 2) ? &S : (char **)NULL), - ((Pass == 2) ? FileType : (DataFileType_e *)NULL), + ((Pass == 2) ? &S : static_cast(NULL)), + ((Pass == 2) ? FileType : static_cast(NULL)), &INumVars, - ((Pass == 2) ? VarNames : (StringList_pa *)NULL)); + ((Pass == 2) ? VarNames : static_cast(NULL))); if (IsOk) - *NumVars = (EntIndex_t)INumVars; + *NumVars = static_cast(INumVars); if ((Pass == 2) && S && IsOk && DataSetTitle) *DataSetTitle = S; @@ -341,7 +319,7 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream, LgIndex_t LocalFNNumBndryConns; IsOk = ReadInZoneHeader(FileStream, IVersion, ZoneSpec, OkToLoad ? (*IsVarCellCentered)[*NumZones] : NULL, - *NumVars, &LocalIsRawFNAvailable, + *NumVars, AuxDataOwner, &LocalIsRawFNAvailable, &LocalFNNumBndryConns); if (IsOk && OkToLoad && IsRawFNAvailable != NULL) { @@ -362,7 +340,7 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream, if (IsOk) { ArrayListItem_u CurZoneSpecItem; - CurZoneSpecItem.VoidPtr = (void *)ZoneSpec; + CurZoneSpecItem.VoidPtr = static_cast(ZoneSpec); ArrayListSetItem(*ZoneSpecList, *NumZones, CurZoneSpecItem, ZoneSpecItemDestructor, 0); @@ -471,12 +449,12 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream, Boolean_t OkToLoad; char *CurUserRec = NULL; - OkToLoad = (Boolean_t)((Pass == 2) && UserRec); + OkToLoad = static_cast((Pass == 2) && UserRec); IsOk = ReadInUserRec(FileStream, IVersion, 500, - OkToLoad ? &CurUserRec : (char **)NULL); + OkToLoad ? &CurUserRec : static_cast(NULL)); if (IsOk && OkToLoad) IsOk = StringListAppendString(*UserRec, CurUserRec); if (CurUserRec) @@ -510,10 +488,10 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream, AuxData_pa VarAuxData; if (OkToLoad) { - VarAuxData = (AuxData_pa)ArrayListGetVoidPtr(*VarAuxDataList, VarNum); + VarAuxData = static_cast(ArrayListGetVoidPtr(*VarAuxDataList, VarNum)); if (VarAuxData == NULL) { - VarAuxData = AuxDataAlloc(); + VarAuxData = AuxDataAlloc(AuxDataOwner); IsOk = (VarAuxData != NULL && ArrayListSetVoidPtr(*VarAuxDataList, VarNum, VarAuxData)); } diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio4.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio4.cpp index f3612623e..4af414e51 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio4.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataio4.cpp @@ -1,26 +1,3 @@ -/* - * 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 @@ -29,7 +6,7 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -47,6 +24,9 @@ #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ +#else /* !TECPLOTKERNEL */ +#define DECLARE_NUMERIC_LOCALE_SETTER +#define VALID_NUMERIC_LOCALE() (1) #endif #include "GEOM2.h" @@ -57,6 +37,7 @@ #include "DATAIO4.h" #include "DATASET0.h" +#include "CHARTYPE.h" #include "STRUTIL.h" #include "ARRLIST.h" #include "STRLIST.h" @@ -105,7 +86,7 @@ static char FilterFloatChar(float X) if (((X >= 32.0) && (X <= 127.0)) || ((X >= 160.0) && (X <= 255.0)) || (X == 0.0)) - C = (char)X; + C = static_cast(X); else C = '?'; return (C); @@ -162,7 +143,7 @@ double GetNextValue(FileStream_s *FileStream, if (!FileStream->IsByteOrderNative) REVERSE_4_BYTES(&L); if (*IsOk) - X = (double)L; + X = static_cast(L); } break; case FieldDataType_Int16 : { @@ -171,14 +152,14 @@ double GetNextValue(FileStream_s *FileStream, if (!FileStream->IsByteOrderNative) REVERSE_2_BYTES(&S); if (*IsOk) - X = (double)S; + X = static_cast(S); } break; case FieldDataType_Byte : { Byte_t B; *IsOk = (TP_FREAD(&B, sizeof(Byte_t), 1, FileStream->File) == 1); if (*IsOk) - X = (double)B; + X = static_cast(B); } break; case FieldDataType_Bit : { @@ -193,7 +174,7 @@ double GetNextValue(FileStream_s *FileStream, Byte_t B; *IsOk = (TP_FREAD(&B, sizeof(Byte_t), 1, FileStream->File) == 1); if (*IsOk) - X = (double)(B & (Byte_t)01); + X = static_cast(B & static_cast(01)); } break; default: CHECK(FALSE); break; } @@ -222,7 +203,7 @@ LgIndex_t GetNextI(FileStream_s *FileStream, if (*IsOk) { Int32_t Int32Val; - *IsOk = (TP_FREAD((void *) & Int32Val, 4, 1, FileStream->File) == 1); + *IsOk = (TP_FREAD(static_cast( & Int32Val), 4, 1, FileStream->File) == 1); if (!FileStream->IsByteOrderNative) REVERSE_4_BYTES(&Int32Val); @@ -253,13 +234,13 @@ LgIndex_t GetIoFileInt(FileStream_s *FileStream, float X; if (*IsOk) { - X = (float)GetNextValue(FileStream, FieldDataType_Float, - (double)IMin - 1.0e-10, - (double)IMax + 1.0e-10, IsOk); + X = static_cast(GetNextValue(FileStream, FieldDataType_Float, + static_cast(IMin) - 1.0e-10, + static_cast(IMax) + 1.0e-10, IsOk)); if (*IsOk) { - if (ABS(X) < (float)MAXINDEX) - I = (LgIndex_t)X; + if (ABS(X) < static_cast(MAXINDEX)) + I = static_cast(X); else *IsOk = FALSE; } @@ -290,7 +271,7 @@ static Boolean_t ReallocString(char **String, REQUIRE(VALID_REF(String)); REQUIRE(*String == NULL || VALID_REF(*String)); - REQUIRE((*String != NULL && NewLength >= (LgIndex_t)strlen(*String)) || + REQUIRE((*String != NULL && NewLength >= static_cast(strlen(*String))) || (*String == NULL && NewLength >= 0)); NewString = ALLOC_ARRAY(NewLength + 1, char, "reallocated string"); @@ -374,7 +355,7 @@ Boolean_t ReadInString(FileStream_s *FileStream, LgIndex_t I; for (I = 0; IsOk && I < MaxCharacters; I++) { - X = (float)GetNextValue(FileStream, FieldDataType_Float, 0.0, 127.0, &IsOk); + X = static_cast(GetNextValue(FileStream, FieldDataType_Float, 0.0, 127.0, &IsOk)); if (!IsOk) break; if (ProcessData) @@ -406,11 +387,6 @@ Boolean_t ReadInString(FileStream_s *FileStream, 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 @@ -418,7 +394,7 @@ Boolean_t ReadInString(FileStream_s *FileStream, if (CharValue != '\0' && (I < MaxCharacters || MaxCharacters == 0)) { - StrBuffer[StrBufferLen] = (char)CharValue; + StrBuffer[StrBufferLen] = static_cast(CharValue); StrBufferLen++; } @@ -439,7 +415,7 @@ Boolean_t ReadInString(FileStream_s *FileStream, I++; } - while (IsOk && (char)CharValue != '\0'); + while (IsOk && static_cast(CharValue) != '\0'); /* if we failed cleanup if necessary */ if (!IsOk && @@ -469,7 +445,7 @@ static void ReadDoubleBlock(FileStream_s *FileStream, if (DoRead) { double *DPtr = Buffer + StartIndex; - *IsOk = (TP_FREAD(DPtr, sizeof(double), NumValues, FileStream->File) == (size_t)NumValues); + *IsOk = (TP_FREAD(DPtr, sizeof(double), NumValues, FileStream->File) == static_cast(NumValues)); if (!FileStream->IsByteOrderNative && *IsOk) { LgIndex_t N; @@ -493,7 +469,7 @@ static void ReadFloatBlock(FileStream_s *FileStream, if (DoRead) { float *FPtr = Buffer + StartIndex; - *IsOk = (TP_FREAD(FPtr, sizeof(float), NumValues, FileStream->File) == (size_t)NumValues); + *IsOk = (TP_FREAD(FPtr, sizeof(float), NumValues, FileStream->File) == static_cast(NumValues)); if (!FileStream->IsByteOrderNative && *IsOk) { LgIndex_t N; @@ -524,7 +500,7 @@ static void ReadBitBlock(FileStream_s *FileStream, *IsOk = (TP_FREAD(Buffer, sizeof(Byte_t), NumBytes, - FileStream->File) == (size_t)NumBytes); + FileStream->File) == static_cast(NumBytes)); } else *IsOk = (TP_FSEEK(FileStream->File, NumBytes * sizeof(Byte_t), SEEK_CUR) == 0); @@ -544,7 +520,7 @@ void ReadByteBlock(FileStream_s *FileStream, *IsOk = (TP_FREAD(Buffer + StartIndex, sizeof(Byte_t), NumValues, - FileStream->File) == (size_t)NumValues); + FileStream->File) == static_cast(NumValues)); } else *IsOk = (TP_FSEEK(FileStream->File, NumValues * sizeof(Byte_t), SEEK_CUR) == 0); @@ -566,7 +542,7 @@ void ReadInt16Block(FileStream_s *FileStream, *IsOk = (TP_FREAD(IntPtr, sizeof(Int16_t), NumValues, - FileStream->File) == (size_t)NumValues); + FileStream->File) == static_cast(NumValues)); if (!FileStream->IsByteOrderNative && *IsOk) { @@ -604,7 +580,7 @@ void ReadInt16BlockToInt32(FileStream_s *FileStream, *IsOk = (TP_FREAD(&Value, sizeof(Int16_t), 1, FileStream->File) == 1); if (!FileStream->IsByteOrderNative && *IsOk) REVERSE_2_BYTES(&Value); - Buffer[ValueIndex] = (Int32_t)Value; + Buffer[ValueIndex] = static_cast(Value); } } else @@ -626,7 +602,7 @@ void ReadInt32Block(FileStream_s *FileStream, *IsOk = (TP_FREAD(IntPtr, sizeof(Int32_t), NumValues, - FileStream->File) == (size_t)NumValues); + FileStream->File) == static_cast(NumValues)); if (!FileStream->IsByteOrderNative && *IsOk) { @@ -663,7 +639,7 @@ void ReadPureBlock(FileStream_s *FileStream, { ReadFloatBlock(FileStream, DoRead, - (float *)Buffer, + static_cast(Buffer), StartIndex, NumValues, IsOk); @@ -672,7 +648,7 @@ void ReadPureBlock(FileStream_s *FileStream, { ReadDoubleBlock(FileStream, DoRead, - (double *)Buffer, + static_cast(Buffer), StartIndex, NumValues, IsOk); @@ -688,7 +664,7 @@ void ReadPureBlock(FileStream_s *FileStream, else ReadBitBlock(FileStream, DoRead, - (Byte_t *)Buffer, + static_cast(Buffer), NumValues, IsOk); } break; @@ -696,7 +672,7 @@ void ReadPureBlock(FileStream_s *FileStream, { ReadByteBlock(FileStream, DoRead, - (Byte_t *)Buffer, + static_cast(Buffer), StartIndex, NumValues, IsOk); @@ -705,7 +681,7 @@ void ReadPureBlock(FileStream_s *FileStream, { ReadInt16Block(FileStream, DoRead, - (Int16_t *)Buffer, + static_cast(Buffer), StartIndex, NumValues, IsOk); @@ -714,7 +690,7 @@ void ReadPureBlock(FileStream_s *FileStream, { ReadInt32Block(FileStream, DoRead, - (Int32_t *)Buffer, + static_cast(Buffer), StartIndex, NumValues, IsOk); @@ -866,11 +842,11 @@ Boolean_t ReadInDataFileTypeTitleAndVarNames(FileStream_s *FileStream, if (IVersion >= 109) { if (FileType) - *FileType = (DataFileType_e)GetIoFileInt(FileStream, + *FileType = static_cast(GetIoFileInt(FileStream, IVersion, 0, DataFileType_Solution, - &IsOk); + &IsOk)); else GetIoFileInt(FileStream, IVersion, @@ -882,7 +858,7 @@ Boolean_t ReadInDataFileTypeTitleAndVarNames(FileStream_s *FileStream, IVersion, ((IVersion < 63) ? 80 : MaxChrsDatasetTitle), DataSetTitle, - (Boolean_t)(DataSetTitle != NULL))) + static_cast(DataSetTitle != NULL))) { if (DataSetTitle) TrimLeadAndTrailSpaces(*DataSetTitle); @@ -924,7 +900,7 @@ Boolean_t ReadInDataFileTypeTitleAndVarNames(FileStream_s *FileStream, IVersion, ((IVersion < 63) ? 5 : MaxChrsVarName), VarNames ? &VName : NULL, - (Boolean_t)(VarNames != NULL)); + static_cast(VarNames != NULL)); if (IsOk && VarNames) { if (VName == NULL) @@ -979,7 +955,7 @@ static Boolean_t ReadInPresetZoneColor(FileStream_s *FileStream, { if (VALID_BASIC_COLOR(ZoneColor)) { - ZoneSpec->ZoneLoadInfo.PresetZoneColor = (EntIndex_t)ZoneColor; + ZoneSpec->ZoneLoadInfo.PresetZoneColor = static_cast(ZoneColor); AdjustCustomColor(IVersion, &ZoneSpec->ZoneLoadInfo.PresetZoneColor); } else if (ZoneColor != -1) @@ -1012,14 +988,14 @@ static void ConvertCommonTimeToSolutionTime(ZoneSpec_s *ZoneSpec) CHECK(Type == AuxDataType_String); char *EndPtr = NULL; - double SolutionTime = strtod((const char *)Value, &EndPtr); - if (EndPtr != (char *)Value) + double SolutionTime = strtod(reinterpret_cast(Value), &EndPtr); + if (EndPtr != reinterpret_cast(Value)) { /* we only allow white space to trail a value */ - while (isspace(*EndPtr)) + while (tecplot::isspace(*EndPtr)) EndPtr++; } - if (EndPtr != (char *)Value && *EndPtr == '\0') + if (EndPtr != reinterpret_cast(Value) && *EndPtr == '\0') { ZoneSpec->SolutionTime = SolutionTime; ZoneSpec->StrandID = STRAND_ID_PENDING; @@ -1038,6 +1014,7 @@ Boolean_t ReadInZoneHeader(FileStream_s *FileStream, ZoneSpec_s *ZoneSpec, Set_pa IsVarCellCentered, EntIndex_t NumVars, + ArbParam_t AuxDataOwner, Boolean_t *IsRawFNAvailable, LgIndex_t *FNNumBndryConns) { @@ -1092,7 +1069,7 @@ Boolean_t ReadInZoneHeader(FileStream_s *FileStream, return (FALSE); } - ZoneDataFormat = (DataFormat_e)I1; + ZoneDataFormat = static_cast(I1); IsZoneFinite = (ZoneDataFormat == DataFormat_FEPoint || ZoneDataFormat == DataFormat_FEBlock); @@ -1137,7 +1114,7 @@ Boolean_t ReadInZoneHeader(FileStream_s *FileStream, { if (IVersion >= 61) { - ZoneSpec->Type = (ZoneType_e)(ZoneSpec->NumPtsK + 1); + ZoneSpec->Type = static_cast(ZoneSpec->NumPtsK + 1); switch (ZoneSpec->Type) { case ZoneType_FETriangle: ZoneSpec->NumPtsK = 3; break; @@ -1197,7 +1174,7 @@ Boolean_t ReadInZoneHeader(FileStream_s *FileStream, IsOk = IsOk && ReadInPresetZoneColor(FileStream, IVersion, ZoneSpec); /* ZoneType */ - I1 = (ZoneType_e)GetIoFileInt(FileStream, IVersion, 0, 7, &IsOk); + I1 = static_cast(GetIoFileInt(FileStream, IVersion, 0, 7, &IsOk)); switch (I1) { case 0: ZoneSpec->Type = ZoneType_Ordered; break; @@ -1218,17 +1195,17 @@ Boolean_t ReadInZoneHeader(FileStream_s *FileStream, /* 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); + (static_cast(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) + if (static_cast(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 && + if (static_cast(GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk)) && IsOk && IsVarCellCentered != NULL) { IsOk = (ZoneSpec->ZoneLoadInfo.IsInBlockFormat); @@ -1267,14 +1244,14 @@ Boolean_t ReadInZoneHeader(FileStream_s *FileStream, /* miscellaneous face neighbor info */ *FNNumBndryConns = GetIoFileInt(FileStream, IVersion, 0, MAXINDEX, &IsOk); if (*FNNumBndryConns != 0) - ZoneSpec->FNMode = (FaceNeighborMode_e)GetIoFileInt(FileStream, IVersion, 0, 3, &IsOk); + ZoneSpec->FNMode = static_cast(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); + FaceNeighborsComplete = static_cast(GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk)); /* * If the user defined face neighbors completely specify all the @@ -1355,7 +1332,7 @@ Boolean_t ReadInZoneHeader(FileStream_s *FileStream, I1 = GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk)) { if (ZoneSpec->AuxData == NULL) - ZoneSpec->AuxData = AuxDataAlloc(); + ZoneSpec->AuxData = AuxDataAlloc(AuxDataOwner); IsOk = (ZoneSpec->AuxData != NULL); if (IsOk) IsOk = ReadInAuxData(FileStream, IVersion, ZoneSpec->AuxData); @@ -1395,7 +1372,7 @@ Boolean_t ReadInCustomLabels(FileStream_s *FileStream, REQUIRE(VALID_BOOLEAN(OkToLoad)); REQUIRE(!(OkToLoad) || VALID_REF(CustomLabelBase)); - NumLabels = (short)GetIoFileInt(FileStream, IVersion, 1, MAXINDEX, &IsOk); + NumLabels = static_cast(GetIoFileInt(FileStream, IVersion, 1, MAXINDEX, &IsOk)); if (IsOk && NumLabels != 0 && OkToLoad) { *CustomLabelBase = StringListAlloc(); @@ -1444,7 +1421,7 @@ Boolean_t ReadInUserRec(FileStream_s *FileStream, if (!ReadInString(FileStream, IVersion, MaxCharactersAllowed, UserRec, - (Boolean_t)(UserRec != NULL))) + static_cast(UserRec != NULL))) { ErrMsg(translate("Invalid USERREC record in binary datafile")); return (FALSE); @@ -1488,7 +1465,7 @@ Boolean_t ReadInAuxData(FileStream_s *FileStream, if (IsOk) { AuxValueType = GetIoFileInt(FileStream, IVersion, 0, 0, &IsOk); - if (IsOk && (AuxValueType != (LgIndex_t)AuxDataType_String)) + if (IsOk && (AuxValueType != static_cast(AuxDataType_String))) { ErrMsg(translate("Unsupported auxiliary data type")); IsOk = FALSE; @@ -1503,7 +1480,7 @@ Boolean_t ReadInAuxData(FileStream_s *FileStream, DoCollectData); if (IsOk && DoCollectData) IsOk = AuxDataSetItem(AuxData, - AuxName, (ArbParam_t)AuxValue, + AuxName, reinterpret_cast(AuxValue), AuxDataType_String, TRUE); /* Retain */ @@ -1530,7 +1507,7 @@ static void GetZoneAttachment(FileStream_s *FileStream, REQUIRE(VALID_REF(IsOk) && VALID_BOOLEAN(*IsOk)); if (IVersion >= 47) - *Z = (EntIndex_t)GetIoFileInt(FileStream, IVersion, -1, MAXZONEMAP, IsOk); + *Z = static_cast(GetIoFileInt(FileStream, IVersion, -1, MAXZONEMAP, IsOk)); else *Z = 0; @@ -1614,9 +1591,9 @@ Boolean_t ReadInGeometry(FileStream_s *FileStream, IsOk = FALSE; } - Geom->Scope = (Scope_e)GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk); + Geom->Scope = static_cast(GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk)); if (IVersion >= 102) - Geom->DrawOrder = (DrawOrder_e)GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk); + Geom->DrawOrder = static_cast(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) @@ -1626,14 +1603,14 @@ Boolean_t ReadInGeometry(FileStream_s *FileStream, GetZoneAttachment(FileStream, IVersion, &Geom->Zone, &Geom->AttachToZone, &IsOk); - Geom->BColor = (SmInteger_t)GetIoFileInt(FileStream, IVersion, 0, 255, &IsOk); + Geom->BColor = static_cast(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); + Geom->FillBColor = static_cast(GetIoFileInt(FileStream, IVersion, 0, 255, &IsOk)); + Geom->IsFilled = static_cast(GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk)); AdjustCustomColor(IVersion, &Geom->FillBColor); } else @@ -1644,7 +1621,7 @@ Boolean_t ReadInGeometry(FileStream_s *FileStream, if (IVersion < 101) { - Geom->GeomType = (GeomType_e)GetIoFileInt(FileStream, IVersion, 0, 5, &IsOk); + Geom->GeomType = static_cast(GetIoFileInt(FileStream, IVersion, 0, 5, &IsOk)); if (Geom->GeomType == GeomType_LineSegs3D) { /* @@ -1657,7 +1634,7 @@ Boolean_t ReadInGeometry(FileStream_s *FileStream, } else { - Geom->GeomType = (GeomType_e)GetIoFileInt(FileStream, IVersion, 0, 4, &IsOk); + Geom->GeomType = static_cast(GetIoFileInt(FileStream, IVersion, 0, 4, &IsOk)); } /* @@ -1672,22 +1649,22 @@ Boolean_t ReadInGeometry(FileStream_s *FileStream, if (IVersion > 41) { - Geom->LinePattern = (LinePattern_e)GetIoFileInt(FileStream, IVersion, 0, (LgIndex_t)LinePattern_DashDotDot, &IsOk); + Geom->LinePattern = static_cast(GetIoFileInt(FileStream, IVersion, 0, static_cast(LinePattern_DashDotDot), &IsOk)); } else { - Geom->LinePattern = (LinePattern_e)((int)Geom->GeomType % 2); - Geom->GeomType = (GeomType_e)((int)Geom->GeomType / 10); + Geom->LinePattern = static_cast((static_cast(Geom->GeomType) % 2)); + Geom->GeomType = static_cast((static_cast(Geom->GeomType) / 10)); } - if ((IVersion < 49) && ((short)(Geom->GeomType) == 2)) + if ((IVersion < 49) && (static_cast(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); + if ((IVersion < 70) && (static_cast(Geom->GeomType) > 1)) + Geom->GeomType = static_cast((static_cast(Geom->GeomType) + 1)); ResetString(&Geom->MacroFunctionCommand, NULL, TRUE); @@ -1703,12 +1680,12 @@ Boolean_t ReadInGeometry(FileStream_s *FileStream, 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, + Geom->NumEllipsePts = static_cast(GetIoFileInt(FileStream, IVersion, 2, MaxPtsCircleOrEllipse, &IsOk)); + Geom->ArrowheadStyle = static_cast(GetIoFileInt(FileStream, IVersion, 0, static_cast(ArrowheadStyle_Hollow), &IsOk)); + Geom->ArrowheadAttachment = static_cast(GetIoFileInt(FileStream, IVersion, 0, - (LgIndex_t)ArrowheadAttachment_AtBothEnds, - &IsOk); + static_cast(ArrowheadAttachment_AtBothEnds), + &IsOk)); Geom->ArrowheadSize = GetNextValue(FileStream, FFT, ArrowheadSizeInputSpec.Min, @@ -1747,26 +1724,26 @@ Boolean_t ReadInGeometry(FileStream_s *FileStream, if (IVersion < 70) Geom->DataType = FieldDataType_Float; else - Geom->DataType = (FieldDataType_e)GetIoFileInt(FileStream, IVersion, 1, 2, &IsOk); + Geom->DataType = static_cast(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); + Geom->Clipping = static_cast(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) + if (Geom->Clipping == static_cast(2)) Geom->Clipping = Clipping_ClipToFrame; } if (IVersion < 50 || Geom->GeomType == GeomType_LineSegs) { - Geom->NumSegments = (SmInteger_t)GetIoFileInt(FileStream, IVersion, 1, MaxGeoSegments, &IsOk); + Geom->NumSegments = static_cast(GetIoFileInt(FileStream, IVersion, 1, MaxGeoSegments, &IsOk)); #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ #endif @@ -1879,7 +1856,7 @@ Boolean_t ReadInText(FileStream_s *FileStream, IsOk = FALSE; } - Text->Scope = (Scope_e)GetIoFileInt(FileStream, IVersion, 0, 1, &IsOk); + Text->Scope = static_cast(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) @@ -1888,9 +1865,21 @@ Boolean_t ReadInText(FileStream_s *FileStream, 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); + { + #if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ + #else + Text->TextShape.Font = static_cast(GetIoFileInt(FileStream, IVersion, 0, static_cast(Font_CourierBold), &IsOk)); + #endif + } else - Text->TextShape.Font = Font_Helvetica; + { + #if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ + #else + Text->TextShape.Font = Font_Helvetica; + #endif + } if (IVersion < 43) GetNextValue(FileStream, FFT, -LARGEDOUBLE, LARGEDOUBLE, &IsOk); if (IVersion < 70) @@ -1901,12 +1890,12 @@ Boolean_t ReadInText(FileStream_s *FileStream, Text->TextShape.SizeUnits = Units_Frame; } else - Text->TextShape.SizeUnits = (Units_e)GetIoFileInt(FileStream, IVersion, 0, (LgIndex_t)Units_Point, &IsOk); + Text->TextShape.SizeUnits = static_cast(GetIoFileInt(FileStream, IVersion, 0, static_cast(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); + Text->Box.BoxType = static_cast(GetIoFileInt(FileStream, IVersion, 0, static_cast(TextBox_Hollow), &IsOk)); if (IVersion < 70) { if (Text->Box.BoxType == TextBox_Hollow) @@ -1925,8 +1914,8 @@ Boolean_t ReadInText(FileStream_s *FileStream, &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); + Text->Box.BColor = static_cast(GetIoFileInt(FileStream, IVersion, 0, 255, &IsOk)); + Text->Box.FillBColor = static_cast(GetIoFileInt(FileStream, IVersion, 0, 255, &IsOk)); AdjustCustomColor(IVersion, &Text->Box.BColor); AdjustCustomColor(IVersion, &Text->Box.FillBColor); } @@ -1953,15 +1942,15 @@ Boolean_t ReadInText(FileStream_s *FileStream, TextLineSpacingInputSpec.Min, TextLineSpacingInputSpec.Max, &IsOk); - Text->Anchor = (TextAnchor_e)GetIoFileInt(FileStream, IVersion, 0, (LgIndex_t)TextAnchor_HeadRight, &IsOk); + Text->Anchor = static_cast(GetIoFileInt(FileStream, IVersion, 0, static_cast(TextAnchor_HeadRight), &IsOk)); } GetZoneAttachment(FileStream, IVersion, &Text->Zone, &Text->AttachToZone, &IsOk); - Text->BColor = (ColorIndex_t)GetIoFileInt(FileStream, IVersion, 0, 255, &IsOk); + Text->BColor = static_cast(GetIoFileInt(FileStream, IVersion, 0, 255, &IsOk)); AdjustCustomColor(IVersion, &Text->BColor); if (IVersion < 70) - TextLength = (short)GetIoFileInt(FileStream, IVersion, 0, 5000, &IsOk); + TextLength = static_cast(GetIoFileInt(FileStream, IVersion, 0, 5000, &IsOk)); ResetString(&Text->MacroFunctionCommand, NULL, TRUE); @@ -1972,9 +1961,9 @@ Boolean_t ReadInText(FileStream_s *FileStream, short I, S; for (I = 0; I < TextLength; I++) { - S = (short)GetIoFileInt(FileStream, IVersion, 0, 1000, &IsOk); + S = static_cast(GetIoFileInt(FileStream, IVersion, 0, 1000, &IsOk)); if (OkToLoad && (I <= MaxTextLen)) - Text->Text[I] = (char)S; + Text->Text[I] = static_cast(S); } if (OkToLoad) Text->Text[MIN(TextLength, MaxTextLen)] = '\0'; @@ -1998,8 +1987,8 @@ Boolean_t ReadInText(FileStream_s *FileStream, * 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 = static_cast(GetIoFileInt(FileStream, IVersion, 0, 2, &IsOk)); + if (Text->Clipping == static_cast(2)) Text->Clipping = Clipping_ClipToFrame; } @@ -2039,7 +2028,7 @@ static Boolean_t CompareVersion(float Version, char *VersionString, Boolean_t IsByteOrderNative) { - char *VersionBuf = (char *) & Version; + char *VersionBuf = reinterpret_cast( & Version); REQUIRE(VALID_REF(VersionString)); @@ -2060,7 +2049,7 @@ static float ValidVersions[] = {7.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]))) +#define NUMVALIDVERSIONS (static_cast(sizeof(ValidVersions)/sizeof(ValidVersions[0]))) /* @@ -2110,7 +2099,7 @@ static short GetNewInputVersion(FileStream_s *FileStream) return (0); I = 1; - while ((I < 4) && isdigit(Buf[I])) + while ((I < 4) && tecplot::isdigit(Buf[I])) IVersion = IVersion * 10 + Buf[I++] - '0'; if (IVersion < 70) @@ -2189,7 +2178,7 @@ short GetInputVersion(FileStream_s *FileStream) if (IsOk) return (IVersion); else - return ((short)0); + return (static_cast(0)); } #if defined TECPLOTKERNEL @@ -2221,8 +2210,8 @@ Boolean_t WriteBinaryByteBlock(FileStream_s *FileStream, Boolean_t IsOk = TP_FWRITE(ByteValues, sizeof(Byte_t), - (size_t)NumValues, - FileStream->File) == (size_t)NumValues; + static_cast(NumValues), + FileStream->File) == static_cast(NumValues); ENSURE(VALID_BOOLEAN(IsOk)); return IsOk; @@ -2250,7 +2239,7 @@ void CopyAndReverseUnalignedBytes(T *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]; + (reinterpret_cast(DstBuffer))[ii] = (reinterpret_cast(SrcBuffer))[typeSize-1-ii]; } /** @@ -2262,7 +2251,7 @@ void CopyUnalignedBytes(T *DstBuffer, 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]; + (reinterpret_cast(DstBuffer))[ii] = (reinterpret_cast(SrcBuffer))[ii]; } /** @@ -2298,7 +2287,7 @@ Boolean_t WriteBinaryInt16(FileStream_s *FileStream, Boolean_t IsOk; REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); REQUIRE("Value can be any Int16_t"); - IsOk = WriteBinaryDataUnaligned(FileStream, (Byte_t *) & Value, TRUE/*ValueInNativeOrder*/); + IsOk = WriteBinaryDataUnaligned(FileStream, reinterpret_cast( & Value), TRUE/*ValueInNativeOrder*/); ENSURE(VALID_BOOLEAN(IsOk)); return IsOk; } @@ -2312,7 +2301,7 @@ Boolean_t WriteBinaryInt32(FileStream_s *FileStream, Boolean_t IsOk; REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); REQUIRE("Value can be any Int32_t"); - IsOk = WriteBinaryDataUnaligned(FileStream, (Byte_t *) & Value, TRUE/*ValueInNativeOrder*/); + IsOk = WriteBinaryDataUnaligned(FileStream, reinterpret_cast( & Value), TRUE/*ValueInNativeOrder*/); ENSURE(VALID_BOOLEAN(IsOk)); return IsOk; } @@ -2421,12 +2410,12 @@ Boolean_t WriteBinaryReal(FileStream_s *FileStream, case FieldDataType_Float : { float FloatVal = CONVERT_DOUBLE_TO_FLOAT(RR); - IsOk = WriteBinaryDataUnaligned(FileStream, (Byte_t *) & FloatVal, TRUE/*NativeOrdering*/); + IsOk = WriteBinaryDataUnaligned(FileStream, reinterpret_cast( & FloatVal), TRUE/*NativeOrdering*/); } break; case FieldDataType_Double : { double DoubleVal = CLAMP_DOUBLE(RR); - IsOk = WriteBinaryDataUnaligned(FileStream, (Byte_t *) & DoubleVal, TRUE/*NativeOrdering*/); + IsOk = WriteBinaryDataUnaligned(FileStream, reinterpret_cast( & DoubleVal), TRUE/*NativeOrdering*/); } break; case FieldDataType_Byte : { @@ -2437,7 +2426,7 @@ Boolean_t WriteBinaryReal(FileStream_s *FileStream, else if (RR < 0) B = 0; else - B = (Byte_t)RR; + B = static_cast(RR); IsOk = WriteBinaryByte(FileStream, B); } break; default: CHECK(FALSE); break; @@ -2453,7 +2442,7 @@ Boolean_t WriteFieldDataType(FileStream_s *FileStream, Boolean_t WriteBinary) { if (WriteBinary) - return (WriteBinaryInt32(FileStream, (LgIndex_t)FDT)); + return (WriteBinaryInt32(FileStream, static_cast(FDT))); else { short S = 0; @@ -2512,14 +2501,14 @@ Boolean_t WriteBinaryFieldDataBlockOfType(FileStream_s *FileStream, if (IsFieldDataDirectAccessAllowed(FieldData)) { Byte_t *ByteArray = GetFieldDataBytePtr(FieldData) + StartOffset * sizeof(T); - IsOk = WriteBinaryChecksumByteValues(FileStream, ByteArray, (HgIndex_t)NumValues); + IsOk = WriteBinaryChecksumByteValues(FileStream, ByteArray, static_cast(NumValues)); } else { for (LgIndex_t Offset = StartOffset; Offset < NumValues; Offset++) { - T ValueBuffer = (T)GetFieldValue(FieldData, Offset); - Byte_t *ByteValue = (Byte_t *) & ValueBuffer; + T ValueBuffer = static_cast(GetFieldValue(FieldData, Offset)); + Byte_t *ByteValue = reinterpret_cast( & ValueBuffer); IsOk = WriteBinaryChecksumByteValues(FileStream, ByteValue, 1); } } @@ -2541,7 +2530,7 @@ static Boolean_t WriteBinaryFieldDataBlockOfTypeBit(FileStream_s *FileStrea if (IsFieldDataDirectAccessAllowed(FieldData)) { Byte_t *ByteArray = GetFieldDataBytePtr(FieldData); - IsOk = WriteBinaryChecksumByteValues(FileStream, ByteArray, (HgIndex_t)NumBytes); + IsOk = WriteBinaryChecksumByteValues(FileStream, ByteArray, static_cast(NumBytes)); } else { @@ -2552,7 +2541,7 @@ static Boolean_t WriteBinaryFieldDataBlockOfTypeBit(FileStream_s *FileStrea Byte_t ValueBuffer = 0; for (int ii = 0; ii < 8; ii++) { - Byte_t CurBit = (Byte_t)GetFieldValue(FieldData, Offset + ii); + Byte_t CurBit = static_cast(GetFieldValue(FieldData, Offset + ii)); ValueBuffer |= (CurBit << ii); } IsOk = WriteBinaryChecksumByteValues(FileStream, &ValueBuffer, 1); @@ -2590,58 +2579,46 @@ Boolean_t WriteBinaryFieldDataBlock(FileStream_s *FileStream, } -static Boolean_t WriteASCIIFieldDataValue(FileStream_s *FileStream, +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; + double V = GetFieldValue(FieldData, Offset); + CHECK(VALID_NUMERIC_LOCALE()); + 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); + sprintf(buffer, " %.*E", static_cast(AsciiPrecision), V); break; case FieldDataType_Int32 : - /* IsOk = FPRINTFOK(fprintf(FileStream->File," %*d",(int)AsciiPrecision,ROUNDL(V))); */ - sprintf(buffer, " %*d", (int)AsciiPrecision, ROUNDL(V)); + sprintf(buffer, " %*d", static_cast(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)); + + Boolean_t IsOk = FPRINTFOK(fprintf(FileStream->File, "%s", buffer)); #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ #endif ENSURE(VALID_BOOLEAN(IsOk)); - return (IsOk); + return IsOk; } @@ -2665,6 +2642,8 @@ Boolean_t WriteCCFieldDataBlock(FileStream_s *FileStream, LgIndex_t KEnd = -1; Boolean_t IsLinear = -1; + DECLARE_NUMERIC_LOCALE_SETTER + REQUIRE(VALID_REF(FileStream) && VALID_REF(FileStream->File)); REQUIRE(VALID_REF(FieldData)); REQUIRE(VALID_BOOLEAN(IsOrderedData)); @@ -2755,7 +2734,7 @@ Boolean_t DumpDatafileString(FileStream_s *FileStream, { const char *CPtr = S; while (IsOk && CPtr && *CPtr) - IsOk = WriteBinaryInt32(FileStream, (LgIndex_t)(unsigned char) * CPtr++); + IsOk = WriteBinaryInt32(FileStream, static_cast(static_cast( * CPtr++))); if (IsOk) IsOk = WriteBinaryInt32(FileStream, 0); } @@ -2826,6 +2805,9 @@ static void WriteAsciiTextGeomBasics(FILE* File, REQUIRE(VALID_BOOLEAN(WriteGridDataAsPolar)); REQUIRE(VALID_REF(AnchorPos)); + DECLARE_NUMERIC_LOCALE_SETTER + CHECK(VALID_NUMERIC_LOCALE()); + fprintf(File, "CS="); if (CoordSys == CoordSys_Frame) fprintf(File, "FRAME"); @@ -2911,26 +2893,26 @@ bool DumpGeometry(FileStream_s* FileStream, else CHECK(FALSE); - WriteBinaryInt32(FileStream, (LgIndex_t)Geom->Scope); - WriteBinaryInt32(FileStream, (LgIndex_t)Geom->DrawOrder); + WriteBinaryInt32(FileStream, static_cast(Geom->Scope)); + WriteBinaryInt32(FileStream, static_cast(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); + WriteBinaryInt32(FileStream, static_cast(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); + WriteBinaryInt32(FileStream, static_cast( - 1)); + WriteBinaryInt32(FileStream, static_cast(Geom->BColor)); + WriteBinaryInt32(FileStream, static_cast(Geom->FillBColor)); + WriteBinaryInt32(FileStream, static_cast(Geom->IsFilled)); CHECK(Geom->GeomType != GeomType_LineSegs3D); /* deprecated */ - WriteBinaryInt32(FileStream, (LgIndex_t)Geom->GeomType); - WriteBinaryInt32(FileStream, (LgIndex_t)Geom->LinePattern); + WriteBinaryInt32(FileStream, static_cast(Geom->GeomType)); + WriteBinaryInt32(FileStream, static_cast(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); + WriteBinaryInt32(FileStream, static_cast(Geom->NumEllipsePts)); + WriteBinaryInt32(FileStream, static_cast(Geom->ArrowheadStyle)); + WriteBinaryInt32(FileStream, static_cast(Geom->ArrowheadAttachment)); WriteBinaryReal(FileStream, Geom->ArrowheadSize, FieldDataType_Double); WriteBinaryReal(FileStream, Geom->ArrowheadAngle, FieldDataType_Double); @@ -2944,7 +2926,7 @@ bool DumpGeometry(FileStream_s* FileStream, */ FDT = GetGeomFieldDataType(Geom); WriteFieldDataType(FileStream, FDT, TRUE); - WriteBinaryInt32(FileStream, (LgIndex_t)Geom->Clipping); + WriteBinaryInt32(FileStream, static_cast(Geom->Clipping)); if (Geom->GeomType == GeomType_LineSegs) { @@ -2977,6 +2959,9 @@ bool DumpGeometry(FileStream_s* FileStream, } else { + DECLARE_NUMERIC_LOCALE_SETTER + CHECK(VALID_NUMERIC_LOCALE()); + double ScaleFact; if (Geom->PositionCoordSys == CoordSys_Frame) ScaleFact = 100.0; @@ -3035,7 +3020,7 @@ bool DumpGeometry(FileStream_s* FileStream, DumpDatafileString(FileStream, Geom->MacroFunctionCommand, FALSE); if ((Geom->GeomType == GeomType_Circle) || (Geom->GeomType == GeomType_Ellipse)) - fprintf(FileStream->File, "EP=%ld\n", (long)Geom->NumEllipsePts); + fprintf(FileStream->File, "EP=%ld\n", static_cast(Geom->NumEllipsePts)); if (Geom->GeomType == GeomType_LineSegs && Geom->PositionCoordSys != CoordSys_Grid3D) { @@ -3057,6 +3042,7 @@ bool DumpGeometry(FileStream_s* FileStream, } if (Geom->ArrowheadAttachment != ArrowheadAttachment_None) { + CHECK(VALID_NUMERIC_LOCALE()); fprintf(FileStream->File, "ASZ=%.12G\n", Geom->ArrowheadSize*ArrowheadSizeInputSpec.InterfaceAdjust.ScaleFact); fprintf(FileStream->File, "AAN=%.12G\n", @@ -3068,15 +3054,17 @@ bool DumpGeometry(FileStream_s* FileStream, { case GeomType_LineSegs : { + CHECK(VALID_NUMERIC_LOCALE()); + 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); + fprintf(FileStream->File, "%d\n", static_cast(Geom->NumSegments)); SegIndex = 0; for (I = 0; IsOk && (I < Geom->NumSegments); I++) { - fprintf(FileStream->File, "%ld\n", (long)Geom->NumSegPts[I]); + fprintf(FileStream->File, "%ld\n", static_cast(Geom->NumSegPts[I])); for (Index = 0; Index < Geom->NumSegPts[I]; Index++) { fprintf(FileStream->File, "%.12G ", GetFieldValue(Geom->GeomData.Generic.V1Base, SegIndex + Index)*ScaleFact); @@ -3084,7 +3072,7 @@ bool DumpGeometry(FileStream_s* FileStream, 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); + IsOk = static_cast(fputc('\n', FileStream->File) != EOF); } SegIndex += Geom->NumSegPts[I]; } @@ -3150,29 +3138,38 @@ bool DumpText(FileStream_s* FileStream, else CHECK(FALSE); - WriteBinaryInt32(FileStream, (LgIndex_t)Text->Scope); + WriteBinaryInt32(FileStream, static_cast(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); + #if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ + #else + { + WriteBinaryInt32(FileStream, static_cast(Text->TextShape.Font)); + } + #endif + WriteBinaryInt32(FileStream, static_cast(Text->TextShape.SizeUnits)); WriteBinaryReal(FileStream, Text->TextShape.Height, FieldDataType_Double); - WriteBinaryInt32(FileStream, (LgIndex_t)Text->Box.BoxType); + WriteBinaryInt32(FileStream, static_cast(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); + WriteBinaryInt32(FileStream, static_cast(Text->Box.BColor)); + WriteBinaryInt32(FileStream, static_cast(Text->Box.FillBColor)); WriteBinaryReal(FileStream, Text->Angle, FieldDataType_Double); WriteBinaryReal(FileStream, Text->LineSpacing, FieldDataType_Double); - WriteBinaryInt32(FileStream, (LgIndex_t)Text->Anchor); + WriteBinaryInt32(FileStream, static_cast(Text->Anchor)); if (Text->AttachToZone) - WriteBinaryInt32(FileStream, (LgIndex_t)Text->Zone); + WriteBinaryInt32(FileStream, static_cast(Text->Zone)); else - WriteBinaryInt32(FileStream, (LgIndex_t) - 1); - WriteBinaryInt32(FileStream, (LgIndex_t)Text->BColor); + WriteBinaryInt32(FileStream, static_cast( - 1)); + WriteBinaryInt32(FileStream, static_cast(Text->BColor)); } else { + DECLARE_NUMERIC_LOCALE_SETTER + CHECK(VALID_NUMERIC_LOCALE()); + double ScaleFact; Boolean_t IncludeZ = Text->PositionCoordSys == CoordSys_Grid3D; if (Text->PositionCoordSys == CoordSys_Frame) @@ -3229,7 +3226,16 @@ bool DumpText(FileStream_s* FileStream, fprintf(FileStream->File, "BXF="); WriteAsciiColor(FileStream->File, Text->Box.FillBColor); fprintf(FileStream->File, "\nF="); - switch (Text->TextShape.Font) + + Font_e font; + #if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ + #else + { + font = Text->TextShape.Font; + } + #endif + switch (font) { case Font_Helvetica : fprintf(FileStream->File, "HELV"); break; case Font_HelveticaBold : fprintf(FileStream->File, "HELV-BOLD"); break; @@ -3270,7 +3276,7 @@ bool DumpText(FileStream_s* FileStream, } else { - WriteBinaryInt32(FileStream, (LgIndex_t)Text->Clipping); + WriteBinaryInt32(FileStream, static_cast(Text->Clipping)); } if (!WriteBinary) @@ -3345,13 +3351,9 @@ bool writeBinaryVersionNumber(FileStream_s& fileStream, #endif #if !defined NO_ASSERTS #endif -#if defined ALLOW_USERDEF_NO_NEIGHBORING_ELEMENT -#else -#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 index ea4ede2cd..aea00548b 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataset.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataset.cpp @@ -1,26 +1,3 @@ -/* - * 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 @@ -29,16 +6,22 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** */ #define DATASETMODULE + +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + #include "GLOBAL.h" #include "TASSERT.h" #include "Q_UNICODE.h" +#include "CHARTYPE.h" #include "STRUTIL.h" #include "AUXDATA.h" #include "ARRLIST.h" @@ -50,6 +33,9 @@ #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ +#else /* !TECPLOTKERNEL */ +#define DECLARE_NUMERIC_LOCALE_SETTER +#define VALID_NUMERIC_LOCALE() (true) #endif #include "DATASET0.h" @@ -118,10 +104,11 @@ void ZoneSpecDealloc(ZoneSpec_s **ZoneSpec) Boolean_t ZoneSpecItemDestructor(void *ItemRef, ArbParam_t ClientData) { - ZoneSpec_s **ZoneSpecRef = (ZoneSpec_s **)ItemRef; + ZoneSpec_s **ZoneSpecRef = static_cast(ItemRef); REQUIRE(VALID_REF(ZoneSpecRef)); REQUIRE(VALID_REF(*ZoneSpecRef) || *ZoneSpecRef == NULL); + UNUSED(ClientData); if (*ZoneSpecRef != NULL) ZoneSpecDealloc(ZoneSpecRef); @@ -187,7 +174,7 @@ ZoneSpec_s *ZoneSpecAlloc(void) { ZoneSpec_s *Result; - Result = (ZoneSpec_s *)ALLOC_ITEM(ZoneSpec_s, "ZoneSpec structure"); + Result = static_cast(ALLOC_ITEM(ZoneSpec_s, "ZoneSpec structure")); if (Result != NULL) SetZoneSpecDefaults(Result); @@ -243,6 +230,7 @@ LgIndex_t ZoneOrVarListAdjustCapacityRequest(ArrayList_pa ZoneOrVarArrayList, REQUIRE((RequestedCapacity == 0 && CurrentCapacity == 0) || RequestedCapacity > CurrentCapacity); REQUIRE(CurrentCapacity <= MaxNumZonesOrVars); + UNUSED(ClientData); if (RequestedCapacity <= MaxNumZonesOrVars) { diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataset0.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataset0.cpp index 138e064bb..87bcfd0ef 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataset0.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/dataset0.cpp @@ -1,35 +1,16 @@ -/* - * 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 TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif #include "stdafx.h" #include "MASTER.h" + #define TECPLOTENGINEMODULE /* ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -43,12 +24,11 @@ #include "ARRLIST.h" #include "DATASET.h" #include "SET.h" -#include "DATASHR.h" #include "FILESTREAM.h" +#include "Q_MSG.h" #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ #endif -#include "Q_MSG.h" #include "DATASET0.h" using namespace tecplot::strutil; @@ -72,34 +52,35 @@ void OutOfMemoryMsg(void) /** */ -FieldData_pa FieldDataAlloc(void) +FieldData_pa FieldDataAlloc(Boolean_t doTrackVarSharing) { FieldData_pa Result; - Result = (FieldData_pa)ALLOC_ITEM(struct _FieldData_a, "FieldDataPtr"); + Result = static_cast(ALLOC_ITEM(struct _FieldData_a, "FieldDataPtr")); if (Result != NULL) { Result->Data = NULL; -# if defined TECPLOTKERNEL /* TecIO doesn't require these features yet */ + #if defined TECPLOTKERNEL /* TecIO doesn't require these features yet */ /* CORE SOURCE CODE REMOVED */ -# else /* ...for TecIO only */ + #else /* ...for TecIO only */ Result->GetValueCallback[0] = NULL; Result->SetValueCallback[0] = NULL; -# endif + #endif -# if defined TECPLOTKERNEL /* TecIO doesn't require these features yet */ + #if defined TECPLOTKERNEL /* TecIO doesn't require these features yet */ /* CORE SOURCE CODE REMOVED */ -# endif + #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 */ + #if defined TECPLOTKERNEL /* TecIO doesn't require these features yet */ /* CORE SOURCE CODE REMOVED */ -# endif + #endif + Result->NumValues = 0; + #if defined TECPLOTKERNEL /* TecIO doesn't require these features yet */ +/* CORE SOURCE CODE REMOVED */ + #endif } ENSURE(VALID_REF(Result) || Result == NULL); @@ -121,7 +102,7 @@ void FieldDataDeallocData(FieldData_pa FieldData) if (FieldData->Data != NULL) { /* Hack to remove 'deleting void* is undefined' warning... */ - char *Tmp = (char *)FieldData->Data; + char *Tmp = static_cast(FieldData->Data); FREE_ARRAY(Tmp, "FieldData _Data"); FieldData->Data = NULL; } @@ -185,18 +166,6 @@ void FieldDataDeallocData(FieldData_pa FieldData) /* 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) @@ -217,26 +186,21 @@ void FieldDataDealloc(FieldData_pa *FieldData, { 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 defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ + #endif if (*FieldData != NULL) { - if (DoTrackVarSharing) - DecVarStructureReference(*FieldData); - DecStructureReference(*FieldData); - if (!IsStructureReferenced(*FieldData)) + #if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ + #endif { FieldDataCleanup(*FieldData); -#if defined TECPLOTKERNEL + #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ -#endif + #endif FREE_ITEM(*FieldData, "field data"); } @@ -248,14 +212,6 @@ void FieldDataDealloc(FieldData_pa *FieldData, #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 @@ -269,11 +225,21 @@ static void copyTypedValueArray(void* DstArray, 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); + REQUIRE(VALID_REF(DstArray)); + REQUIRE(DstStart >= 0); + REQUIRE(VALID_REF(SrcArray)); + REQUIRE(0 <= SrcStart && SrcStart <= SrcEnd+1); + REQUIRE(DstArray != SrcArray); + + size_t const numBytes = sizeof(T) * (SrcEnd - SrcStart + 1); + if (numBytes != 0) + { + T const* SrcPtr = (static_cast(SrcArray)) + SrcStart; + T* DstPtr = (static_cast(DstArray)) + DstStart; + memcpy(DstPtr, SrcPtr, numBytes); + } } + /** * DstArray and SrcArray are aligned on proper word boundaries. */ @@ -289,7 +255,7 @@ void CopyTypedValueArray(FieldDataType_e ValueType, REQUIRE(VALID_REF(DstArray)); REQUIRE(DstStart >= 0); REQUIRE(VALID_REF(SrcArray)); - REQUIRE(0 <= SrcStart && SrcStart <= SrcEnd); + REQUIRE(0 <= SrcStart && SrcStart <= SrcEnd+1); REQUIRE(DstArray != SrcArray); switch (ValueType) @@ -356,8 +322,8 @@ void SwapBytesInTypedValueArray(FieldDataType_e ValueType, case FieldDataType_Double: { /* swap 8 bytes blocks */ - UInt64_t *SrcPtr = ((UInt64_t *)SrcArray) + SrcStart; - UInt64_t *SrcPtrEnd = ((UInt64_t *)SrcArray) + SrcEnd; + UInt64_t *SrcPtr = (static_cast(SrcArray)) + SrcStart; + UInt64_t *SrcPtrEnd = (static_cast(SrcArray)) + SrcEnd; CHECK(sizeof(UInt64_t) == 8 && sizeof(double) == 8); while (SrcPtr <= SrcPtrEnd) { @@ -369,8 +335,8 @@ void SwapBytesInTypedValueArray(FieldDataType_e ValueType, case FieldDataType_Int32: { /* swap 4 bytes blocks */ - UInt32_t *SrcPtr = ((UInt32_t *)SrcArray) + SrcStart; - UInt32_t *SrcPtrEnd = ((UInt32_t *)SrcArray) + SrcEnd; + UInt32_t *SrcPtr = (static_cast(SrcArray)) + SrcStart; + UInt32_t *SrcPtrEnd = (static_cast(SrcArray)) + SrcEnd; CHECK(sizeof(UInt32_t) == 4 && sizeof(float) == 4); while (SrcPtr <= SrcPtrEnd) { @@ -381,8 +347,8 @@ void SwapBytesInTypedValueArray(FieldDataType_e ValueType, case FieldDataType_Int16: { /* swap 4 bytes blocks */ - UInt16_t *SrcPtr = ((UInt16_t *)SrcArray) + SrcStart; - UInt16_t *SrcPtrEnd = ((UInt16_t *)SrcArray) + SrcEnd; + UInt16_t *SrcPtr = (static_cast(SrcArray)) + SrcStart; + UInt16_t *SrcPtrEnd = (static_cast(SrcArray)) + SrcEnd; CHECK(sizeof(UInt16_t) == 2); while (SrcPtr <= SrcPtrEnd) { @@ -421,8 +387,8 @@ void SwapBytesInUnalignedTypedValueArray(FieldDataType_e ValueType, 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); + Byte_t *SrcPtr = (static_cast(SrcArray)) + SrcStart * sizeof(UInt64_t); + Byte_t *SrcPtrEnd = (static_cast(SrcArray)) + SrcEnd * sizeof(UInt64_t); size_t byte_skip = SrcSkip * sizeof(UInt64_t); CHECK(sizeof(UInt64_t) == 8 && sizeof(double) == 8); while (SrcPtr <= SrcPtrEnd) @@ -435,8 +401,8 @@ void SwapBytesInUnalignedTypedValueArray(FieldDataType_e ValueType, 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); + Byte_t *SrcPtr = (static_cast(SrcArray)) + SrcStart * sizeof(UInt32_t); + Byte_t *SrcPtrEnd = (static_cast(SrcArray)) + SrcEnd * sizeof(UInt32_t); size_t byte_skip = SrcSkip * sizeof(UInt32_t); CHECK(sizeof(UInt32_t) == 4 && sizeof(float) == 4); while (SrcPtr <= SrcPtrEnd) @@ -448,8 +414,8 @@ void SwapBytesInUnalignedTypedValueArray(FieldDataType_e ValueType, 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); + Byte_t *SrcPtr = (static_cast(SrcArray)) + SrcStart * sizeof(UInt16_t); + Byte_t *SrcPtrEnd = (static_cast(SrcArray)) + SrcEnd * sizeof(UInt16_t); size_t byte_skip = SrcSkip * sizeof(UInt16_t); CHECK(sizeof(UInt16_t) == 2); while (SrcPtr <= SrcPtrEnd) @@ -509,6 +475,14 @@ void SwapBytesInUnalignedTypedValueArray(FieldDataType_e ValueType, /* 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[] = @@ -531,7 +505,7 @@ static unsigned char BadValueStr[] = # 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) + memcmp(BadValueStr,(static_cast((fd)->Data))+sizeof(type)*(pt), sizeof(type)) != 0) # endif #else # define FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, type) TRUE @@ -552,7 +526,7 @@ double STDCALL GetFieldValueForFloat(const FieldData_pa fd, REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, float)); - double Result = (double)GetFieldDataFloatPtr(fd)[pt]; + double Result = static_cast(GetFieldDataFloatPtr(fd)[pt]); return Result; } @@ -599,7 +573,7 @@ double STDCALL GetFieldValueForInt32(const FieldData_pa fd, REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Int32_t)); - double Result = (double)GetFieldDataInt32Ptr(fd)[pt]; + double Result = static_cast(GetFieldDataInt32Ptr(fd)[pt]); return Result; } @@ -622,7 +596,7 @@ double STDCALL GetFieldValueForInt16(const FieldData_pa fd, REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Int16_t)); - double Result = (double)GetFieldDataInt16Ptr(fd)[pt]; + double Result = static_cast(GetFieldDataInt16Ptr(fd)[pt]); return Result; } @@ -646,7 +620,7 @@ double STDCALL GetFieldValueForByte(const FieldData_pa fd, REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Byte_t)); - double Result = (double)GetFieldDataBytePtr(fd)[pt]; + double Result = static_cast(GetFieldDataBytePtr(fd)[pt]); return Result; } @@ -850,7 +824,7 @@ static void STDCALL SetFieldValueForByte(FieldData_pa fd, else if (val > 255.0) GetFieldDataBytePtr(fd)[pt] = 255; else - GetFieldDataBytePtr(fd)[pt] = (Byte_t)val; + GetFieldDataBytePtr(fd)[pt] = static_cast(val); ENSURE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Byte_t)); } @@ -955,12 +929,12 @@ Int64_t FieldDataGetBytesNeeded(LgIndex_t NumValues, 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; + case FieldDataType_Float: Result = (static_cast(NumValues))*sizeof(float); break; + case FieldDataType_Double: Result = (static_cast(NumValues))*sizeof(double); break; + case FieldDataType_Int32: Result = (static_cast(NumValues))*sizeof(LgIndex_t); break; + case FieldDataType_Int16: Result = (static_cast(NumValues))*sizeof(SmInteger_t); break; + case FieldDataType_Byte: Result = (static_cast(NumValues))*sizeof(Byte_t); break; + case FieldDataType_Bit: Result = (static_cast(NumValues+7)/8)*sizeof(Byte_t); break; default: CHECK(FALSE); break; } @@ -969,9 +943,9 @@ Int64_t FieldDataGetBytesNeeded(LgIndex_t NumValues, } /** - * 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. + * On the SGI, HP, Sun and Itanium Linux 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) @@ -988,7 +962,7 @@ Boolean_t IsOffsetAlignedForFieldDataType(FieldDataType_e FieldDataType, REQUIRE(Offset >= 0); Int64_t SizeOfType = FieldDataGetBytesNeeded(1, FieldDataType); - if (SizeOfType > (Int64_t)SIZEOF_LARGEST_OBJECT_TO_ALIGN) + if (SizeOfType > static_cast(SIZEOF_LARGEST_OBJECT_TO_ALIGN)) SizeOfType = SIZEOF_LARGEST_OBJECT_TO_ALIGN; Boolean_t HasValidAlignment = (Offset % SizeOfType == 0); @@ -1006,7 +980,7 @@ Int64_t GetAlignedOffsetForFieldDataType(FieldDataType_e FieldDataType, REQUIRE(Offset >= 0); Int64_t SizeOfType = FieldDataGetBytesNeeded(1, FieldDataType); - if (SizeOfType > (Int64_t)SIZEOF_LARGEST_OBJECT_TO_ALIGN) + if (SizeOfType > static_cast(SIZEOF_LARGEST_OBJECT_TO_ALIGN)) SizeOfType = SIZEOF_LARGEST_OBJECT_TO_ALIGN; Int64_t NumBytesPastAlignment = (Offset % SizeOfType); @@ -1049,13 +1023,17 @@ void FieldDataDefineData(FieldData_pa FieldData, # 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); + FieldData->GetValueCallback[0] = reinterpret_cast(DetermineFieldDataGetFunction(DataType, FALSE)); + FieldData->SetValueCallback[0] = reinterpret_cast(DetermineFieldDataSetFunction(DataType, FALSE)); #endif ENSURE(FieldData->Data == NULL); } +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif + /** */ Boolean_t FieldDataAllocData(FieldData_pa FieldData, @@ -1071,7 +1049,7 @@ Boolean_t FieldDataAllocData(FieldData_pa FieldData, * 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; + size_t BytesToAllocate = static_cast(ActualBytesNeeded); /* * 64 bit architectures are effectively unlimited in their allocation size @@ -1081,12 +1059,12 @@ Boolean_t FieldDataAllocData(FieldData_pa FieldData, CHECK(sizeof(size_t) == 4 || sizeof(size_t) == 8); Boolean_t IsOk = (FieldData->NumValues <= MAXINDEX && IMPLICATION(sizeof(size_t) == 4, - ActualBytesNeeded <= (Int64_t)0xffffffff)); + ActualBytesNeeded <= static_cast(0xffffffff))); if (IsOk) { if (FieldData->NumValues > 0) { - FieldData->Data = (void *)ALLOC_ARRAY(BytesToAllocate, char, "FieldData's Data"); + FieldData->Data = reinterpret_cast(ALLOC_ARRAY(BytesToAllocate, char, "FieldData's Data")); #if defined DEBUG_FIELDVALUES { if (FieldData->Data != NULL) @@ -1100,8 +1078,8 @@ Boolean_t FieldDataAllocData(FieldData_pa FieldData, * 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'; + if (FieldData->Type == FieldDataType_Bit && FieldData->Data != NULL) + (static_cast(FieldData->Data))[BytesToAllocate-1] = '\0'; } IsOk = (FieldData->NumValues == 0 || FieldData->Data != NULL); @@ -1109,7 +1087,7 @@ Boolean_t FieldDataAllocData(FieldData_pa FieldData, OutOfMemoryMsg(); } else if (ShowErrMsg) - ErrMsg(translate("Storage limit (%ld) exceeded for a single variable."), (long)MAXINDEX); + ErrMsg(translate("Storage limit (%ld) exceeded for a single variable."), static_cast(MAXINDEX)); # if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ @@ -1179,7 +1157,7 @@ FieldData_pa AllocScratchNodalFieldDataPtr(LgIndex_t NumValues, REQUIRE(VALID_FIELD_DATA_TYPE(Type)); REQUIRE(VALID_BOOLEAN(ShowErrMsg)); - FieldData_pa Result = FieldDataAlloc(); + FieldData_pa Result = FieldDataAlloc(FALSE); if (Result != NULL) { FieldDataDefineData(Result, NumValues, Type, ValueLocation_Nodal); @@ -1476,6 +1454,26 @@ void *GetFieldDataVoidPtr_FUNC(FieldData_pa fd) } #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 /* TECPLOTKERNEL */ @@ -1500,6 +1498,22 @@ void *GetFieldDataVoidPtr_FUNC(FieldData_pa fd) /* 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 */ @@ -1575,6 +1589,12 @@ void CopyFieldValue(FieldData_pa dst, } /* CopyFieldValue() */ +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#if defined TECPLOTKERNEL +#endif /* TECPLOTKERNEL */ +#endif + #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ #endif @@ -1651,8 +1671,12 @@ void SetFieldDataPtrToAllZeros(FieldData_pa fd) if (NumBytesToMemSet > 0) { - void *fd_data = GetFieldDataVoidPtr(fd); - memset(fd_data, 0, NumBytesToMemSet); + char* fd_data = static_cast(GetFieldDataVoidPtr(fd)); + #if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ + #else + memset(fd_data, 0, NumBytesToMemSet); + #endif } else { diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/datautil.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/datautil.cpp index e55271edf..af9e059b5 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/datautil.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/datautil.cpp @@ -1,26 +1,3 @@ -/* - * 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 @@ -28,7 +5,7 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -158,7 +135,7 @@ void LocalReadBlock(FileStream_s *FileStream, { ReadPureBlock(FileStream, DoRead, - (void *)CurVPtr, + static_cast(CurVPtr), FieldDataTypeInFile, 0, NumValues, @@ -205,6 +182,7 @@ Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly, LgIndex_t **NumPtsK, ZoneType_e **ZoneType, StringList_pa *UserRec, + AuxData_pa *DatasetAuxData, Boolean_t RawDataSpaceAllocated, NodeMap_t ***NodeMap, double ***VDataBase) @@ -247,22 +225,23 @@ Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly, FALSE, NumZones, NumVars, - (SmInteger_t *)NULL, + static_cast(NULL), DataSetTitle, - (Text_s **)NULL, - (Geom_s **)NULL, - (StringList_pa **)NULL, + static_cast(NULL), + static_cast(NULL), + static_cast(NULL), UserRec, - (AuxData_pa *)NULL, + DatasetAuxData, + 0, &IsVarCellCentered, - (Boolean_t *)NULL, - (Boolean_t *)NULL, + static_cast(NULL), + static_cast(NULL), &ZoneSpecList, VarNames, - (ArrayList_pa *)NULL, - (Set_pa *)NULL, + static_cast(NULL), + static_cast(NULL), &FNNumBndryConns, - (DataFileType_e *)NULL); + static_cast(NULL)); @@ -437,10 +416,10 @@ Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly, { EntIndex_t NumDupVars, ZZ; - NumDupVars = (EntIndex_t)GetIoFileInt(ReadTecFileStream, *IVersion, 0, (LgIndex_t) * NumVars, &InputIsOk); + NumDupVars = static_cast(GetIoFileInt(ReadTecFileStream, *IVersion, 0, static_cast( * NumVars), &InputIsOk)); for (J = 0; J < NumDupVars; J++) { - ZZ = (EntIndex_t)GetIoFileInt(ReadTecFileStream, *IVersion, 0, *NumVars, &InputIsOk) - 1; + ZZ = static_cast(GetIoFileInt(ReadTecFileStream, *IVersion, 0, *NumVars, &InputIsOk)) - 1; VarSharesFromZone[ZZ] = CurZone - 1; /* emulate DupVar: share from previous zone */ } /* Can't duplicate from the first zone */ @@ -457,10 +436,10 @@ Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly, { for (J = 0; J < *NumVars; J++) { - VarType[J] = (FieldDataType_e)GetIoFileInt(ReadTecFileStream, *IVersion, + VarType[J] = static_cast(GetIoFileInt(ReadTecFileStream, *IVersion, 0, - (LgIndex_t)FieldDataType_Bit, - &InputIsOk); + static_cast(FieldDataType_Bit), + &InputIsOk)); if (!InputIsOk) { ErrMsg(translate("Invalid data type - binary input file corrupted")); @@ -497,13 +476,13 @@ Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly, if (*IVersion >= 105 && InputIsOk) { /* passive variables */ - if ((Boolean_t)GetIoFileInt(ReadTecFileStream, *IVersion, 0, 1, &InputIsOk) && InputIsOk) + if (static_cast(GetIoFileInt(ReadTecFileStream, *IVersion, 0, 1, &InputIsOk)) && InputIsOk) { for (CurVar = 0; CurVar < *NumVars && InputIsOk; CurVar++) { - IsVarPassive[CurVar] = (Boolean_t)GetIoFileInt(ReadTecFileStream, + IsVarPassive[CurVar] = static_cast(GetIoFileInt(ReadTecFileStream, *IVersion, - 0, 1, &InputIsOk); + 0, 1, &InputIsOk)); } } } @@ -511,7 +490,7 @@ Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly, if (*IVersion >= 101 && InputIsOk) { /* variable sharing: equivalent to DupVar for ReadTec */ - if ((Boolean_t)GetIoFileInt(ReadTecFileStream, *IVersion, 0, 1, &InputIsOk) && InputIsOk) + if (static_cast(GetIoFileInt(ReadTecFileStream, *IVersion, 0, 1, &InputIsOk)) && InputIsOk) { for (CurVar = 0; CurVar < *NumVars && InputIsOk; CurVar++) { @@ -928,13 +907,13 @@ Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly, void * STDCALL TecAlloc(size_t size) { - return (void *)ALLOC_ARRAY(size, char, "TecAlloc"); + return static_cast(ALLOC_ARRAY(size, char, "TecAlloc")); } void STDCALL TecFree(void *ptr) { /* Hack to remove delete warning... */ - char *Tmp = (char *)ptr; + char *Tmp = static_cast(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 index 9a0e11571..159890523 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/filestream.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/filestream.cpp @@ -1,26 +1,3 @@ -/* - * 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 @@ -29,7 +6,7 @@ ***************************************************************** ***************************************************************** ******* ******** - ****** Copyright (C) 1988-2008 Tecplot, Inc. ******* + ****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/geom2.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/geom2.cpp index 90eef5b7b..f78aa57b4 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/geom2.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/geom2.cpp @@ -1,26 +1,3 @@ -/* - * 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 @@ -29,7 +6,7 @@ ***************************************************************** ***************************************************************** ******* ******** -****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_msg.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_msg.cpp index b94b94b51..bca637fdb 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_msg.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_msg.cpp @@ -1,26 +1,3 @@ -/* - * 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" @@ -30,7 +7,7 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -190,19 +167,19 @@ static void SendWarningToFile(FILE *F, /** - * Show the warning message. Note that the Format string can be the only + * 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 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, +void Warning(TranslatedString format, ...) /* zero or more arguments */ { - REQUIRE(!Format.isNull()); + REQUIRE(!format.isNull()); static Boolean_t InWarning = FALSE; /* ...used to prevent recursive deadlock */ if (!InWarning) @@ -222,14 +199,14 @@ void Warning(TranslatedString Format, Boolean_t cleanUp = TRUE; va_list Arguments; - va_start(Arguments, Format); - char* message = vFormatString(Format.c_str(), 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(); + message = const_cast(format.c_str()); } #if defined TECPLOTKERNEL @@ -261,13 +238,13 @@ void Warning(TranslatedString Format, static void SendErrToFile(FILE *File, const char *Msg) { - char *FormattedMsg; + char *formattedMsg; REQUIRE(VALID_REF(File)); REQUIRE(VALID_REF(Msg)); - if (WrapString(Msg, &FormattedMsg)) + if (WrapString(Msg, &formattedMsg)) { - fprintf(File, "Err: %s\n", FormattedMsg); - FREE_ARRAY(FormattedMsg, "temp error string"); + fprintf(File, "Err: %s\n", formattedMsg); + FREE_ARRAY(formattedMsg, "temp error string"); } else fprintf(File, "Err: %s\n", Msg); @@ -290,10 +267,12 @@ static void DefaultErrMsg(const char *Msg) #endif } -static void PostErrorMessage(TranslatedString Format, +/** + */ +static void PostErrorMessage(TranslatedString format, va_list Arguments) { - REQUIRE(!Format.isNull()); + REQUIRE(!format.isNull()); /* * Attempt to format the string. Failing that simply use the original format @@ -302,26 +281,26 @@ static void PostErrorMessage(TranslatedString Format, * previous operation anyway. */ Boolean_t cleanUp = TRUE; - char* messageString = vFormatString(Format.c_str(), Arguments); + 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(); + messageString = const_cast(format.c_str()); } -#if defined TECPLOTKERNEL + #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ -#ifdef MSWIN -#endif -#if defined UNIXX -#if !defined ENGINE -#endif -#endif -#else /* !TECPLOTKERNEL */ + #if defined MSWIN + #endif + #if defined UNIXX + #if !defined ENGINE + #endif + #endif + #else /* !TECPLOTKERNEL */ { DefaultErrMsg(messageString); } -#endif + #endif /* cleanup if we allocated the string */ if (cleanUp) @@ -335,10 +314,10 @@ static void PostErrorMessage(TranslatedString Format, * queued for display on idle. In batch mode all messages are sent to the * batch log file. */ -void vErrMsg(TranslatedString Format, +void vErrMsg(TranslatedString format, va_list Arguments) { - REQUIRE(!Format.isNull()); + REQUIRE(!format.isNull()); static Boolean_t InErrMsg = FALSE; /* ...used to prevent recursive deadlock */ if (!InErrMsg) @@ -349,7 +328,7 @@ void vErrMsg(TranslatedString Format, InErrMsg = TRUE; { - PostErrorMessage(Format, Arguments); + PostErrorMessage(format, Arguments); } InErrMsg = FALSE; @@ -360,26 +339,26 @@ void vErrMsg(TranslatedString Format, } /** - * Show the error message. Note that the Format string can be the only + * 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 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, +void ErrMsg(TranslatedString format, ...) /* zero or more arguments */ { - REQUIRE(!Format.isNull()); + REQUIRE(!format.isNull()); va_list Arguments; - va_start(Arguments, Format); + va_start(Arguments, format); #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ #else - PostErrorMessage(Format, Arguments); + PostErrorMessage(format, Arguments); #endif va_end(Arguments); } diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_unicode.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_unicode.cpp index 96bad6089..ab69b6063 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_unicode.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/q_unicode.cpp @@ -1,26 +1,3 @@ -/* - * 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" @@ -30,7 +7,7 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -299,6 +276,14 @@ Boolean_t IsValidUtf8Byte(Byte_t uch) return Result; } +/** + */ +Boolean_t IsPrintable8BitAsciiChar(wchar_t wChar) +{ + return ((wChar >= static_cast(33) && wChar <= static_cast(126)) || + (wChar >= static_cast(160) && wChar <= static_cast(255))); +} + Boolean_t ShouldConvertWideStringToUtf8String(const wchar_t *str) { @@ -306,7 +291,9 @@ Boolean_t ShouldConvertWideStringToUtf8String(const wchar_t *str) #if defined MSWIN && defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ -#endif /* MSWIN and TECPLOTKERNEL */ +#else + UNUSED(str); +#endif ENSURE(VALID_BOOLEAN(Result)); return Result; @@ -412,6 +399,38 @@ Boolean_t IsNullOrZeroLengthString(TranslatedString TS) return TS.isNullOrZeroLength(); } +/** + * Convert an ASCII character, 0..255, to a UTF-8 encoded string. This function + * was copied from http://www.daniweb.com/forums/thread151622.html + */ +std::string AsciiToUtf8String(unsigned char asciiChar) +{ + std::string result; + + if (asciiChar < 128) + { + /* + * if the character is less than 128 then leave it as it is since + * anything less than 128 is represented in binary as 0xxxxxxx + */ + result += asciiChar; + } + else + { + /* + * If the character is 128 or above, then it is represented as + * 110xxxxx 10xxxxxx (2 bytes). So for getting the first byte we + * right shift the character 6 times and or it with 0xC0 (11000000) + * i.e. asciiChar >> 6 = 000xxx, then 000xxxxx OR 11000000 = 110xxxxx. + * For the second byte we need the lower 6 bits, so just block the + * first 2 bits, i.e. (00111111 AND xxxxxxxx) OR 10000000 = 10xxxxxx + */ + result += static_cast((asciiChar & 0x3F) | 0x80); + result += static_cast((asciiChar >> 6) | 0xC0); + } + + return result; +} } } @@ -442,6 +461,4 @@ void MSWinTrace(const char *Format, ...) 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 index f163e73da..41ddcff46 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/set.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/set.cpp @@ -1,26 +1,3 @@ -/* - * 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 @@ -30,7 +7,7 @@ ***************************************************************** ***************************************************************** ******* ******** -****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** @@ -45,7 +22,6 @@ #include "ALLOC.h" #include "SET.h" - /* * SET FUNCTIONS * */ #if defined TECPLOTKERNEL @@ -61,7 +37,7 @@ #define SetExpansionFactor 2 #endif -using namespace tecplot::strutil; +using tecplot::strutil::translate; /* */ @@ -110,10 +86,11 @@ void DeallocSet(Set_pa *Set) Boolean_t SetItemDestructor(void *ItemRef, ArbParam_t ClientData) { - Set_pa *SetRef = (Set_pa *)ItemRef; + Set_pa *SetRef = static_cast(ItemRef); REQUIRE(VALID_REF(SetRef)); REQUIRE(VALID_REF(*SetRef) || *SetRef == NULL); + UNUSED(ClientData); if (*SetRef != NULL) DeallocSet(SetRef); @@ -130,7 +107,7 @@ Boolean_t ExpandSet(Set_pa Set, Boolean_t show_error_msg) { SetData_t *data; - long new_size; + SetIndex_t new_size; REQUIRE(max_val >= 0); @@ -175,7 +152,7 @@ Boolean_t ExpandSet(Set_pa Set, 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); + memset(reinterpret_cast(data) + old_set_size_in_bytes, 0, numBytesToReset); FREE_ARRAY(Set->data, "old Set data"); Set->data = data; @@ -201,7 +178,7 @@ Boolean_t CopySet(Set_pa dst, 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); + memset(reinterpret_cast(dst->data + src_size_in_words), 0, numBytesToReset); return TRUE; } @@ -222,7 +199,7 @@ Boolean_t AppendSet(Set_pa dst, SetIndex_t member; ForAllMembersInSet(member, src) { - if (!AddToSet(dst, member, TRUE)) + if (!AddToSet(dst, member, show_error_msg)) return FALSE; } return TRUE; @@ -254,7 +231,7 @@ Boolean_t AddToSet(Set_pa 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); + SetData_t bit = static_cast(1) << (member % SetBitSize); Set->data[word] |= bit; return TRUE; } @@ -273,8 +250,8 @@ void RemoveFromSet(Set_pa Set, 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); + SetData_t bit = static_cast (1) << (member % SetBitSize); + Set->data[word] &= ((static_cast( - 1)) ^ bit); } } /* RemoveFromSet() */ @@ -441,7 +418,7 @@ SetIndex_t GetNextMember(Set_pa Set, else if (start_at + 1 < Set->size) { word = (start_at + 1) / SetBitSize; - bit = (start_at + 1) % SetBitSize; + bit = static_cast((start_at + 1) % SetBitSize); if (word < set_size_in_words) word_val = Set->data[word] >> bit; } @@ -492,7 +469,7 @@ SetIndex_t GetPrevMember(Set_pa Set, else if (start_at > 0) { word = (start_at - 1) / SetBitSize; - bit = (start_at - 1) % SetBitSize; + bit = static_cast((start_at - 1) % SetBitSize); if (word >= 0) word_val = Set->data[word] << (SetBitSize - bit - 1); } @@ -503,7 +480,7 @@ SetIndex_t GetPrevMember(Set_pa Set, while ((word >= 0) && (word_val == 0)) { word--; - bit = SetBitSize - 1; + bit = static_cast(SetBitSize - 1); if (word >= 0) word_val = Set->data[word] << (SetBitSize - bit - 1); } @@ -691,6 +668,3 @@ void ShiftSet(Set_pa Set, 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 index 783967170..3f7ffed94 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/stdafx.h +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/stdafx.h @@ -1,26 +1,3 @@ -/* - * 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_ @@ -28,7 +5,7 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -37,8 +14,14 @@ * 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 */ + +/* + * Must include locale before MFC includes to avoid a conflict + * between xlocale and MFC debug new. + */ +#include + #if defined _WIN32 /* diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/strlist.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/strlist.cpp index f91c54086..1504e4206 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/strlist.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/strlist.cpp @@ -1,26 +1,3 @@ -/* - * 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 @@ -29,7 +6,7 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -49,7 +26,10 @@ /* END HEADER */ -using namespace tecplot::strutil; +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif +using tecplot::strutil::dontTranslate; /* * This set of functions provide a wrapper around the array list utilities @@ -71,14 +51,14 @@ using namespace tecplot::strutil; * return * TRUE is a requirement */ -static Boolean_t StringListItemDestructor(void *ItemRef, +static Boolean_t StringListItemDestructor(void* ItemRef, ArbParam_t ClientData) { - char **StringRef = (char **)ItemRef; - - REQUIRE(VALID_REF(StringRef)); - REQUIRE(VALID_REF(*StringRef) || *StringRef == NULL); + REQUIRE(VALID_REF(ItemRef)); + REQUIRE(VALID_REF(*static_cast(ItemRef)) || *static_cast(ItemRef) == NULL); + UNUSED(ClientData); + char** StringRef = static_cast(ItemRef); if (*StringRef != NULL) { FREE_ARRAY(*StringRef, "string"); @@ -105,17 +85,18 @@ static Boolean_t StringListItemDestructor(void *ItemRef, * is the client's responsibility to cleanup any * partial duplication */ -static Boolean_t StringListItemDuplicator(void *TargetItemRef, - void *SourceItemRef, +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(TargetItemRef)); + REQUIRE(VALID_REF(SourceItemRef)); + REQUIRE(VALID_REF(*static_cast(SourceItemRef)) || *static_cast(SourceItemRef) == NULL); + UNUSED(ClientData); - REQUIRE(VALID_REF(TargetStringRef)); - REQUIRE(VALID_REF(SourceStringRef)); - REQUIRE(VALID_REF(*SourceStringRef) || *SourceStringRef == NULL); + Boolean_t IsOk = TRUE; + char** TargetStringRef = static_cast(TargetItemRef); + char** SourceStringRef = static_cast(SourceItemRef); if (*SourceStringRef != NULL) IsOk = ((*TargetStringRef = DupString(dontTranslate(*SourceStringRef))) != NULL); @@ -133,29 +114,29 @@ static Boolean_t StringListItemDuplicator(void *TargetItemRef, */ Boolean_t StringListValid(StringList_pa stringList) { - Boolean_t isValid = ArrayListIsValid((ArrayList_pa)stringList); - + Boolean_t isValid = ArrayListIsValid(reinterpret_cast(stringList)); if (isValid) { - LgIndex_t stringCount = ArrayListGetCount((ArrayList_pa)stringList); + LgIndex_t stringCount = ArrayListGetCount(reinterpret_cast(stringList)); -#if defined PERFORM_EXPENSIVE_STRLIST_TESTS + #if defined PERFORM_EXPENSIVE_STRLIST_TESTS { for (LgIndex_t index = 0; index < stringCount; index++) { - char *string = ArrayListGetCharPtr((ArrayList_pa)stringList, index); + char* string = ArrayListGetCharPtr(reinterpret_cast(stringList), index); if (string != NULL && !VALID_REF(string)) { isValid = FALSE; break; } } -#else + } + #else { /* Check first and last only */ if (stringCount > 0) { - char *string = ArrayListGetCharPtr((ArrayList_pa)stringList, 0); + char* string = ArrayListGetCharPtr(reinterpret_cast(stringList), 0); if (string != NULL && !VALID_REF(string)) { isValid = FALSE; @@ -163,903 +144,761 @@ Boolean_t StringListValid(StringList_pa stringList) } if (isValid && stringCount > 1) { - char *string = ArrayListGetCharPtr((ArrayList_pa)stringList, stringCount - 1); + char* string = ArrayListGetCharPtr(reinterpret_cast(stringList), stringCount - 1); if (string != NULL && !VALID_REF(string)) { isValid = FALSE; } } } -#endif /* PERFORM_SKIP_EXPENSIVE_STRLIST_TESTS */ - } - - ENSURE(VALID_BOOLEAN(isValid)); - return isValid; + #endif /* PERFORM_SKIP_EXPENSIVE_STRLIST_TESTS */ } - - /* - * 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); - } + ENSURE(VALID_BOOLEAN(isValid)); + return isValid; +} - /* - * 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)); +/* + * Remove all members of the string list. + */ +void StringListClear(StringList_pa StringList) +{ + REQUIRE(StringListValid(StringList)); - ArrayListDeleteItems((ArrayList_pa)StringList, StringOffset, Count, - StringListItemDestructor, 0); + ArrayListDeleteAllItems(reinterpret_cast(StringList), StringListItemDestructor, 0); - ENSURE(StringListValid(StringList)); - } + ENSURE(StringListValid(StringList) && StringListCount(StringList) == 0); +} - /* - * 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); +/* + * 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, 1, - StringListItemDestructor, 0); + ArrayListDeleteItems(reinterpret_cast(StringList), StringOffset, Count, + StringListItemDestructor, 0); - ENSURE(StringListValid(StringList)); - } + 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)); +/* + * 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); - if (*StringList != NULL) - ArrayListDealloc((ArrayList_pa *)StringList, StringListItemDestructor, 0); + ArrayListDeleteItems(reinterpret_cast(StringList), StringOffset, 1, + StringListItemDestructor, 0); - ENSURE(*StringList == NULL); - } + ENSURE(StringListValid(StringList)); +} - /* - * Allocate a string list handle. A handle of NULL is - * returned if sufficient memory is not available. - */ - StringList_pa StringListAlloc(void) - { - StringList_pa Result; +/* + * 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)); - Result = (StringList_pa)ArrayListAlloc(0, ArrayListType_CharPtr, NULL, 0); + if (*StringList != NULL) + ArrayListDealloc(reinterpret_cast(StringList), StringListItemDestructor, 0); - ENSURE(Result == NULL || StringListValid(Result)); - return Result; - } + ENSURE(*StringList == NULL); +} - /* - * 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; +/* + * Allocate a string list handle. A handle of NULL is + * returned if sufficient memory is not available. + */ +StringList_pa StringListAlloc(void) +{ + StringList_pa Result = reinterpret_cast(ArrayListAlloc(0, ArrayListType_CharPtr, NULL, 0)); - REQUIRE(StringListValid(StringList)); - REQUIRE(String == NULL || VALID_REF(String)); - - IsOk = StringListSetString(StringList, StringListCount(StringList), String); - - ENSURE(StringListValid(StringList)); - ENSURE(VALID_BOOLEAN(IsOk)); - return IsOk; - } + ENSURE(Result == NULL || StringListValid(Result)); + return Result; +} - /* - * Return the number of strings currently in the string list. - */ - LgIndex_t LIBCALL StringListCount(StringList_pa StringList) - { - LgIndex_t 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, + char const* String) +{ + REQUIRE(StringListValid(StringList)); + REQUIRE(String == NULL || VALID_REF(String)); - REQUIRE(StringListValid(StringList)); + Boolean_t IsOk = StringListSetString(StringList, StringListCount(StringList), String); - Result = ArrayListGetCount((ArrayList_pa)StringList); - - ENSURE(Result >= 0); - return Result; - } + ENSURE(StringListValid(StringList)); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} - /* - * 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; +/* + * Return the number of strings currently in the string list. + */ +LgIndex_t LIBCALL StringListCount(StringList_pa StringList) +{ + REQUIRE(StringListValid(StringList)); - REQUIRE(StringListValid(StringList)); - REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1); + LgIndex_t Result = ArrayListGetCount(reinterpret_cast(StringList)); - StringRef = StringListGetStringRef(StringList, StringOffset); - if (StringRef == NULL) - Result = NULL; - else - Result = DupString(dontTranslate(StringRef)); + ENSURE(Result >= 0); + return Result; +} - ENSURE(Result == NULL || VALID_REF(Result)); - 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) +{ + REQUIRE(StringListValid(StringList)); + REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1); + + char* Result; + char const* 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; +/* + * 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. + */ +char const* StringListGetStringRef_FUNC(StringList_pa StringList, + LgIndex_t StringOffset) +{ + REQUIRE(StringListValid(StringList)); + REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1); - REQUIRE(StringListValid(StringList)); - REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1); + char const* Result = StringListGetStringRef_MACRO(StringList, StringOffset); - Result = StringListGetStringRef_MACRO(StringList, StringOffset); - - ENSURE(Result == NULL || VALID_REF(Result)); - return Result; - } + 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) +/* + * 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, + char const* String) +{ + REQUIRE(StringListValid(StringList)); + REQUIRE(StringOffset >= 0); + REQUIRE(String == NULL || VALID_REF(String)); + + Boolean_t IsOk; + ArrayListItem_u ItemCopy; + + if (String != NULL) { - 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; + ItemCopy.CharPtr = DupString(dontTranslate(String)); + IsOk = (ItemCopy.CharPtr != NULL); + } + else + { + ItemCopy.CharPtr = NULL; + IsOk = TRUE; } + if (IsOk) + IsOk = ArrayListSetItem(reinterpret_cast(StringList), StringOffset, ItemCopy, + StringListItemDestructor, 0); - /* - * 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) + 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, + char const* String) +{ + REQUIRE(StringListValid(StringList)); + REQUIRE(StringOffset >= 0); + REQUIRE(String == NULL || VALID_REF(String)); + + Boolean_t IsOk; + ArrayListItem_u ItemCopy; + + if (String != NULL) { - 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; + ItemCopy.CharPtr = DupString(dontTranslate(String)); + IsOk = (ItemCopy.CharPtr != NULL); + } + else + { + ItemCopy.CharPtr = NULL; + IsOk = TRUE; } + if (IsOk) + IsOk = ArrayListInsertItem(reinterpret_cast(StringList), + StringOffset, ItemCopy); - /* - * 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) + 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) +{ + REQUIRE(StringListValid(StringList)); + + StringList_pa Result = + reinterpret_cast(ArrayListCopy(reinterpret_cast(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) +{ + REQUIRE(StringListValid(Target)); + REQUIRE(StringListValid(Source)); + + StringList_pa SourceCopy = StringListCopy(Source); + Boolean_t IsOk = (SourceCopy != NULL); + if (IsOk) { - 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; + ArrayListAppend(reinterpret_cast(Target), reinterpret_cast(SourceCopy)); + /* deallocate the list but not the string items since Target now owns them */ + ArrayListDealloc(static_cast(static_cast(&SourceCopy)), NULL, 0); } + ENSURE(StringListValid(Target)); + ENSURE(VALID_BOOLEAN(IsOk)); + return IsOk; +} - /* - * 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) + +/* + * 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) +{ + REQUIRE(StringListValid(StringList)); + + size_t Length = 0; + + /* determine the resulting new line, '\n', separated string length */ + LgIndex_t Count = StringListCount(StringList); + if (Count >= 1) { - Boolean_t IsOk; - StringList_pa SourceCopy; - - REQUIRE(StringListValid(Target)); - REQUIRE(StringListValid(Source)); - - SourceCopy = StringListCopy(Source); - IsOk = (SourceCopy != NULL); - if (IsOk) + LgIndex_t Index; + for (Index = 0, Length = strlen("\n") * (Count - 1); + Index < Count; + Index++) { - 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); + char* String = ArrayListGetCharPtr(reinterpret_cast(StringList), Index); + if (String != NULL) + Length += strlen(String); } - - 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) + /* create a new line, '\n', separated string */ + char* Result = ALLOC_ARRAY(Length + 1, char, "new line separated string"); + if (Result != NULL) { - 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) + LgIndex_t Index; + for (Index = 0, strcpy(Result, ""); + Index < Count; + Index++) { - int Index; - for (Index = 0, Length = strlen("\n") * (Count - 1); - Index < Count; - Index++) + char* String = ArrayListGetCharPtr(reinterpret_cast(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(char const* String) +{ + REQUIRE(VALID_REF(String)); + + /* create the string list and scan the entire string */ + StringList_pa Result = StringListAlloc(); + LgIndex_t StartIndex; + LgIndex_t EndIndex; + 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) { - char *String = ArrayListGetCharPtr((ArrayList_pa)StringList, Index); - if (String != NULL) - Length += strlen(String); - } - } + CopySubString(SubString, String, StartIndex, Length); + StringListAppendString(Result, SubString); - /* 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); + FREE_ARRAY(SubString, "sub string"); - 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 */ - } + if (String[EndIndex] != '\0') + StartIndex = EndIndex + 1; else - { - /* memory allocation failure: bail out */ - StringListDealloc(&Result); - Result = NULL; - break; - } + break; /* nothing left to scan */ + } + else + { + /* memory allocation failure: bail out */ + StringListDealloc(&Result); + Result = NULL; + break; } } - - ENSURE(Result == NULL || StringListValid(Result)); - return Result; } + 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)); +/* + * Return a 'C' string array representation of the string list. + * Caller is responsible for de-allocating the result. + */ +char** StringListToArray(StringList_pa StringList) +{ + REQUIRE(StringListValid(StringList)); - Result = (char **)ArrayListToArray((ArrayList_pa)StringList, - StringListItemDuplicator, 0); + char** Result = static_cast(ArrayListToArray(reinterpret_cast(StringList), + StringListItemDuplicator, 0)); - ENSURE(Result == NULL || VALID_REF(Result)); - return Result; - } + 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; +/* + * 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(char const** StringArray, + LgIndex_t Count) +{ + REQUIRE((Count == 0 && StringArray == NULL) || + (Count >= 1 && VALID_REF(StringArray))); - REQUIRE((Count == 0 && StringArray == NULL) || - (Count >= 1 && VALID_REF(StringArray))); + StringList_pa Result = reinterpret_cast(ArrayListFromArray(static_cast(StringArray), + Count, ArrayListType_CharPtr, + StringListItemDuplicator, 0)); - Result = (StringList_pa)ArrayListFromArray((void *)StringArray, - Count, ArrayListType_CharPtr, - StringListItemDuplicator, 0); - - ENSURE(Result == NULL || StringListValid(Result)); - return Result; - } + ENSURE(Result == NULL || StringListValid(Result)); + return Result; +} #define ISJOINCHAR(c) ((c == ';') || (c == '+')) - static void SkipWhiteSpaceOrComma(const char **CPtr) +static void SkipWhiteSpaceOrComma(char const** 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: +;, + * + */ +static Boolean_t GetNextSubString(char const** OriginalCPtr, + char** NextSubString) +{ + REQUIRE(VALID_REF(OriginalCPtr) && (VALID_REF(*OriginalCPtr))); + REQUIRE(VALID_REF(NextSubString)); + + Boolean_t IsOk = TRUE; + + *NextSubString = NULL; + + char const* CPtr = *OriginalCPtr; + SkipWhiteSpaceOrComma(&CPtr); + + char InsideDelimiter = '\0'; + if (*CPtr == '"' || *CPtr == '\'') { - REQUIRE(VALID_REF(CPtr) && VALID_REF(*CPtr)); - while (ISWHITESPACE(**CPtr) || (**CPtr == ',')) - (*CPtr)++; + InsideDelimiter = *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: +;, - * - */ - static Boolean_t GetNextSubString(const char **OriginalCPtr, - char **NextSubString) + char const* CStart = CPtr; + + while (*CPtr && + ((InsideDelimiter && (*CPtr != InsideDelimiter)) || + (!InsideDelimiter && (*CPtr != ',') && + !ISJOINCHAR(*CPtr) && + !ISWHITESPACE(*CPtr)))) { - 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; + if (InsideDelimiter && + (*CPtr == '\\') && + (*(CPtr + 1) == InsideDelimiter)) + CPtr += 2; + else CPtr++; - } + } - CStart = CPtr; + if (InsideDelimiter && (*CPtr != InsideDelimiter)) + IsOk = FALSE; - while (*CPtr && - ((InsideDelimiter && (*CPtr != InsideDelimiter)) || - (!InsideDelimiter && (*CPtr != ',') && - !ISJOINCHAR(*CPtr) && - !ISWHITESPACE(*CPtr)))) + + if (IsOk && CStart < CPtr) + { + size_t StrLen = static_cast(CPtr - CStart); + *NextSubString = ALLOC_ARRAY(StrLen + 1, char, "GetNextSubString: NextSubString"); + if (*NextSubString) { - 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) { - 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'; + if ((*CStart == '\\') && (*(CStart + 1) == InsideDelimiter)) + CStart++; + *NPtr++ = *CStart++; } - else - IsOk = FALSE; + *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][del] [GroupJoinCharacter] [del][del] [GroupJoinCharacter] ..... + * or + * ... + * + * where: + * [del] is an optional single quote or a double quote. [del] must be used + * if 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(char const* String) +{ + REQUIRE(VALID_REF(String)); + SkipWhiteSpaceOrComma(&String); + REQUIRE(!ISJOINCHAR(*String)); + + Boolean_t IsOk = TRUE; + + /* extract character sequences */ + StringList_pa Result = StringListAlloc(); + char const* CPtr = String; + + char* CurString = NULL; + 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) { - 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][del] [GroupJoinCharacter] [del][del] [GroupJoinCharacter] ..... - * or - * ... - * - * where: - * [del] is an optional single quote or a double quote. [del] must be used - * if 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. + * Tack on the sub-string to the running string. */ - - if (IsOk && !ISJOINCHAR(*CPtr)) - { - StringListAppendString(Result, CurString); - if (CurString != NULL) - FREE_ARRAY(CurString, "current string"); - CurString = NULL; - } + 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 (CurString != NULL) - FREE_ARRAY(CurString, "current string"); + if (NextSubString != NULL) + FREE_ARRAY(NextSubString, "StringListFromCompound: NextSubString"); - if (!IsOk) - StringListDealloc(&Result); + /* + * 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. + */ - ENSURE(Result == NULL || StringListValid(Result)); - return Result; + 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"); - /* - * 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) + 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, + char const* CharsToEscape) +{ + REQUIRE(StringListValid(StringList)); + REQUIRE(StringListCount(StringList) >= 1); + REQUIRE(ISJOINCHAR(GroupJoinCharacter)); + REQUIRE(VALID_REF(CharsToEscape)); + + char* Result = NULL; + + Boolean_t IsOk = TRUE; + LgIndex_t Index; + LgIndex_t Count; + for (Index = 0, Count = StringListCount(StringList), IsOk = TRUE; + Index < Count && IsOk; + Index++) { - Boolean_t IsOk = TRUE; - LgIndex_t Index; - LgIndex_t Count; - char *Result = NULL; + char* String = StringListGetString(StringList, Index); - 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++) + if (String != NULL && strlen(String) != 0) { - char *String = StringListGetString(StringList, Index); + char* CStart = NULL; + char* CEnd = NULL; + char* EscapedString = NULL; + char const* EscChar = NULL; + char* StrChar = NULL; - if (String != NULL && strlen(String) != 0) + /* 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++) { - char *CStart = NULL; - char *CEnd = NULL; - char *EscapedString = NULL; - const char *EscChar = NULL; - char *StrChar = NULL; + for (EscChar = CharsToEscape; *EscChar != '\0'; EscChar++) + if (*StrChar == *EscChar) + { + IsOk = TackOnChar(&EscapedString, '\\'); + IsOk = TackOnChar(&EscapedString, '\\'); + break; + } + IsOk = TackOnChar(&EscapedString, *StrChar); + } - /* 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++) + CEnd = EscapedString; + while (IsOk && *CEnd != '\0') + { + int Len = 0; + CStart = CEnd; + while (*CEnd != '\0' && *CEnd != '\n') { - for (EscChar = CharsToEscape; *EscChar != '\0'; EscChar++) - if (*StrChar == *EscChar) - { - IsOk = TackOnChar(&EscapedString, '\\'); - IsOk = TackOnChar(&EscapedString, '\\'); - break; - } - IsOk = TackOnChar(&EscapedString, *StrChar); + Len++; + if (*CEnd == '"') + Len++; + CEnd++; } - CEnd = EscapedString; - while (IsOk && *CEnd != '\0') + char* TString = ALLOC_ARRAY(Len + 4, char, "temp compound sub-string"); + if (TString != NULL) { - int Len = 0; - char *TString; - - CStart = CEnd; - while (*CEnd != '\0' && *CEnd != '\n') + /* prepend the new string with either */ + /* a space character or the plus symbol */ + if (CStart == EscapedString) { - 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++; + if (Index != 0) + IsOk = TackOnChar(&Result, ' '); } else { - IsOk = FALSE; + IsOk = TackOnChar(&Result, GroupJoinCharacter); } + + /* stuff TString and append the new string */ + char* 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++; } - - 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); + { + IsOk = FALSE; + } } - if (String != NULL) - FREE_ARRAY(String, "string list item"); + if (EscapedString != NULL) + FREE_ARRAY(EscapedString, "escaped string"); } - - 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); + { + /* a null pointer or length of zero indicates an empty sub-string */ + if (Index == 0) + TackOnString(&Result, "\"\"", FALSE, FALSE); + else + TackOnString(&Result, " \"\"", FALSE, FALSE); + } - ENSURE((Result == -1) || (Result == 0) || (Result == 1)); - return Result; + if (String != NULL) + FREE_ARRAY(String, "string list item"); } - /** - * 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 (!IsOk) { + if (Result != NULL) + { + FREE_ARRAY(Result, "StringListToCompound"); + Result = NULL; + } + } + + ENSURE(Result == NULL || VALID_REF(Result)); + return Result; +} + #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 index e0c58d16e..0d7a1aaf7 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/strutil.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/strutil.cpp @@ -1,26 +1,3 @@ -/* - * 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 @@ -29,7 +6,7 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** @@ -44,6 +21,7 @@ #endif #include "ARRLIST.h" #include "STRLIST.h" +#include "CHARTYPE.h" #include "STRUTIL.h" #include "ALLOC.h" @@ -55,10 +33,18 @@ #include "TranslatedString.h" #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ +#else + #define DECLARE_NUMERIC_LOCALE_SETTER + #define VALID_NUMERIC_LOCALE() (true) #endif -using namespace std; -using namespace tecplot::strutil; +using std::string; +using tecplot::strutil::translate; +using tecplot::strutil::dontTranslate; +using tecplot::strutil::TranslatedString; +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif #ifdef MSWIN # pragma warning (disable : 4786) /* STL warning about trucated identifiers */ @@ -77,9 +63,9 @@ static int FormatStringBufferSize = INITIAL_FORMAT_BUFFER_SIZE; #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ -#if defined MSWIN -#else -#endif /* !MSWIN */ + #if defined MSWIN + #else + #endif /* !MSWIN */ #endif #if defined TECPLOTKERNEL @@ -120,10 +106,13 @@ char *vFormatString(const char *Format, * causing infinite recursion. */ if (FormatStringBuffer == NULL) - FormatStringBuffer = (char *)malloc(FormatStringBufferSize); + FormatStringBuffer = static_cast(malloc(FormatStringBufferSize)); if (FormatStringBuffer != NULL) { + DECLARE_NUMERIC_LOCALE_SETTER + REQUIRE(VALID_NUMERIC_LOCALE()); + Boolean_t TryAgain = FALSE; do { @@ -132,7 +121,7 @@ char *vFormatString(const char *Format, * 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'; + FormatStringBuffer[FormatStringBufferSize - 1] = static_cast(!'\0'); # if defined MSWIN memset(FormatStringBuffer, 0, FormatStringBufferSize - 1); @@ -169,7 +158,7 @@ char *vFormatString(const char *Format, */ free(FormatStringBuffer); FormatStringBufferSize += MAX(1, FormatStringBufferSize / 2); - FormatStringBuffer = (char *)malloc(FormatStringBufferSize); + FormatStringBuffer = static_cast(malloc(FormatStringBufferSize)); TryAgain = (FormatStringBuffer != NULL); if (!TryAgain) FormatStringBufferSize = INITIAL_FORMAT_BUFFER_SIZE; @@ -222,7 +211,7 @@ int FormatString(string& Buffer, if (FormattedString != NULL) { Buffer.assign(FormattedString); - Result = (int)Buffer.size(); + Result = static_cast(Buffer.size()); FREE_ARRAY(FormattedString, "FormattedString"); } else @@ -272,14 +261,14 @@ void CopySubString(char *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(0 <= Index && Index <= static_cast(strlen(Source))); REQUIRE(Count >= 0); - Length = MIN((LgIndex_t)strlen(&Source[Index]), Count); + Length = MIN(static_cast(strlen(&Source[Index])), Count); memmove(Target, &Source[Index], Length); Target[Length] = '\0'; - ENSURE(VALID_REF(Target) && (LgIndex_t)strlen(Target) == Length); + ENSURE(VALID_REF(Target) && static_cast(strlen(Target)) == Length); } #if defined TECPLOTKERNEL @@ -299,7 +288,7 @@ char *StringFlushLeft(char *String) /* move the substring beginning at the first non-whitespace */ /* character to the head of the string */ - while (isspace(*Start)) + while (tecplot::isspace(*Start)) Start++; if (Start != String) memmove(String, Start, strlen(Start) + 1); @@ -320,7 +309,7 @@ static char *StringFlushRight(char *String) REQUIRE(VALID_REF(String)); - for (End = EndOfString(String); End != String && isspace(End[-1]); End--) + for (End = EndOfString(String); End != String && tecplot::isspace(End[-1]); End--) End[-1] = '\0'; ENSURE(VALID_REF(Result) && Result == String); @@ -366,11 +355,11 @@ char *StringTruncate(char *String, REQUIRE(VALID_REF(String)); REQUIRE(MaxLength >= 0); - if ((LgIndex_t)strlen(String) > MaxLength) + if (static_cast(strlen(String)) > MaxLength) String[MaxLength] = '\0';/* UTF8_SetAt(String,'\0',MaxLength); */ ENSURE(VALID_REF(String)); - ENSURE((LgIndex_t)strlen(String) <= MaxLength); + ENSURE(static_cast(strlen(String)) <= MaxLength); return String; } @@ -393,11 +382,21 @@ char *StringTrimAndTruncate(char *String, REQUIRE(VALID_REF(String)); REQUIRE(MaxLength >= 0); - TrimLeadAndTrailSpaces(String); - StringTruncate(String, MaxLength); + /* + * Note that we are careful to truncate the string after trimming + * whitespace from the left side but then trim whitespace from the end + * after truncating to make sure we don't return a string that has + * whitespace simply because it truncated on a word break. + */ + StringFlushLeft(String); + StringTruncate(String,MaxLength); + StringFlushRight(String); ENSURE(VALID_REF(String)); - ENSURE((LgIndex_t)strlen(String) <= MaxLength); + ENSURE(static_cast(strlen(String)) <= MaxLength); + ENSURE(IMPLICATION(strlen(String) != 0, + (!tecplot::isspace(String[0]) && + !tecplot::isspace(String[strlen(String)-1])))); return String; } @@ -491,7 +490,6 @@ StringList_pa LineBreakString(const char *String, } #endif - #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ #endif /* TECPLOTKERNEL */ @@ -520,7 +518,6 @@ int ustrncmp(const char *s1, { REQUIRE((s1 == NULL) || VALID_REF(s1)); REQUIRE((s2 == NULL) || VALID_REF(s2)); - REQUIRE(Len >= 0); char *t1; char *t2; @@ -534,8 +531,8 @@ int ustrncmp(const char *s1, else if (s2 == NULL) return 1; - t1 = (char*)s1; - t2 = (char*)s2; + t1 = const_cast(s1); + t2 = const_cast(s2); while (*t1 && *t2 && (I < Len)) { @@ -578,7 +575,9 @@ int ustrcmp(const char *s1, return (ustrncmp(s1, s2, INT_MAX)); } - +#if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ +#endif #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ @@ -700,7 +699,7 @@ Boolean_t TackOnString(char **SBase, (*StringToAdd == '\0') && DeleteStringToAdd) { - char *TMP = (char *)StringToAdd; + char *TMP = const_cast(StringToAdd); FREE_ARRAY(TMP, "empty string to add"); } } @@ -724,7 +723,7 @@ Boolean_t TackOnString(char **SBase, { if (DeleteStringToAdd) { - char *TMP = (char *)StringToAdd; + char *TMP = const_cast(StringToAdd); FREE_ARRAY(TMP, StringToAdd); } IsOk = FALSE; @@ -758,7 +757,7 @@ Boolean_t TackOnString(char **SBase, if (DeleteStringToAdd) { - char *TMP = (char *)StringToAdd; + char *TMP = const_cast(StringToAdd); FREE_ARRAY(TMP, StringToAdd); } diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tassert.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tassert.cpp index f74a2d30e..3906ca069 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tassert.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tassert.cpp @@ -1,26 +1,3 @@ -/* - * 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 @@ -29,7 +6,7 @@ ***************************************************************** ***************************************************************** ******* ******** -****** Copyright (C) 1988-2008 Tecplot, Inc. ******* +****** Copyright (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ***************************************************************** ***************************************************************** diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tecio.vcproj b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tecio.vcproj new file mode 100644 index 000000000..ad5233c7c --- /dev/null +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tecio.vcproj @@ -0,0 +1,1826 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tecxxx.cpp b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tecxxx.cpp index e64504a07..e9be811a1 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tecxxx.cpp +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio/tecsrc/tecxxx.cpp @@ -1,26 +1,3 @@ -/* - * 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" @@ -30,12 +7,12 @@ ****************************************************************** ****************************************************************** ******* ******** -****** (C) 1988-2008 Tecplot, Inc. ******* +****** (C) 1988-2010 Tecplot, Inc. ******* ******* ******** ****************************************************************** ****************************************************************** */ -/* Source file revision $Revision: 7627 $ */ +/* Source file revision $Revision: 37579 $ */ #include "GLOBAL.h" #include "TASSERT.h" @@ -45,6 +22,7 @@ #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ #endif +#include "CHARTYPE.h" #include "DATAIO4.h" #include "DATASET0.h" #include "TECXXX.h" @@ -134,6 +112,34 @@ static LgIndex_t KMax[MaxNumFiles]; /* ones based indices */ static vector TotalNumFaceNodes[MaxNumFiles]; /* vector dimensioned by num zones */ static LgIndex_t TotalNumFaceBndryFaces[MaxNumFiles]; static LgIndex_t TotalNumFaceBndryConns[MaxNumFiles]; +struct PolyZoneWriteInfo +{ + PolyZoneWriteInfo() + : numFacesWritten(0) + , faceNodeSum(0) + , numBoundaryFacesWritten(0) + , boundaryConnectionSum(0) + , numFaceNodesOffset(0) + , faceNodesOffset(0) + , leftElemsOffset(0) + , rightElemsOffset(0) + , connectionCountsOffset(0) + , connectionElemsOffset(0) + , connectionZonesOffset(0) + {} + LgIndex_t numFacesWritten; + LgIndex_t faceNodeSum; + LgIndex_t numBoundaryFacesWritten; + LgIndex_t boundaryConnectionSum; + FileOffset_t numFaceNodesOffset; + FileOffset_t faceNodesOffset; + FileOffset_t leftElemsOffset; + FileOffset_t rightElemsOffset; + FileOffset_t connectionCountsOffset; + FileOffset_t connectionElemsOffset; + FileOffset_t connectionZonesOffset; +}; +static vector PolyZoneWriteInfos[MaxNumFiles]; static LgIndex_t ICellMax[MaxNumFiles]; static LgIndex_t JCellMax[MaxNumFiles]; static LgIndex_t KCellMax[MaxNumFiles]; @@ -149,12 +155,13 @@ static vector IsSharedVar[MaxNumFiles]; /* vector dimensioned by static vector 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 FieldDataType[MaxNumFiles]; static INTEGER4 CurFile = -1; static vector IsCellCentered[MaxNumFiles]; /* vector dimensioned by num vars */ static Boolean_t HasFECONNECT[MaxNumFiles]; static INTEGER4 FileTypes[MaxNumFiles]; static vector NumConnectivityNodes[MaxNumFiles]; /* vector dimensioned by num zones */ +static vector NumConnectivityNodesWritten[MaxNumFiles]; /* vector dimensioned by num zones */ static vector ConnectivityWritten[MaxNumFiles]; /* vector dimensioned by num zones */ /* @@ -197,7 +204,13 @@ static char const* ZoneTypes[] = static void WriteErr(const char *routine_name) { #if defined MAKEARCHIVE - PRINT2("Err: (%s) Write failure on file %d.\n", routine_name, CurFile + 1); + { + PRINT2("Err: (%s) Write failure on file %d.\n", routine_name, CurFile + 1); + } + #else + { + UNUSED(routine_name); + } #endif NumErrs[CurFile]++; } @@ -224,7 +237,7 @@ Boolean_t ParseDupList(LgIndex_t **ShareVarFromZone, if (*DupList && !strncmp(DupList, "FECONNECT", 9)) *ShareConnectivityFromZone = TecXXXZoneNum; - else if (*DupList && !isdigit(*DupList)) + else if (*DupList && !tecplot::isdigit(*DupList)) IsOk = FALSE; /* syntax error */ else if (*DupList) @@ -239,7 +252,7 @@ Boolean_t ParseDupList(LgIndex_t **ShareVarFromZone, { *ShareVarFromZone = ALLOC_ARRAY(numVarsForFile, LgIndex_t, "Variable sharing list"); if (*ShareVarFromZone) - memset(*ShareVarFromZone, (char)0, numVarsForFile * sizeof(LgIndex_t)); + memset(*ShareVarFromZone, static_cast(0), numVarsForFile * sizeof(LgIndex_t)); } if (*ShareVarFromZone) @@ -372,7 +385,13 @@ INTEGER4 LIBCALL TECINI112(char *Title, CurFile = 0; #if defined MAKEARCHIVE - DebugLevel[NewFile] = *Debug; + { + DebugLevel[NewFile] = *Debug; + } + #else + { + UNUSED(Debug); + } #endif /* check sizes for array sized by number of variables */ CHECK(VarMinValue[NewFile].empty()); @@ -385,9 +404,11 @@ INTEGER4 LIBCALL TECINI112(char *Title, /* check sizes for array sized by number of zones */ CHECK(MinMaxOffset[NewFile].empty()); CHECK(TotalNumFaceNodes[NewFile].empty()); + CHECK(PolyZoneWriteInfos[NewFile].empty()); CHECK(NumFaceConnections[NewFile].empty()); CHECK(FaceNeighborsOrMapWritten[NewFile].empty()); CHECK(NumConnectivityNodes[NewFile].empty()); + CHECK(NumConnectivityNodesWritten[NewFile].empty()); CHECK(ConnectivityWritten[NewFile].empty()); CurZone[NewFile] = -1; @@ -507,7 +528,7 @@ INTEGER4 LIBCALL TECINI112(char *Title, } CHECK(TecplotBinaryFileVersion == 112); - if (!WriteBinaryInt32(HeadFile[NewFile], (LgIndex_t)FileTypes[NewFile])) + if (!WriteBinaryInt32(HeadFile[NewFile], static_cast(FileTypes[NewFile]))) { WriteErr("TECINI112"); return (-1); @@ -587,7 +608,7 @@ INTEGER4 LIBCALL TECINI112(char *Title, return (-1); } - if (!WriteBinaryInt32(HeadFile[NewFile], (LgIndex_t)NumVars[NewFile])) + if (!WriteBinaryInt32(HeadFile[NewFile], static_cast(NumVars[NewFile]))) { WriteErr("TECINI110"); return (-1); @@ -636,9 +657,9 @@ INTEGER4 LIBCALL TECINI112(char *Title, IsOpen[NewFile] = 1; if (*VIsDouble) - FieldDataType = FieldDataType_Double; + FieldDataType[NewFile] = FieldDataType_Double; else - FieldDataType = FieldDataType_Float; + FieldDataType[NewFile] = FieldDataType_Float; return (0); } @@ -787,9 +808,15 @@ 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]); + { + 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]); + } + #else + { + UNUSED(routine_name); + } #endif NumErrs[CurFile]++; return (-1); @@ -802,8 +829,14 @@ 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); + { + PRINT2("Err: (%s) Attempt to use invalid file (%d).\n", + routine_name, CurFile + 1); + } + #else + { + UNUSED(routine_name); + } #endif return (-1); } @@ -926,9 +959,11 @@ INTEGER4 LIBCALL TECZNE112(char *ZnTitle, { MinMaxOffset[CurFile].resize(CurZone[CurFile] + 1); TotalNumFaceNodes[CurFile].resize(CurZone[CurFile] + 1); + PolyZoneWriteInfos[CurFile].resize(CurZone[CurFile] + 1); NumFaceConnections[CurFile].resize(CurZone[CurFile] + 1); FaceNeighborsOrMapWritten[CurFile].resize(CurZone[CurFile] + 1); NumConnectivityNodes[CurFile].resize(CurZone[CurFile] + 1); + NumConnectivityNodesWritten[CurFile].resize(CurZone[CurFile] + 1); ConnectivityWritten[CurFile].resize(CurZone[CurFile] + 1); } catch (std::bad_alloc const&) @@ -949,6 +984,7 @@ INTEGER4 LIBCALL TECZNE112(char *ZnTitle, 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; + NumConnectivityNodesWritten[CurFile][CurZone[CurFile]] = 0; ConnectivityWritten[CurFile][CurZone[CurFile]] = FALSE; if (ZoneType[CurFile] == ZoneType_FEPolygon || @@ -975,7 +1011,7 @@ INTEGER4 LIBCALL TECZNE112(char *ZnTitle, } WriteBinaryReal(HeadFile[CurFile], - (double)ZoneMarker, + static_cast(ZoneMarker), FieldDataType_Float); if (!DumpDatafileString(HeadFile[CurFile], ZnTitle, @@ -1028,16 +1064,18 @@ INTEGER4 LIBCALL TECZNE112(char *ZnTitle, 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 */ + WriteBinaryInt32(HeadFile[CurFile], static_cast(*ParentZone) - 1); /* ...ParentZone is zero based for binary file */ + WriteBinaryInt32(HeadFile[CurFile], static_cast(*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], static_cast( - 1)); /* No Zone Color Assignment */ WriteBinaryInt32(HeadFile[CurFile], ZoneType[CurFile]); NumDataValuesToWrite[CurFile] = 0; @@ -1047,12 +1085,11 @@ INTEGER4 LIBCALL TECZNE112(char *ZnTitle, IsPassiveVar[CurFile][I] = (PassiveVarList != NULL && PassiveVarList[I] == 1); /* ...passive? */ } - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)(ValueLocation != NULL ? 1 : 0)); /* ...are var locations specified? */ + WriteBinaryInt32(HeadFile[CurFile], static_cast(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; @@ -1069,33 +1106,28 @@ INTEGER4 LIBCALL TECZNE112(char *ZnTitle, NumCells = JMax[CurFile]; } - if (IsSharedVar[CurFile][I]) - VIndex = ShareVarFromZone[I] - 1; - else - VIndex = I; - - if (VIndex == 0) + if (I == 0) NumRunningVarValues[CurFile][I] = 0; else - NumRunningVarValues[CurFile][VIndex] = NumRunningVarValues[CurFile][VIndex-1]; + NumRunningVarValues[CurFile][I] = NumRunningVarValues[CurFile][I-1]; - IsCellCentered[CurFile][VIndex] = (ValueLocation[I] == ValueLocation_CellCentered); + IsCellCentered[CurFile][I] = (ValueLocation[I] == ValueLocation_CellCentered); if (ValueLocation[I] == ValueLocation_CellCentered) { - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)1); + WriteBinaryInt32(HeadFile[CurFile], static_cast(1)); if (!IsSharedVar[CurFile][I] && !IsPassiveVar[CurFile][I]) { - NumDataValuesToWrite[CurFile] += NumCells; - NumRunningVarValues[CurFile][VIndex] += NumCells; + NumDataValuesToWrite[CurFile] += NumCells; + NumRunningVarValues[CurFile][I] += NumCells; } } else if (ValueLocation[I] == ValueLocation_Nodal) { - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)0); + WriteBinaryInt32(HeadFile[CurFile], static_cast(0)); if (!IsSharedVar[CurFile][I] && !IsPassiveVar[CurFile][I]) { - NumDataValuesToWrite[CurFile] += NumNodes; - NumRunningVarValues[CurFile][VIndex] += NumNodes; + NumDataValuesToWrite[CurFile] += NumNodes; + NumRunningVarValues[CurFile][I] += NumNodes; } } else @@ -1122,22 +1154,16 @@ INTEGER4 LIBCALL TECZNE112(char *ZnTitle, for (I = 0; I < NumVars[CurFile]; I++) { - int VIndex; - if (IsSharedVar[CurFile][I]) - VIndex = ShareVarFromZone[I] - 1; - else - VIndex = I; - - if (VIndex == 0) + if (I == 0) NumRunningVarValues[CurFile][I] = 0; else - NumRunningVarValues[CurFile][VIndex] = NumRunningVarValues[CurFile][VIndex-1]; + NumRunningVarValues[CurFile][I] = NumRunningVarValues[CurFile][I-1]; - IsCellCentered[CurFile][VIndex] = FALSE; + IsCellCentered[CurFile][I] = FALSE; if (!IsSharedVar[CurFile][I] && !IsPassiveVar[CurFile][I]) { - NumDataValuesToWrite[CurFile] += NumNodes; - NumRunningVarValues[CurFile][VIndex] += NumNodes; + NumDataValuesToWrite[CurFile] += NumNodes; + NumRunningVarValues[CurFile][I] += NumNodes; } } } @@ -1150,27 +1176,27 @@ INTEGER4 LIBCALL TECZNE112(char *ZnTitle, * step and instead fall back to the delivering * one neighbor at a time. */ - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)0); /* IsRawFNAvailable */ + WriteBinaryInt32(HeadFile[CurFile], static_cast(0)); /* IsRawFNAvailable */ - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)NumFaceConnections[CurFile][CurZone[CurFile]]); + WriteBinaryInt32(HeadFile[CurFile], static_cast(NumFaceConnections[CurFile][CurZone[CurFile]])); if (NumFaceConnections[CurFile][CurZone[CurFile]] > 0) { - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)FaceNeighborMode[CurFile]); + WriteBinaryInt32(HeadFile[CurFile], static_cast(FaceNeighborMode[CurFile])); if (ZoneType[CurFile] != ORDERED) - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)0); /* FEFaceNeighborsComplete */ + WriteBinaryInt32(HeadFile[CurFile], static_cast(0)); /* FEFaceNeighborsComplete */ } - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)IMax[CurFile]); + WriteBinaryInt32(HeadFile[CurFile], static_cast(IMax[CurFile])); if (ZoneType[CurFile] == FEPOLYGON || ZoneType[CurFile] == FEPOLYHEDRON) { - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)KMax[CurFile]); + WriteBinaryInt32(HeadFile[CurFile], static_cast(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]]); + WriteBinaryInt32(HeadFile[CurFile], static_cast(TotalNumFaceNodes[CurFile][CurZone[CurFile]])); if (TotalNumFaceBndryFaces[CurFile] > 0) { /* Each boundary face must have >= 1 boundary connection. */ @@ -1193,23 +1219,23 @@ INTEGER4 LIBCALL TECZNE112(char *ZnTitle, * 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 */ + WriteBinaryInt32(HeadFile[CurFile], static_cast(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], static_cast(TotalNumFaceBndryFaces[CurFile])); + WriteBinaryInt32(HeadFile[CurFile], static_cast(TotalNumFaceBndryConns[CurFile])); } - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)JMax[CurFile]); + WriteBinaryInt32(HeadFile[CurFile], static_cast(JMax[CurFile])); if (ZoneType[CurFile] == ORDERED) { - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)KMax[CurFile]); + WriteBinaryInt32(HeadFile[CurFile], static_cast(KMax[CurFile])); } else { - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)ICellMax[CurFile]); - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)JCellMax[CurFile]); - WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)KCellMax[CurFile]); + WriteBinaryInt32(HeadFile[CurFile], static_cast(ICellMax[CurFile])); + WriteBinaryInt32(HeadFile[CurFile], static_cast(JCellMax[CurFile])); + WriteBinaryInt32(HeadFile[CurFile], static_cast(KCellMax[CurFile])); } /* @@ -1217,16 +1243,16 @@ INTEGER4 LIBCALL TECZNE112(char *ZnTitle, * 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); + WriteBinaryInt32(HeadFile[CurFile], static_cast(0)); WriteBinaryReal(BlckFile[CurFile], - (double)ZoneMarker, + static_cast(ZoneMarker), FieldDataType_Float); for (I = 0; I < NumVars[CurFile]; I++) { if (!WriteFieldDataType(BlckFile[CurFile], - (FieldDataType_e)FieldDataType, + static_cast(FieldDataType[CurFile]), TRUE)) { WriteErr("TECZNE112"); @@ -1265,7 +1291,7 @@ INTEGER4 LIBCALL TECZNE112(char *ZnTitle, * 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); + MinMaxOffset[CurFile][CurZone[CurFile]] = static_cast(TP_FTELL(BlckFile[CurFile]->File)); for (I = 0; I < NumVars[CurFile]; I++) { @@ -1543,7 +1569,7 @@ INTEGER4 LIBCALL TECZNE(char *ZoneTitle, INTEGER4 NumFaceBndryFaces = 0; INTEGER4 NumFaceBndryConns = 0; - Result = TECZNE112((char *)ZoneTitle, + Result = TECZNE112(static_cast(ZoneTitle), &ZoneType, IMx, JMx, @@ -1570,7 +1596,7 @@ INTEGER4 LIBCALL TECZNE(char *ZoneTitle, if (ShareVarFromZone) FREE_ARRAY(ShareVarFromZone, "Variable sharing list"); - return (INTEGER4) Result; + return static_cast( Result); } #endif // INDEX_16_BIT -- not supported in this test-only mode @@ -1763,7 +1789,7 @@ LIBFUNCTION INTEGER4 LIBCALL teczne_(char *ZoneTitle, */ static void RewritePendingMinMaxValues(void) { - FileOffset_t CurrentOffset = (FileOffset_t)TP_FTELL(BlckFile[CurFile]->File); + FileOffset_t CurrentOffset = static_cast(TP_FTELL(BlckFile[CurFile]->File)); TP_FSEEK(BlckFile[CurFile]->File, MinMaxOffset[CurFile][CurZone[CurFile]], SEEK_SET); int I; @@ -1788,8 +1814,8 @@ INTEGER4 LIBCALL TECDAT112(INTEGER4 *N, INTEGER4 *IsDouble) { LgIndex_t I; - double *dptr = (double *)Data; - float *fptr = (float *)Data; + double *dptr = static_cast(Data); + float *fptr = static_cast(Data); if (CheckFile("TECDAT112") < 0) return (-1); @@ -1809,7 +1835,7 @@ INTEGER4 LIBCALL TECDAT112(INTEGER4 *N, if (Value > VarMaxValue[CurFile][CurVar[CurFile]]) VarMaxValue[CurFile][CurVar[CurFile]] = Value; - if (!WriteBinaryReal(BlckFile[CurFile], Value, (FieldDataType_e)FieldDataType)) + if (!WriteBinaryReal(BlckFile[CurFile], Value, static_cast(FieldDataType[CurFile]))) { WriteErr("TECDAT112"); return (-1); @@ -1845,7 +1871,7 @@ INTEGER4 LIBCALL TECDAT112(INTEGER4 *N, if (IIndex + 1 == FinalIMax && FinalIMax < IMax[CurFile] - IMaxAdjust) { NumOrderedCCDataValuesWritten[CurFile]++; - if (!WriteBinaryReal(BlckFile[CurFile], 0.0, (FieldDataType_e)FieldDataType)) + if (!WriteBinaryReal(BlckFile[CurFile], 0.0, static_cast(FieldDataType[CurFile]))) { WriteErr("TECDAT112"); return (-1); @@ -1858,7 +1884,7 @@ INTEGER4 LIBCALL TECDAT112(INTEGER4 *N, for (II = 1; II <= IMax[CurFile] - IMaxAdjust; II++) { NumOrderedCCDataValuesWritten[CurFile]++; - if (!WriteBinaryReal(BlckFile[CurFile], 0.0, (FieldDataType_e)FieldDataType)) + if (!WriteBinaryReal(BlckFile[CurFile], 0.0, static_cast(FieldDataType[CurFile]))) { WriteErr("TECDAT112"); return (-1); @@ -1874,7 +1900,7 @@ INTEGER4 LIBCALL TECDAT112(INTEGER4 *N, for (II = 1; II <= IMax[CurFile] - IMaxAdjust; II++) { NumOrderedCCDataValuesWritten[CurFile]++; - if (!WriteBinaryReal(BlckFile[CurFile], 0.0, (FieldDataType_e)FieldDataType)) + if (!WriteBinaryReal(BlckFile[CurFile], 0.0, static_cast(FieldDataType[CurFile]))) { WriteErr("TECDAT112"); return (-1); @@ -1930,7 +1956,7 @@ INTEGER4 LIBCALL TECDAT112(INTEGER4 *N, an error message) */ (NumDataValuesToWrite[CurFile] == NumDataValuesWritten[CurFile])) { - if (!WriteBinaryInt32(BlckFile[CurFile], (LgIndex_t)1)) + if (!WriteBinaryInt32(BlckFile[CurFile], static_cast(1))) { WriteErr("TECDAT112"); return (-1); @@ -2146,6 +2172,113 @@ LIBFUNCTION INTEGER4 LIBCALL tecnod_(INTEGER4 *NData) } #endif +/** + * TECNODEXXX + */ +INTEGER4 LIBCALL TECNODE112( + INTEGER4 *N, + INTEGER4 *NData) +{ + LgIndex_t I; + + + if (CheckFile("TECNODE112") < 0) + return (-1); + + if (ZoneType[CurFile] == FEPOLYGON || + ZoneType[CurFile] == FEPOLYHEDRON) + { + /* Wrong way to specify connectivity for polygons and polyhedrons */ + #if defined MAKEARCHIVE + PRINT0("Err: (TECNODE112) Cannot call TECNODE112 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 TECNODE112() + */ + return (-1); + } + + if (FileTypes[CurFile] == SOLUTIONFILE) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECNODE112) Cannot call TECNODE112 if file type is SOLUTIONFILE.\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + if (ZoneType[CurFile] == ORDERED) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECNODE112) Cannot call TECNODE112 if zone type is ORDERED.\n"); + #endif + NumErrs[CurFile]++; + return (-1); + } + + if (CheckData("TECNODE112") < 0) + return (-1); + + if (NumConnectivityNodesWritten[CurFile][CurZone[CurFile]] + *N > NumConnectivityNodes[CurFile][CurZone[CurFile]]) + { + #if defined MAKEARCHIVE + PRINT0("Err: (TECNODE112) Connectivity Nodes chunk exceeds the total number of Connectivity Nodes:\n"); + PRINT2(" Nodes written = %d, Current chunk size = %d, ", NumConnectivityNodesWritten[CurFile][CurZone[CurFile]], *N); + PRINT1("total connectivity nodes = %d.\n", NumConnectivityNodes[CurFile][CurZone[CurFile]]); + #endif + NumErrs[CurFile]++; + return (-1); + } + + for (I = 0; I < *N; I++) + { + if ((NData[I] > IMax[CurFile]) || + (NData[I] < 1)) + { + #if defined MAKEARCHIVE + PRINT1("Err: (TECNODE112) 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("TECNODE112"); + return (-1); + } + + NumConnectivityNodesWritten[CurFile][CurZone[CurFile]]++; + } + + if (NumConnectivityNodesWritten[CurFile][CurZone[CurFile]] == NumConnectivityNodes[CurFile][CurZone[CurFile]]) + { + ConnectivityWritten[CurFile][CurZone[CurFile]] = TRUE; + } + + return (0); +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecnode112_(INTEGER4 *N, + INTEGER4 *NData) +{ + return TECNODE112(N, NData); +} +#endif + /** * TECENDXXX */ @@ -2167,7 +2300,10 @@ INTEGER4 LIBCALL TECEND112(void) { #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); + if (NumConnectivityNodesWritten[CurFile][ZoneIndex] == 0) + PRINT1(" Zone %d was defined with a Classic FE zone type but TECNOD112() was not called.\n", ZoneIndex + 1); + else + PRINT1(" Zone %d was defined with a Classic FE zone type but TECNODE112() was not called for all node chunks.\n", ZoneIndex + 1); #endif NumErrs[CurFile]++; RetVal = -1; @@ -2188,7 +2324,8 @@ INTEGER4 LIBCALL TECEND112(void) { #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", + PRINT2(" %d face nodes were specified for zone %d but TECPOLYFACE112() and/or\n" + " TECPOLYBCONN112() was not called for all face chunks.\n", TotalNumFaceNodes[CurFile][ZoneIndex], ZoneIndex + 1); #endif NumErrs[CurFile]++; @@ -2228,10 +2365,10 @@ INTEGER4 LIBCALL TECEND112(void) while ((RetVal == 0) && (feof(BlckFile[CurFile]->File) == 0)) { - bytesRead = fread((void*)buffer, 1, BYTES_PER_CHUNK, BlckFile[CurFile]->File); + bytesRead = fread(static_cast(buffer), 1, BYTES_PER_CHUNK, BlckFile[CurFile]->File); if (ferror(BlckFile[CurFile]->File) == 0) { - if (bytesRead != fwrite((void*)buffer, 1, bytesRead, HeadFile[CurFile]->File)) + if (bytesRead != fwrite(static_cast(buffer), 1, bytesRead, HeadFile[CurFile]->File)) { /* do not call WriteErr, use custom message instead */ #if defined MAKEARCHIVE @@ -2291,9 +2428,11 @@ INTEGER4 LIBCALL TECEND112(void) /* reset arrays sized by number of zones */ MinMaxOffset[CurFile].clear(); TotalNumFaceNodes[CurFile].clear(); + PolyZoneWriteInfos[CurFile].clear(); NumFaceConnections[CurFile].clear(); FaceNeighborsOrMapWritten[CurFile].clear(); NumConnectivityNodes[CurFile].clear(); + NumConnectivityNodesWritten[CurFile].clear(); ConnectivityWritten[CurFile].clear(); CurFile = 0; @@ -2388,7 +2527,7 @@ static void GetNextLabel(const char **CPtr, */ INTEGER4 LIBCALL TECLAB112(char *S) { - const char *CPtr = (const char *)S; + const char *CPtr = const_cast(S); LgIndex_t N = 0; char Label[60]; @@ -2419,13 +2558,13 @@ INTEGER4 LIBCALL TECLAB112(char *S) } WriteBinaryReal(HeadFile[CurFile], CustomLabelMarker, FieldDataType_Float); - if (!WriteBinaryInt32(HeadFile[CurFile], (LgIndex_t)N)) + if (!WriteBinaryInt32(HeadFile[CurFile], static_cast(N))) { WriteErr("TECLAB112"); return (-1); } - CPtr = (const char *)S; + CPtr = const_cast(S); do { GetNextLabel(&CPtr, Label); @@ -2661,7 +2800,7 @@ INTEGER4 LIBCALL TECGEO112(double *XOrThetaPos, if (CheckFile("TECGEO112") < 0) return (-1); - Geom.PositionCoordSys = (CoordSys_e) * PosCoordMode; + Geom.PositionCoordSys = static_cast( * PosCoordMode); if (Geom.PositionCoordSys == CoordSys_Frame) Fract = 0.01; else @@ -2672,21 +2811,21 @@ INTEGER4 LIBCALL TECGEO112(double *XOrThetaPos, 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.BColor = static_cast( * Color); + Geom.FillBColor = static_cast( * FillColor); Geom.IsFilled = *IsFilled; - Geom.GeomType = (GeomType_e) * GeomType; - Geom.LinePattern = (LinePattern_e) * LinePattern; + Geom.GeomType = static_cast( * GeomType); + Geom.LinePattern = static_cast( * 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.ArrowheadStyle = static_cast( * ArrowheadStyle); + Geom.ArrowheadAttachment = static_cast( * ArrowheadAttachment); Geom.ArrowheadSize = *ArrowheadSize / 100.0; Geom.ArrowheadAngle = *ArrowheadAngle / DEGPERRADIANS; - Geom.Scope = (Scope_e) * Scope; + Geom.Scope = static_cast( * Scope); Geom.DrawOrder = DrawOrder_AfterData; - Geom.Clipping = (Clipping_e) * Clipping; + Geom.Clipping = static_cast( * Clipping); Geom.NumSegments = *NumSegments; Geom.MacroFunctionCommand = mfc; Geom.ImageFileName = NULL; @@ -2742,9 +2881,9 @@ INTEGER4 LIBCALL TECGEO112(double *XOrThetaPos, 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); + SetFieldValue(Geom.GeomData.Generic.V1Base, I, static_cast(XOrThetaGeomData[I]*Fract)); + SetFieldValue(Geom.GeomData.Generic.V2Base, I, static_cast(YOrRGeomData[I]*Fract)); + SetFieldValue(Geom.GeomData.Generic.V3Base, I, static_cast(ZGeomData[I]*Fract)); } if (DumpGeometry(HeadFile[CurFile], &Geom, TRUE, FALSE)) @@ -2950,7 +3089,7 @@ INTEGER4 LIBCALL TECGEO(double *XPos, float *ZGeomData, char *mfc) { - int Clipping = (int)Clipping_ClipToViewport; + int Clipping = static_cast(Clipping_ClipToViewport); return TECGEO112(XPos, YPos, ZPos, @@ -3286,7 +3425,7 @@ INTEGER4 LIBCALL TECTXT112(double *XOrThetaPos, if (CheckFile("TECTXT112") < 0) return (-1); - Text.PositionCoordSys = (CoordSys_e) * PosCoordMode; + Text.PositionCoordSys = static_cast( * PosCoordMode); if (Text.PositionCoordSys == CoordSys_Frame) Fract = 0.01; else @@ -3297,25 +3436,29 @@ INTEGER4 LIBCALL TECTXT112(double *XOrThetaPos, 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; + Text.BColor = static_cast(*TextColor); + #if defined TECPLOTKERNEL +/* CORE SOURCE CODE REMOVED */ + #else + Text.TextShape.Font = static_cast(*BFont); + #endif + Text.TextShape.SizeUnits = static_cast(*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.BoxType = static_cast(*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.Box.BColor = static_cast(*BoxColor); + Text.Box.FillBColor = static_cast(*BoxFillColor); + Text.Anchor = static_cast(*Anchor); Text.LineSpacing = *LineSpacing; Text.Angle = *Angle / DEGPERRADIANS; - Text.Scope = (Scope_e) * Scope; + Text.Scope = static_cast(*Scope); Text.Text = String; Text.MacroFunctionCommand = mfc; - Text.Clipping = (Clipping_e) * Clipping; + Text.Clipping = static_cast(*Clipping); #if defined MAKEARCHIVE if (DebugLevel[CurFile]) @@ -3493,7 +3636,7 @@ INTEGER4 LIBCALL TECTXT(double *XPos, char *mfc) { double ZPos = 0.0; - int Clipping = (int)Clipping_ClipToViewport; + int Clipping = static_cast(Clipping_ClipToViewport); return TECTXT112(XPos, YPos, &ZPos, @@ -3917,11 +4060,11 @@ static Boolean_t AuxDataIsValidNameChar(char Char, REQUIRE(VALID_BOOLEAN(IsLeadChar)); IsValidNameChar = (Char == '_' || - isalpha(Char)); + tecplot::isalpha(Char)); if (!IsLeadChar) IsValidNameChar = (IsValidNameChar || Char == '.' || - isdigit(Char)); + tecplot::isdigit(Char)); ENSURE(VALID_BOOLEAN(IsValidNameChar)); return IsValidNameChar; @@ -4810,3 +4953,537 @@ LIBFUNCTION INTEGER4 LIBCALL tecpoly111_(INTEGER4 *FaceNodeCounts, #if defined TECPLOTKERNEL /* CORE SOURCE CODE REMOVED */ #endif + +namespace +{ + +void calculateInitialPolyZoneOffsets() +{ + PolyZoneWriteInfo& polyZoneWriteInfo = PolyZoneWriteInfos[CurFile][CurZone[CurFile]]; + polyZoneWriteInfo.numFaceNodesOffset = static_cast(TP_FTELL(BlckFile[CurFile]->File)); + if (ZoneType[CurFile] == FEPOLYHEDRON) + { + polyZoneWriteInfo.faceNodesOffset = polyZoneWriteInfo.numFaceNodesOffset + + sizeof(INTEGER4) * (KMax[CurFile] + 1); + } + else + { + // polygonal zones don't write number of nodes per face + polyZoneWriteInfo.faceNodesOffset = polyZoneWriteInfo.numFaceNodesOffset; + } + polyZoneWriteInfo.leftElemsOffset = polyZoneWriteInfo.faceNodesOffset + + sizeof(INTEGER4) * TotalNumFaceNodes[CurFile][CurZone[CurFile]]; + polyZoneWriteInfo.rightElemsOffset = polyZoneWriteInfo.leftElemsOffset + + sizeof(INTEGER4) * KMax[CurFile]; + polyZoneWriteInfo.connectionCountsOffset = polyZoneWriteInfo.rightElemsOffset + + sizeof(INTEGER4) * KMax[CurFile]; + polyZoneWriteInfo.connectionElemsOffset = polyZoneWriteInfo.connectionCountsOffset + + sizeof(INTEGER4) * (TotalNumFaceBndryFaces[CurFile] + 2); + polyZoneWriteInfo.connectionZonesOffset = polyZoneWriteInfo.connectionElemsOffset + + sizeof(INTEGER4) * TotalNumFaceBndryConns[CurFile]; +} + +INTEGER4 checkForPolyFacePreconditions() +{ + if (CheckFile("TECPOLYFACE112") < 0) + return (-1); + + if (FaceNeighborsOrMapWritten[CurFile][CurZone[CurFile]]) + { + if (NumErrs[CurFile] == 0) + { +#if defined MAKEARCHIVE + PRINT0("Err: (TECPOLYFACE112) TECPOLYFACE112 called after all specified faces were already written.\n"); +#endif + NumErrs[CurFile]++; + } + return (-1); + } + + if (KMax[CurFile] == 0 || + (ZoneType[CurFile] != FEPOLYGON && + ZoneType[CurFile] != FEPOLYHEDRON)) + { +#if defined MAKEARCHIVE + PRINT0("Err: (TECPOLYFACE112) The zone type must be FEPOLYGON or FEPOLYHEDRON and have KMax (NumFaces) > 0.\n"); + PRINT1(" KMax = %d\n", KMax[CurFile]); +#endif + NumErrs[CurFile]++; + /* 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; + 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: (TECPOLYFACE112) TotalNumFaceNodes MUST be specified for polyhedral zones.\n"); + PRINT1(" TotalNumFaceNodes = %d\n", TotalNumFaceNodes[CurFile][CurZone[CurFile]]); +#endif + NumErrs[CurFile]++; + /* 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; + return (-1); + } + } + else + { + if (TotalNumFaceNodes[CurFile][CurZone[CurFile]] != (2 * KMax[CurFile])) + { +#if defined MAKEARCHIVE + PRINT0("Err: (TECPOLYFACE112) TotalNumFaceNodes is specified for the polygonal zone but is not equal to 2 * KMax.\n"); + PRINT2(" TotalNumFaceNodes = %d. If specified, it must be 2 * %d.", TotalNumFaceNodes[CurFile][CurZone[CurFile]], KMax[CurFile]); +#endif + NumErrs[CurFile]++; + /* 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; + return (-1); + } + } + + return 0; +} + +INTEGER4 getMinNeighborValue(LgIndex_t &MinNeighborValue) +{ + MinNeighborValue = TECIO_NO_NEIGHBORING_ELEM; + + 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: (TECPOLYFACE112) 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]++; + /* 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; + return (-1); + } + + return 0; +} + +INTEGER4 writePolyhedralFaceNodeOffsets(PolyZoneWriteInfo& polyZoneWriteInfo, INTEGER4 NumFaces, INTEGER4* FaceNodeCounts ) +{ + { + TP_FSEEK(BlckFile[CurFile]->File, polyZoneWriteInfo.numFaceNodesOffset, SEEK_SET); + if (polyZoneWriteInfo.faceNodeSum == 0) + if (!WriteBinaryInt32(BlckFile[CurFile], 0)) + { + WriteErr("TECPOLYFACE112"); + return -1; + } + for (LgIndex_t Index = 0; Index < NumFaces; Index++) + { + polyZoneWriteInfo.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 (polyZoneWriteInfo.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], polyZoneWriteInfo.faceNodeSum)) + { + WriteErr("TECPOLYFACE112"); + return -1; + } + } + polyZoneWriteInfo.numFaceNodesOffset = static_cast(TP_FTELL(BlckFile[CurFile]->File)); + } + + return 0; +} + +INTEGER4 writeFaceNodes(PolyZoneWriteInfo& polyZoneWriteInfo, LgIndex_t BeginningFaceNodeSum, INTEGER4 NumFaces, INTEGER4* FaceNodes) +{ + TP_FSEEK(BlckFile[CurFile]->File, polyZoneWriteInfo.faceNodesOffset, SEEK_SET); + LgIndex_t LocalFaceNodeSum; + if (ZoneType[CurFile] == FEPOLYHEDRON) + LocalFaceNodeSum = polyZoneWriteInfo.faceNodeSum - BeginningFaceNodeSum; + else + LocalFaceNodeSum = 2 * (NumFaces); + + for (LgIndex_t Index = 0; Index < LocalFaceNodeSum; 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)) + { + WriteErr("TECPOLYFACE112"); + return -1; + } + } + polyZoneWriteInfo.faceNodesOffset = static_cast(TP_FTELL(BlckFile[CurFile]->File)); + + return 0; +} + +INTEGER4 checkElements(INTEGER4 NumFaces, INTEGER4* FaceLeftElems, INTEGER4* FaceRightElems, INTEGER4 MinNeighborValue) +{ + for (LgIndex_t Index = 0; Index < NumFaces; Index++) + { + if (FaceLeftElems[Index] < MinNeighborValue || + FaceLeftElems[Index] > JMax[CurFile]) + { +#if defined MAKEARCHIVE + PRINT1("Err: (TECPOLYFACE112) 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 (FaceRightElems[Index] < MinNeighborValue || + FaceRightElems[Index] > JMax[CurFile]) + { +#if defined MAKEARCHIVE + PRINT1("Err: (TECPOLYFACE112) 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 (FaceLeftElems[Index] == TECIO_NO_NEIGHBORING_ELEM && + FaceRightElems[Index] == TECIO_NO_NEIGHBORING_ELEM) + { +#if defined MAKEARCHIVE + PRINT1("Err: (TECPOLYFACE112) Both left and right neighbors are set to no neighboring element at face %d.\n", Index); +#endif + NumErrs[CurFile]++; + return (-1); + } + } + + return 0; +} + +/** + * Write the items of the integer array, but convert to zero-based + */ +INTEGER4 writeDecrementedIntegerArray(INTEGER4 numItems, INTEGER4* items) +{ + for (INTEGER4 i = 0; i < numItems; ++i) + { + if (!WriteBinaryInt32(BlckFile[CurFile], items[i] - 1)) + { + WriteErr("TECPOLYFACE112"); + return -1; + } + } + return 0; +} + +INTEGER4 writeElements(PolyZoneWriteInfo& polyZoneWriteInfo, INTEGER4 NumFaces, INTEGER4* FaceLeftElems, INTEGER4* FaceRightElems, INTEGER4 MinNeighborValue) +{ + if (checkElements(NumFaces, FaceLeftElems, FaceRightElems, MinNeighborValue) != 0) + return (-1); + + TP_FSEEK(BlckFile[CurFile]->File, polyZoneWriteInfo.leftElemsOffset, SEEK_SET); + if (writeDecrementedIntegerArray(NumFaces, FaceLeftElems) != 0) + return -1; + polyZoneWriteInfo.leftElemsOffset = static_cast(TP_FTELL(BlckFile[CurFile]->File)); + + TP_FSEEK(BlckFile[CurFile]->File, polyZoneWriteInfo.rightElemsOffset, SEEK_SET); + if (writeDecrementedIntegerArray(NumFaces, FaceRightElems) != 0) + return -1; + polyZoneWriteInfo.rightElemsOffset = static_cast(TP_FTELL(BlckFile[CurFile]->File)); + + return 0; +} + +INTEGER4 writeBoundaryConnectionCounts(PolyZoneWriteInfo& polyZoneWriteInfo, INTEGER4 NumBndryFaces, INTEGER4* FaceBndryConnectionCounts) +{ + /* + * 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". + */ + TP_FSEEK(BlckFile[CurFile]->File, polyZoneWriteInfo.connectionCountsOffset, SEEK_SET); + if (polyZoneWriteInfo.boundaryConnectionSum == 0) + { + if (!(WriteBinaryInt32(BlckFile[CurFile], 0) && + WriteBinaryInt32(BlckFile[CurFile], 0))) + { + WriteErr("TECPOLYFACE112"); + return -1; + } + } + + for (LgIndex_t Index = 0; Index < NumBndryFaces; Index++) + { + polyZoneWriteInfo.boundaryConnectionSum += FaceBndryConnectionCounts[Index]; + if (FaceBndryConnectionCounts[Index] < 0) + { +#if defined MAKEARCHIVE + PRINT1("Err: (TECPOLYBCONN112) Invalid boundary connection count at position %d:\n", Index + 1); + PRINT1(" boundary connection count = %d.\n", FaceBndryConnectionCounts[Index]); +#endif + NumErrs[CurFile]++; + return (-1); + } + else if (!WriteBinaryInt32(BlckFile[CurFile], polyZoneWriteInfo.boundaryConnectionSum)) + { + WriteErr("TECPOLYFACE112"); + return -1; + } + } + if (polyZoneWriteInfo.boundaryConnectionSum > TotalNumFaceBndryConns[CurFile]) + { +#if defined MAKEARCHIVE + PRINT0("Err: (TECPOLYBCONN112) Invalid number of boundary connections:\n"); + PRINT2(" number of boundary connections written = %d, total number of boundary connections = %d.", + polyZoneWriteInfo.boundaryConnectionSum, TotalNumFaceBndryConns[CurFile]); +#endif + NumErrs[CurFile]++; + return (-1); + } + polyZoneWriteInfo.connectionCountsOffset = static_cast(TP_FTELL(BlckFile[CurFile]->File)); + + return 0; +} + +INTEGER4 writeBoundaryConnectionElements( + PolyZoneWriteInfo& polyZoneWriteInfo, + INTEGER4 NumBndryFaces, + INTEGER4* FaceBndryConnectionCounts, + INTEGER4* FaceBndryConnectionElems, + INTEGER4* FaceBndryConnectionZones) +{ + /* Write the boundary connection elements but convert 1-based to 0-based. */ + TP_FSEEK(BlckFile[CurFile]->File, polyZoneWriteInfo.connectionElemsOffset, SEEK_SET); + LgIndex_t LocalBndryConnCount = 0; + for (LgIndex_t Index = 0; Index < NumBndryFaces; Index++) + { + for (LgIndex_t BIndex = 0; BIndex < FaceBndryConnectionCounts[Index]; BIndex++) + { + if (BIndex > 0 && + FaceBndryConnectionElems[LocalBndryConnCount] == TECIO_NO_NEIGHBORING_ELEM) + { +#if defined MAKEARCHIVE + PRINT1("Err: (TECPOLYBCONN112) Partially obscured faces must specify no neighboring element first. See boundary connections for face %d.\n", polyZoneWriteInfo.numBoundaryFacesWritten + Index + 1); +#endif + NumErrs[CurFile]++; + return (-1); + } + if (FaceBndryConnectionElems[LocalBndryConnCount] < TECIO_NO_NEIGHBORING_ELEM) + { +#if defined MAKEARCHIVE + PRINT1("Err: (TECPOLYBCONN112) Invalid boundary element value at boundary connections for face %d:\n", polyZoneWriteInfo.numBoundaryFacesWritten + Index + 1); +#endif + NumErrs[CurFile]++; + return (-1); + } + if (FaceBndryConnectionElems[LocalBndryConnCount] == TECIO_NO_NEIGHBORING_ELEM && + FaceBndryConnectionZones[LocalBndryConnCount] != TECIO_NO_NEIGHBORING_ZONE) + { +#if defined MAKEARCHIVE + PRINT1("Err: (TECPOLYBCONN112) 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[LocalBndryConnCount] - 1)) + { + WriteErr("TECPOLYFACE112"); + return -1; + } + LocalBndryConnCount++; + } + } + polyZoneWriteInfo.connectionElemsOffset = static_cast(TP_FTELL(BlckFile[CurFile]->File)); + + return 0; +} + +INTEGER4 writeBoundaryConnectionZones( + PolyZoneWriteInfo& polyZoneWriteInfo, + INTEGER4 NumBndryFaces, + INTEGER4* FaceBndryConnectionCounts, + INTEGER4* FaceBndryConnectionZones) +{ + TP_FSEEK(BlckFile[CurFile]->File, polyZoneWriteInfo.connectionZonesOffset, SEEK_SET); + INTEGER4 LocalBndryConnCount = 0; + for (LgIndex_t Index = 0; Index < NumBndryFaces; Index++) + { + for (LgIndex_t BIndex = 0; BIndex < FaceBndryConnectionCounts[Index]; BIndex++) + { + if (FaceBndryConnectionZones[LocalBndryConnCount] < TECIO_NO_NEIGHBORING_ZONE) + { +#if defined MAKEARCHIVE + PRINT1("Err: (TECPOLYBCONN112) Invalid boundary zone value at boundary connections for face %d:\n", Index + 1); +#endif + NumErrs[CurFile]++; + return (-1); + } + else if (!WriteBinaryInt32(BlckFile[CurFile], FaceBndryConnectionZones[LocalBndryConnCount] - 1)) + { + WriteErr("TECPOLYFACE112"); + return -1; + } + LocalBndryConnCount++; + } + } + polyZoneWriteInfo.connectionZonesOffset = static_cast(TP_FTELL(BlckFile[CurFile]->File)); + + return 0; +} + +} // namespace + +/** + * TECPOLYFACEXXX + */ +LIBFUNCTION INTEGER4 LIBCALL TECPOLYFACE112(INTEGER4 *NumFaces, + INTEGER4 *FaceNodeCounts, + INTEGER4 *FaceNodes, + INTEGER4 *FaceLeftElems, + INTEGER4 *FaceRightElems) +{ + INTEGER4 Result = checkForPolyFacePreconditions(); + if (Result != 0) + return Result; + + INTEGER4 MinNeighborValue; + Result = getMinNeighborValue(MinNeighborValue); + if (Result != 0) + return Result; + + if (PolyZoneWriteInfos[CurFile][CurZone[CurFile]].numFacesWritten == 0 && + PolyZoneWriteInfos[CurFile][CurZone[CurFile]].numBoundaryFacesWritten == 0) + calculateInitialPolyZoneOffsets(); + PolyZoneWriteInfo& polyZoneWriteInfo = PolyZoneWriteInfos[CurFile][CurZone[CurFile]]; + + /* Write the facenodesoffsets array from the facenodecounts array. */ + LgIndex_t BeginningFaceNodeSum = polyZoneWriteInfo.faceNodeSum; + if (ZoneType[CurFile] == FEPOLYHEDRON) /* FEPOLYGON doesn't specify facenodesoffsets */ + Result = writePolyhedralFaceNodeOffsets(polyZoneWriteInfo, *NumFaces, FaceNodeCounts); + if (Result != 0) + return Result; + + /* Write the facenodes array but convert 1-based to 0-based. */ + Result = writeFaceNodes(polyZoneWriteInfo, BeginningFaceNodeSum, *NumFaces, FaceNodes); + if (Result != 0) + return Result; + + /* Write the left and right elements array but convert 1-based to 0-based. */ + Result = writeElements(polyZoneWriteInfo, *NumFaces, FaceLeftElems, FaceRightElems, MinNeighborValue); + if (Result != 0) + return Result; + + polyZoneWriteInfo.numFacesWritten += *NumFaces; + if (polyZoneWriteInfo.numFacesWritten == KMax[CurFile] && + polyZoneWriteInfo.numBoundaryFacesWritten == TotalNumFaceBndryFaces[CurFile]) + { + FaceNeighborsOrMapWritten[CurFile][CurZone[CurFile]] = TRUE; + } + + return 0; +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecpolyface112_(INTEGER4 *NumFaces, + INTEGER4 *FaceNodeCounts, + INTEGER4 *FaceNodes, + INTEGER4 *FaceLeftElems, + INTEGER4 *FaceRightElems) +{ + return TECPOLYFACE112(NumFaces, + FaceNodeCounts, + FaceNodes, + FaceLeftElems, + FaceRightElems); +} +#endif + +/** + * TECPOLYBCONNXXX + */ +LIBFUNCTION INTEGER4 LIBCALL TECPOLYBCONN112(INTEGER4 *NumBndryFaces, + INTEGER4 *FaceBndryConnectionCounts, + INTEGER4 *FaceBndryConnectionElems, + INTEGER4 *FaceBndryConnectionZones) +{ + if (CheckFile("TECPOLYBCONN112") < 0) + return (-1); + + if (PolyZoneWriteInfos[CurFile][CurZone[CurFile]].numFacesWritten == 0 && + PolyZoneWriteInfos[CurFile][CurZone[CurFile]].numBoundaryFacesWritten == 0) + calculateInitialPolyZoneOffsets(); + PolyZoneWriteInfo& polyZoneWriteInfo = PolyZoneWriteInfos[CurFile][CurZone[CurFile]]; + + /* Write the boundary arrays. */ + if (TotalNumFaceBndryFaces[CurFile] > 0) + { + /* Write the boundaryconnectionoffsets array from the boundaryconnectioncounts array. */ + if (writeBoundaryConnectionCounts(polyZoneWriteInfo, *NumBndryFaces, FaceBndryConnectionCounts) != 0) + return -1; + + if (writeBoundaryConnectionElements(polyZoneWriteInfo, *NumBndryFaces, + FaceBndryConnectionCounts, FaceBndryConnectionElems, FaceBndryConnectionZones) != 0) + return -1; + + /* Write the boundary connection zones but convert 1-based to 0-based. */ + if (writeBoundaryConnectionZones(polyZoneWriteInfo, *NumBndryFaces, + FaceBndryConnectionCounts, FaceBndryConnectionZones) != 0) + return -1; + } + + polyZoneWriteInfo.numBoundaryFacesWritten += *NumBndryFaces; + if (polyZoneWriteInfo.numFacesWritten == KMax[CurFile] && + polyZoneWriteInfo.numBoundaryFacesWritten == TotalNumFaceBndryFaces[CurFile]) + { + FaceNeighborsOrMapWritten[CurFile][CurZone[CurFile]] = TRUE; + } + + return 0; +} + +#if defined MAKEARCHIVE && !defined _WIN32 /* every platform but Windows Intel */ +LIBFUNCTION INTEGER4 LIBCALL tecpolybconn112_(INTEGER4 *NumBndryFaces, + INTEGER4 *FaceBndryConnectionCounts, + INTEGER4 *FaceBndryConnectionElems, + INTEGER4 *FaceBndryConnectionZones) +{ + return TECPOLYBCONN112(NumBndryFaces, + FaceBndryConnectionCounts, + FaceBndryConnectionElems, + FaceBndryConnectionZones); +} +#endif diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio2009.zip b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio2009.zip deleted file mode 100644 index 9ee8a6724..000000000 Binary files a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/tecio2009.zip and /dev/null differ