CXX-syntax: updated tecio c++ casting style to suppress [-Wold-style-cast]

This commit is contained in:
Danial Khazaei 2019-01-31 17:20:44 +03:30
parent a480f9577c
commit 9c81a37a62
No known key found for this signature in database
GPG key ID: 0EF86F9BFB18F88C
81 changed files with 7003 additions and 5160 deletions

View file

@ -1,4 +1,3 @@
#!/bin/sh
MAKEWHAT= MAKEWHAT=
EXTRAFLAGS= EXTRAFLAGS=
@ -15,7 +14,7 @@ if test $# -ge 1 ; then
elif test "$1" = "-skipcompile" ; then elif test "$1" = "-skipcompile" ; then
skipcompile=y skipcompile=y
elif test "$1" = "-tecio" ; then elif test "$1" = "-tecio" ; then
MAKEWHAT=tecio.a MAKEWHAT=libtecio.a
else else
EXTRAFLAGS="$EXTRAFLAGS $1" EXTRAFLAGS="$EXTRAFLAGS $1"
fi fi
@ -25,7 +24,7 @@ else
echo "Choose platform:" echo "Choose platform:"
echo " " echo " "
echo " macux.104" echo " macux.104"
echo " macix64.105" echo " macix64.106"
echo " sgix.62" echo " sgix.62"
echo " sgix3.62" echo " sgix3.62"
echo " sgix.65" echo " sgix.65"
@ -45,23 +44,24 @@ else
echo " hp7xx64.11" echo " hp7xx64.11"
echo " hpi64.11" echo " hpi64.11"
echo " linux.24" echo " linux.24"
echo " linuxi64.24" echo " linux64.26"
echo " linux.22" echo " linux.22"
echo " linuxa.22" echo " linuxa.22"
echo " linuxg248x64.26" echo " linux32-centos4.8"
echo " linuxg27x64.26" echo " linux64-sled10.4"
echo " linuxg29x64.26"
echo " crayc90" echo " crayc90"
echo "->\c" echo "->\c"
read Platname read Platname
echo "Choose:" echo "Choose:"
echo " 1. Make tecio.a only" echo " 1. Make libtecio.a only"
echo " 2. Make tecio.a and pltview" echo " 2. Make libtecio.a and pltview"
read choice read choice
if test $choice -eq 1 ;then if test $choice -eq 1 ;then
MAKEWHAT=tecio.a MAKEWHAT=libtecio.a
fi fi
fi fi
@ -72,18 +72,32 @@ AR=ar
ARFLAGS=qv ARFLAGS=qv
DISTSUBDIR2= DISTSUBDIR2=
#
# The blah-64 platforms are 64-bit builds of tecio, typically on 32-bit
# platforms.
#
case $Platname in case $Platname in
mac*) CCOMP=g++ macix64*) CCOMP=g++
FINALCFLAGS="-arch ppc -arch i386 -arch ppc64 -arch x86_64 -DDARWIN -DLONGIS64 -I/usr/X11R6/include" FINALCFLAGS="-arch x86_64 -DDARWIN -DMAC64 -I/usr/X11R6/include"
STRIPFLAG=-Wl,-x 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 sgix.65-64) CCOMP=CC
FINALCFLAGS="-DIRISX -DLONGIS64 -mips4 -64" FINALCFLAGS="-DIRISX -mips4 -64"
LINKFLAGS="-mips4 -64" LINKFLAGS="-mips4 -64"
;; ;;
sgix64.65) CCOMP=CC sgix64.65) CCOMP=CC
FINALCFLAGS="-DIRISX -DLONGIS64 -mips4 -64" FINALCFLAGS="-DIRISX -mips4 -64"
LINKFLAGS="-mips4 -64" LINKFLAGS="-mips4 -64"
;; ;;
sgix.65) CCOMP=CC sgix.65) CCOMP=CC
@ -95,7 +109,7 @@ case $Platname in
LINKFLAGS="-o32" LINKFLAGS="-o32"
;; ;;
sgix.62-64) CCOMP=CC sgix.62-64) CCOMP=CC
FINALCFLAGS="-DIRISX -DIRIX62 -DLONGIS64 -mips4 -64" FINALCFLAGS="-DIRISX -DIRIX62 -mips4 -64"
LINKFLAGS="-mips4 -64" LINKFLAGS="-mips4 -64"
;; ;;
sgix.62) CCOMP=CC sgix.62) CCOMP=CC
@ -114,7 +128,7 @@ case $Platname in
FINALCFLAGS=-DIBMRS6000X FINALCFLAGS=-DIBMRS6000X
;; ;;
ibmx64.*) CCOMP=xlC ibmx64.*) CCOMP=xlC
FINALCFLAGS="-DIBMRS6000X -DLONGIS64 -q64" FINALCFLAGS="-DIBMRS6000X -q64"
ARFLAGS="-X64 qv" ARFLAGS="-X64 qv"
;; ;;
compaq.51) CCOMP=cxx compaq.51) CCOMP=cxx
@ -124,15 +138,15 @@ case $Platname in
FINALCFLAGS="-DDECALPHAX -I/usr/include -ieee_with_inexact" FINALCFLAGS="-DDECALPHAX -I/usr/include -ieee_with_inexact"
;; ;;
hp7xx.*-64) CCOMP=aCC 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" LINKFLAGS="+DA2.0W +DD64 +DS2.0W"
;; ;;
hp7xx64.11) CCOMP=aCC 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" LINKFLAGS="+DA2.0W +DD64 +DS2.0W"
;; ;;
hpi64.11) CCOMP=aCC 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" LINKFLAGS="+DD64"
;; ;;
hp7xx.11) CCOMP=aCC hp7xx.11) CCOMP=aCC
@ -142,10 +156,13 @@ case $Platname in
crayc90) CCOMP=cc crayc90) CCOMP=cc
FINALCFLAGS="-DCRAY -DUNIXX" FINALCFLAGS="-DCRAY -DUNIXX"
;; ;;
linux*i64.*)CCOMP=g++ linux.64-gcc4.2.4.26) #
FINALCFLAGS="-fPIC -DLINUX -DLINUXI64" # 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++ linux*64*) CCOMP=g++
FINALCFLAGS="-fPIC -DLINUX -DLINUX64" FINALCFLAGS="-fPIC -DLINUX -DLINUX64"
;; ;;
linux*) CCOMP=g++ linux*) CCOMP=g++
@ -173,21 +190,21 @@ case $Platname in
ARFLAGS="-xar -o" ARFLAGS="-xar -o"
;; ;;
sun4.57-64) CCOMP=/opt/SUNWspro/bin/CC 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" LINKFLAGS="-KPIC -xarch=v9 -library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg"
MAKECMD=/usr/ccs/bin/make MAKECMD=/usr/ccs/bin/make
AR=/opt/SUNWspro/bin/CC AR=/opt/SUNWspro/bin/CC
ARFLAGS="-xar -o" ARFLAGS="-xar -o"
;; ;;
sun464.57) CCOMP=/opt/SUNWspro/bin/CC 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" LINKFLAGS="-KPIC -xarch=v9 -library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg"
MAKECMD=/usr/ccs/bin/make MAKECMD=/usr/ccs/bin/make
AR=/opt/SUNWspro/bin/CC AR=/opt/SUNWspro/bin/CC
ARFLAGS="-xar -o" ARFLAGS="-xar -o"
;; ;;
sun464.59) CCOMP=/opt/SUNWspro/bin/CC 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" LINKFLAGS="-KPIC -m64 -xarch=generic -library=libC -library=Cstd -library=no%rwtools7 -library=no%rwtools7_dbg"
MAKECMD=/usr/ccs/bin/make MAKECMD=/usr/ccs/bin/make
AR=/opt/SUNWspro/bin/CC AR=/opt/SUNWspro/bin/CC
@ -260,18 +277,18 @@ cd ..
pwd pwd
echo "$AR $ARFLAGS tecio.a $OBJLIST" echo "$AR $ARFLAGS libtecio.a $OBJLIST"
$AR $ARFLAGS tecio.a $OBJLIST $AR $ARFLAGS libtecio.a $OBJLIST
if test -f /bin/ranlib ; then if test -f /bin/ranlib ; then
/bin/ranlib tecio.a; /bin/ranlib libtecio.a;
elif test -f /usr/bin/ranlib ; then elif test -f /usr/bin/ranlib ; then
/usr/bin/ranlib tecio.a; /usr/bin/ranlib libtecio.a;
elif test -f /usr/ucb/ranlib ; then elif test -f /usr/ucb/ranlib ; then
/usr/ucb/ranlib tecio.a; /usr/ucb/ranlib libtecio.a;
fi fi
echo "$CCOMP -I./tecsrc -DMAKEARCHIVE $FINALCFLAGS -c pltview.cpp" echo "$CCOMP -I./tecsrc -DMAKEARCHIVE $FINALCFLAGS -c pltview.cpp"
$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" echo "$CCOMP $FINALCFLAGS pltview.o libtecio.a $LINKFLAGS $LINKLIBS $STRIPFLAG -lm -o pltview"
$CCOMP $FINALCFLAGS pltview.o tecio.a $LINKFLAGS $LINKLIBS $STRIPFLAG -lm -o pltview $CCOMP $FINALCFLAGS pltview.o libtecio.a $LINKFLAGS $LINKLIBS $STRIPFLAG -lm -o pltview

View file

@ -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)

View file

@ -31,10 +31,8 @@ int main()
&FileType, &FileType,
&Debug, &Debug,
&VIsDouble); &VIsDouble);
/* DOCEND */ /* DOCEND */
/* After TECINI is called, call TECZNE to create one or more /* After TECINI is called, call TECZNE to create one or more
* zones for your data file. In this example, Zone 1 contains a * zones for your data file. In this example, Zone 1 contains a
* single rectangular solid created as a face-based finite-element * single rectangular solid created as a face-based finite-element
@ -106,7 +104,6 @@ int main()
ValueLocation, ValueLocation,
NULL, NULL,
&SharConn); &SharConn);
/* DOCEND */ /* DOCEND */
/* DOCSTART:arrow_tecdat_rect.txt*/ /* DOCSTART:arrow_tecdat_rect.txt*/
@ -137,7 +134,6 @@ int main()
P_Rect[0] = 10; P_Rect[0] = 10;
INTEGER4 IsDouble = 1; INTEGER4 IsDouble = 1;
I = TECDAT112(&NumPts_Rect, X_Rect, &IsDouble); I = TECDAT112(&NumPts_Rect, X_Rect, &IsDouble);
I = TECDAT112(&NumPts_Rect, Y_Rect, &IsDouble); I = TECDAT112(&NumPts_Rect, Y_Rect, &IsDouble);
@ -146,7 +142,6 @@ int main()
/* DOCEND */ /* DOCEND */
/* DOCSTART:arrow_facenodes_rect.txt*/ /* DOCSTART:arrow_facenodes_rect.txt*/
/* The FaceNodeCounts array is used to describe the number of /* The FaceNodeCounts array is used to describe the number of
* nodes in each face of the zone. The first value in the array * 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 * is the number of nodes in Face 1, the second value is the
@ -247,6 +242,12 @@ int main()
* in Zone 5. * in Zone 5.
*/ */
FaceLeftElems_Rect[3] = -1; FaceLeftElems_Rect[3] = -1;
I = TECPOLYFACE112(&NumFaces_Rect,
FaceNodeCounts_Rect,
FaceNodes_Rect,
FaceLeftElems_Rect,
FaceRightElems_Rect);
/* DOCEND */ /* DOCEND */
/* DOCSTART:arrow_tecpoly_rect.txt*/ /* DOCSTART:arrow_tecpoly_rect.txt*/
@ -276,10 +277,7 @@ int main()
FaceBndryConnElems_Rect[0] = 1; FaceBndryConnElems_Rect[0] = 1;
FaceBndryConnZones_Rect[0] = 2; FaceBndryConnZones_Rect[0] = 2;
I = TECPOLY112(FaceNodeCounts_Rect, I = TECPOLYBCONN112(&NumConnBndryFaces_Rect,
FaceNodes_Rect,
FaceLeftElems_Rect,
FaceRightElems_Rect,
FaceBndryConnCounts_Rect, FaceBndryConnCounts_Rect,
FaceBndryConnElems_Rect, FaceBndryConnElems_Rect,
FaceBndryConnZones_Rect); FaceBndryConnZones_Rect);
@ -359,13 +357,10 @@ int main()
/* DOCEND */ /* DOCEND */
/* DOCSTART:arrow_tecdat_prism.txt*/ /* DOCSTART:arrow_tecdat_prism.txt*/
double *X_Prism = new double[NumPts_Prism]; double *X_Prism = new double[NumPts_Prism];
double *Y_Prism = new double[NumPts_Prism]; double *Y_Prism = new double[NumPts_Prism];
double *Z_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 */ /* Set the X and Y variable values, one z-plane at a time */
double ZVal = 0; double ZVal = 0;
for (INTEGER4 ii = 0; ii < 2; ii++) for (INTEGER4 ii = 0; ii < 2; ii++)
@ -470,10 +465,15 @@ int main()
* element and zone for a face. * element and zone for a face.
*/ */
FaceLeftElems_Prism[0] = -1; FaceLeftElems_Prism[0] = -1;
I = TECPOLYFACE112(&NumFaces_Prism,
FaceNodeCounts_Prism,
FaceNodes_Prism,
FaceLeftElems_Prism,
FaceRightElems_Prism);
/* DOCEND */ /* DOCEND */
/* DOCSTART:arrow_tecpoly_prism.txt*/ /* DOCSTART:arrow_tecpoly_prism.txt*/
INTEGER4 *FaceBndryConnCounts_Prism = new INTEGER4[NumConnBndryFaces_Prism]; INTEGER4 *FaceBndryConnCounts_Prism = new INTEGER4[NumConnBndryFaces_Prism];
FaceBndryConnCounts_Prism[0] = 2; FaceBndryConnCounts_Prism[0] = 2;
@ -500,10 +500,7 @@ int main()
FaceBndryConnElems_Prism[1] = 1; FaceBndryConnElems_Prism[1] = 1;
FaceBndryConnZones_Prism[1] = 1; FaceBndryConnZones_Prism[1] = 1;
I = TECPOLY112(FaceNodeCounts_Prism, I = TECPOLYBCONN112(&NumConnBndryFaces_Prism,
FaceNodes_Prism,
FaceLeftElems_Prism,
FaceRightElems_Prism,
FaceBndryConnCounts_Prism, FaceBndryConnCounts_Prism,
FaceBndryConnElems_Prism, FaceBndryConnElems_Prism,
FaceBndryConnZones_Prism); FaceBndryConnZones_Prism);

View file

@ -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)

View file

@ -19,6 +19,11 @@ C 11. Close file 2.
C C
Program ComplexTest 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" 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)

View file

@ -6,19 +6,19 @@
<Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" DeleteExtensionsOnClean="*.obj;*.mod;*.pdb;*.asm;*.map;*.dyn;*.dpi;*.tmp;*.log;*.ilk;*.exe;$(TargetPath)"> <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" DeleteExtensionsOnClean="*.obj;*.mod;*.pdb;*.asm;*.map;*.dyn;*.dpi;*.tmp;*.log;*.ilk;*.exe;$(TargetPath)">
<Tool Name="VFMidlTool" SuppressStartupBanner="true" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/> <Tool Name="VFMidlTool" SuppressStartupBanner="true" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/>
<Tool Name="VFPreBuildEventTool"/> <Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" AdditionalIncludeDirectories="$(TEC_360_2009)/Include" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" Traceback="true" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebug" CompileOnly="true"/> <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" AdditionalIncludeDirectories="$(TEC_360_2013R1)/Include" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" Traceback="true" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebug" CompileOnly="true"/>
<Tool Name="VFPostBuildEventTool"/> <Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFCustomBuildTool"/> <Tool Name="VFCustomBuildTool"/>
<Tool Name="VFLinkerTool" OutputFile="$(OUTDIR)/comtestf.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(TEC_360_2009)/Bin" GenerateDebugInformation="true" ProgramDatabaseFile="$(OUTDIR)/comtestf.pdb" SubSystem="subSystemConsole" AdditionalDependencies="tecio.lib"/> <Tool Name="VFLinkerTool" OutputFile="$(OUTDIR)/comtestf.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(TEC_360_2013R1)/Bin" GenerateDebugInformation="true" ProgramDatabaseFile="$(OUTDIR)/comtestf.pdb" SubSystem="subSystemConsole" AdditionalDependencies="tecio.lib"/>
<Tool Name="VFResourceCompilerTool" ResourceOutputFileName="$(IntDir)/$(InputName).res"/> <Tool Name="VFResourceCompilerTool" ResourceOutputFileName="$(IntDir)/$(InputName).res"/>
<Tool Name="VFPreLinkEventTool"/></Configuration> <Tool Name="VFPreLinkEventTool"/></Configuration>
<Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" DeleteExtensionsOnClean="*.obj;*.mod;*.pdb;*.asm;*.map;*.dyn;*.dpi;*.tmp;*.log;*.ilk;*.exe;$(TargetPath)" MustRebuild="true"> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" DeleteExtensionsOnClean="*.obj;*.mod;*.pdb;*.asm;*.map;*.dyn;*.dpi;*.tmp;*.log;*.ilk;*.exe;$(TargetPath)" MustRebuild="true">
<Tool Name="VFMidlTool" SwitchesHaveChanged="true" SuppressStartupBanner="true" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/> <Tool Name="VFMidlTool" SwitchesHaveChanged="true" SuppressStartupBanner="true" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/>
<Tool Name="VFPreBuildEventTool"/> <Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFFortranCompilerTool" SwitchesHaveChanged="true" SuppressStartupBanner="true" AdditionalIncludeDirectories="$(TEC_360_2009)/Include" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" RuntimeLibrary="rtMultiThreaded" CompileOnly="true"/> <Tool Name="VFFortranCompilerTool" SwitchesHaveChanged="true" SuppressStartupBanner="true" AdditionalIncludeDirectories="$(TEC_360_2013R1)/Include" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" RuntimeLibrary="rtMultiThreaded" CompileOnly="true"/>
<Tool Name="VFPostBuildEventTool"/> <Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFCustomBuildTool"/> <Tool Name="VFCustomBuildTool"/>
<Tool Name="VFLinkerTool" SwitchesHaveChanged="true" MustRebuild="true" OutputFile="$(OUTDIR)/comtestf.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(TEC_360_2009)/Bin" SubSystem="subSystemConsole" AdditionalDependencies="tecio.lib"/> <Tool Name="VFLinkerTool" SwitchesHaveChanged="true" MustRebuild="true" OutputFile="$(OUTDIR)/comtestf.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(TEC_360_2013R1)/Bin" SubSystem="subSystemConsole" AdditionalDependencies="tecio.lib"/>
<Tool Name="VFResourceCompilerTool" SwitchesHaveChanged="true" ResourceOutputFileName="$(IntDir)/$(InputName).res"/> <Tool Name="VFResourceCompilerTool" SwitchesHaveChanged="true" ResourceOutputFileName="$(IntDir)/$(InputName).res"/>
<Tool Name="VFPreLinkEventTool"/></Configuration></Configurations> <Tool Name="VFPreLinkEventTool"/></Configuration></Configurations>
<Files> <Files>

View file

@ -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)

View file

@ -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)

View file

@ -89,7 +89,6 @@ int main()
/* DOCEND */ /* DOCEND */
/* DOCSTART:gridsolution_grid_tecdat.txt*/ /* DOCSTART:gridsolution_grid_tecdat.txt*/
/* TECDAT Parameters */ /* TECDAT Parameters */
double Phi = 0.5 * (1.0 + sqrt(5.0)); double Phi = 0.5 * (1.0 + sqrt(5.0));
double Pi = 3.141592653578; double Pi = 3.141592653578;
@ -130,11 +129,10 @@ int main()
delete X; delete X;
delete Y; delete Y;
delete Z; delete Z;
/* DOCEND */ /* DOCEND */
/* DOCSTART:gridsolution_grid_facenodes.txt*/ /* DOCSTART:gridsolution_grid_facenodes.txt*/
/* TecPoly Parameters */ /* TecPolyFace Parameters */
/* Create a FaceNodes array, dimensioned by the total number /* Create a FaceNodes array, dimensioned by the total number
* of face nodes in the zone. * of face nodes in the zone.
@ -225,7 +223,6 @@ int main()
FaceNodes[n++] = 9; FaceNodes[n++] = 9;
FaceNodes[n++] = 13; FaceNodes[n++] = 13;
FaceNodes[n++] = 17; FaceNodes[n++] = 17;
/* DOCEND */ /* DOCEND */
/* Specify the number of nodes for each face, and the right and /* Specify the number of nodes for each face, and the right and
@ -277,21 +274,17 @@ int main()
FaceLeftElems[10] = 0; FaceLeftElems[10] = 0;
FaceLeftElems[11] = 1; FaceLeftElems[11] = 1;
I = TECPOLY112(FaceNodeCounts, I = TECPOLYFACE112(&NumFaces,
FaceNodeCounts,
FaceNodes, FaceNodes,
FaceLeftElems, FaceLeftElems,
FaceRightElems, FaceRightElems);
NULL, /* No boundary connections. */
NULL,
NULL);
delete FaceNodes; delete FaceNodes;
delete FaceLeftElems; delete FaceLeftElems;
delete FaceRightElems; delete FaceRightElems;
/* DOCEND */ /* DOCEND */
/* DOCSTART:gridsolution_grid_tecend.txt*/ /* DOCSTART:gridsolution_grid_tecend.txt*/
I = TECEND112(); I = TECEND112();
/* DOCEND */ /* DOCEND */
@ -348,7 +341,6 @@ int main()
/* DOCEND */ /* DOCEND */
/* DOCSTART:gridsolution_solution_tecdat.txt*/ /* DOCSTART:gridsolution_solution_tecdat.txt*/
/* TECDAT Parameters */ /* TECDAT Parameters */
double *P = new double[NumPts]; double *P = new double[NumPts];
double *T = new double[NumPts]; double *T = new double[NumPts];
@ -364,7 +356,6 @@ int main()
delete P; delete P;
delete T; delete T;
/* DOCEND */ /* DOCEND */
/* DOCSTART:gridsolution_solution_tecend.txt*/ /* DOCSTART:gridsolution_solution_tecend.txt*/

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -1,6 +1,6 @@
/* This example illustrates using TecPoly to create two polygonal /* This example illustrates using TecPolyFace and TecPolyBConn to create
* zones. The first zone contains six hexagons, and the second * two polygonal zones. The first zone contains six hexagons, and the
* zone contains a hexagon and an octagon. Refer to the Data * second zone contains a hexagon and an octagon. Refer to the Data
* Format Guide for a picture of the configuration, including node * Format Guide for a picture of the configuration, including node
* and face numbers. * and face numbers.
*/ */
@ -110,7 +110,6 @@ int main()
/* DOCEND */ /* DOCEND */
/* DOCSTART:hexagons_zone1_tecdat.txt*/ /* DOCSTART:hexagons_zone1_tecdat.txt*/
/* TECDAT Parameters */ /* TECDAT Parameters */
double *X_Z1 = new double[NumPts_Z1]; double *X_Z1 = new double[NumPts_Z1];
double *Y_Z1 = new double[NumPts_Z1]; double *Y_Z1 = new double[NumPts_Z1];
@ -154,13 +153,11 @@ int main()
X_Z1[12] = 0; X_Z1[12] = 0;
Y_Z1[12] = 3; Y_Z1[12] = 3;
double *P_Z1 = new double[NumElems_Z1]; double *P_Z1 = new double[NumElems_Z1];
P_Z1[0] = 2; P_Z1[0] = 2;
P_Z1[1] = 4; P_Z1[1] = 4;
P_Z1[2] = 5; P_Z1[2] = 5;
INTEGER4 IsDouble = 1; INTEGER4 IsDouble = 1;
I = TECDAT112(&NumPts_Z1, X_Z1, &IsDouble); I = TECDAT112(&NumPts_Z1, X_Z1, &IsDouble);
I = TECDAT112(&NumPts_Z1, Y_Z1, &IsDouble); I = TECDAT112(&NumPts_Z1, Y_Z1, &IsDouble);
@ -171,7 +168,7 @@ int main()
/* DOCEND */ /* DOCEND */
/* DOCSTART:hexagons_zone1_facenodes.txt*/ /* DOCSTART:hexagons_zone1_facenodes.txt*/
/* TecPoly Parameters */ /* TecPolyFace Parameters */
/* Create a FaceNodes array, dimensioned by the total number /* Create a FaceNodes array, dimensioned by the total number
* of face nodes in the zone. * of face nodes in the zone.
@ -225,7 +222,6 @@ int main()
FaceNodes_Z1[28] = 13; FaceNodes_Z1[28] = 13;
FaceNodes_Z1[29] = 5; FaceNodes_Z1[29] = 5;
/* DOCEND */ /* DOCEND */
/* Specify the right and left neighboring elements. /* Specify the right and left neighboring elements.
@ -259,7 +255,7 @@ int main()
FaceLeftElems_Z1[7] = 0; FaceLeftElems_Z1[7] = 0;
FaceLeftElems_Z1[8] = -1; FaceLeftElems_Z1[8] = -1;
FaceLeftElems_Z1[9] = -2; FaceLeftElems_Z1[9] = -2;
FaceLeftElems_Z1[10] = 2; FaceLeftElems_Z1[10] = 3;
/* Left Face Elems for Element 3 */ /* Left Face Elems for Element 3 */
FaceLeftElems_Z1[11] = -3; FaceLeftElems_Z1[11] = -3;
@ -274,14 +270,25 @@ int main()
for (INTEGER4 ii = 0; ii < 6; ii++) for (INTEGER4 ii = 0; ii < 6; ii++)
FaceRightElems_Z1[ii] = 1; FaceRightElems_Z1[ii] = 1;
for (INTEGER4 ii = 6; ii < 10; ii++) for (INTEGER4 ii = 6; ii < 11; ii++)
FaceRightElems_Z1[ii] = 2; FaceRightElems_Z1[ii] = 2;
for (INTEGER4 ii = 10; ii <= 14; ii++) for (INTEGER4 ii = 11; ii <= 14; ii++)
FaceRightElems_Z1[ii] = 3; 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 */ /* DOCEND */
/* DOCSTART:hexagons_zone1_tecpoly.txt */ /* DOCSTART:hexagons_zone1_tecpoly.txt */
/* TecPolyBConn Parameters */
/* The FaceBndryConnectionCounts array is used to define the /* The FaceBndryConnectionCounts array is used to define the
* number of boundary connections for each face that has a * number of boundary connections for each face that has a
@ -308,19 +315,10 @@ int main()
INTEGER4 FaceBndryConnectionElems_Z1[3] = {1, 2, 2}; INTEGER4 FaceBndryConnectionElems_Z1[3] = {1, 2, 2};
INTEGER4 FaceBndryConnectionZones_Z1[3] = {2, 2, 2}; INTEGER4 FaceBndryConnectionZones_Z1[3] = {2, 2, 2};
I = TECPOLYBCONN112(&TotalNumBndryFaces_Z1,
I = TECPOLY112(NULL, /* Not used for polygon zones */
FaceNodes_Z1,
FaceLeftElems_Z1,
FaceRightElems_Z1,
FaceBndryConnectionCounts_Z1, FaceBndryConnectionCounts_Z1,
FaceBndryConnectionElems_Z1, FaceBndryConnectionElems_Z1,
FaceBndryConnectionZones_Z1); FaceBndryConnectionZones_Z1);
delete FaceNodes_Z1;
delete FaceLeftElems_Z1;
delete FaceRightElems_Z1;
/* DOCEND */ /* DOCEND */
/* Define Zone 2. Zone 2 contains an octagon and a hexagon. */ /* Define Zone 2. Zone 2 contains an octagon and a hexagon. */
@ -397,7 +395,6 @@ int main()
X_Z2[5] = 4; X_Z2[5] = 4;
Y_Z2[5] = 3; Y_Z2[5] = 3;
X_Z2[6] = 3; X_Z2[6] = 3;
Y_Z2[6] = 3; Y_Z2[6] = 3;
@ -433,7 +430,7 @@ int main()
delete P_Z2; delete P_Z2;
/* DOCEND */ /* DOCEND */
/* TecPoly Parameters */ /* TecPolyFace Parameters */
/* DOCSTART:hexagons_zone2_facemap.txt*/ /* DOCSTART:hexagons_zone2_facemap.txt*/
INTEGER4 *FaceNodes_Z2; INTEGER4 *FaceNodes_Z2;
FaceNodes_Z2 = new INTEGER4[TotalNumFaceNodes_Z2]; FaceNodes_Z2 = new INTEGER4[TotalNumFaceNodes_Z2];
@ -457,7 +454,6 @@ int main()
FaceNodes_Z2[10] = 6; FaceNodes_Z2[10] = 6;
FaceNodes_Z2[11] = 1; FaceNodes_Z2[11] = 1;
/* Face Nodes for Element 2 */ /* Face Nodes for Element 2 */
FaceNodes_Z2[12] = 7; FaceNodes_Z2[12] = 7;
FaceNodes_Z2[13] = 6; FaceNodes_Z2[13] = 6;
@ -481,8 +477,7 @@ int main()
FaceNodes_Z2[25] = 7; FaceNodes_Z2[25] = 7;
/* DOCEND */ /* DOCEND */
/* DOCSTART:hexagons_zone2_tecpolyface.txt*/
/* DOCSTART:hexagons_zone2_tecpoly.txt*/
/* Specify the right and left neighboring elements. /* Specify the right and left neighboring elements.
* The neighboring elements can be determined using the * The neighboring elements can be determined using the
* right-hand rule. For each face, place your right-hand along * right-hand rule. For each face, place your right-hand along
@ -525,6 +520,16 @@ int main()
for (INTEGER4 ii = 6; ii < 13; ii++) for (INTEGER4 ii = 6; ii < 13; ii++)
FaceRightElems_Z2[ii] = 2; 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 */ /* DOCEND */
/* DOCSTART:hexagons_zone2_tecpoly.txt*/ /* DOCSTART:hexagons_zone2_tecpoly.txt*/
@ -548,17 +553,10 @@ int main()
INTEGER4 FaceBndryConnectionElems_Z2[3] = {2, 3, 3}; INTEGER4 FaceBndryConnectionElems_Z2[3] = {2, 3, 3};
INTEGER4 FaceBndryConnectionZones_Z2[3] = {1, 1, 1}; INTEGER4 FaceBndryConnectionZones_Z2[3] = {1, 1, 1};
I = TECPOLY112(NULL, I = TECPOLYBCONN112(&TotalNumBndryFaces_Z2,
FaceNodes_Z2,
FaceLeftElems_Z2,
FaceRightElems_Z2,
FaceBndryConnectionCounts_Z2, FaceBndryConnectionCounts_Z2,
FaceBndryConnectionElems_Z2, FaceBndryConnectionElems_Z2,
FaceBndryConnectionZones_Z2); FaceBndryConnectionZones_Z2);
delete FaceNodes_Z2;
delete FaceLeftElems_Z2;
delete FaceRightElems_Z2;
/* DOCEND */ /* DOCEND */
/* DOCSTART:hexagons_tecend.txt*/ /* DOCSTART:hexagons_tecend.txt*/

View file

@ -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)

View file

@ -195,7 +195,6 @@ int main()
FaceNodes[2*ii+1] = ii + 2; FaceNodes[2*ii+1] = ii + 2;
} }
FaceNodes[15] = 1; FaceNodes[15] = 1;
/* DOCEND */ /* DOCEND */
/* Define the right and left elements of each face. /* Define the right and left elements of each face.
@ -228,13 +227,11 @@ int main()
/* DOCEND */ /* DOCEND */
/* Write the polyhedral data to the file. */ /* Write the polyhedral data to the file. */
/* DOCSTART:octagon_tecpoly.txt*/ /* DOCSTART:octagon_tecpoly.txt*/
I = TECPOLY112(NULL, I = TECPOLYFACE112(&NumFaces,
NULL,
FaceNodes, FaceNodes,
FaceLeftElems, FaceLeftElems,
FaceRightElems, FaceRightElems);
NULL,
NULL,
NULL);
delete FaceNodes; delete FaceNodes;
delete FaceLeftElems; delete FaceLeftElems;

View file

@ -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)

View file

@ -20,7 +20,6 @@ int main()
&(Debug), &(Debug),
&(VIsDouble)); &(VIsDouble));
/* Call TECZNE112 */ /* Call TECZNE112 */
INTEGER4 ZoneType = 7; /* 7 for FEPolyhedron */ INTEGER4 ZoneType = 7; /* 7 for FEPolyhedron */
INTEGER4 NumNodes = 5; /* number of unique nodes */ INTEGER4 NumNodes = 5; /* number of unique nodes */
@ -117,7 +116,7 @@ int main()
delete Z; delete Z;
/* Define the Face Nodes. /* Define the Face Nodes.
*
* The FaceNodes array is used to indicate which nodes define * The FaceNodes array is used to indicate which nodes define
* which face. As mentioned earlier, the number of the nodes is * which face. As mentioned earlier, the number of the nodes is
* implicitly defined by the order in which the nodal data is * implicitly defined by the order in which the nodal data is
@ -201,14 +200,12 @@ int main()
FaceRightElems[3] = 1; FaceRightElems[3] = 1;
FaceRightElems[4] = 1; FaceRightElems[4] = 1;
/* Write the face map (created above) using TECPOLY112. */ /* Write the face map (created above) using TECPOLYFACE112. */
I = TECPOLY112(FaceNodeCounts, /* The face node counts array */ I = TECPOLYFACE112(&NumFaces,
FaceNodeCounts, /* The face node counts array */
FaceNodes, /* The face nodes array */ FaceNodes, /* The face nodes array */
FaceLeftElems, /* The left elements array */ FaceLeftElems, /* The left elements array */
FaceRightElems, /* The right elements array */ FaceRightElems); /* The right elements array */
NULL, /* No boundary connection counts */
NULL, /* No boundary connection elements */
NULL); /* No boundary connection zones */
delete FaceNodeCounts; delete FaceNodeCounts;
delete FaceNodes; delete FaceNodes;
@ -218,5 +215,4 @@ int main()
I = TECEND112(); I = TECEND112();
return 0; return 0;
} }
/* DOCEND */ /* DOCEND */

View file

@ -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)

View file

@ -11,6 +11,11 @@ C
C C
program test 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' INCLUDE 'tecio.inc'
character*1 NULLCHR character*1 NULLCHR

View file

@ -7,18 +7,18 @@
<Tool Name="VFMidlTool" SuppressStartupBanner="true" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/> <Tool Name="VFMidlTool" SuppressStartupBanner="true" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/>
<Tool Name="VFPreBuildEventTool"/> <Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/> <Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" AdditionalIncludeDirectories="$(TEC_360_2009)/Include" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" Traceback="true" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebug" CompileOnly="true"/> <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" DebugInformationFormat="debugEnabled" Optimization="optimizeDisabled" AdditionalIncludeDirectories="$(TEC_360_2013R1)/Include" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" Traceback="true" BoundsCheck="true" RuntimeLibrary="rtMultiThreadedDebug" CompileOnly="true"/>
<Tool Name="VFCustomBuildTool"/> <Tool Name="VFCustomBuildTool"/>
<Tool Name="VFLinkerTool" OutputFile="$(OUTDIR)/simtestf.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(TEC_360_2009)/Bin" GenerateDebugInformation="true" ProgramDatabaseFile="$(OUTDIR)/simtestf.pdb" SubSystem="subSystemConsole" AdditionalDependencies="tecio.lib"/> <Tool Name="VFLinkerTool" OutputFile="$(OUTDIR)/simtestf.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(TEC_360_2013R1)/Bin" GenerateDebugInformation="true" ProgramDatabaseFile="$(OUTDIR)/simtestf.pdb" SubSystem="subSystemConsole" AdditionalDependencies="tecio.lib"/>
<Tool Name="VFPreLinkEventTool"/> <Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFResourceCompilerTool" ResourceOutputFileName="$(IntDir)/$(InputName).res"/></Configuration> <Tool Name="VFResourceCompilerTool" ResourceOutputFileName="$(IntDir)/$(InputName).res"/></Configuration>
<Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" DeleteExtensionsOnClean="*.obj;*.mod;*.pdb;*.asm;*.map;*.dyn;*.dpi;*.tmp;*.log;*.ilk;*.exe;$(TargetPath)"> <Configuration Name="Release|Win32" OutputDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" IntermediateDirectory="$(SolutionDir)$(PlatformName)/$(ConfigurationName)" DeleteExtensionsOnClean="*.obj;*.mod;*.pdb;*.asm;*.map;*.dyn;*.dpi;*.tmp;*.log;*.ilk;*.exe;$(TargetPath)">
<Tool Name="VFMidlTool" SuppressStartupBanner="true" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/> <Tool Name="VFMidlTool" SuppressStartupBanner="true" HeaderFileName="$(InputName).h" TypeLibraryName="$(IntDir)/$(InputName).tlb"/>
<Tool Name="VFPreBuildEventTool"/> <Tool Name="VFPreBuildEventTool"/>
<Tool Name="VFPostBuildEventTool"/> <Tool Name="VFPostBuildEventTool"/>
<Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" AdditionalIncludeDirectories="$(TEC_360_2009)/Include" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" RuntimeLibrary="rtMultiThreaded" CompileOnly="true"/> <Tool Name="VFFortranCompilerTool" SuppressStartupBanner="true" AdditionalIncludeDirectories="$(TEC_360_2013R1)/Include" ModulePath="$(INTDIR)/" ObjectFile="$(INTDIR)/" RuntimeLibrary="rtMultiThreaded" CompileOnly="true"/>
<Tool Name="VFCustomBuildTool"/> <Tool Name="VFCustomBuildTool"/>
<Tool Name="VFLinkerTool" OutputFile="$(OUTDIR)/simtestf.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(TEC_360_2009)/Bin" SubSystem="subSystemConsole" AdditionalDependencies="tecio.lib"/> <Tool Name="VFLinkerTool" OutputFile="$(OUTDIR)/simtestf.exe" LinkIncremental="linkIncrementalNo" SuppressStartupBanner="true" AdditionalLibraryDirectories="$(TEC_360_2013R1)/Bin" SubSystem="subSystemConsole" AdditionalDependencies="tecio.lib"/>
<Tool Name="VFPreLinkEventTool"/> <Tool Name="VFPreLinkEventTool"/>
<Tool Name="VFResourceCompilerTool" ResourceOutputFileName="$(IntDir)/$(InputName).res"/></Configuration></Configurations> <Tool Name="VFResourceCompilerTool" ResourceOutputFileName="$(IntDir)/$(InputName).res"/></Configuration></Configurations>
<Files> <Files>

View file

@ -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)

View file

@ -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)

View file

@ -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 #if defined ADDON
#include "TECADDON.h" #include "TECADDON.h"
#include "GUIDEFS.h" #include "GUIDEFS.h"
#include "GUI.h" #include "TECGUI.h"
#define READTEC TecUtilReadBinaryData #define READTEC TecUtilReadBinaryData
#define SHOWINFO(S) TecGUITextAppendString(Output_T_D1,S); #define SHOWINFO(S) TecGUITextAppendString(Output_T_D1,S);
#define ERRMSG(S) TecUtilDialogErrMsg(S) #define ERRMSG(S) TecUtilDialogErrMsg(S)
@ -75,6 +52,12 @@ END CODELOG
#define STRINGLISTGETSTRING(S,N) TecUtilStringListGetString(S,N) #define STRINGLISTGETSTRING(S,N) TecUtilStringListGetString(S,N)
#define STRINGLISTGETCOUNT(S) TecUtilStringListGetCount(S) #define STRINGLISTGETCOUNT(S) TecUtilStringListGetCount(S)
#define STRINGLISTDEALLOC(S) TecUtilStringListDealloc(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 #else
#include "MASTER.h" #include "MASTER.h"
#include "GLOBAL.h" #include "GLOBAL.h"
@ -83,22 +66,21 @@ END CODELOG
#define FREE_ARRAY(N,S) TecFree((void *)N) #define FREE_ARRAY(N,S) TecFree((void *)N)
#include "ARRLIST.h" #include "ARRLIST.h"
#include "STRLIST.h" #include "STRLIST.h"
#include "AUXDATA.h"
#include "DATAUTIL.h" #include "DATAUTIL.h"
/*
#include "TECADDON.h"
#include "TECXXX.h"
#include "DATAUTIL.h"
#include "STRLIST.h"
*/
#define READTEC ReadTec #define READTEC ReadTec
#define SHOWINFO(S) printf("%s",S); #define SHOWINFO(S) printf("%s",S);
#define ERRMSG(S) printf("Err: %s\n",S); #define ERRMSG(S) printf("Err: %s\n",S);
#define STRINGLISTGETSTRING(S,N) StringListGetString(S,(N)-1) #define STRINGLISTGETSTRING(S,N) StringListGetString(S,(N)-1)
#define STRINGLISTGETCOUNT(S) StringListCount(S) #define STRINGLISTGETCOUNT(S) StringListCount(S)
#define STRINGLISTDEALLOC(S) StringListDealloc(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 #endif
@ -144,7 +126,8 @@ static void DeallocHeaderInfo(char **DataSetTitle,
LgIndex_t **NumPtsJ, LgIndex_t **NumPtsJ,
LgIndex_t **NumPtsK, LgIndex_t **NumPtsK,
ZoneType_e **ZoneType, ZoneType_e **ZoneType,
StringList_pa *UserRec) StringList_pa *UserRec,
AuxData_pa *DatasetAuxData)
{ {
if (*DataSetTitle) if (*DataSetTitle)
FREE_ARRAY(*DataSetTitle, "data set title"); FREE_ARRAY(*DataSetTitle, "data set title");
@ -162,6 +145,8 @@ static void DeallocHeaderInfo(char **DataSetTitle,
FREE_ARRAY(*ZoneType, "ZoneType Array"); FREE_ARRAY(*ZoneType, "ZoneType Array");
if (*UserRec) if (*UserRec)
STRINGLISTDEALLOC(UserRec); STRINGLISTDEALLOC(UserRec);
if (*DatasetAuxData)
AUXDATADEALLOC(DatasetAuxData);
*DataSetTitle = NULL; *DataSetTitle = NULL;
*VarNames = NULL; *VarNames = NULL;
@ -173,10 +158,56 @@ static void DeallocHeaderInfo(char **DataSetTitle,
*UserRec = NULL; *UserRec = NULL;
} }
#define MAXCHARSINFOLINE 5000 #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<char*>(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, void ReportFileInfo(char *FName,
Boolean_t LoadRawData, Boolean_t LoadRawData,
@ -193,6 +224,7 @@ void ReportFileInfo(char *FName,
LgIndex_t *NumPtsK = NULL; LgIndex_t *NumPtsK = NULL;
ZoneType_e *ZoneType = NULL; ZoneType_e *ZoneType = NULL;
StringList_pa UserRec = NULL; StringList_pa UserRec = NULL;
AuxData_pa DatasetAuxData = NULL;
int CZ, CV; int CZ, CV;
char InfoLine[MAXCHARSINFOLINE+1]; char InfoLine[MAXCHARSINFOLINE+1];
double **VDataBase = NULL; double **VDataBase = NULL;
@ -215,6 +247,7 @@ void ReportFileInfo(char *FName,
&NumPtsK, &NumPtsK,
&ZoneType, &ZoneType,
&UserRec, &UserRec,
&DatasetAuxData,
FALSE, FALSE,
(NodeMap_t ***)NULL, (NodeMap_t ***)NULL,
(double ***)NULL)) (double ***)NULL))
@ -272,7 +305,8 @@ void ReportFileInfo(char *FName,
&NumPtsJ, &NumPtsJ,
&NumPtsK, &NumPtsK,
&ZoneType, &ZoneType,
&UserRec); &UserRec,
&DatasetAuxData);
/* /*
* Reread the datafile. This time load in the header AND the raw data * Reread the datafile. This time load in the header AND the raw data
@ -292,6 +326,7 @@ void ReportFileInfo(char *FName,
&NumPtsK, &NumPtsK,
&ZoneType, &ZoneType,
&UserRec, &UserRec,
&DatasetAuxData,
AllocateRawDataSpaceLocally, AllocateRawDataSpaceLocally,
&NodeMap, &NodeMap,
&VDataBase)) &VDataBase))
@ -368,6 +403,9 @@ void ReportFileInfo(char *FName,
sprintf(InfoLine, "DataSetTitle: %s\n", DataSetTitle ? DataSetTitle : " "); sprintf(InfoLine, "DataSetTitle: %s\n", DataSetTitle ? DataSetTitle : " ");
SHOWINFO(InfoLine); SHOWINFO(InfoLine);
ShowDatasetAuxData(DatasetAuxData, InfoLine);
sprintf(InfoLine, "NumZones : %d\n", (int)NumZones); sprintf(InfoLine, "NumZones : %d\n", (int)NumZones);
SHOWINFO(InfoLine); SHOWINFO(InfoLine);
sprintf(InfoLine, "NumVars : %d\n", (int)NumVars); sprintf(InfoLine, "NumVars : %d\n", (int)NumVars);
@ -534,7 +572,8 @@ void ReportFileInfo(char *FName,
&NumPtsJ, &NumPtsJ,
&NumPtsK, &NumPtsK,
&ZoneType, &ZoneType,
&UserRec); &UserRec,
&DatasetAuxData);
} }
} }

View file

@ -2,10 +2,10 @@
** README ** ** 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. 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 in GLOBAL.h (to identify machine as 64 bit) and/or in
dataio4.c. Just look for CRAY in dataio4.c and you dataio4.c. Just look for CRAY in dataio4.c and you
will find most of the critical areas. Note that the 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() ReadTec()
The ReadTec() is included in the tecio library but is The ReadTec() function is included in the tecio library
not supported by Tecplot, Inc. ReadTec is used but is not supported by Tecplot, Inc. ReadTec is used
to read Tecplot binary data files (all versions at or to read Tecplot binary data files (all versions at or
older than the Tecplot version providing the tecio older than the Tecplot version providing the tecio
library). See tecsrc/DATAUTIL.h for more information. 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 to read just the header from a file as well as loading all
field data from a file./* 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/
*
*/

View file

@ -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 * ALLOC_ITEM and ALLOC_ARRAY that expect a return value of
* NULL on failure instead of the exception. 2008-05-08 CAM * 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 <typename T> template <typename T>
inline T *nonExceptionNew(size_t numItems, inline T *nonExceptionNew(size_t numItems,
const char* fileName, const char* fileName,
@ -88,7 +65,7 @@ inline T *nonExceptionNew(size_t numItems,
#endif #endif
result = new(fileName, lineNumber) T[numItems]; result = new(fileName, lineNumber) T[numItems];
#ifdef USING_DEBUG_NEW #ifdef USING_DEBUG_NEW
#define new DEBUG_NEW //#define new DEBUG_NEW
#undef USING_DEBUG_NEW #undef USING_DEBUG_NEW
#endif #endif
#else #else
@ -172,7 +149,7 @@ inline void nonExceptionDelete(T* &ptr)
* NOTE: the pointer is set to 0xFFFF after the free for asserted * NOTE: the pointer is set to 0xFFFF after the free for asserted
* builds in the hopes of catching invalid pointer usage * builds in the hopes of catching invalid pointer usage
*/ */
ptr = (T*)(void*)0xFFFF; ptr = static_cast<T*>(reinterpret_cast<void*>(0xFFFF));
#endif #endif
} }
#define FREE_ARRAY(ptr,str) nonExceptionDelete((ptr)) #define FREE_ARRAY(ptr,str) nonExceptionDelete((ptr))

View file

@ -1,31 +1,10 @@
/* #include "stdafx.h"
* NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM #include "MASTER.h"
*
* 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 +21,10 @@
# define EXTERN extern # define EXTERN extern
#endif #endif
#if !defined TECPLOTKERNEL
typedef struct _ArrayList_s* ArrayList_pa;
#endif
typedef enum typedef enum
{ {
ArrayListType_UnsignedChar, ArrayListType_UnsignedChar,
@ -121,16 +104,9 @@ typedef union
void (*FunctionPtr)(void); void (*FunctionPtr)(void);
} ArrayListItem_u; } ArrayListItem_u;
/** #if defined TECPLOTKERNEL
* NULL array list item for added convenience of inserting a NULL item without /* CORE SOURCE CODE REMOVED */
* having to declare and assign one. Can be used as follows: #endif
*
* IsOk = ArrayListInsertItem(SomeArrayList, SomeIndex, ArrayListNumItem);
*
* NOTE: This value must be set to zero before Tecplot uses array lists.
* memset(&ArrayListNullItem, 0, sizeof(ArrayListType_Any));
*/
EXTERN ArrayListItem_u ArrayListNullItem;
/** /**
* Visitor for traversing an array list. An iterator may not perform any * Visitor for traversing an array list. An iterator may not perform any
@ -155,7 +131,7 @@ typedef Boolean_t (*ArrayListItemVisitor_pf)(void *ItemRef,
REQUIRE(VALID_REF(*TypeRef) || *TypeRef == NULL); REQUIRE(VALID_REF(*TypeRef) || *TypeRef == NULL);
Boolean_t DoContinue = TRUE; Boolean_t DoContinue = TRUE;
<type> *TypeRef = (<type> *)ItemRef; <type>* TypeRef = static_cast<<type>*>(ItemRef);
ENSURE(VALID_BOOLEAN(DoContinue)); ENSURE(VALID_BOOLEAN(DoContinue));
return DoContinue; return DoContinue;
@ -210,8 +186,8 @@ typedef Boolean_t (*ArrayListItemDuplicator_pf)(void *TargetItemRef,
REQUIRE(VALID_REF(*SourceTypeRef) || *SourceTypeRef == NULL); REQUIRE(VALID_REF(*SourceTypeRef) || *SourceTypeRef == NULL);
Boolean_t IsOk = TRUE; Boolean_t IsOk = TRUE;
<type> *TargetTypeRef = (<type> *)TargetItemRef; <type>* TargetTypeRef = static_cast<<type>*>(TargetItemRef);
<type> *SourceTypeRef = (<type> *)SourceItemRef; <type>* SourceTypeRef = static_cast<<type>*>(SourceItemRef);
ENSURE(VALID_BOOLEAN(IsOk)); ENSURE(VALID_BOOLEAN(IsOk));
return IsOk; return IsOk;
@ -297,23 +273,24 @@ EXTERN Boolean_t ArrayListEnlargeCapacity(ArrayList_pa ArrayList,
LgIndex_t RequestedCapacity); LgIndex_t RequestedCapacity);
EXTERN ArrayList_pa ArrayListAlloc(LgIndex_t EstimatedCapacity, EXTERN ArrayList_pa ArrayListAlloc(LgIndex_t EstimatedCapacity,
ArrayListType_e Type, ArrayListType_e Type,
ArrayListCapacityRequestAdjuster_pf CapacityRequestAdjuster, ArrayListCapacityRequestAdjuster_pf CapacityRequestAdjuster = 0,
ArbParam_t CapacityRequestAdjusterClientData); ArbParam_t CapacityRequestAdjusterClientData = 0);
EXTERN void ArrayListDealloc(ArrayList_pa* ArrayList, EXTERN void ArrayListDealloc(ArrayList_pa* ArrayList,
ArrayListItemDestructor_pf ItemDestructor, ArrayListItemDestructor_pf ItemDestructor = 0,
ArbParam_t ClientData); ArbParam_t ClientData = 0);
EXTERN void ArrayListClear(ArrayList_pa ArrayList);
EXTERN void ArrayListDeleteAllItems(ArrayList_pa ArrayList, EXTERN void ArrayListDeleteAllItems(ArrayList_pa ArrayList,
ArrayListItemDestructor_pf ItemDestructor, ArrayListItemDestructor_pf ItemDestructor = 0,
ArbParam_t ClientData); ArbParam_t ClientData = 0);
EXTERN void ArrayListDeleteItems(ArrayList_pa ArrayList, EXTERN void ArrayListDeleteItems(ArrayList_pa ArrayList,
LgIndex_t ItemOffset, LgIndex_t ItemOffset,
LgIndex_t Count, LgIndex_t Count,
ArrayListItemDestructor_pf ItemDestructor, ArrayListItemDestructor_pf ItemDestructor = 0,
ArbParam_t ClientData); ArbParam_t ClientData = 0);
EXTERN void ArrayListDeleteItem(ArrayList_pa ArrayList, EXTERN void ArrayListDeleteItem(ArrayList_pa ArrayList,
LgIndex_t ItemOffset, LgIndex_t ItemOffset,
ArrayListItemDestructor_pf ItemDestructor, ArrayListItemDestructor_pf ItemDestructor = 0,
ArbParam_t ClientData); ArbParam_t ClientData = 0);
EXTERN ArrayList_pa ArrayListRemoveItems(ArrayList_pa ArrayList, EXTERN ArrayList_pa ArrayListRemoveItems(ArrayList_pa ArrayList,
LgIndex_t ItemOffset, LgIndex_t ItemOffset,
LgIndex_t Count); LgIndex_t Count);
@ -338,35 +315,32 @@ EXTERN ArrayListItem_u ArrayListGetItem(ArrayList_pa ArrayList,
EXTERN Boolean_t ArrayListSetItem(ArrayList_pa ArrayList, EXTERN Boolean_t ArrayListSetItem(ArrayList_pa ArrayList,
LgIndex_t ItemOffset, LgIndex_t ItemOffset,
ArrayListItem_u Item, ArrayListItem_u Item,
ArrayListItemDestructor_pf ItemDestructor, ArrayListItemDestructor_pf ItemDestructor = 0,
ArbParam_t ClientData); ArbParam_t ClientData = 0);
EXTERN Boolean_t ArrayListAppendItem(ArrayList_pa ArrayList, EXTERN Boolean_t ArrayListAppendItem(ArrayList_pa ArrayList,
ArrayListItem_u Item); ArrayListItem_u Item);
EXTERN Boolean_t ArrayListAppend(ArrayList_pa Target, EXTERN Boolean_t ArrayListAppend(ArrayList_pa Target,
ArrayList_pa Source); ArrayList_pa Source);
EXTERN ArrayList_pa ArrayListCopy(ArrayList_pa ArrayList, EXTERN ArrayList_pa ArrayListCopy(ArrayList_pa ArrayList,
ArrayListItemDuplicator_pf ItemDuplicator, ArrayListItemDuplicator_pf ItemDuplicator = 0,
ArbParam_t ClientData); ArbParam_t ClientData = 0);
EXTERN void* ArrayListToArray(ArrayList_pa ArrayList, EXTERN void* ArrayListToArray(ArrayList_pa ArrayList,
ArrayListItemDuplicator_pf ItemDuplicator, ArrayListItemDuplicator_pf ItemDuplicator,
ArbParam_t ClientData); ArbParam_t ClientData);
EXTERN ArrayList_pa ArrayListFromArray(void* Source, EXTERN ArrayList_pa ArrayListFromArray(void* Source,
LgIndex_t Count, LgIndex_t Count,
ArrayListType_e Type, ArrayListType_e Type,
ArrayListItemDuplicator_pf ItemDuplicator, ArrayListItemDuplicator_pf ItemDuplicator = 0,
ArbParam_t ClientData); ArbParam_t ClientData = 0);
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif #endif
EXTERN void ArrayListQSort(ArrayList_pa ArrayList,
ArrayListItemComparator_pf Comparator,
ArbParam_t ClientData);
EXTERN Boolean_t ArrayListBSearch(ArrayList_pa ArrayList, EXTERN Boolean_t ArrayListBSearch(ArrayList_pa ArrayList,
ArrayListItem_u Item, ArrayListItem_u Item,
ArrayListItemComparator_pf Comparator, ArrayListItemComparator_pf Comparator,
ArbParam_t ClientData, ArbParam_t ClientData,
LgIndex_t *ItemIndex); LgIndex_t* ItemIndex = 0);
#if defined USE_MACROS_FOR_FUNCTIONS #if defined USE_MACROS_FOR_FUNCTIONS
/** /**
@ -452,53 +426,53 @@ EXTERN Boolean_t ArrayListBSearch(ArrayList_pa ArrayList,
# define ArrayListGetItemInternalRef ArrayListGetItemInternalRef_FUNC # define ArrayListGetItemInternalRef ArrayListGetItemInternalRef_FUNC
# define ArrayListGetCount ArrayListGetCount_FUNC # define ArrayListGetCount ArrayListGetCount_FUNC
# define ArrayListGetUnsignedChar(ArrayList, ItemOffset) (*((unsigned char *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetUnsignedChar(ArrayList, ItemOffset) (*(static_cast<unsigned char*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetUnsignedShort(ArrayList, ItemOffset) (*((unsigned short *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetUnsignedShort(ArrayList, ItemOffset) (*(static_cast<unsigned short*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetUnsignedInt(ArrayList, ItemOffset) (*((unsigned int *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetUnsignedInt(ArrayList, ItemOffset) (*(static_cast<unsigned int*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetUnsignedLong(ArrayList, ItemOffset) (*((unsigned long *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetUnsignedLong(ArrayList, ItemOffset) (*(static_cast<unsigned long*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetInt64(ArrayList, ItemOffset) (*((Int64_t *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetInt64(ArrayList, ItemOffset) (*(static_cast<Int64_t*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetChar(ArrayList, ItemOffset) (*((char *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetChar(ArrayList, ItemOffset) (*(static_cast<char*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetShort(ArrayList, ItemOffset) (*((short *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetShort(ArrayList, ItemOffset) (*(static_cast<short*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetInt(ArrayList, ItemOffset) (*((int *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetInt(ArrayList, ItemOffset) (*(static_cast<int*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetLong(ArrayList, ItemOffset) (*((long *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetLong(ArrayList, ItemOffset) (*(static_cast<long*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetFloat(ArrayList, ItemOffset) (*((float *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetFloat(ArrayList, ItemOffset) (*(static_cast<float*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetDouble(ArrayList, ItemOffset) (*((double *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetDouble(ArrayList, ItemOffset) (*(static_cast<double*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetLgIndex(ArrayList, ItemOffset) (*((LgIndex_t *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetLgIndex(ArrayList, ItemOffset) (*(static_cast<LgIndex_t*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetEntIndex(ArrayList, ItemOffset) (*((EntIndex_t *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetEntIndex(ArrayList, ItemOffset) (*(static_cast<EntIndex_t*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetSmInteger(ArrayList, ItemOffset) (*((SmInteger_t *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetSmInteger(ArrayList, ItemOffset) (*(static_cast<SmInteger_t*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetBoolean(ArrayList, ItemOffset) (*((Boolean_t *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetBoolean(ArrayList, ItemOffset) (*(static_cast<Boolean_t*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetArbParam(ArrayList, ItemOffset) (*((ArbParam_t *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetArbParam(ArrayList, ItemOffset) (*(static_cast<ArbParam_t*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetUnsignedCharPtr(ArrayList, ItemOffset) (*((unsigned char * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetUnsignedCharPtr(ArrayList, ItemOffset) (*(static_cast<unsigned char**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetUnsignedShortPtr(ArrayList, ItemOffset) (*((unsigned short * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetUnsignedShortPtr(ArrayList, ItemOffset) (*(static_cast<unsigned short**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetUnsignedIntPtr(ArrayList, ItemOffset) (*((unsigned int * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetUnsignedIntPtr(ArrayList, ItemOffset) (*(static_cast<unsigned int**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetUnsignedLongPtr(ArrayList, ItemOffset) (*((unsigned long * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetUnsignedLongPtr(ArrayList, ItemOffset) (*(static_cast<unsigned long**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetInt64Ptr(ArrayList, ItemOffset) (*((Int64_t * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetInt64Ptr(ArrayList, ItemOffset) (*(static_cast<Int64_t**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetCharPtr(ArrayList, ItemOffset) (*((char * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetCharPtr(ArrayList, ItemOffset) (*(static_cast<char**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetShortPtr(ArrayList, ItemOffset) (*((short * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetShortPtr(ArrayList, ItemOffset) (*(static_cast<short**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetIntPtr(ArrayList, ItemOffset) (*((int * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetIntPtr(ArrayList, ItemOffset) (*(static_cast<int**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetLongPtr(ArrayList, ItemOffset) (*((long * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetLongPtr(ArrayList, ItemOffset) (*(static_cast<long**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetFloatPtr(ArrayList, ItemOffset) (*((float * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetFloatPtr(ArrayList, ItemOffset) (*(static_cast<float**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetDoublePtr(ArrayList, ItemOffset) (*((double * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetDoublePtr(ArrayList, ItemOffset) (*(static_cast<double**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetLgIndexPtr(ArrayList, ItemOffset) (*((LgIndex_t * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetLgIndexPtr(ArrayList, ItemOffset) (*(static_cast<LgIndex_t**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetEntIndexPtr(ArrayList, ItemOffset) (*((EntIndex_t * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetEntIndexPtr(ArrayList, ItemOffset) (*(static_cast<EntIndex_t**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetSmIntegerPtr(ArrayList, ItemOffset) (*((SmInteger_t * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetSmIntegerPtr(ArrayList, ItemOffset) (*(static_cast<SmInteger_t**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetBooleanPtr(ArrayList, ItemOffset) (*((Boolean_t * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetBooleanPtr(ArrayList, ItemOffset) (*(static_cast<Boolean_t**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetArbParamPtr(ArrayList, ItemOffset) (*((ArbParam_t * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetArbParamPtr(ArrayList, ItemOffset) (*(static_cast<ArbParam_t**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetVoidPtr(ArrayList, ItemOffset) (*((void * *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetVoidPtr(ArrayList, ItemOffset) (*(static_cast<void**>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
# define ArrayListGetFunctionPtr(ArrayList, ItemOffset) (*(((**)(void) *)ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset))) # define ArrayListGetFunctionPtr(ArrayList, ItemOffset) (*(static_cast<**(void)*>(const_cast<void*>(ArrayListGetItemInternalRef_FUNC(ArrayList, ItemOffset)))))
#endif #endif
#if !defined USE_MACROS_FOR_FUNCTIONS #if !defined USE_MACROS_FOR_FUNCTIONS
EXTERN const void *ArrayListGetInternalRef_FUNC(ArrayList_pa ArrayList); EXTERN void const* ArrayListGetInternalRef_FUNC(ArrayList_pa ArrayList);
EXTERN const void *ArrayListGetItemInternalRef_FUNC(ArrayList_pa ArrayList, EXTERN void const* ArrayListGetItemInternalRef_FUNC(ArrayList_pa ArrayList,
LgIndex_t ItemOffset); LgIndex_t ItemOffset);
EXTERN LgIndex_t ArrayListGetCount_FUNC(ArrayList_pa ArrayList); EXTERN LgIndex_t ArrayListGetCount_FUNC(ArrayList_pa ArrayList);
#endif #endif
#define ArrayListGetInternalRef_MACRO(ArrayList) ((const void *)((ArrayList)->Array)) #define ArrayListGetInternalRef_MACRO(ArrayList) static_cast<void const*>((ArrayList)->Array)
#define ArrayListGetItemInternalRef_MACRO(ArrayList, ItemOffset) ((const void *)&((ArrayList)->Array[(ItemOffset)*(ArrayList)->ItemSize])) #define ArrayListGetItemInternalRef_MACRO(ArrayList, ItemOffset) static_cast<void const*>(&((ArrayList)->Array[(ItemOffset)*(ArrayList)->ItemSize]))
#define ArrayListGetCount_MACRO(ArrayList) ((ArrayList)->Count) #define ArrayListGetCount_MACRO(ArrayList) ((ArrayList)->Count)
#define ArrayListGetTypedArrayRef(ArrayList, NativeType) ((NativeType *)((ArrayList)->Array)) #define ArrayListGetTypedArrayRef(ArrayList, NativeType) reinterpret_cast<NativeType*>((ArrayList)->Array)
#define ArrayListGetTypedItem(ArrayList, ItemOffset, NativeType) (ArrayListGetTypedArrayRef(ArrayList,NativeType)[ItemOffset]) #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) \ #define ArrayListSetTypedItem(ArrayList, ItemOffset, Item, NativeType) \
((ArrayListOffsetWithinCapacity((ArrayList), (ItemOffset)) || \ ((ArrayListOffsetWithinCapacity((ArrayList), (ItemOffset)) || \
ArrayListEnlargeCapacity((ArrayList), (ItemOffset)+1)) \ ArrayListEnlargeCapacity((ArrayList), (ItemOffset)+1)) \
? (((((NativeType *)((ArrayList)->Array))[(ItemOffset)]) = (Item)), \ ? ((void)((ArrayListGetTypedArrayRef((ArrayList),NativeType)[(ItemOffset)]) = (Item)), \
(((ItemOffset)+1 > (ArrayList)->Count) \ (((ItemOffset)+1 > (ArrayList)->Count) \
? (((ArrayList)->Count = (ItemOffset)+1), TRUE) \ ? (((ArrayList)->Count = (ItemOffset)+1), TRUE) \
: (TRUE))) \ : (TRUE))) \
: (FALSE)) : (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 * 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 * 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. * 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 ArrayListSetUnsignedChar(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),unsigned char)
#define ArrayListSetUnsignedShort(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned short) #define ArrayListSetUnsignedShort(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),unsigned short)
#define ArrayListSetUnsignedInt(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned int) #define ArrayListSetUnsignedInt(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),unsigned int)
#define ArrayListSetUnsignedLong(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned long) #define ArrayListSetUnsignedLong(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),unsigned long)
#define ArrayListSetInt64(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, Int64_t) #define ArrayListSetInt64(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),Int64_t)
#define ArrayListSetChar(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, char) #define ArrayListSetChar(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),char)
#define ArrayListSetShort(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, short) #define ArrayListSetShort(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),short)
#define ArrayListSetInt(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, int) #define ArrayListSetInt(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),int)
#define ArrayListSetLong(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, long) #define ArrayListSetLong(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),long)
#define ArrayListSetFloat(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, float) #define ArrayListSetFloat(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),float)
#define ArrayListSetDouble(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, double) #define ArrayListSetDouble(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),double)
#define ArrayListSetLgIndex(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, LgIndex_t) #define ArrayListSetLgIndex(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),LgIndex_t)
#define ArrayListSetEntIndex(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, EntIndex_t) #define ArrayListSetEntIndex(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),EntIndex_t)
#define ArrayListSetSmInteger(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, SmInteger_t) #define ArrayListSetSmInteger(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),SmInteger_t)
#define ArrayListSetBoolean(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, Boolean_t) #define ArrayListSetBoolean(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),Boolean_t)
#define ArrayListSetArbParam(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, ArbParam_t) #define ArrayListSetArbParam(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),ArbParam_t)
#define ArrayListSetUnsignedCharPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned char *) #define ArrayListSetUnsignedCharPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),unsigned char*)
#define ArrayListSetUnsignedShortPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned short *) #define ArrayListSetUnsignedShortPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),unsigned short*)
#define ArrayListSetUnsignedIntPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned int *) #define ArrayListSetUnsignedIntPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),unsigned int*)
#define ArrayListSetUnsignedLongPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, unsigned long *) #define ArrayListSetUnsignedLongPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),unsigned long*)
#define ArrayListSetInt64Ptr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, Int64_t *) #define ArrayListSetInt64Ptr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),Int64_t*)
#define ArrayListSetCharPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, char *) #define ArrayListSetCharPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),char*)
#define ArrayListSetShortPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, short *) #define ArrayListSetShortPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),short*)
#define ArrayListSetIntPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, int *) #define ArrayListSetIntPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),int*)
#define ArrayListSetLongPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, long *) #define ArrayListSetLongPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),long*)
#define ArrayListSetFloatPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, float *) #define ArrayListSetFloatPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),float*)
#define ArrayListSetDoublePtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, double *) #define ArrayListSetDoublePtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),double*)
#define ArrayListSetLgIndexPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, LgIndex_t *) #define ArrayListSetLgIndexPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),LgIndex_t*)
#define ArrayListSetEntIndexPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, EntIndex_t *) #define ArrayListSetEntIndexPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),EntIndex_t*)
#define ArrayListSetSmIntegerPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, SmInteger_t *) #define ArrayListSetSmIntegerPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),SmInteger_t*)
#define ArrayListSetBooleanPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, Boolean_t *) #define ArrayListSetBooleanPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),Boolean_t*)
#define ArrayListSetArbParamPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, ArbParam_t *) #define ArrayListSetArbParamPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),ArbParam_t*)
#define ArrayListSetVoidPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem(ArrayList, ItemOffset, Item, void *) #define ArrayListSetVoidPtr(ArrayList, ItemOffset, Item) ArrayListSetTypedItem((ArrayList),(ItemOffset),(Item),void*)
#define ArrayListSetFunctionPtr(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 ArrayListAppendUnsignedChar(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned char)
#define ArrayListAppendUnsignedShort(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned short) #define ArrayListAppendUnsignedShort(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned short)
#define ArrayListAppendUnsignedInt(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned int) #define ArrayListAppendUnsignedInt(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned int)
#define ArrayListAppendUnsignedLong(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned long) #define ArrayListAppendUnsignedLong(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned long)
#define ArrayListAppendInt64(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, Int64_t) #define ArrayListAppendInt64(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),Int64_t)
#define ArrayListAppendChar(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, char) #define ArrayListAppendChar(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),char)
#define ArrayListAppendShort(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, short) #define ArrayListAppendShort(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),short)
#define ArrayListAppendInt(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, int) #define ArrayListAppendInt(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),int)
#define ArrayListAppendLong(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, long) #define ArrayListAppendLong(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),long)
#define ArrayListAppendFloat(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, float) #define ArrayListAppendFloat(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),float)
#define ArrayListAppendDouble(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, double) #define ArrayListAppendDouble(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),double)
#define ArrayListAppendLgIndex(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, LgIndex_t) #define ArrayListAppendLgIndex(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),LgIndex_t)
#define ArrayListAppendEntIndex(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, EntIndex_t) #define ArrayListAppendEntIndex(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),EntIndex_t)
#define ArrayListAppendSmInteger(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, SmInteger_t) #define ArrayListAppendSmInteger(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),SmInteger_t)
#define ArrayListAppendBoolean(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, Boolean_t) #define ArrayListAppendBoolean(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),Boolean_t)
#define ArrayListAppendArbParam(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, ArbParam_t) #define ArrayListAppendArbParam(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),ArbParam_t)
#define ArrayListAppendUnsignedCharPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned char *) #define ArrayListAppendUnsignedCharPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned char*)
#define ArrayListAppendUnsignedShortPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned short *) #define ArrayListAppendUnsignedShortPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned short*)
#define ArrayListAppendUnsignedIntPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned int *) #define ArrayListAppendUnsignedIntPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned int*)
#define ArrayListAppendUnsignedLongPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, unsigned long *) #define ArrayListAppendUnsignedLongPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),unsigned long*)
#define ArrayListAppendInt64Ptr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, Int64_t *) #define ArrayListAppendInt64Ptr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),Int64_t*)
#define ArrayListAppendCharPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, char *) #define ArrayListAppendCharPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),char*)
#define ArrayListAppendShortPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, short *) #define ArrayListAppendShortPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),short*)
#define ArrayListAppendIntPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, int *) #define ArrayListAppendIntPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),int*)
#define ArrayListAppendLongPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, long *) #define ArrayListAppendLongPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),long*)
#define ArrayListAppendFloatPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, float *) #define ArrayListAppendFloatPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),float*)
#define ArrayListAppendDoublePtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, double *) #define ArrayListAppendDoublePtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),double*)
#define ArrayListAppendLgIndexPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, LgIndex_t *) #define ArrayListAppendLgIndexPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),LgIndex_t*)
#define ArrayListAppendEntIndexPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, EntIndex_t *) #define ArrayListAppendEntIndexPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),EntIndex_t*)
#define ArrayListAppendSmIntegerPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, SmInteger_t *) #define ArrayListAppendSmIntegerPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),SmInteger_t*)
#define ArrayListAppendBooleanPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, Boolean_t *) #define ArrayListAppendBooleanPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),Boolean_t*)
#define ArrayListAppendArbParamPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, ArbParam_t *) #define ArrayListAppendArbParamPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),ArbParam_t*)
#define ArrayListAppendVoidPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, void *) #define ArrayListAppendVoidPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),void*)
#define ArrayListAppendFunctionPtr(ArrayList, Item) ArrayListSetTypedItem(ArrayList, (ArrayList)->Count, Item, (**)(void)) #define ArrayListAppendFunctionPtr(ArrayList, Item) ArrayListAppendTypedItem((ArrayList),(Item),(**)(void))
#endif /* ARRLIST_h */ #endif /* ARRLIST_h */

View file

@ -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 # define EXTERN extern
#endif #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, 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,7 +76,7 @@ EXTERN Boolean_t AuxDataGetItemIndex(AuxData_pa AuxData,
LgIndex_t *ItemIndex); LgIndex_t *ItemIndex);
/** /**
*/ */
EXTERN void AuxDataGetItemByIndex(AuxData_pa AuxData, LIBFUNCTION void LIBCALL AuxDataGetItemByIndex(AuxData_pa AuxData,
LgIndex_t Index, LgIndex_t Index,
const char **Name, const char **Name,
ArbParam_t *Value, ArbParam_t *Value,
@ -104,7 +102,7 @@ EXTERN Boolean_t AuxDataGetBooleanItemByName(AuxData_pa AuxData,
/** /**
*/ */
EXTERN Boolean_t AuxDataSetItem(AuxData_pa AuxData, EXTERN Boolean_t AuxDataSetItem(AuxData_pa AuxData,
const char *Name, char const* Name,
ArbParam_t Value, ArbParam_t Value,
AuxDataType_e Type, AuxDataType_e Type,
Boolean_t Retain); Boolean_t Retain);

View file

@ -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 <typename CHAR_TYPE>
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<int>(ch));
#else
REQUIRE(std::has_facet<std::ctype<wchar_t> >(loc));
return std::use_facet<std::ctype<wchar_t> >(loc).is(std::ctype_base::space, static_cast<wchar_t>(ch));
#endif
}
/**
* Same as std::isprint() with the classic default C locale for portable
* comparisons.
*/
template <typename CHAR_TYPE>
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<int>(ch));
#else
REQUIRE(std::has_facet<std::ctype<wchar_t> >(loc));
return std::use_facet<std::ctype<wchar_t> >(loc).is(std::ctype_base::print, static_cast<wchar_t>(ch));
#endif
}
/**
* Same as std::iscntrl() with the classic default C locale for portable
* comparisons.
*/
template <typename CHAR_TYPE>
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<int>(ch));
#else
REQUIRE(std::has_facet<std::ctype<wchar_t> >(loc));
return std::use_facet<std::ctype<wchar_t> >(loc).is(std::ctype_base::cntrl, static_cast<wchar_t>(ch));
#endif
}
/**
* Same as std::isupper() with the classic default C locale for portable
* comparisons.
*/
template <typename CHAR_TYPE>
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<int>(ch));
#else
REQUIRE(std::has_facet<std::ctype<wchar_t> >(loc));
return std::use_facet<std::ctype<wchar_t> >(loc).is(std::ctype_base::upper, static_cast<wchar_t>(ch));
#endif
}
/**
* Same as std::islower() with the classic default C locale for portable
* comparisons.
*/
template <typename CHAR_TYPE>
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<int>(ch));
#else
REQUIRE(std::has_facet<std::ctype<wchar_t> >(loc));
return std::use_facet<std::ctype<wchar_t> >(loc).is(std::ctype_base::lower, static_cast<wchar_t>(ch));
#endif
}
/**
* Same as std::isalpha() with the classic default C locale for portable
* comparisons.
*/
template <typename CHAR_TYPE>
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<int>(ch));
#else
REQUIRE(std::has_facet<std::ctype<wchar_t> >(loc));
return std::use_facet<std::ctype<wchar_t> >(loc).is(std::ctype_base::alpha, static_cast<wchar_t>(ch));
#endif
}
/**
* Same as std::isdigit() with the classic default C locale for portable
* comparisons.
*/
template <typename CHAR_TYPE>
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<int>(ch));
#else
REQUIRE(std::has_facet<std::ctype<wchar_t> >(loc));
return std::use_facet<std::ctype<wchar_t> >(loc).is(std::ctype_base::digit, static_cast<wchar_t>(ch));
#endif
}
/**
* Same as std::ispunct() with the classic default C locale for portable
* comparisons.
*/
template <typename CHAR_TYPE>
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<int>(ch));
#else
REQUIRE(std::has_facet<std::ctype<wchar_t> >(loc));
return std::use_facet<std::ctype<wchar_t> >(loc).is(std::ctype_base::punct, static_cast<wchar_t>(ch));
#endif
}
/**
* Same as std::isxdigit() with the classic default C locale for portable
* comparisons.
*/
template <typename CHAR_TYPE>
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<int>(ch));
#else
REQUIRE(std::has_facet<std::ctype<wchar_t> >(loc));
return std::use_facet<std::ctype<wchar_t> >(loc).is(std::ctype_base::xdigit, static_cast<wchar_t>(ch));
#endif
}
/**
* Same as std::isalnum() with the classic default C locale for portable
* comparisons.
*/
template <typename CHAR_TYPE>
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<int>(ch));
#else
REQUIRE(std::has_facet<std::ctype<wchar_t> >(loc));
return std::use_facet<std::ctype<wchar_t> >(loc).is(std::ctype_base::alnum, static_cast<wchar_t>(ch));
#endif
}
/**
* Same as std::isgraph() with the classic default C locale for portable
* comparisons.
*/
template <typename CHAR_TYPE>
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<int>(ch));
#else
REQUIRE(std::has_facet<std::ctype<wchar_t> >(loc));
return std::use_facet<std::ctype<wchar_t> >(loc).is(std::ctype_base::graph, static_cast<wchar_t>(ch));
#endif
}
/**
* Same as std::toupper() with the classic default C locale for portable
* comparisons.
*/
template <typename CHAR_TYPE>
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<CHAR_TYPE>(::toupper(static_cast<int>(ch)));
#else
REQUIRE(std::has_facet<std::ctype<wchar_t> >(loc));
return static_cast<CHAR_TYPE>(
std::use_facet<std::ctype<wchar_t> >(loc).toupper(static_cast<wchar_t>(ch)));
#endif
}
/**
* Same as std::tolower() with the classic default C locale for portable
* comparisons.
*/
template <typename CHAR_TYPE>
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<CHAR_TYPE>(::tolower(static_cast<int>(ch)));
#else
REQUIRE(std::has_facet<std::ctype<wchar_t> >(loc));
return static_cast<CHAR_TYPE>(
std::use_facet<std::ctype<wchar_t> >(loc).tolower(static_cast<wchar_t>(ch)));
#endif
}
}
#endif

View file

@ -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 #if defined EXTERN
#undef EXTERN #undef EXTERN
#endif #endif
@ -47,6 +24,7 @@ EXTERN Boolean_t ReadDataFileHeader(FileStream_s *FileStream,
StringList_pa **CustomLabelBase, StringList_pa **CustomLabelBase,
StringList_pa *UserRec, StringList_pa *UserRec,
AuxData_pa *DataSetAuxData, AuxData_pa *DataSetAuxData,
ArbParam_t AuxDataOwner,
Set_pa **IsVarCellCentered, Set_pa **IsVarCellCentered,
Boolean_t *HasText, Boolean_t *HasText,
Boolean_t *HasGeoms, Boolean_t *HasGeoms,

View file

@ -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 #ifndef DATAIO4_H
#define 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, ZoneSpec_s *ZoneSpec,
Set_pa IsVarCellCentered, Set_pa IsVarCellCentered,
EntIndex_t NumVars, EntIndex_t NumVars,
ArbParam_t AuxDataOwner,
Boolean_t *IsRawFNAvailable, Boolean_t *IsRawFNAvailable,
LgIndex_t *FNNumBndryConns); LgIndex_t *FNNumBndryConns);
EXTERN Boolean_t ReadInCustomLabels(FileStream_s *FileStream, EXTERN Boolean_t ReadInCustomLabels(FileStream_s *FileStream,

View file

@ -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__ #ifndef DATASET_h__
#define 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
#endif #endif
#define GetZoneSpec(ZoneSpecList,Zone) ((ZoneSpec_s *)ArrayListGetVoidPtr(ZoneSpecList,Zone)) #define GetZoneSpec(ZoneSpecList,Zone) (static_cast<ZoneSpec_s *>(ArrayListGetVoidPtr(ZoneSpecList,Zone)))
#define GetZoneAuxData(DataSet, Zone) (GetZoneSpec((DataSet)->ZoneSpecList, (Zone))->AuxData) #define GetZoneAuxData(DataSet, Zone) (GetZoneSpec((DataSet)->ZoneSpecList, (Zone))->AuxData)
#define GetVarSpec(VarSpecList,Var) ((VarSpec_s *)ArrayListGetVoidPtr(VarSpecList,Var)) #define GetVarSpec(VarSpecList,Var) (static_cast<VarSpec_s *>(ArrayListGetVoidPtr(VarSpecList,Var)))
#define GetVarAuxData(DataSet, Var) (GetVarSpec((DataSet)->VarSpecList, (Var))->AuxData) #define GetVarAuxData(DataSet, Var) (GetVarSpec((DataSet)->VarSpecList, (Var))->AuxData)
#define GetStrandInfo(StrandInfoList, StrandID) ((StrandInfo_s *)ArrayListGetVoidPtr(StrandInfoList,StrandID)) #define GetStrandInfo(StrandInfoList, StrandID) (static_cast<StrandInfo_s *>(ArrayListGetVoidPtr(StrandInfoList,StrandID)))
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL

View file

@ -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 #if defined EXTERN
#undef EXTERN #undef EXTERN
#endif #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 tecplot
{ {
namespace io
{
class File; class File;
} }
}
EXTERN void OutOfMemoryMsg(void); EXTERN void OutOfMemoryMsg(void);
@ -74,8 +52,9 @@ struct _FieldData_a
/* PRIVATE */ /* PRIVATE */
FieldDataType_e Type; FieldDataType_e Type;
ValueLocation_e ValueLocation; ValueLocation_e ValueLocation;
LgIndex_t RefCount; #if defined TECPLOTKERNEL /* TecIO doesn't require these features yet. */
LgIndex_t VarShareRefCount; /* CORE SOURCE CODE REMOVED */
#endif
LgIndex_t NumValues; 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 */ /* CORE SOURCE CODE REMOVED */
@ -119,8 +98,8 @@ struct _FieldData_a
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#else /* ...for TecIO only */ #else /* ...for TecIO only */
#define GetFieldDataGetFunction_MACRO(FieldData) ((FieldValueGetFunction_pf)(FieldData)->GetValueCallback[0]) #define GetFieldDataGetFunction_MACRO(FieldData) (reinterpret_cast<FieldValueGetFunction_pf>((FieldData)->GetValueCallback[0]))
#define GetFieldDataSetFunction_MACRO(FieldData) ((FieldValueSetFunction_pf)(FieldData)->SetValueCallback[0]) #define GetFieldDataSetFunction_MACRO(FieldData) (reinterpret_cast<FieldValueSetFunction_pf>((FieldData)->SetValueCallback[0]))
#endif #endif
#define GetFieldDataNumValues_MACRO(FieldData) ((FieldData)->NumValues) #define GetFieldDataNumValues_MACRO(FieldData) ((FieldData)->NumValues)
#define GetFieldDataValueLocation_MACRO(FieldData) ((FieldData)->ValueLocation) #define GetFieldDataValueLocation_MACRO(FieldData) ((FieldData)->ValueLocation)
@ -202,21 +181,21 @@ typedef UInt64_t Int64Rev_t;
#define GetFieldDataVoidPtr GetFieldDataVoidPtr_FUNC /*danger:see above*/ #define GetFieldDataVoidPtr GetFieldDataVoidPtr_FUNC /*danger:see above*/
#endif #endif
#define GetFieldDataFloatPtr_MACRO(FieldData) ((float *)((FieldData)->Data)) #define GetFieldDataFloatPtr_MACRO(FieldData) (static_cast<float *>((FieldData)->Data))
#define GetFieldDataFloatRevPtr_MACRO(FieldData) ((FloatRev_t *)((FieldData)->Data)) #define GetFieldDataFloatRevPtr_MACRO(FieldData) (static_cast<FloatRev_t *>((FieldData)->Data))
#define GetFieldDataDoublePtr_MACRO(FieldData) ((double *)((FieldData)->Data)) #define GetFieldDataDoublePtr_MACRO(FieldData) (static_cast<double *>((FieldData)->Data))
#define GetFieldDataDoubleRevPtr_MACRO(FieldData) ((DoubleRev_t *)((FieldData)->Data)) #define GetFieldDataDoubleRevPtr_MACRO(FieldData) (static_cast<DoubleRev_t *>((FieldData)->Data))
#define GetFieldDataInt64Ptr_MACRO(FieldData) ((Int64_t *)((FieldData)->Data)) #define GetFieldDataInt64Ptr_MACRO(FieldData) (static_cast<Int64_t *>((FieldData)->Data))
#define GetFieldDataInt64RevPtr_MACRO(FieldData) ((Int64Rev_t *)((FieldData)->Data)) #define GetFieldDataInt64RevPtr_MACRO(FieldData) (static_cast<Int64Rev_t *>((FieldData)->Data))
#define GetFieldDataInt32Ptr_MACRO(FieldData) ((Int32_t *)((FieldData)->Data)) #define GetFieldDataInt32Ptr_MACRO(FieldData) (static_cast<Int32_t *>((FieldData)->Data))
#define GetFieldDataInt32RevPtr_MACRO(FieldData) ((Int32Rev_t *)((FieldData)->Data)) #define GetFieldDataInt32RevPtr_MACRO(FieldData) (static_cast<Int32Rev_t *>((FieldData)->Data))
#define GetFieldDataInt16Ptr_MACRO(FieldData) ((Int16_t *)((FieldData)->Data)) #define GetFieldDataInt16Ptr_MACRO(FieldData) (static_cast<Int16_t *>((FieldData)->Data))
#define GetFieldDataInt16RevPtr_MACRO(FieldData) ((Int16Rev_t *)((FieldData)->Data)) #define GetFieldDataInt16RevPtr_MACRO(FieldData) (static_cast<Int16Rev_t *>((FieldData)->Data))
#define GetFieldDataBytePtr_MACRO(FieldData) ((Byte_t *)((FieldData)->Data)) #define GetFieldDataBytePtr_MACRO(FieldData) (static_cast<Byte_t *>((FieldData)->Data))
#define GetFieldData2BytePtr_MACRO(FieldData) ((UInt16_t *)((FieldData)->Data)) #define GetFieldData2BytePtr_MACRO(FieldData) (static_cast<UInt16_t *>((FieldData)->Data))
#define GetFieldData4BytePtr_MACRO(FieldData) ((UInt32_t *)((FieldData)->Data)) #define GetFieldData4BytePtr_MACRO(FieldData) (static_cast<UInt32_t *>((FieldData)->Data))
#define GetFieldData8BytePtr_MACRO(FieldData) ((UInt64_t *)((FieldData)->Data)) #define GetFieldData8BytePtr_MACRO(FieldData) (static_cast<UInt64_t *>((FieldData)->Data))
#define GetFieldDataVoidPtr_MACRO(FieldData) ((void *)((FieldData)->Data)) /*danger:see above*/ #define GetFieldDataVoidPtr_MACRO(FieldData) (static_cast<void *>((FieldData)->Data)) /*danger:see above*/
#if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS #if !defined USE_MACROS_FOR_FIELD_DATA_FUNCTIONS
EXTERN float *GetFieldDataFloatPtr_FUNC(FieldData_pa fd); 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 * Copies values from "src" to "dst". "src" or "dst" may
* be differing types. Either or both may be V3D data pointers. * 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, EXTERN void CopyFieldDataRange(FieldData_pa dst,
LgIndex_t dst_start, LgIndex_t dst_start,
@ -317,6 +298,9 @@ EXTERN void CopyFieldValue(FieldData_pa dst,
FieldData_pa src, FieldData_pa src,
LgIndex_t srcindex); LgIndex_t srcindex);
#if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */
#endif
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */

View file

@ -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 */

View file

@ -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. * DATAUTIL.h : COPYRIGHT (C)1987-2002 Tecplot, Inc.
* ALL RIGHTS RESERVED * ALL RIGHTS RESERVED
@ -76,6 +53,10 @@ extern void InitInputSpecs(void);
* @param UserRec * @param UserRec
* Allocates space for and returns the user records. * 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 * @param RawDataspaceAllocated
* Only used if GetHeaderInfoOnly is FALSE. TRUE = calling program has alloced space for * 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. * 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, LgIndex_t **NumPtsK,
ZoneType_e **ZoneType, ZoneType_e **ZoneType,
StringList_pa *UserRec, StringList_pa *UserRec,
AuxData_pa *DatasetAuxData,
Boolean_t RawDataspaceAllocated, Boolean_t RawDataspaceAllocated,
NodeMap_t ***NodeMap, NodeMap_t ***NodeMap,
double ***VDataBase); double ***VDataBase);

View file

@ -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, LgIndex_t FOffset,
Boolean_t ConsiderValueBlanking, Boolean_t ConsiderValueBlanking,
Boolean_t ConsiderIJKBlanking, Boolean_t ConsiderIJKBlanking,
Boolean_t ConsiderDepthBlanking); Boolean_t ConsiderDepthBlanking,
Boolean_t ConsiderClipBlanking);
EXTERN EntIndex_t GetNodesPerElementFace(ZoneType_e ZoneType); EXTERN EntIndex_t GetNodesPerElementFace(ZoneType_e ZoneType);
@ -121,6 +99,20 @@ EXTERN EntIndex_t GetFacesPerElement(ZoneType_e ZoneType,
LgIndex_t JMax, LgIndex_t JMax,
LgIndex_t KMax); 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, EXTERN CollapsedStatus_e GetSurfaceCellCollapsedStatus(CZInfo_s const* CZInfo,
CZData_s const* CZData, CZData_s const* CZData,
tecplot::kernel::SubElemValueProducerInterface* SubElemValueProducer); tecplot::kernel::SubElemValueProducerInterface* SubElemValueProducer);

View file

@ -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. *******
******* ******** ******* ********
***************************************************************** *****************************************************************
***************************************************************** *****************************************************************

View file

@ -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. *******
******* ******** ******* ********
***************************************************************** *****************************************************************
***************************************************************** *****************************************************************

View file

@ -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. *******
******* ******** ******* ********
***************************************************************** *****************************************************************
***************************************************************** *****************************************************************

View file

@ -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*/ SurfaceTranslucencyInputSpec;
EXTERN InputSpec_s /*X*/ MaxDepthBufferSizeInputSpec; EXTERN InputSpec_s /*X*/ MaxDepthBufferSizeInputSpec;
EXTERN InputSpec_s /*X*/ MaxMultiSamplesInputSpec; EXTERN InputSpec_s /*X*/ MaxMultiSamplesInputSpec;
EXTERN InputSpec_s /*X*/ MaxAccumBufferSizeInputSpec;
EXTERN InputSpec_s /*X*/ MinBitsPerRGBPlaneInputSpec; EXTERN InputSpec_s /*X*/ MinBitsPerRGBPlaneInputSpec;
EXTERN InputSpec_s /*X*/ AnimationSpeedInputSpec; EXTERN InputSpec_s /*X*/ AnimationSpeedInputSpec;
EXTERN InputSpec_s /*X*/ AnimationNumStepsInputSpec; EXTERN InputSpec_s /*X*/ AnimationNumStepsInputSpec;

View file

@ -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. *******
******* ******** ******* ********
***************************************************************** *****************************************************************
*****************************************************************/ *****************************************************************/
@ -220,8 +197,8 @@
#include "stdafx.h" #include "stdafx.h"
#if defined MSWIN #if defined MSWIN && defined TECPLOTKERNEL
#include "W__BASE.h" /* CORE SOURCE CODE REMOVED */
#endif #endif
#include <string> #include <string>
@ -271,8 +248,8 @@
#if defined NO_ASSERTS #if defined NO_ASSERTS
#undef NO_ASSERTS #undef NO_ASSERTS
#endif #endif
#if defined NDEBUG #if !defined NDEBUG
#undef NDEBUG #define NDEBUG
#endif #endif
#else /* RELEASE */ #else /* RELEASE */
#if !defined NDEBUG #if !defined NDEBUG
@ -373,7 +350,7 @@
#define SYSV #define SYSV
#endif #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 #define UNIXX
#endif #endif
@ -505,6 +482,10 @@
/* OPENGL currently a must have */ /* OPENGL currently a must have */
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* 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 ENGINE
# if defined UNIXX # if defined UNIXX
# endif # endif
@ -524,11 +505,7 @@
# if XmVERSION == 1 && XmREVISION == 0 # if XmVERSION == 1 && XmREVISION == 0
# endif # endif
# else # else
# ifndef darwin
# include <X11/Intrinsic.h> # include <X11/Intrinsic.h>
# else
typedef void *Widget;
# endif
# endif # endif
#endif #endif
@ -658,13 +635,15 @@ typedef Widget GridWidget_t;
* also be a release build (NDEBUG) * also be a release build (NDEBUG)
*/ */
#if defined MSWIN && defined CHECKED_BUILD && !defined 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 #endif
#if defined NO_ASSERTS #if defined NO_ASSERTS
# if !defined USE_MACROS_FOR_FUNCTIONS
# define USE_MACROS_FOR_FUNCTIONS # define USE_MACROS_FOR_FUNCTIONS
# endif # endif
#endif
/* ENDREMOVEFROMADDON */ /* ENDREMOVEFROMADDON */
/* BEGINREMOVEFROMADDON */ /* BEGINREMOVEFROMADDON */
@ -683,6 +662,21 @@ typedef Widget GridWidget_t;
#define DISALLOW_OFFSCREEN_EXPORT_IN_BATCH #define DISALLOW_OFFSCREEN_EXPORT_IN_BATCH
#endif #endif
/* indentify the platforms capable of using FFMPEG for encoding video formats */
#if defined MSWIN || defined LINUX || defined DARWIN
#define HAVE_FFMPEG
#endif
/* ENDREMOVEFROMADDON */ /* 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_ */ #endif /* _MASTER_H_ */

View file

@ -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 #ifndef Q_MSG_H
#define 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, EXTERN Boolean_t WrapString(const char *OldString,
char **NewString); char **NewString);
EXTERN void Warning(tecplot::strutil::TranslatedString Format, EXTERN void Warning(tecplot::strutil::TranslatedString format,
...); /* zero or more arguments */ ...); /* zero or more arguments */
# if defined TECPLOTKERNEL # if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif #endif
EXTERN void ErrMsg(tecplot::strutil::TranslatedString Format, EXTERN void ErrMsg(tecplot::strutil::TranslatedString format,
...); /* zero or more arguments */ ...); /* zero or more arguments */
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */

View file

@ -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 // functions
Boolean_t IsValidUtf8LeadByte(Byte_t ch); EXTERN Boolean_t IsValidUtf8LeadByte(Byte_t ch);
Boolean_t IsValidUtf8ContinuingByte(Byte_t ch); EXTERN Boolean_t IsValidUtf8ContinuingByte(Byte_t ch);
Boolean_t IsValidUtf8Byte(Byte_t ch); EXTERN Boolean_t IsValidUtf8Byte(Byte_t ch);
Boolean_t IsValidUtf8String(const char *str); EXTERN Boolean_t IsPrintable8BitAsciiChar(wchar_t wChar);
Boolean_t ShouldConvertWideStringToUtf8String(const wchar_t *str);
void InitTranslatedStrings();
void CleanUpTranslatedStrings();
Boolean_t IsNullOrZeroLengthString(const char *S); EXTERN Boolean_t IsValidUtf8String(const char *str);
Boolean_t IsNullOrZeroLengthString(tecplot::strutil::TranslatedString TS); EXTERN Boolean_t ShouldConvertWideStringToUtf8String(const wchar_t *str);
EXTERN void InitTranslatedStrings();
EXTERN void CleanUpTranslatedStrings();
Boolean_t IsEmptyString(const char *S); EXTERN Boolean_t IsNullOrZeroLengthString(const char *S);
Boolean_t IsEmptyString(tecplot::strutil::TranslatedString S); EXTERN Boolean_t IsNullOrZeroLengthString(tecplot::strutil::TranslatedString TS);
Boolean_t IsEmptyString(const wchar_t* S);
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 #if defined MSWIN
std::string LookUpTranslation(std::string& strEnglish); EXTERN std::string LookUpTranslation(std::string& strEnglish);
void MsWinInitTranslatedStrings(); EXTERN void MsWinInitTranslatedStrings();
std::string WStringToString(std::wstring str); EXTERN std::string WStringToString(std::wstring str);
std::wstring StringToWString(std::string str); EXTERN std::wstring StringToWString(std::string str);
std::wstring MultiByteToWideChar(const char *Utf8Str, EXTERN std::wstring MultiByteToWideChar(const char* Utf8Str,
unsigned int CodePage); unsigned int CodePage);
std::string WideCharToMultiByte(const wchar_t *WideStr, EXTERN std::string WideCharToMultiByte(const wchar_t* WideStr,
unsigned int CodePage); unsigned int CodePage);
// Conversion // Conversion
std::string WideCharToUtf8(const wchar_t* str); EXTERN std::string WideCharToUtf8(const wchar_t* str);
std::wstring Utf8ToWideChar(const char *str); EXTERN std::wstring Utf8ToWideChar(const char *str);
char *getenv(const char *str); EXTERN char *getenv(const char *str);
#endif #endif

View file

@ -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 #if defined EXTERN
#undef EXTERN #undef EXTERN
#endif #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 <vector>
#include <algorithm>
#define PadOut(X,Y) (static_cast<int>(((X)-1)/(Y)+1)*(Y))
#define SetBitSize (8*sizeof(SetData_t)) #define SetBitSize (8*sizeof(SetData_t))
#define SetLastBit (((unsigned long)1)<<(SetBitSize-1)) #define SetLastBit ((static_cast<unsigned long>(1))<<(SetBitSize-1))
#if defined _DEBUG #if defined _DEBUG
# define USE_FUNCTIONS_FOR_SETS # define USE_FUNCTIONS_FOR_SETS
@ -150,7 +130,7 @@ inline Boolean_t AddToSet(Set_pa Set,
ExpandSet(Set, member + 1, show_error_msg))) ExpandSet(Set, member + 1, show_error_msg)))
{ {
SetIndex_t word = member / SetBitSize; SetIndex_t word = member / SetBitSize;
SetData_t bit = (SetData_t)1 << (member % SetBitSize); SetData_t bit = static_cast<SetData_t>(1) << (member % SetBitSize);
Set->data[word] |= bit; Set->data[word] |= bit;
return TRUE; return TRUE;
} }
@ -193,7 +173,7 @@ inline Boolean_t InSet(Set_pa Set,
if (Set && (0 <= member && member < Set->size)) if (Set && (0 <= member && member < Set->size))
{ {
SetIndex_t word = member / SetBitSize; SetIndex_t word = member / SetBitSize;
SetData_t bit = (SetData_t)1 << (member % SetBitSize); SetData_t bit = static_cast<SetData_t>(1) << (member % SetBitSize);
return (Set->data[word]&bit) != 0; return (Set->data[word]&bit) != 0;
} }
else else
@ -280,4 +260,76 @@ EXTERN void ShiftSet(Set_pa Set,
Member != BAD_SET_VALUE; \ Member != BAD_SET_VALUE; \
Member = GetPrevMember((Set), (Member))) 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 <typename T>
std::vector<T> toVector(Set_pa itemSet)
{
REQUIRE(VALID_REF(itemSet) || itemSet == 0);
std::vector<T> result;
size_t const count = MemberCount(itemSet);
if (count != 0)
{
result.reserve(count);
SetIndex_t item;
ForAllMembersInSet(item,itemSet)
result.push_back(static_cast<T>(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 <typename T>
Set_pa toSet(std::vector<T> 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<T>::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<T>::const_iterator item = items.begin();item != items.end();++item)
{
if (!AddToSet(result,static_cast<SetIndex_t>(*item),FALSE))
throw std::bad_alloc();
}
}
ENSURE(VALID_REF(result));
return result;
}
}
#endif // _SET_H_INCLUDED #endif // _SET_H_INCLUDED

View file

@ -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 * by adding LIBFUNCTION & LIBCALL as in
* StringListDealloc(), etc. below. * StringListDealloc(), etc. below.
* *
* When building the tecplot kernal, LIBFUNCTION * When building the tecplot kernel, LIBFUNCTION
* and LIBCALL are nop's. * and LIBCALL are nop's.
* *
*/ */
@ -75,7 +52,7 @@ EXTERN void StringListRemoveString(StringList_pa StringList,
LIBFUNCTION void LIBCALL StringListDealloc(StringList_pa* StringList); LIBFUNCTION void LIBCALL StringListDealloc(StringList_pa* StringList);
EXTERN StringList_pa StringListAlloc(void); EXTERN StringList_pa StringListAlloc(void);
EXTERN Boolean_t StringListAppendString(StringList_pa StringList, EXTERN Boolean_t StringListAppendString(StringList_pa StringList,
const char *String); char const* String);
LIBFUNCTION LgIndex_t LIBCALL StringListCount(StringList_pa StringList); LIBFUNCTION LgIndex_t LIBCALL StringListCount(StringList_pa StringList);
LIBFUNCTION char* LIBCALL StringListGetString(StringList_pa StringList, LIBFUNCTION char* LIBCALL StringListGetString(StringList_pa StringList,
LgIndex_t StringOffset); LgIndex_t StringOffset);
@ -87,36 +64,36 @@ LIBFUNCTION char * LIBCALL StringListGetString(StringList_pa StringList,
#endif #endif
#if !defined USE_MACROS_FOR_FUNCTIONS #if !defined USE_MACROS_FOR_FUNCTIONS
EXTERN const char * StringListGetStringRef_FUNC(StringList_pa StringList, EXTERN char const* StringListGetStringRef_FUNC(StringList_pa StringList,
LgIndex_t StringOffset); LgIndex_t StringOffset);
#endif #endif
/** /**
* To maintain the string list's integrity the result is cast to a * 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. * to FREE_ARRAY.
*/ */
#define StringListGetStringRef_MACRO(StringList, StringOffset) \ #define StringListGetStringRef_MACRO(StringList, StringOffset) \
((const char *)ArrayListGetCharPtr((ArrayList_pa)(StringList), StringOffset)) static_cast<char const*>(ArrayListGetCharPtr(reinterpret_cast<ArrayList_pa>(StringList), StringOffset))
EXTERN Boolean_t StringListSetString(StringList_pa StringList, EXTERN Boolean_t StringListSetString(StringList_pa StringList,
LgIndex_t StringOffset, LgIndex_t StringOffset,
const char *String); char const* String);
EXTERN Boolean_t StringListInsertString(StringList_pa StringList, EXTERN Boolean_t StringListInsertString(StringList_pa StringList,
LgIndex_t StringOffset, LgIndex_t StringOffset,
const char *String); char const* String);
EXTERN StringList_pa StringListCopy(StringList_pa StringList); EXTERN StringList_pa StringListCopy(StringList_pa StringList);
EXTERN Boolean_t StringListAppend(StringList_pa Target, EXTERN Boolean_t StringListAppend(StringList_pa Target,
StringList_pa Source); StringList_pa Source);
EXTERN char* StringListToNLString(StringList_pa StringList); EXTERN char* StringListToNLString(StringList_pa StringList);
EXTERN StringList_pa StringListFromNLString(const char *String); EXTERN StringList_pa StringListFromNLString(char const* String);
EXTERN char** StringListToArray(StringList_pa StringList); EXTERN char** StringListToArray(StringList_pa StringList);
EXTERN StringList_pa StringListFromArray(const char **StringArray, EXTERN StringList_pa StringListFromArray(char const** StringArray,
LgIndex_t Count); LgIndex_t Count);
EXTERN StringList_pa StringListFromCompound(const char *String); EXTERN StringList_pa StringListFromCompound(char const* String);
EXTERN char* StringListToCompound(StringList_pa StringList, EXTERN char* StringListToCompound(StringList_pa StringList,
char GroupJoinCharacter, char GroupJoinCharacter,
const char *CharsToEscape); char const* CharsToEscape);
EXTERN void StringListSort(StringList_pa StringList, #if defined TECPLOTKERNEL
StringListStringComparator_pf Comparator, /* CORE SOURCE CODE REMOVED */
ArbParam_t ClientData); #endif

View file

@ -1,31 +1,10 @@
/* #ifndef TECPLOT_STRUTIL
* NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM #define TECPLOT_STRUTIL
*
* 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. *******
******* ******** ******* ********
****************************************************************** ******************************************************************
****************************************************************** ******************************************************************
@ -136,8 +115,6 @@ EXTERN StringList_pa LineBreakString(const char *String,
UInt32_t WrapMargin); UInt32_t WrapMargin);
#endif #endif
EXTERN Boolean_t MatchKey(char *StringToMatch,
char *Key);
EXTERN void RemoveSeparator(const char **CPtr); EXTERN void RemoveSeparator(const char **CPtr);
EXTERN void SkipWhiteSpace(const char **CPtr); EXTERN void SkipWhiteSpace(const char **CPtr);
EXTERN void SkipNonWhiteSpace(char **CPtr); EXTERN void SkipNonWhiteSpace(char **CPtr);
@ -148,6 +125,11 @@ EXTERN int ustrncmp(const char *s1,
size_t Len); size_t Len);
EXTERN int ustrcmp(const char *s1, EXTERN int ustrcmp(const char *s1,
const char *s2); const char *s2);
#if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */
#endif
/* public access */ /* public access */
/* InternalResetString should not be used directly (use ResetString macro) */ /* InternalResetString should not be used directly (use ResetString macro) */
#if !defined NO_ASSERTS #if !defined NO_ASSERTS
@ -216,3 +198,5 @@ inline char const* EndOfString(char const* str)
{ {
return str + strlen(str); return str + strlen(str);
}; };
#endif

View file

@ -1,31 +1,11 @@
/* #ifndef TECPLOT_SYSTEM_H
* NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM #define TECPLOT_SYSTEM_H
*
* 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. *******
******* ******** ******* ********
***************************************************************** *****************************************************************
***************************************************************** *****************************************************************
@ -39,6 +19,15 @@
#define EXTERN extern #define EXTERN extern
#endif #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 #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif #endif
@ -48,7 +37,6 @@ EXTERN Boolean_t VerifyToOverwriteFile(const char *FName);
EXTERN Boolean_t IsValidDirectory(const char *FName); EXTERN Boolean_t IsValidDirectory(const char *FName);
EXTERN Boolean_t FileExists(const char *F, EXTERN Boolean_t FileExists(const char *F,
Boolean_t ShowErr); Boolean_t ShowErr);
EXTERN Boolean_t IsOkFNameChar(unsigned char ch);
EXTERN void ErrFName(const char *FName); EXTERN void ErrFName(const char *FName);
EXTERN Boolean_t IsValidFileName(const char *FileName, EXTERN Boolean_t IsValidFileName(const char *FileName,
Boolean_t IsReading, Boolean_t IsReading,
@ -65,3 +53,4 @@ EXTERN Boolean_t Open_File(FILE **F,
Boolean_t ShowErr, Boolean_t ShowErr,
Boolean_t IsAscii); Boolean_t IsAscii);
#endif

View file

@ -1,31 +1,10 @@
/* #ifndef TASSERT_H
* NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM #define TASSERT_H
*
* 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. *******
******* ******** ******* ********
****************************************************************** ******************************************************************
****************************************************************** ******************************************************************
@ -76,8 +55,7 @@
* builds and always fails at compile time for release * builds and always fails at compile time for release
* builds. * builds.
*/ */
#if !defined TASSERT_H
#define TASSERT_H
#if defined (MSWIN) #if defined (MSWIN)
# include <assert.h> # include <assert.h>
@ -125,8 +103,12 @@
#if !defined TECPLOTKERNEL #if !defined TECPLOTKERNEL
/* For add-ons, there is a problem with VALID_REF, so just test for non-NULL */ /* For add-ons, there is a problem with VALID_REF, so just test for non-NULL */
/* ENDREMOVEFROMADDON */ /* ENDREMOVEFROMADDON */
# if !defined VALID_REF
# define VALID_REF(p) ( (p) != NULL ) # define VALID_REF(p) ( (p) != NULL )
# endif
# if !defined VALID_FN_REF
# define VALID_FN_REF(fp) ( (fp) != NULL ) # define VALID_FN_REF(fp) ( (fp) != NULL )
# endif
/* BEGINREMOVEFROMADDON */ /* BEGINREMOVEFROMADDON */
#endif /* !defined TECPLOTKERNAL */ #endif /* !defined TECPLOTKERNAL */
/* ENDREMOVEFROMADDON */ /* ENDREMOVEFROMADDON */
@ -147,12 +129,20 @@
#if defined NO_ASSERTS #if defined NO_ASSERTS
/* release build in TecUtil layer uses these for TUASSERT */ /* release build in TecUtil layer uses these for TUASSERT */
# if !defined VALID_REF
# define VALID_REF(p) ((p) != NULL) # define VALID_REF(p) ((p) != NULL)
# endif
# if !defined VALID_FN_REF
# define VALID_FN_REF(pf) ((pf) != NULL) # define VALID_FN_REF(pf) ((pf) != NULL)
# endif
#else #else
# if !defined VALID_REF
# define VALID_REF(p) ((p) != NULL && !IsBadReadPtr((const void *)(p), 1)) # 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*))) # define VALID_FN_REF(pf) ((pf) != NULL && !IsBadReadPtr((const void *)(pf),(UINT_PTR)sizeof(const void*)))
# endif # endif
#endif
/* BEGINREMOVEFROMADDON */ /* BEGINREMOVEFROMADDON */
/* Widgets are numbers under Windows, so we decode it with GetWindowFromWidget */ /* Widgets are numbers under Windows, so we decode it with GetWindowFromWidget */
@ -178,13 +168,21 @@
/* ENDREMOVEFROMADDON */ /* ENDREMOVEFROMADDON */
/* other useful validity checks */ /* other useful validity checks */
#if !defined VALID_BOOLEAN
# define VALID_BOOLEAN(b) ((b) == TRUE || (b) == FALSE) # define VALID_BOOLEAN(b) ((b) == TRUE || (b) == FALSE)
#define VALID_ENUM(value, type) (0 <= (value) && \ #endif
(value) < END_##type) #if !defined VALID_ENUM
# define VALID_ENUM(value, type) (0 <= static_cast<int>((value)) && \
static_cast<int>((value)) < END_##type)
#endif
/* Test a parameter than can be NULL or a valid pointer */ /* Test a parameter than can be NULL or a valid pointer */
#if !defined VALID_REF_OR_NULL
# define VALID_REF_OR_NULL(ptr) IMPLICATION((ptr) != NULL, VALID_REF(ptr)) # 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)) # define VALID_FN_REF_OR_NULL(ptr) IMPLICATION((ptr) != NULL, VALID_FN_REF(ptr))
#endif
/* BEGINREMOVEFROMADDON */ /* BEGINREMOVEFROMADDON */
#define VALID_TRANSLATED_STRING(ts) (!(ts).isNull()) #define VALID_TRANSLATED_STRING(ts) (!(ts).isNull())
@ -267,6 +265,7 @@
/* ENDREMOVEFROMADDON */ /* ENDREMOVEFROMADDON */
/* Check for a non-zero length string */ /* Check for a non-zero length string */
#if !defined VALID_NON_ZERO_LEN_STR
# if defined MSWIN # if defined MSWIN
# if defined NO_ASSERTS # if defined NO_ASSERTS
# define VALID_NON_ZERO_LEN_STR(str) (VALID_REF(str) && !ISEMPTYSTRING(str)) # define VALID_NON_ZERO_LEN_STR(str) (VALID_REF(str) && !ISEMPTYSTRING(str))
@ -279,11 +278,16 @@
# else # else
# define VALID_NON_ZERO_LEN_STR(str) (VALID_REF(str) && !ISEMPTYSTRING(str)) # define VALID_NON_ZERO_LEN_STR(str) (VALID_REF(str) && !ISEMPTYSTRING(str))
# endif # endif
#endif
#if !defined VALID_SET_INDEX
# define VALID_SET_INDEX(setIndex) (((SetIndex_t)setIndex)>=(SetIndex_t)1) # define VALID_SET_INDEX(setIndex) (((SetIndex_t)setIndex)>=(SetIndex_t)1)
#endif
/* Check for valid stdio file handle */ /* Check for valid stdio file handle */
#if !defined VALID_FILE_HANDLE
# define VALID_FILE_HANDLE(stream) ((stream) != NULL) # define VALID_FILE_HANDLE(stream) ((stream) != NULL)
#endif
/* To check colors and pen numbers */ /* To check colors and pen numbers */
/* BEGINREMOVEFROMADDON */ /* BEGINREMOVEFROMADDON */
@ -333,7 +337,7 @@
#define VALID_NAME(Name, MaxLength) \ #define VALID_NAME(Name, MaxLength) \
(VALID_REF(Name) && \ (VALID_REF(Name) && \
(ISEMPTYSTRING(Name) || \ (ISEMPTYSTRING(Name) || \
(!isspace((Name)[0]) && !isspace((Name)[strlen(Name)-1]))) && \ (!tecplot::isspace((Name)[0]) && !tecplot::isspace((Name)[strlen(Name)-1]))) && \
strlen(Name) <= (MaxLength)) strlen(Name) <= (MaxLength))
#define VALID_ZONE_NAME(Name) VALID_NAME((Name), MaxChrsZnTitle) #define VALID_ZONE_NAME(Name) VALID_NAME((Name), MaxChrsZnTitle)
#define VALID_VAR_NAME(Name) VALID_NAME((Name), MaxChrsVarName) #define VALID_VAR_NAME(Name) VALID_NAME((Name), MaxChrsVarName)
@ -366,18 +370,44 @@ extern TAssertFailureNotifyFunc InstallTAssertFailureNotify(
/* BEGINREMOVEFROMADDON */ /* BEGINREMOVEFROMADDON */
# define TASSERT(EXPR) # define TASSERT(EXPR)
/* ENDREMOVEFROMADDON */ /* ENDREMOVEFROMADDON */
# if !defined INVARIANT
# define INVARIANT(EXPR) # define INVARIANT(EXPR)
# endif
# if !defined REQUIRE
# define REQUIRE(EXPR) # define REQUIRE(EXPR)
# endif
# if !defined ENSURE
# define ENSURE(EXPR) # define ENSURE(EXPR)
# endif
# if !defined CHECK
# define CHECK(EXPR) # define CHECK(EXPR)
# endif
# ifdef VERIFY # ifdef VERIFY
# undef VERIFY # undef VERIFY
# endif # endif
# define VERIFY(EXPR) ((void)(EXPR)) # 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 * Only define IGNORENOTIMPLEMENTED if building a "test" release build
* that you are fully aware may contain unimplemented features. * that you are fully aware may contain unimplemented features.
*/ */
# if !defined NOT_IMPLEMENTED
# if defined IGNORENOTIMPLEMENTED # if defined IGNORENOTIMPLEMENTED
# define NOT_IMPLEMENTED() CHECK(FALSE) # define NOT_IMPLEMENTED() CHECK(FALSE)
# else # else
@ -393,14 +423,23 @@ extern TAssertFailureNotifyFunc InstallTAssertFailureNotify(
# define NOT_IMPLEMENTED() not implemented /* intentionally break the compile */ # define NOT_IMPLEMENTED() not implemented /* intentionally break the compile */
# endif # endif
# endif # endif
# endif
#elif defined STD_ASSERTS #elif defined STD_ASSERTS
/* BEGINREMOVEFROMADDON */ /* BEGINREMOVEFROMADDON */
# define TASSERT(EXPR) assert(EXPR) # define TASSERT(EXPR) assert(EXPR)
/* ENDREMOVEFROMADDON */ /* ENDREMOVEFROMADDON */
# if !defined INVARIANT
# define INVARIANT(EXPR) assert(EXPR) # define INVARIANT(EXPR) assert(EXPR)
# endif
# if !defined REQUIRE
# define REQUIRE(EXPR) assert(EXPR) # define REQUIRE(EXPR) assert(EXPR)
# endif
# if !defined ENSURE
# define ENSURE(EXPR) assert(EXPR) # define ENSURE(EXPR) assert(EXPR)
# endif
# if !defined CHECK
# define CHECK(EXPR) assert(EXPR) # define CHECK(EXPR) assert(EXPR)
# endif
# ifdef VERIFY # ifdef VERIFY
# undef VERIFY # undef VERIFY
# endif # endif
@ -411,7 +450,15 @@ extern TAssertFailureNotifyFunc InstallTAssertFailureNotify(
# define VERIFY(EXPR) assert(EXPR) # define VERIFY(EXPR) assert(EXPR)
# endif # endif
# endif /* VERIFY */ # endif /* VERIFY */
# if !defined NOT_IMPLEMENTED
# define NOT_IMPLEMENTED() assert(!("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 #else
/* BEGINREMOVEFROMADDON */ /* BEGINREMOVEFROMADDON */
#if defined (MSWIN) #if defined (MSWIN)
@ -486,9 +533,23 @@ Works in both release & debug builds */
# define NOT_IMPLEMENTED() NiceNotImplemented() # define NOT_IMPLEMENTED() NiceNotImplemented()
# else # else
# define NOT_IMPLEMENTED() TASSERT(!("Not Implemented")) # define NOT_IMPLEMENTED() TASSERT(!("Not Implemented"))
# endif
/*
* See note above for this macro.
*/
# if !defined ASSERT_ONLY
# define ASSERT_ONLY(PARAMETER) PARAMETER
# endif # endif
/* ENDREMOVEFROMADDON */ /* ENDREMOVEFROMADDON */
#endif #endif
/**
* @deprecated use ASSERT_ONLY instead
*/
#if !defined ASSERT_ONLY_PARAM && defined ASSERT_ONLY
# define ASSERT_ONLY_PARAM(PARAMETER) ASSERT_ONLY(PARAMETER)
#endif
/* BEGINREMOVEFROMADDON */ /* BEGINREMOVEFROMADDON */
#if !defined STD_ASSERTS #if !defined STD_ASSERTS
extern void TecplotMopupOnAssert(void); extern void TecplotMopupOnAssert(void);
@ -500,8 +561,12 @@ extern void NiceNotImplemented(void);
/* ENDREMOVEFROMADDON */ /* ENDREMOVEFROMADDON */
/* convenience macros for implication, P -> Q, and equivalence, P <-> Q. */ /* convenience macros for implication, P -> Q, and equivalence, P <-> Q. */
#if !defined IMPLICATION
# define IMPLICATION(P,Q) (!(P) || (Q)) # define IMPLICATION(P,Q) (!(P) || (Q))
#endif
#if !defined EQUIVALENCE
# define EQUIVALENCE(P,Q) ((P) == (Q)) # define EQUIVALENCE(P,Q) ((P) == (Q))
#endif
/* BEGINREMOVEFROMADDON */ /* BEGINREMOVEFROMADDON */
#if defined RLM #if defined RLM

View file

@ -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" #include "TECXXX.h"

View file

@ -1,28 +1,5 @@
/* /*
* NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM * TECXXX.h: Copyright (C) 1988-2010 Tecplot, Inc.
*
* Copyright (C) 1988-2009 Tecplot, Inc. All rights reserved worldwide.
*
* Tecplot hereby grants OpenCFD limited authority to distribute without
* alteration the source code to the Tecplot Input/Output library, known
* as TecIO, as part of its distribution of OpenFOAM and the
* OpenFOAM_to_Tecplot converter. Users of this converter are also hereby
* granted access to the TecIO source code, and may redistribute it for the
* purpose of maintaining the converter. However, no authority is granted
* to alter the TecIO source code in any form or manner.
*
* This limited grant of distribution does not supersede Tecplot, Inc.'s
* copyright in TecIO. Contact Tecplot, Inc. for further information.
*
* Tecplot, Inc.
* 3535 Factoria Blvd, Ste. 550
* Bellevue, WA 98006, USA
* Phone: +1 425 653 1200
* http://www.tecplot.com/
*
*/
/*
* TECXXX.h: Copyright (C) 1988-2008 Tecplot, Inc.
*/ */
#if !defined TECXXX_H_ #if !defined TECXXX_H_
@ -34,6 +11,7 @@
# define TECZNE112 teczne112 # define TECZNE112 teczne112
# define TECDAT112 tecdat112 # define TECDAT112 tecdat112
# define TECNOD112 tecnod112 # define TECNOD112 tecnod112
# define TECNODE112 tecnode112
# define TECGEO112 tecgeo112 # define TECGEO112 tecgeo112
# define TECTXT112 tectxt112 # define TECTXT112 tectxt112
# define TECLAB112 teclab112 # define TECLAB112 teclab112
@ -45,6 +23,8 @@
# define TECVAUXSTR112 tecvauxstr112 # define TECVAUXSTR112 tecvauxstr112
# define TECFACE112 tecface112 # define TECFACE112 tecface112
# define TECPOLY112 tecpoly112 # define TECPOLY112 tecpoly112
# define TECPOLYFACE112 tecpolyface112
# define TECPOLYBCONN112 tecpolybconn112
# define TECFOREIGN111 tecforeign111 # define TECFOREIGN111 tecforeign111
# define TECINI111 tecini111 # define TECINI111 tecini111
@ -156,10 +136,15 @@
#if defined (TECPLOTKERNEL) #if defined (TECPLOTKERNEL)
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#else
#if defined (MAKEARCHIVE)
#define LIBCALL STDCALL
#define LIBFUNCTION EXTERNC DLLEXPORT
#else /* !TECPLOTKERNAL && !MAKEARCHIVE */ #else /* !TECPLOTKERNAL && !MAKEARCHIVE */
#define LIBCALL STDCALL #define LIBCALL STDCALL
#define LIBFUNCTION EXTERNC DLLIMPORT #define LIBFUNCTION EXTERNC DLLIMPORT
#endif #endif
#endif
/* /*
* V11.3 tecio functions * V11.3 tecio functions
@ -203,6 +188,9 @@ LIBFUNCTION INTEGER4 LIBCALL TECDAT112(INTEGER4 *N,
LIBFUNCTION INTEGER4 LIBCALL TECNOD112(INTEGER4 *NData); LIBFUNCTION INTEGER4 LIBCALL TECNOD112(INTEGER4 *NData);
LIBFUNCTION INTEGER4 LIBCALL TECNODE112(INTEGER4 *N,
INTEGER4 *NData);
LIBFUNCTION INTEGER4 LIBCALL TECEND112(void); LIBFUNCTION INTEGER4 LIBCALL TECEND112(void);
LIBFUNCTION INTEGER4 LIBCALL TECLAB112(char *S); LIBFUNCTION INTEGER4 LIBCALL TECLAB112(char *S);
@ -281,6 +269,17 @@ LIBFUNCTION INTEGER4 LIBCALL TECPOLY112(INTEGER4 *FaceNodeCounts,
INTEGER4 *FaceBndryConnectionElems, INTEGER4 *FaceBndryConnectionElems,
INTEGER4 *FaceBndryConnectionZones); 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 * V11.1 tecio functions TODO (JN): Tecplot's version is still in flux so the .1 may change
*/ */

View file

@ -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. *******
******* ******** ******* ********
****************************************************************** ******************************************************************
****************************************************************** ******************************************************************

View file

@ -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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
#define TECPLOTENGINEMODULE #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() TranslatedString::TranslatedString()
{ {
init(DontTranslate, (const char*)NULL, (const char*)NULL); init(DontTranslate, static_cast<const char*>(NULL), static_cast<const char*>(NULL));
ENSURE(this->isValid()); ENSURE(this->isValid());
} }

View file

@ -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. *******
******* ******** ******* ********
***************************************************************** *****************************************************************
***************************************************************** *****************************************************************

View file

@ -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

View file

@ -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<<CLASS_NUM_BITS)-1)
#define ITEM_ID_FILTER ((1<<ITEM_ID_BITS)-1)
#define ITEM_OFFSET_FILTER ((1<<ITEM_OFFSET_BITS)-1)
#define TP_CLASS_NO_CLASS 0
#define TP_ITEM_CLASS_ITSELF 0
#define TP_OFFSET_ITEM_ITSELF 0
#define TP_OFFSET_MENU_CASCADE (ITEM_OFFSET_FILTER-1)
#define TP_OFFSET_MENU_OPTION ITEM_OFFSET_FILTER
/* MAKEWIDGET must be a define and not an inline function so widget's can be used in case statements. */
#define MAKEWIDGET(ClassNum, ItemID, ItemOffset) ((Widget)( ( ( ((ClassNum)<<ITEM_ID_BITS) | (ItemID) ) << ITEM_OFFSET_BITS ) | (ItemOffset) ))
inline INT_PTR GetClassNum(Widget W)
{
return (W >> 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

View file

@ -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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
@ -30,7 +7,7 @@
****************************************************************** ******************************************************************
****************************************************************** ******************************************************************
******* ******** ******* ********
****** (C) 1988-2008 Tecplot, Inc. ******* ****** (C) 1988-2010 Tecplot, Inc. *******
******* ******** ******* ********
****************************************************************** ******************************************************************
****************************************************************** ******************************************************************

View file

@ -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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
#define TECPLOTENGINEMODULE #define TECPLOTENGINEMODULE
@ -29,7 +6,7 @@
***************************************************************** *****************************************************************
***************************************************************** *****************************************************************
******* ******** ******* ********
****** Copyright (C) 1988-2008 Tecplot, Inc. ******** ****** Copyright (C) 1988-2010 Tecplot, Inc. ********
******* All Rights Reserved. ******** ******* All Rights Reserved. ********
******* ******** ******* ********
***************************************************************** *****************************************************************
@ -40,11 +17,7 @@
#include "GLOBAL.h" #include "GLOBAL.h"
#include "TASSERT.h" #include "TASSERT.h"
#include "ALLOC.h" #include "ALLOC.h"
#if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */
#endif
#include "ARRLIST.h" #include "ARRLIST.h"
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif #endif
@ -106,11 +79,11 @@ static void CopyArrayItems(char *TargetArray,
REQUIRE(SourceOffset >= 0); REQUIRE(SourceOffset >= 0);
REQUIRE(&TargetArray[TargetOffset] != &SourceArray[SourceOffset]); REQUIRE(&TargetArray[TargetOffset] != &SourceArray[SourceOffset]);
REQUIRE(Count >= 1); REQUIRE(Count >= 1);
REQUIRE(1 <= ItemSize && ItemSize <= (SmInteger_t)sizeof(ArrayListItem_u)); REQUIRE(1 <= ItemSize && ItemSize <= static_cast<SmInteger_t>(sizeof(ArrayListItem_u)));
void* TargetPtr = &TargetArray[TargetOffset * ItemSize]; void* TargetPtr = &TargetArray[TargetOffset * ItemSize];
void* SourcePtr = &SourceArray[SourceOffset * ItemSize]; void* SourcePtr = &SourceArray[SourceOffset * ItemSize];
memmove(TargetPtr, SourcePtr, ((size_t)Count) * ItemSize); memmove(TargetPtr, SourcePtr, static_cast<size_t>(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 * Adjusted capacity that is at least as large as the request or zero if
* unable to satisfy the requested capacity. * 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 CurrentCapacity,
LgIndex_t RequestedCapacity, LgIndex_t RequestedCapacity,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
LgIndex_t Result;
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
REQUIRE((RequestedCapacity == 0 && CurrentCapacity == 0) || REQUIRE((RequestedCapacity == 0 && CurrentCapacity == 0) ||
RequestedCapacity > CurrentCapacity); RequestedCapacity > CurrentCapacity);
UNUSED(ClientData);
LgIndex_t Result;
if (RequestedCapacity != 0 && CurrentCapacity == 0) if (RequestedCapacity != 0 && CurrentCapacity == 0)
{ {
/* first allocation; assume the request is the desired capacityy */ /* first allocation; assume the request is the desired capacityy */
@ -152,7 +125,7 @@ static LgIndex_t AdjustCapacityRequest(ArrayList_pa ArrayList,
} }
else else
{ {
const LgIndex_t DEFAULT_CAPACITY = 32; LgIndex_t const DEFAULT_CAPACITY = 32;
LgIndex_t BlockSize = MAX(DEFAULT_CAPACITY, CurrentCapacity / 2); LgIndex_t BlockSize = MAX(DEFAULT_CAPACITY, CurrentCapacity / 2);
if (RequestedCapacity == 0) if (RequestedCapacity == 0)
Result = DEFAULT_CAPACITY; Result = DEFAULT_CAPACITY;
@ -176,118 +149,117 @@ static LgIndex_t AdjustCapacityRequest(ArrayList_pa ArrayList,
*/ */
static SmInteger_t GetElementSize(ArrayListType_e Type) static SmInteger_t GetElementSize(ArrayListType_e Type)
{ {
SmInteger_t Result;
REQUIRE(VALID_ENUM(Type, ArrayListType_e)); REQUIRE(VALID_ENUM(Type, ArrayListType_e));
SmInteger_t Result;
switch (Type) switch (Type)
{ {
case ArrayListType_UnsignedChar: case ArrayListType_UnsignedChar:
Result = (SmInteger_t)sizeof(unsigned char); Result = static_cast<SmInteger_t>(sizeof(unsigned char));
break; break;
case ArrayListType_UnsignedShort: case ArrayListType_UnsignedShort:
Result = (SmInteger_t)sizeof(unsigned short); Result = static_cast<SmInteger_t>(sizeof(unsigned short));
break; break;
case ArrayListType_UnsignedInt: case ArrayListType_UnsignedInt:
Result = (SmInteger_t)sizeof(unsigned int); Result = static_cast<SmInteger_t>(sizeof(unsigned int));
break; break;
case ArrayListType_UnsignedLong: case ArrayListType_UnsignedLong:
Result = (SmInteger_t)sizeof(unsigned long); Result = static_cast<SmInteger_t>(sizeof(unsigned long));
break; break;
case ArrayListType_Int64: case ArrayListType_Int64:
Result = (SmInteger_t)sizeof(Int64_t); Result = static_cast<SmInteger_t>(sizeof(Int64_t));
break; break;
case ArrayListType_Char: case ArrayListType_Char:
Result = (SmInteger_t)sizeof(char); Result = static_cast<SmInteger_t>(sizeof(char));
break; break;
case ArrayListType_Short: case ArrayListType_Short:
Result = (SmInteger_t)sizeof(short); Result = static_cast<SmInteger_t>(sizeof(short));
break; break;
case ArrayListType_Int: case ArrayListType_Int:
Result = (SmInteger_t)sizeof(int); Result = static_cast<SmInteger_t>(sizeof(int));
break; break;
case ArrayListType_Long: case ArrayListType_Long:
Result = (SmInteger_t)sizeof(long); Result = static_cast<SmInteger_t>(sizeof(long));
break; break;
case ArrayListType_Float: case ArrayListType_Float:
Result = (SmInteger_t)sizeof(float); Result = static_cast<SmInteger_t>(sizeof(float));
break; break;
case ArrayListType_Double: case ArrayListType_Double:
Result = (SmInteger_t)sizeof(double); Result = static_cast<SmInteger_t>(sizeof(double));
break; break;
case ArrayListType_LgIndex: case ArrayListType_LgIndex:
Result = (SmInteger_t)sizeof(LgIndex_t); Result = static_cast<SmInteger_t>(sizeof(LgIndex_t));
break; break;
case ArrayListType_EntIndex: case ArrayListType_EntIndex:
Result = (SmInteger_t)sizeof(EntIndex_t); Result = static_cast<SmInteger_t>(sizeof(EntIndex_t));
break; break;
case ArrayListType_SmInteger: case ArrayListType_SmInteger:
Result = (SmInteger_t)sizeof(SmInteger_t); Result = static_cast<SmInteger_t>(sizeof(SmInteger_t));
break; break;
case ArrayListType_Boolean: case ArrayListType_Boolean:
Result = (SmInteger_t)sizeof(Boolean_t); Result = static_cast<SmInteger_t>(sizeof(Boolean_t));
break; break;
case ArrayListType_ArbParam: case ArrayListType_ArbParam:
Result = (SmInteger_t)sizeof(ArbParam_t); Result = static_cast<SmInteger_t>(sizeof(ArbParam_t));
break; break;
case ArrayListType_UnsignedCharPtr: case ArrayListType_UnsignedCharPtr:
Result = (SmInteger_t)sizeof(unsigned char *); Result = static_cast<SmInteger_t>(sizeof(unsigned char*));
break; break;
case ArrayListType_UnsignedShortPtr: case ArrayListType_UnsignedShortPtr:
Result = (SmInteger_t)sizeof(unsigned short *); Result = static_cast<SmInteger_t>(sizeof(unsigned short*));
break; break;
case ArrayListType_UnsignedIntPtr: case ArrayListType_UnsignedIntPtr:
Result = (SmInteger_t)sizeof(unsigned int *); Result = static_cast<SmInteger_t>(sizeof(unsigned int*));
break; break;
case ArrayListType_UnsignedLongPtr: case ArrayListType_UnsignedLongPtr:
Result = (SmInteger_t)sizeof(unsigned long *); Result = static_cast<SmInteger_t>(sizeof(unsigned long*));
break; break;
case ArrayListType_Int64Ptr: case ArrayListType_Int64Ptr:
Result = (SmInteger_t)sizeof(Int64_t *); Result = static_cast<SmInteger_t>(sizeof(Int64_t*));
break; break;
case ArrayListType_CharPtr: case ArrayListType_CharPtr:
Result = (SmInteger_t)sizeof(char *); Result = static_cast<SmInteger_t>(sizeof(char*));
break; break;
case ArrayListType_ShortPtr: case ArrayListType_ShortPtr:
Result = (SmInteger_t)sizeof(short *); Result = static_cast<SmInteger_t>(sizeof(short*));
break; break;
case ArrayListType_IntPtr: case ArrayListType_IntPtr:
Result = (SmInteger_t)sizeof(int *); Result = static_cast<SmInteger_t>(sizeof(int*));
break; break;
case ArrayListType_LongPtr: case ArrayListType_LongPtr:
Result = (SmInteger_t)sizeof(long *); Result = static_cast<SmInteger_t>(sizeof(long*));
break; break;
case ArrayListType_FloatPtr: case ArrayListType_FloatPtr:
Result = (SmInteger_t)sizeof(float *); Result = static_cast<SmInteger_t>(sizeof(float*));
break; break;
case ArrayListType_DoublePtr: case ArrayListType_DoublePtr:
Result = (SmInteger_t)sizeof(double *); Result = static_cast<SmInteger_t>(sizeof(double*));
break; break;
case ArrayListType_LgIndexPtr: case ArrayListType_LgIndexPtr:
Result = (SmInteger_t)sizeof(LgIndex_t *); Result = static_cast<SmInteger_t>(sizeof(LgIndex_t*));
break; break;
case ArrayListType_EntIndexPtr: case ArrayListType_EntIndexPtr:
Result = (SmInteger_t)sizeof(EntIndex_t *); Result = static_cast<SmInteger_t>(sizeof(EntIndex_t*));
break; break;
case ArrayListType_SmIntegerPtr: case ArrayListType_SmIntegerPtr:
Result = (SmInteger_t)sizeof(SmInteger_t *); Result = static_cast<SmInteger_t>(sizeof(SmInteger_t*));
break; break;
case ArrayListType_BooleanPtr: case ArrayListType_BooleanPtr:
Result = (SmInteger_t)sizeof(Boolean_t *); Result = static_cast<SmInteger_t>(sizeof(Boolean_t*));
break; break;
case ArrayListType_ArbParamPtr: case ArrayListType_ArbParamPtr:
Result = (SmInteger_t)sizeof(ArbParam_t *); Result = static_cast<SmInteger_t>(sizeof(ArbParam_t*));
break; break;
case ArrayListType_VoidPtr: case ArrayListType_VoidPtr:
Result = (SmInteger_t)sizeof(void *); Result = static_cast<SmInteger_t>(sizeof(void*));
break; break;
case ArrayListType_FunctionPtr: case ArrayListType_FunctionPtr:
Result = (SmInteger_t)sizeof(void (*)()); Result = static_cast<SmInteger_t>(sizeof(void (*)()));
break; break;
case ArrayListType_Any: /* allows a mixed bag of items */ case ArrayListType_Any: /* allows a mixed bag of items */
Result = (SmInteger_t)sizeof(ArrayListItem_u); Result = static_cast<SmInteger_t>(sizeof(ArrayListItem_u));
break; break;
default: default:
@ -296,7 +268,7 @@ static SmInteger_t GetElementSize(ArrayListType_e Type)
break; break;
} }
ENSURE(1 <= Result && Result <= (SmInteger_t)sizeof(ArrayListItem_u)); ENSURE(1 <= Result && Result <= static_cast<SmInteger_t>(sizeof(ArrayListItem_u)));
return Result; return Result;
} }
@ -324,24 +296,19 @@ static void DestroyItems(ArrayList_pa ArrayList,
ArrayListItemDestructor_pf ItemDestructor, ArrayListItemDestructor_pf ItemDestructor,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
LgIndex_t Index;
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1); REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1);
REQUIRE(1 <= Count && ItemOffset + Count <= ArrayList->Count); REQUIRE(1 <= Count && ItemOffset + Count <= ArrayList->Count);
REQUIRE(VALID_FN_REF(ItemDestructor)); REQUIRE(VALID_FN_REF(ItemDestructor));
for (Index = 0; for (LgIndex_t Index = 0;
Index < Count; Index < Count;
Index++) Index++)
{ {
LgIndex_t ItemIndex = (Index + ItemOffset) * ItemSize; LgIndex_t ItemIndex = (Index + ItemOffset) * ItemSize;
#if !defined NO_ASSERTS Boolean_t CHECK_DoContinue;
Boolean_t DoContinue = ItemDestructor((void *) & ArrayList->Array[ItemIndex], ClientData); CHECK_DoContinue = ItemDestructor(static_cast<void*>(&ArrayList->Array[ItemIndex]), ClientData);
CHECK(DoContinue); /* this is a requirement of ArrayListItemDestructor_pf */ CHECK(CHECK_DoContinue); /* this is a requirement of ArrayListItemDestructor_pf */
#else
ItemDestructor((void *)&ArrayList->Array[ItemIndex], ClientData);
#endif
} }
} }
@ -379,26 +346,24 @@ static Boolean_t DuplicateItems(char *TargetArray,
ArrayListItemDuplicator_pf ItemDuplicator, ArrayListItemDuplicator_pf ItemDuplicator,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
Boolean_t IsOk = TRUE;
LgIndex_t Index;
REQUIRE(VALID_REF(TargetArray)); REQUIRE(VALID_REF(TargetArray));
REQUIRE(TargetItemOffset >= 0); REQUIRE(TargetItemOffset >= 0);
REQUIRE(VALID_REF(SourceArray)); REQUIRE(VALID_REF(SourceArray));
REQUIRE(SourceItemOffset >= 0); REQUIRE(SourceItemOffset >= 0);
REQUIRE(1 <= ItemSize && REQUIRE(1 <= ItemSize &&
ItemSize <= (SmInteger_t)sizeof(ArrayListItem_u)); ItemSize <= static_cast<SmInteger_t>(sizeof(ArrayListItem_u)));
REQUIRE(Count >= 1); REQUIRE(Count >= 1);
REQUIRE(VALID_FN_REF(ItemDuplicator)); REQUIRE(VALID_FN_REF(ItemDuplicator));
for (Index = 0; Boolean_t IsOk = TRUE;
for (LgIndex_t Index = 0;
Index < Count && IsOk; Index < Count && IsOk;
Index++) Index++)
{ {
LgIndex_t TargetItemIndex = (Index + TargetItemOffset) * ItemSize; LgIndex_t TargetItemIndex = (Index + TargetItemOffset) * ItemSize;
LgIndex_t SourceItemIndex = (Index + SourceItemOffset) * ItemSize; LgIndex_t SourceItemIndex = (Index + SourceItemOffset) * ItemSize;
IsOk = ItemDuplicator((void *) & TargetArray[TargetItemIndex], IsOk = ItemDuplicator(static_cast<void*>(&TargetArray[TargetItemIndex]),
(void *) & SourceArray[SourceItemIndex], static_cast<void*>(&SourceArray[SourceItemIndex]),
ClientData); ClientData);
} }
@ -418,15 +383,14 @@ static Boolean_t DuplicateItems(char *TargetArray,
*/ */
Boolean_t ArrayListIsValid(ArrayList_pa ArrayList) 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 */ Boolean_t IsValid = (VALID_REF(ArrayList) &&
INVARIANT(ArrayListNullItem.Double == 0.0);
IsValid = (VALID_REF(ArrayList) &&
VALID_ENUM(ArrayList->Type, ArrayListType_e) && VALID_ENUM(ArrayList->Type, ArrayListType_e) &&
(1 <= ArrayList->ItemSize && (1 <= ArrayList->ItemSize &&
ArrayList->ItemSize <= (SmInteger_t)sizeof(ArrayListItem_u)) && ArrayList->ItemSize <= static_cast<SmInteger_t>(sizeof(ArrayListItem_u))) &&
(0 <= ArrayList->Count && (0 <= ArrayList->Count &&
ArrayList->Count <= ArrayList->Capacity)); ArrayList->Count <= ArrayList->Capacity));
@ -446,11 +410,9 @@ Boolean_t ArrayListIsValid(ArrayList_pa ArrayList)
*/ */
ArrayListType_e ArrayListGetType(ArrayList_pa ArrayList) ArrayListType_e ArrayListGetType(ArrayList_pa ArrayList)
{ {
ArrayListType_e Result;
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
Result = ArrayList->Type; ArrayListType_e Result = ArrayList->Type;
ENSURE(VALID_ENUM(Result, ArrayListType_e)); ENSURE(VALID_ENUM(Result, ArrayListType_e));
return Result; return Result;
@ -465,9 +427,9 @@ ArrayListType_e ArrayListGetType(ArrayList_pa ArrayList)
* the RequestedCapacity. * the RequestedCapacity.
* *
* param ArrayList * 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 * param RequestedCapacity
* Capacity (number ot items) request or zero for default size. * Capacity (number of items) request or zero for default size.
* *
* return * return
* TRUE if the list could be enlarged (or was large enough), * 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, Boolean_t ArrayListEnlargeCapacity(ArrayList_pa ArrayList,
LgIndex_t RequestedCapacity) LgIndex_t RequestedCapacity)
{ {
Boolean_t IsOk;
LgIndex_t AdjustedCapacity;
char *EnlargedArray;
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
REQUIRE(IMPLICATION(RequestedCapacity == 0, ArrayList->Capacity == 0)); REQUIRE(IMPLICATION(RequestedCapacity == 0, ArrayList->Capacity == 0));
Boolean_t IsOk;
if (RequestedCapacity == 0 || if (RequestedCapacity == 0 ||
RequestedCapacity > ArrayList->Capacity) RequestedCapacity > ArrayList->Capacity)
{ {
AdjustedCapacity = LgIndex_t AdjustedCapacity =
ArrayList->CapacityRequestAdjuster(ArrayList, ArrayList->CapacityRequestAdjuster(ArrayList,
ArrayList->Capacity, ArrayList->Capacity,
RequestedCapacity, RequestedCapacity,
@ -494,6 +453,7 @@ Boolean_t ArrayListEnlargeCapacity(ArrayList_pa ArrayList,
CHECK(AdjustedCapacity == 0 || CHECK(AdjustedCapacity == 0 ||
AdjustedCapacity >= RequestedCapacity); AdjustedCapacity >= RequestedCapacity);
char* EnlargedArray = NULL; /* ...quiet compiler */
IsOk = (AdjustedCapacity != 0); /* ...were we able to meet the request? */ IsOk = (AdjustedCapacity != 0); /* ...were we able to meet the request? */
if (IsOk) if (IsOk)
{ {
@ -571,12 +531,10 @@ ArrayList_pa ArrayListAlloc(LgIndex_t EstimatedCapacit
ArrayListCapacityRequestAdjuster_pf CapacityRequestAdjuster, ArrayListCapacityRequestAdjuster_pf CapacityRequestAdjuster,
ArbParam_t CapacityRequestAdjusterClientData) ArbParam_t CapacityRequestAdjusterClientData)
{ {
ArrayList_pa Result;
REQUIRE(EstimatedCapacity >= 0); REQUIRE(EstimatedCapacity >= 0);
REQUIRE(VALID_ENUM(Type, ArrayListType_e)); 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) if (Result != NULL)
{ {
Result->Array = NULL; Result->Array = NULL;
@ -660,11 +618,9 @@ void ArrayListDealloc(ArrayList_pa *ArrayList,
*/ */
LgIndex_t ArrayListGetCount_FUNC(ArrayList_pa ArrayList) LgIndex_t ArrayListGetCount_FUNC(ArrayList_pa ArrayList)
{ {
LgIndex_t Result;
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
Result = ArrayListGetCount_MACRO(ArrayList); LgIndex_t Result = ArrayListGetCount_MACRO(ArrayList);
ENSURE(Result >= 0); ENSURE(Result >= 0);
return Result; return Result;
@ -845,14 +801,13 @@ ArrayList_pa ArrayListRemoveItems(ArrayList_pa ArrayList,
ArrayListItem_u ArrayListRemoveItem(ArrayList_pa ArrayList, ArrayListItem_u ArrayListRemoveItem(ArrayList_pa ArrayList,
LgIndex_t ItemOffset) LgIndex_t ItemOffset)
{ {
ArrayListItem_u Result;
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1); REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1);
REQUIRE(!ArrayList->IsVisitingItems); REQUIRE(!ArrayList->IsVisitingItems);
/* record the original item */ /* record the original item */
CopyArrayItems((char *)&Result, 0, ArrayListItem_u Result;
CopyArrayItems(static_cast<char*>(&Result.Char), 0,
ArrayList->Array, ItemOffset, ArrayList->Array, ItemOffset,
1, ArrayList->ItemSize); 1, ArrayList->ItemSize);
@ -883,8 +838,6 @@ Boolean_t ArrayListInsert(ArrayList_pa Target,
LgIndex_t ItemOffset, LgIndex_t ItemOffset,
ArrayList_pa Source) ArrayList_pa Source)
{ {
Boolean_t IsOk = TRUE;
REQUIRE(ArrayListIsValid(Target)); REQUIRE(ArrayListIsValid(Target));
REQUIRE(ItemOffset >= 0); REQUIRE(ItemOffset >= 0);
REQUIRE(ArrayListIsValid(Source)); REQUIRE(ArrayListIsValid(Source));
@ -892,6 +845,8 @@ Boolean_t ArrayListInsert(ArrayList_pa Target,
REQUIRE(Target->Type == Source->Type); REQUIRE(Target->Type == Source->Type);
REQUIRE(!Target->IsVisitingItems); REQUIRE(!Target->IsVisitingItems);
Boolean_t IsOk = TRUE;
if (Source->Count != 0) if (Source->Count != 0)
{ {
LgIndex_t NeededCapacity; LgIndex_t NeededCapacity;
@ -960,14 +915,14 @@ Boolean_t ArrayListInsertItem(ArrayList_pa ArrayList,
LgIndex_t ItemOffset, LgIndex_t ItemOffset,
ArrayListItem_u Item) ArrayListItem_u Item)
{ {
Boolean_t IsOk = TRUE;
LgIndex_t NeededCapacity;
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
REQUIRE(ItemOffset >= 0); REQUIRE(ItemOffset >= 0);
REQUIRE(!ArrayList->IsVisitingItems); REQUIRE(!ArrayList->IsVisitingItems);
Boolean_t IsOk = TRUE;
/* if necessary enlarge the list to accommodate the request */ /* if necessary enlarge the list to accommodate the request */
LgIndex_t NeededCapacity;
if (ItemOffset > ArrayList->Count) if (ItemOffset > ArrayList->Count)
NeededCapacity = ItemOffset + 1; NeededCapacity = ItemOffset + 1;
else else
@ -998,7 +953,7 @@ Boolean_t ArrayListInsertItem(ArrayList_pa ArrayList,
/* insert the item */ /* insert the item */
CopyArrayItems(ArrayList->Array, ItemOffset, CopyArrayItems(ArrayList->Array, ItemOffset,
(char *)&Item, 0, static_cast<char*>(&Item.Char), 0,
1, ArrayList->ItemSize); 1, ArrayList->ItemSize);
} }
@ -1032,23 +987,21 @@ Boolean_t ArrayListVisitItems(ArrayList_pa ArrayList,
ArrayListItemVisitor_pf ItemVisitor, ArrayListItemVisitor_pf ItemVisitor,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
Boolean_t DoContinue = TRUE;
Boolean_t IsVisitingItems;
SmInteger_t ItemSize;
LgIndex_t Index;
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
REQUIRE(VALID_FN_REF(ItemVisitor)); REQUIRE(VALID_FN_REF(ItemVisitor));
IsVisitingItems = ArrayList->IsVisitingItems; Boolean_t IsVisitingItems = ArrayList->IsVisitingItems;
ArrayList->IsVisitingItems = TRUE; /* guards against structure changes */ ArrayList->IsVisitingItems = TRUE; /* guards against structure changes */
LgIndex_t Index;
SmInteger_t ItemSize;
Boolean_t DoContinue = TRUE;
for (Index = 0, ItemSize = ArrayList->ItemSize; for (Index = 0, ItemSize = ArrayList->ItemSize;
Index < Count && DoContinue; Index < Count && DoContinue;
Index++) Index++)
{ {
LgIndex_t ItemIndex = (Index + ItemOffset) * ItemSize; LgIndex_t ItemIndex = (Index + ItemOffset) * ItemSize;
DoContinue = ItemVisitor((void *) & ArrayList->Array[ItemIndex], ClientData); DoContinue = ItemVisitor(static_cast<void*>(&ArrayList->Array[ItemIndex]), ClientData);
} }
ArrayList->IsVisitingItems = IsVisitingItems; ArrayList->IsVisitingItems = IsVisitingItems;
@ -1079,13 +1032,11 @@ ArrayList_pa ArrayListGetItems(ArrayList_pa ArrayList,
LgIndex_t ItemOffset, LgIndex_t ItemOffset,
LgIndex_t Count) LgIndex_t Count)
{ {
ArrayList_pa Result;
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1); REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1);
REQUIRE(1 <= Count && ItemOffset + Count <= ArrayList->Count); REQUIRE(1 <= Count && ItemOffset + Count <= ArrayList->Count);
Result = ArrayListAlloc(Count, ArrayList->Type, ArrayList_pa Result = ArrayListAlloc(Count, ArrayList->Type,
ArrayList->CapacityRequestAdjuster, ArrayList->CapacityRequestAdjuster,
ArrayList->CapacityRequestAdjusterClientData); ArrayList->CapacityRequestAdjusterClientData);
if (Result != NULL) if (Result != NULL)
@ -1117,12 +1068,11 @@ ArrayList_pa ArrayListGetItems(ArrayList_pa ArrayList,
ArrayListItem_u ArrayListGetItem(ArrayList_pa ArrayList, ArrayListItem_u ArrayListGetItem(ArrayList_pa ArrayList,
LgIndex_t ItemOffset) LgIndex_t ItemOffset)
{ {
ArrayListItem_u Result;
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1); REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1);
CopyArrayItems((char *)&Result, 0, ArrayListItem_u Result;
CopyArrayItems(static_cast<char*>(&Result.Char), 0,
ArrayList->Array, ItemOffset, ArrayList->Array, ItemOffset,
1, ArrayList->ItemSize); 1, ArrayList->ItemSize);
@ -1150,13 +1100,13 @@ ArrayListItem_u ArrayListGetItem(ArrayList_pa ArrayList,
* return * return
* The internal reference to the requested item. * The internal reference to the requested item.
*/ */
const void *ArrayListGetItemInternalRef_FUNC(ArrayList_pa ArrayList, void const* ArrayListGetItemInternalRef_FUNC(ArrayList_pa ArrayList,
LgIndex_t ItemOffset) LgIndex_t ItemOffset)
{ {
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
REQUIRE(0 <= ItemOffset && ItemOffset <= ArrayList->Count - 1); 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)); ENSURE(Result == NULL || VALID_REF(Result));
return Result; return Result;
} }
@ -1190,14 +1140,14 @@ Boolean_t ArrayListSetItem(ArrayList_pa ArrayList,
ArrayListItemDestructor_pf ItemDestructor, ArrayListItemDestructor_pf ItemDestructor,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
Boolean_t IsOk = TRUE;
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
REQUIRE(ItemOffset >= 0); REQUIRE(ItemOffset >= 0);
REQUIRE(VALID_FN_REF(ItemDestructor) || ItemDestructor == NULL); REQUIRE(VALID_FN_REF(ItemDestructor) || ItemDestructor == NULL);
REQUIRE(IMPLICATION(ItemOffset + 1 > ArrayList->Count, REQUIRE(IMPLICATION(ItemOffset + 1 > ArrayList->Count,
!ArrayList->IsVisitingItems)); !ArrayList->IsVisitingItems));
Boolean_t IsOk = TRUE;
/* release the item if a destructor is installed */ /* release the item if a destructor is installed */
if (ItemDestructor != NULL && ItemOffset < ArrayList->Count) if (ItemDestructor != NULL && ItemOffset < ArrayList->Count)
DestroyItems(ArrayList, ItemOffset, ArrayList->ItemSize, 1, DestroyItems(ArrayList, ItemOffset, ArrayList->ItemSize, 1,
@ -1212,7 +1162,7 @@ Boolean_t ArrayListSetItem(ArrayList_pa ArrayList,
if (ItemOffset + 1 > ArrayList->Count) if (ItemOffset + 1 > ArrayList->Count)
ArrayList->Count = ItemOffset + 1; ArrayList->Count = ItemOffset + 1;
CopyArrayItems(ArrayList->Array, ItemOffset, CopyArrayItems(ArrayList->Array, ItemOffset,
(char *)&Item, 0, static_cast<char*>(&Item.Char), 0,
1, ArrayList->ItemSize); 1, ArrayList->ItemSize);
} }
@ -1237,12 +1187,10 @@ Boolean_t ArrayListSetItem(ArrayList_pa ArrayList,
Boolean_t ArrayListAppendItem(ArrayList_pa ArrayList, Boolean_t ArrayListAppendItem(ArrayList_pa ArrayList,
ArrayListItem_u Item) ArrayListItem_u Item)
{ {
Boolean_t IsOk;
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
REQUIRE(!ArrayList->IsVisitingItems); REQUIRE(!ArrayList->IsVisitingItems);
IsOk = ArrayListInsertItem(ArrayList, ArrayList->Count, Item); Boolean_t IsOk = ArrayListInsertItem(ArrayList, ArrayList->Count, Item);
ENSURE(ArrayListIsValid(ArrayList)); ENSURE(ArrayListIsValid(ArrayList));
ENSURE(VALID_BOOLEAN(IsOk)); ENSURE(VALID_BOOLEAN(IsOk));
@ -1265,15 +1213,13 @@ Boolean_t ArrayListAppendItem(ArrayList_pa ArrayList,
Boolean_t ArrayListAppend(ArrayList_pa Target, Boolean_t ArrayListAppend(ArrayList_pa Target,
ArrayList_pa Source) ArrayList_pa Source)
{ {
Boolean_t IsOk;
REQUIRE(ArrayListIsValid(Target)); REQUIRE(ArrayListIsValid(Target));
REQUIRE(ArrayListIsValid(Source)); REQUIRE(ArrayListIsValid(Source));
REQUIRE(Target != Source); REQUIRE(Target != Source);
REQUIRE(Target->Type == Source->Type); REQUIRE(Target->Type == Source->Type);
REQUIRE(!Target->IsVisitingItems); REQUIRE(!Target->IsVisitingItems);
IsOk = ArrayListInsert(Target, Target->Count, Source); Boolean_t IsOk = ArrayListInsert(Target, Target->Count, Source);
ENSURE(ArrayListIsValid(Target)); ENSURE(ArrayListIsValid(Target));
ENSURE(VALID_BOOLEAN(IsOk)); ENSURE(VALID_BOOLEAN(IsOk));
@ -1301,12 +1247,10 @@ ArrayList_pa ArrayListCopy(ArrayList_pa ArrayList,
ArrayListItemDuplicator_pf ItemDuplicator, ArrayListItemDuplicator_pf ItemDuplicator,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
ArrayList_pa Result;
REQUIRE(ArrayListIsValid(ArrayList)); REQUIRE(ArrayListIsValid(ArrayList));
REQUIRE(VALID_FN_REF(ItemDuplicator) || ItemDuplicator == NULL); REQUIRE(VALID_FN_REF(ItemDuplicator) || ItemDuplicator == NULL);
Result = ArrayListAlloc(ArrayList->Count, ArrayList->Type, ArrayList_pa Result = ArrayListAlloc(ArrayList->Count, ArrayList->Type,
ArrayList->CapacityRequestAdjuster, ArrayList->CapacityRequestAdjuster,
ArrayList->CapacityRequestAdjusterClientData); ArrayList->CapacityRequestAdjusterClientData);
if (Result != NULL && ArrayList->Count != 0) if (Result != NULL && ArrayList->Count != 0)
@ -1360,14 +1304,13 @@ void *ArrayListToArray(ArrayList_pa Source,
ArrayListItemDuplicator_pf ItemDuplicator, ArrayListItemDuplicator_pf ItemDuplicator,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
void *Result;
REQUIRE(ArrayListIsValid(Source)); REQUIRE(ArrayListIsValid(Source));
REQUIRE(VALID_FN_REF(ItemDuplicator) || ItemDuplicator == NULL); REQUIRE(VALID_FN_REF(ItemDuplicator) || ItemDuplicator == NULL);
void* Result;
if (Source->Count != 0) if (Source->Count != 0)
Result = (void *)ALLOC_ARRAY(Source->Count * Source->ItemSize, Result = static_cast<void*>(ALLOC_ARRAY(Source->Count * Source->ItemSize,
char, "native array"); char, "native array"));
else else
Result = NULL; Result = NULL;
@ -1376,20 +1319,20 @@ void *ArrayListToArray(ArrayList_pa Source,
Boolean_t IsOk = TRUE; Boolean_t IsOk = TRUE;
if (ItemDuplicator != NULL) if (ItemDuplicator != NULL)
/* client defines how the item duplication is performed */ /* client defines how the item duplication is performed */
IsOk = DuplicateItems((char*)Result, 0, IsOk = DuplicateItems(static_cast<char*>(Result), 0,
Source->Array, 0, Source->Array, 0,
Source->ItemSize, Source->Count, Source->ItemSize, Source->Count,
ItemDuplicator, ClientData); ItemDuplicator, ClientData);
else else
/* copy the original items into the result */ /* copy the original items into the result */
CopyArrayItems((char *)Result, 0, CopyArrayItems(static_cast<char*>(Result), 0,
Source->Array, 0, Source->Array, 0,
Source->Count, Source->Count,
Source->ItemSize); Source->ItemSize);
if (!IsOk) if (!IsOk)
{ {
/* Hack to remove delete warning... */ /* Hack to remove delete warning... */
char *Tmp = (char *)Result; char* Tmp = static_cast<char*>(Result);
FREE_ARRAY(Tmp, "native array"); FREE_ARRAY(Tmp, "native array");
} }
} }
@ -1427,27 +1370,25 @@ ArrayList_pa ArrayListFromArray(void *Source,
ArrayListItemDuplicator_pf ItemDuplicator, ArrayListItemDuplicator_pf ItemDuplicator,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
ArrayList_pa Result;
REQUIRE(VALID_REF(Source)); REQUIRE(VALID_REF(Source));
REQUIRE(Count >= 0); REQUIRE(Count >= 0);
REQUIRE(VALID_ENUM(Type, ArrayListType_e)); REQUIRE(VALID_ENUM(Type, ArrayListType_e));
REQUIRE(VALID_FN_REF(ItemDuplicator) || ItemDuplicator == NULL); 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) if (Result != NULL && Count != 0)
{ {
Boolean_t IsOk = TRUE; Boolean_t IsOk = TRUE;
if (ItemDuplicator != NULL) if (ItemDuplicator != NULL)
/* client defines how the item duplication is performed */ /* client defines how the item duplication is performed */
IsOk = DuplicateItems(Result->Array, 0, IsOk = DuplicateItems(Result->Array, 0,
(char*)Source, 0, static_cast<char*>(Source), 0,
Result->ItemSize, Count, Result->ItemSize, Count,
ItemDuplicator, ClientData); ItemDuplicator, ClientData);
else else
/* copy the original items into the result */ /* copy the original items into the result */
CopyArrayItems(Result->Array, 0, CopyArrayItems(Result->Array, 0,
(char *)Source, 0, static_cast<char*>(Source), 0,
Count, Result->ItemSize); Count, Result->ItemSize);
if (IsOk) if (IsOk)
Result->Count = Count; Result->Count = Count;
@ -1459,122 +1400,10 @@ ArrayList_pa ArrayListFromArray(void *Source,
return Result; 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 #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif #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 * Binary searches a sorted array looking for a match using the supplied
@ -1660,11 +1489,11 @@ Boolean_t ArrayListBSearch(ArrayList_pa ArrayList,
* return * return
* Reference to the array list's internal buffer. * 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)); REQUIRE(ArrayListIsValid(ArrayList));
const void *Result = ArrayListGetInternalRef_MACRO(ArrayList); void const* Result = ArrayListGetInternalRef_MACRO(ArrayList);
ENSURE(Result == NULL || VALID_REF(Result)); ENSURE(Result == NULL || VALID_REF(Result));
return Result; return Result;
} }

View file

@ -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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
#define TECPLOTENGINEMODULE #define TECPLOTENGINEMODULE
@ -29,7 +6,7 @@
***************************************************************** *****************************************************************
***************************************************************** *****************************************************************
******* ******** ******* ********
****** Copyright (C) 1988-2008 Tecplot, Inc. ******** ****** Copyright (C) 1988-2010 Tecplot, Inc. ********
******* All Rights Reserved. ******** ******* All Rights Reserved. ********
******* ******** ******* ********
***************************************************************** *****************************************************************
@ -41,6 +18,7 @@
#include "TASSERT.h" #include "TASSERT.h"
#include "Q_UNICODE.h" #include "Q_UNICODE.h"
#include "ALLOC.h" #include "ALLOC.h"
#include "CHARTYPE.h"
#include "STRUTIL.h" #include "STRUTIL.h"
#include "ARRLIST.h" #include "ARRLIST.h"
#include "DATASET.h" #include "DATASET.h"
@ -58,7 +36,7 @@ using namespace tecplot::strutil;
*/ */
typedef struct typedef struct
{ {
const char *Name; char const* Name;
ArbParam_t Value; ArbParam_t Value;
AuxDataType_e Type; AuxDataType_e Type;
Boolean_t Retain; Boolean_t Retain;
@ -66,15 +44,14 @@ typedef struct
/** /**
* Private auxiliary data item container structure. * Private auxiliary data item container structure.
* INVARIANT: ItemList is case-insensitive sorted by AuxDataItem->Name
*/ */
typedef struct _AuxData_s 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; /* <AuxDataItem_s *>[dynamic] */ ArrayList_pa ItemList; /* <AuxDataItem_s *>[dynamic] */
} AuxData_s; } AuxData_s;
static Mutex_pa AuxDataMutex = NULL;
/** /**
* A valid auxiliary data name character must begin with a '_' or alpha * 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)); REQUIRE(VALID_BOOLEAN(IsLeadChar));
IsValidNameChar = (Char == '_' || IsValidNameChar = (Char == '_' ||
isalpha(Char)); tecplot::isalpha(Char));
if (!IsLeadChar) if (!IsLeadChar)
IsValidNameChar = (IsValidNameChar || IsValidNameChar = (IsValidNameChar ||
Char == '.' || Char == '.' ||
isdigit(Char)); tecplot::isdigit(Char));
ENSURE(VALID_BOOLEAN(IsValidNameChar)); ENSURE(VALID_BOOLEAN(IsValidNameChar));
return IsValidNameChar; return IsValidNameChar;
@ -136,13 +113,13 @@ static void AuxDataItemDealloc(AuxDataItem_s **AuxDataItem)
if (*AuxDataItem != NULL) if (*AuxDataItem != NULL)
{ {
char *Name = (char *)(*AuxDataItem)->Name; char *Name = const_cast<char *>((*AuxDataItem)->Name);
if (Name != NULL) if (Name != NULL)
FREE_ARRAY(Name, "auxiliary name"); FREE_ARRAY(Name, "auxiliary name");
if ((*AuxDataItem)->Type == AuxDataType_String) if ((*AuxDataItem)->Type == AuxDataType_String)
{ {
char *Value = (char *)(*AuxDataItem)->Value; char *Value = reinterpret_cast<char *>((*AuxDataItem)->Value);
if (Value != NULL) if (Value != NULL)
FREE_ARRAY(Value, "auxiliary value"); FREE_ARRAY(Value, "auxiliary value");
} }
@ -161,35 +138,33 @@ static void AuxDataItemDealloc(AuxDataItem_s **AuxDataItem)
* *
* NOTE: Copies are made of the name and value. * NOTE: Copies are made of the name and value.
* *
* param Name * @param Name
* Auxiliary data item's name (case insenstive). * Auxiliary data item's name (case insenstive).
* param Value * @param Value
* Auxiliary data item's value. * Auxiliary data item's value.
* param Type * @param Type
* Auxiliary data item's value type. * Auxiliary data item's value type.
* param Retain * @param Retain
* Indicates if the auxiliary data item should persist. In other words * Indicates if the auxiliary data item should persist. In other words
* copied, saved, etc. * copied, saved, etc.
* *
* return * @return
* A new auxiliary data item or NULL if sufficient memory was not * A new auxiliary data item or NULL if sufficient memory was not
* available. * available.
*/ */
static AuxDataItem_s *AuxDataItemAlloc(const char *Name, static AuxDataItem_s* AuxDataItemAlloc(char const* Name,
ArbParam_t Value, ArbParam_t Value,
AuxDataType_e Type, AuxDataType_e Type,
Boolean_t Retain) Boolean_t Retain)
{ {
AuxDataItem_s *Result;
REQUIRE(VALID_REF(Name) && AuxDataIsValidName(Name)); REQUIRE(VALID_REF(Name) && AuxDataIsValidName(Name));
REQUIRE(IMPLICATION(Type == AuxDataType_String, REQUIRE(IMPLICATION(Type == AuxDataType_String,
(VALID_REF((char *)Value) || (VALID_REF(reinterpret_cast<char *>(Value)) ||
(char *)Value == NULL))); reinterpret_cast<char *>(Value) == NULL)));
REQUIRE(VALID_ENUM(Type, AuxDataType_e)); REQUIRE(VALID_ENUM(Type, AuxDataType_e));
REQUIRE(VALID_BOOLEAN(Retain)); 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) if (Result != NULL)
{ {
Boolean_t IsOk; Boolean_t IsOk;
@ -200,15 +175,15 @@ static AuxDataItem_s *AuxDataItemAlloc(const char *Name,
Result->Value = 0; /* to satisfy some compilers' uninitialized warnings */ Result->Value = 0; /* to satisfy some compilers' uninitialized warnings */
if (IsOk && Type == AuxDataType_String) if (IsOk && Type == AuxDataType_String)
{ {
char *strValue = (char *)Value; char *strValue = reinterpret_cast<char *>(Value);
if (strValue != NULL) if (strValue != NULL)
{ {
char *strCopy = DupString(dontTranslate(strValue)); char *strCopy = DupString(dontTranslate(strValue));
Result->Value = (ArbParam_t)strCopy; Result->Value = reinterpret_cast<ArbParam_t>(strCopy);
IsOk = (strCopy != NULL); IsOk = (strCopy != NULL);
} }
else else
Result->Value = (ArbParam_t)NULL; Result->Value = static_cast<ArbParam_t>(NULL);
} }
else else
CHECK(FALSE); CHECK(FALSE);
@ -236,10 +211,11 @@ static AuxDataItem_s *AuxDataItemAlloc(const char *Name,
static Boolean_t AuxDataItemListItemDestructor(void *ItemRef, static Boolean_t AuxDataItemListItemDestructor(void *ItemRef,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
AuxDataItem_s **AuxDataItemRef = (AuxDataItem_s **)ItemRef; AuxDataItem_s **AuxDataItemRef = static_cast<AuxDataItem_s **>(ItemRef);
REQUIRE(VALID_REF(AuxDataItemRef)); REQUIRE(VALID_REF(AuxDataItemRef));
REQUIRE(VALID_REF(*AuxDataItemRef) || *AuxDataItemRef == NULL); REQUIRE(VALID_REF(*AuxDataItemRef) || *AuxDataItemRef == NULL);
UNUSED(ClientData);
if (*AuxDataItemRef != NULL) if (*AuxDataItemRef != NULL)
AuxDataItemDealloc(AuxDataItemRef); AuxDataItemDealloc(AuxDataItemRef);
@ -263,10 +239,11 @@ static Boolean_t AuxDataItemListItemDestructor(void *ItemRef,
Boolean_t AuxDataItemDestructor(void *ItemRef, Boolean_t AuxDataItemDestructor(void *ItemRef,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
AuxData_pa *AuxDataRef = (AuxData_pa *)ItemRef; AuxData_pa *AuxDataRef = static_cast<AuxData_pa *>(ItemRef);
REQUIRE(VALID_REF(AuxDataRef)); REQUIRE(VALID_REF(AuxDataRef));
REQUIRE(VALID_REF(*AuxDataRef) || *AuxDataRef == NULL); REQUIRE(VALID_REF(*AuxDataRef) || *AuxDataRef == NULL);
UNUSED(ClientData);
if (*AuxDataRef != NULL) if (*AuxDataRef != NULL)
AuxDataDealloc(AuxDataRef); AuxDataDealloc(AuxDataRef);
@ -296,16 +273,16 @@ static Boolean_t AuxDataItemDuplicator(void *TargetItemRef,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
Boolean_t IsOk = TRUE; Boolean_t IsOk = TRUE;
AuxDataItem_s **TargetAuxDataItemRef = (AuxDataItem_s **)TargetItemRef; AuxDataItem_s **TargetAuxDataItemRef = static_cast<AuxDataItem_s **>(TargetItemRef);
AuxDataItem_s **SourceAuxDataItemRef = (AuxDataItem_s **)SourceItemRef; AuxDataItem_s **SourceAuxDataItemRef = static_cast<AuxDataItem_s **>(SourceItemRef);
Boolean_t ConsiderRetain; Boolean_t ConsiderRetain;
REQUIRE(VALID_REF(TargetAuxDataItemRef)); REQUIRE(VALID_REF(TargetAuxDataItemRef));
REQUIRE(VALID_REF(SourceAuxDataItemRef)); REQUIRE(VALID_REF(SourceAuxDataItemRef));
REQUIRE(VALID_REF(*SourceAuxDataItemRef) || *SourceAuxDataItemRef == NULL); REQUIRE(VALID_REF(*SourceAuxDataItemRef) || *SourceAuxDataItemRef == NULL);
REQUIRE(VALID_BOOLEAN((Boolean_t)ClientData)); REQUIRE(VALID_BOOLEAN(static_cast<Boolean_t>(ClientData)));
ConsiderRetain = (Boolean_t)ClientData; ConsiderRetain = static_cast<Boolean_t>(ClientData);
/* duplicate the item */ /* duplicate the item */
if (*SourceAuxDataItemRef != NULL && if (*SourceAuxDataItemRef != NULL &&
@ -331,7 +308,7 @@ static Boolean_t AuxDataItemDuplicator(void *TargetItemRef,
* param AuxData * param AuxData
* Reference to an auxiliary data handle or reference to NULL. * 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));
REQUIRE(VALID_REF(*AuxData) || *AuxData == NULL); REQUIRE(VALID_REF(*AuxData) || *AuxData == NULL);
@ -349,14 +326,17 @@ void AuxDataDealloc(AuxData_pa *AuxData)
/** /**
* Allocates an auxiliary data handle. * 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. * 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"); AuxData_pa Result = ALLOC_ITEM(AuxData_s, "auxiliary data container");
if (Result != NULL) if (Result != NULL)
{ {
Result->Owner = Owner;
Result->ItemList = ArrayListAlloc(0, ArrayListType_VoidPtr, NULL, 0); Result->ItemList = ArrayListAlloc(0, ArrayListType_VoidPtr, NULL, 0);
if (Result->ItemList == NULL) if (Result->ItemList == NULL)
AuxDataDealloc(&Result); AuxDataDealloc(&Result);
@ -441,7 +421,7 @@ AuxData_pa AuxDataCopy(AuxData_pa AuxData,
* return * return
* Number of items maintained by the auxiliary data. * Number of items maintained by the auxiliary data.
*/ */
LgIndex_t AuxDataGetNumItems(AuxData_pa AuxData) LgIndex_t LIBCALL AuxDataGetNumItems(AuxData_pa AuxData)
{ {
LgIndex_t NumItems; LgIndex_t NumItems;
@ -482,40 +462,17 @@ Boolean_t AuxDataGetItemIndex(AuxData_pa AuxData,
REQUIRE(VALID_REF(Name) && AuxDataIsValidName(Name)); REQUIRE(VALID_REF(Name) && AuxDataIsValidName(Name));
REQUIRE(VALID_REF(ItemIndex)); 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); NumItems = AuxDataGetNumItems(AuxData);
# if defined DO_LINEAR_SEARCH
{
for (Index = 0; Index < NumItems; Index++)
{
AuxDataItem_s *AuxDataItem =
(AuxDataItem_s *)ArrayListGetVoidPtr(AuxData->ItemList, Index);
int CompareResult = ustrcmp(AuxDataItem->Name, Name);
if (CompareResult >= 0)
{
FoundItem = (CompareResult == 0);
break;
}
}
}
# else
{
int low, high; int low, high;
low = 0; low = 0;
high = NumItems - 1; high = NumItems - 1;
Index = 0; Index = 0;
while (low <= high) while (low <= high)
{ {
AuxDataItem_s *AuxDataItem;
int CompareResult; int CompareResult;
Index = (low + high) / 2; Index = (low + high) / 2;
AuxDataItem = (AuxDataItem_s *)ArrayListGetVoidPtr(AuxData->ItemList, Index); AuxDataItem_s* AuxDataItem = static_cast<AuxDataItem_s *>(ArrayListGetVoidPtr(AuxData->ItemList, Index));
CompareResult = ustrcmp(Name, AuxDataItem->Name); CompareResult = ustrcmp(Name, AuxDataItem->Name);
if (CompareResult < 0) if (CompareResult < 0)
high = Index - 1; /* If the new name is "less" than the one we're comparing to, high = Index - 1; /* If the new name is "less" than the one we're comparing to,
@ -530,8 +487,6 @@ Boolean_t AuxDataGetItemIndex(AuxData_pa AuxData,
break; break;
} }
} }
}
# endif
*ItemIndex = Index; *ItemIndex = Index;
@ -560,7 +515,7 @@ Boolean_t AuxDataGetItemIndex(AuxData_pa AuxData,
* param Retain * param Retain
* Address to hold the auxiliary data item retain flag. * Address to hold the auxiliary data item retain flag.
*/ */
void AuxDataGetItemByIndex(AuxData_pa AuxData, void LIBCALL AuxDataGetItemByIndex(AuxData_pa AuxData,
LgIndex_t Index, LgIndex_t Index,
const char **Name, const char **Name,
ArbParam_t *Value, ArbParam_t *Value,
@ -577,7 +532,7 @@ void AuxDataGetItemByIndex(AuxData_pa AuxData,
REQUIRE(VALID_REF(Type)); REQUIRE(VALID_REF(Type));
REQUIRE(VALID_REF(Retain)); REQUIRE(VALID_REF(Retain));
AuxDataItem = (AuxDataItem_s *)ArrayListGetVoidPtr(AuxData->ItemList, Index); AuxDataItem = static_cast<AuxDataItem_s *>(ArrayListGetVoidPtr(AuxData->ItemList, Index));
*Name = AuxDataItem->Name; *Name = AuxDataItem->Name;
*Value = AuxDataItem->Value; *Value = AuxDataItem->Value;
*Type = AuxDataItem->Type; *Type = AuxDataItem->Type;
@ -585,8 +540,8 @@ void AuxDataGetItemByIndex(AuxData_pa AuxData,
ENSURE(VALID_REF(*Name) && AuxDataIsValidName(*Name)); ENSURE(VALID_REF(*Name) && AuxDataIsValidName(*Name));
ENSURE(IMPLICATION(*Type == AuxDataType_String, ENSURE(IMPLICATION(*Type == AuxDataType_String,
(VALID_REF((char *)(*Value)) || (VALID_REF(reinterpret_cast<char *>(*Value)) ||
(char *)(*Value) == NULL))); reinterpret_cast<char *>(*Value) == NULL)));
ENSURE(VALID_ENUM(*Type, AuxDataType_e)); ENSURE(VALID_ENUM(*Type, AuxDataType_e));
ENSURE(VALID_BOOLEAN(*Retain)); ENSURE(VALID_BOOLEAN(*Retain));
} }
@ -639,8 +594,8 @@ Boolean_t AuxDataGetItemByName(AuxData_pa AuxData,
ENSURE(VALID_BOOLEAN(FoundItem)); ENSURE(VALID_BOOLEAN(FoundItem));
ENSURE(IMPLICATION(FoundItem, ENSURE(IMPLICATION(FoundItem,
IMPLICATION(*Type == AuxDataType_String, IMPLICATION(*Type == AuxDataType_String,
(VALID_REF((char *)(*Value)) || (VALID_REF(reinterpret_cast<char *>(*Value)) ||
(char *)(*Value) == NULL)))); reinterpret_cast<char *>(*Value) == NULL))));
ENSURE(IMPLICATION(FoundItem, ENSURE(IMPLICATION(FoundItem,
VALID_ENUM(*Type, AuxDataType_e))); VALID_ENUM(*Type, AuxDataType_e)));
ENSURE(IMPLICATION(FoundItem, ENSURE(IMPLICATION(FoundItem,
@ -675,13 +630,13 @@ Boolean_t AuxDataGetBooleanItemByName(AuxData_pa AuxData, /* IN */
Retain); Retain);
if (FoundItem && if (FoundItem &&
(ustrcmp((char *)strValue, "YES") == 0 || (ustrcmp(reinterpret_cast<char *>(strValue), "YES") == 0 ||
ustrcmp((char *)strValue, "YEP") == 0 || ustrcmp(reinterpret_cast<char *>(strValue), "YEP") == 0 ||
ustrcmp((char *)strValue, "Y") == 0 || ustrcmp(reinterpret_cast<char *>(strValue), "Y") == 0 ||
ustrcmp((char *)strValue, "TRUE") == 0 || ustrcmp(reinterpret_cast<char *>(strValue), "TRUE") == 0 ||
ustrcmp((char *)strValue, "T") == 0 || ustrcmp(reinterpret_cast<char *>(strValue), "T") == 0 ||
ustrcmp((char *)strValue, "ON") == 0 || ustrcmp(reinterpret_cast<char *>(strValue), "ON") == 0 ||
ustrcmp((char *)strValue, "1") == 0)) ustrcmp(reinterpret_cast<char *>(strValue), "1") == 0))
{ {
*Value = TRUE; *Value = TRUE;
} }
@ -702,47 +657,44 @@ Boolean_t AuxDataGetBooleanItemByName(AuxData_pa AuxData, /* IN */
* *
* NOTE: The auxiliary data makes copies of the name and value. * NOTE: The auxiliary data makes copies of the name and value.
* *
* param AuxData * @param AuxData
* Auxiliary data handle. * Auxiliary data handle.
* param Name * @param Name
* Auxiliary data item's name (case insenstive). * Auxiliary data item's name (case insenstive).
* param Value * @param Value
* Auxiliary data item's value. * Auxiliary data item's value.
* param Type * @param Type
* Auxiliary data item's value type. * Auxiliary data item's value type.
* param Retain * @param Retain
* Indicates if the auxiliary data item should persist. * Indicates if the auxiliary data item should persist.
* *
* return * @return
* TRUE if the item was added to the auxiliary data. * TRUE if the item was added to the auxiliary data.
*/ */
Boolean_t AuxDataSetItem(AuxData_pa AuxData, Boolean_t AuxDataSetItem(AuxData_pa AuxData,
const char *Name, char const* Name,
ArbParam_t Value, ArbParam_t Value,
AuxDataType_e Type, AuxDataType_e Type,
Boolean_t Retain) Boolean_t Retain)
{ {
Boolean_t IsOk;
AuxDataItem_s *AuxDataItem;
REQUIRE(VALID_REF(AuxData)); REQUIRE(VALID_REF(AuxData));
INVARIANT("AuxData->ItemList is case-insensitive sorted by AuxDataItem->Name"); INVARIANT("AuxData->ItemList is case-insensitive sorted by AuxDataItem->Name");
REQUIRE(VALID_REF(Name) && AuxDataIsValidName(Name)); REQUIRE(VALID_REF(Name) && AuxDataIsValidName(Name));
REQUIRE(IMPLICATION(Type == AuxDataType_String, REQUIRE(IMPLICATION(Type == AuxDataType_String,
(VALID_REF((char *)Value) || (VALID_REF(reinterpret_cast<char *>(Value)) ||
(char *)Value == NULL))); reinterpret_cast<char *>(Value) == NULL)));
REQUIRE(VALID_ENUM(Type, AuxDataType_e)); REQUIRE(VALID_ENUM(Type, AuxDataType_e));
REQUIRE(VALID_BOOLEAN(Retain)); REQUIRE(VALID_BOOLEAN(Retain));
AuxDataItem = AuxDataItemAlloc(Name, Value, Type, Retain); AuxDataItem_s* AuxDataItem = AuxDataItemAlloc(Name, Value, Type, Retain);
IsOk = (AuxDataItem != NULL); Boolean_t IsOk = (AuxDataItem != NULL);
if (IsOk) if (IsOk)
{ {
LgIndex_t ItemIndex; LgIndex_t ItemIndex;
ArrayListItem_u ListItem; ArrayListItem_u ListItem;
/* add or replace the item to the list */ /* add or replace the item to the list */
ListItem.VoidPtr = (void *)AuxDataItem; ListItem.VoidPtr = static_cast<void *>(AuxDataItem);
if (!AuxDataGetItemIndex(AuxData, Name, &ItemIndex)) if (!AuxDataGetItemIndex(AuxData, Name, &ItemIndex))
IsOk = ArrayListInsertItem(AuxData->ItemList, ItemIndex, ListItem); IsOk = ArrayListInsertItem(AuxData->ItemList, ItemIndex, ListItem);
else else

View file

@ -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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
#define TECPLOTENGINEMODULE #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 **CustomLabelBase,
StringList_pa *UserRec, StringList_pa *UserRec,
AuxData_pa *DataSetAuxData, AuxData_pa *DataSetAuxData,
ArbParam_t AuxDataOwner,
Set_pa **IsVarCellCentered, /* Create an Array dim by zones */ Set_pa **IsVarCellCentered, /* Create an Array dim by zones */
Boolean_t *HasText, Boolean_t *HasText,
Boolean_t *HasGeoms, Boolean_t *HasGeoms,
@ -235,12 +213,12 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream,
if (IsOk && (UserRec != NULL && *UserRec == NULL)) if (IsOk && (UserRec != NULL && *UserRec == NULL))
{ {
*UserRec = StringListAlloc(); *UserRec = StringListAlloc();
IsOk = (Boolean_t)(*UserRec != NULL); IsOk = static_cast<Boolean_t>(*UserRec != NULL);
} }
if (IsOk && (DataSetAuxData != NULL && *DataSetAuxData == NULL)) if (IsOk && (DataSetAuxData != NULL && *DataSetAuxData == NULL))
{ {
*DataSetAuxData = AuxDataAlloc(); *DataSetAuxData = AuxDataAlloc(AuxDataOwner);
IsOk = (Boolean_t)(*DataSetAuxData != NULL); IsOk = static_cast<Boolean_t>(*DataSetAuxData != NULL);
} }
if (IsOk && (VarAuxDataList != NULL && *VarAuxDataList == NULL) && *NumVars > 0) 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 * Now allocate a set for each zone
*/ */
(*IsVarCellCentered)[Z] = AllocSet(FALSE); (*IsVarCellCentered)[Z] = AllocSet(FALSE);
IsOk = (Boolean_t)((*IsVarCellCentered)[Z] != NULL); IsOk = static_cast<Boolean_t>((*IsVarCellCentered)[Z] != NULL);
} }
} }
else else
@ -303,13 +281,13 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream,
IsOk = ReadInDataFileTypeTitleAndVarNames(FileStream, IsOk = ReadInDataFileTypeTitleAndVarNames(FileStream,
IVersion, IVersion,
((Pass == 2) ? &S : (char **)NULL), ((Pass == 2) ? &S : static_cast<char **>(NULL)),
((Pass == 2) ? FileType : (DataFileType_e *)NULL), ((Pass == 2) ? FileType : static_cast<DataFileType_e *>(NULL)),
&INumVars, &INumVars,
((Pass == 2) ? VarNames : (StringList_pa *)NULL)); ((Pass == 2) ? VarNames : static_cast<StringList_pa *>(NULL)));
if (IsOk) if (IsOk)
*NumVars = (EntIndex_t)INumVars; *NumVars = static_cast<EntIndex_t>(INumVars);
if ((Pass == 2) && S && IsOk && DataSetTitle) if ((Pass == 2) && S && IsOk && DataSetTitle)
*DataSetTitle = S; *DataSetTitle = S;
@ -341,7 +319,7 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream,
LgIndex_t LocalFNNumBndryConns; LgIndex_t LocalFNNumBndryConns;
IsOk = ReadInZoneHeader(FileStream, IVersion, ZoneSpec, IsOk = ReadInZoneHeader(FileStream, IVersion, ZoneSpec,
OkToLoad ? (*IsVarCellCentered)[*NumZones] : NULL, OkToLoad ? (*IsVarCellCentered)[*NumZones] : NULL,
*NumVars, &LocalIsRawFNAvailable, *NumVars, AuxDataOwner, &LocalIsRawFNAvailable,
&LocalFNNumBndryConns); &LocalFNNumBndryConns);
if (IsOk && OkToLoad && IsRawFNAvailable != NULL) if (IsOk && OkToLoad && IsRawFNAvailable != NULL)
{ {
@ -362,7 +340,7 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream,
if (IsOk) if (IsOk)
{ {
ArrayListItem_u CurZoneSpecItem; ArrayListItem_u CurZoneSpecItem;
CurZoneSpecItem.VoidPtr = (void *)ZoneSpec; CurZoneSpecItem.VoidPtr = static_cast<void *>(ZoneSpec);
ArrayListSetItem(*ZoneSpecList, *NumZones, ArrayListSetItem(*ZoneSpecList, *NumZones,
CurZoneSpecItem, CurZoneSpecItem,
ZoneSpecItemDestructor, 0); ZoneSpecItemDestructor, 0);
@ -471,12 +449,12 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream,
Boolean_t OkToLoad; Boolean_t OkToLoad;
char *CurUserRec = NULL; char *CurUserRec = NULL;
OkToLoad = (Boolean_t)((Pass == 2) && UserRec); OkToLoad = static_cast<Boolean_t>((Pass == 2) && UserRec);
IsOk = ReadInUserRec(FileStream, IsOk = ReadInUserRec(FileStream,
IVersion, IVersion,
500, 500,
OkToLoad ? &CurUserRec : (char **)NULL); OkToLoad ? &CurUserRec : static_cast<char **>(NULL));
if (IsOk && OkToLoad) if (IsOk && OkToLoad)
IsOk = StringListAppendString(*UserRec, CurUserRec); IsOk = StringListAppendString(*UserRec, CurUserRec);
if (CurUserRec) if (CurUserRec)
@ -510,10 +488,10 @@ Boolean_t ReadDataFileHeader(FileStream_s *FileStream,
AuxData_pa VarAuxData; AuxData_pa VarAuxData;
if (OkToLoad) if (OkToLoad)
{ {
VarAuxData = (AuxData_pa)ArrayListGetVoidPtr(*VarAuxDataList, VarNum); VarAuxData = static_cast<AuxData_pa>(ArrayListGetVoidPtr(*VarAuxDataList, VarNum));
if (VarAuxData == NULL) if (VarAuxData == NULL)
{ {
VarAuxData = AuxDataAlloc(); VarAuxData = AuxDataAlloc(AuxDataOwner);
IsOk = (VarAuxData != NULL && IsOk = (VarAuxData != NULL &&
ArrayListSetVoidPtr(*VarAuxDataList, VarNum, VarAuxData)); ArrayListSetVoidPtr(*VarAuxDataList, VarNum, VarAuxData));
} }

View file

@ -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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
#define TECPLOTENGINEMODULE #define TECPLOTENGINEMODULE
@ -29,16 +6,22 @@
****************************************************************** ******************************************************************
****************************************************************** ******************************************************************
******* ******** ******* ********
****** (C) 1988-2008 Tecplot, Inc. ******* ****** (C) 1988-2010 Tecplot, Inc. *******
******* ******** ******* ********
****************************************************************** ******************************************************************
****************************************************************** ******************************************************************
*/ */
#define DATASETMODULE #define DATASETMODULE
#if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */
#endif
#include "GLOBAL.h" #include "GLOBAL.h"
#include "TASSERT.h" #include "TASSERT.h"
#include "Q_UNICODE.h" #include "Q_UNICODE.h"
#include "CHARTYPE.h"
#include "STRUTIL.h" #include "STRUTIL.h"
#include "AUXDATA.h" #include "AUXDATA.h"
#include "ARRLIST.h" #include "ARRLIST.h"
@ -50,6 +33,9 @@
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#else /* !TECPLOTKERNEL */
#define DECLARE_NUMERIC_LOCALE_SETTER
#define VALID_NUMERIC_LOCALE() (true)
#endif #endif
#include "DATASET0.h" #include "DATASET0.h"
@ -118,10 +104,11 @@ void ZoneSpecDealloc(ZoneSpec_s **ZoneSpec)
Boolean_t ZoneSpecItemDestructor(void *ItemRef, Boolean_t ZoneSpecItemDestructor(void *ItemRef,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
ZoneSpec_s **ZoneSpecRef = (ZoneSpec_s **)ItemRef; ZoneSpec_s **ZoneSpecRef = static_cast<ZoneSpec_s **>(ItemRef);
REQUIRE(VALID_REF(ZoneSpecRef)); REQUIRE(VALID_REF(ZoneSpecRef));
REQUIRE(VALID_REF(*ZoneSpecRef) || *ZoneSpecRef == NULL); REQUIRE(VALID_REF(*ZoneSpecRef) || *ZoneSpecRef == NULL);
UNUSED(ClientData);
if (*ZoneSpecRef != NULL) if (*ZoneSpecRef != NULL)
ZoneSpecDealloc(ZoneSpecRef); ZoneSpecDealloc(ZoneSpecRef);
@ -187,7 +174,7 @@ ZoneSpec_s *ZoneSpecAlloc(void)
{ {
ZoneSpec_s *Result; ZoneSpec_s *Result;
Result = (ZoneSpec_s *)ALLOC_ITEM(ZoneSpec_s, "ZoneSpec structure"); Result = static_cast<ZoneSpec_s *>(ALLOC_ITEM(ZoneSpec_s, "ZoneSpec structure"));
if (Result != NULL) if (Result != NULL)
SetZoneSpecDefaults(Result); SetZoneSpecDefaults(Result);
@ -243,6 +230,7 @@ LgIndex_t ZoneOrVarListAdjustCapacityRequest(ArrayList_pa ZoneOrVarArrayList,
REQUIRE((RequestedCapacity == 0 && CurrentCapacity == 0) || REQUIRE((RequestedCapacity == 0 && CurrentCapacity == 0) ||
RequestedCapacity > CurrentCapacity); RequestedCapacity > CurrentCapacity);
REQUIRE(CurrentCapacity <= MaxNumZonesOrVars); REQUIRE(CurrentCapacity <= MaxNumZonesOrVars);
UNUSED(ClientData);
if (RequestedCapacity <= MaxNumZonesOrVars) if (RequestedCapacity <= MaxNumZonesOrVars)
{ {

View file

@ -1,35 +1,16 @@
/* #if defined TECPLOTKERNEL
* NOTICE and LICENSE for Tecplot Input/Output Library (TecIO) - OpenFOAM /* CORE SOURCE CODE REMOVED */
* #endif
* 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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
#define TECPLOTENGINEMODULE #define TECPLOTENGINEMODULE
/* /*
****************************************************************** ******************************************************************
****************************************************************** ******************************************************************
******* ******** ******* ********
****** (C) 1988-2008 Tecplot, Inc. ******* ****** (C) 1988-2010 Tecplot, Inc. *******
******* ******** ******* ********
****************************************************************** ******************************************************************
****************************************************************** ******************************************************************
@ -43,12 +24,11 @@
#include "ARRLIST.h" #include "ARRLIST.h"
#include "DATASET.h" #include "DATASET.h"
#include "SET.h" #include "SET.h"
#include "DATASHR.h"
#include "FILESTREAM.h" #include "FILESTREAM.h"
#include "Q_MSG.h"
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif #endif
#include "Q_MSG.h"
#include "DATASET0.h" #include "DATASET0.h"
using namespace tecplot::strutil; using namespace tecplot::strutil;
@ -72,11 +52,11 @@ void OutOfMemoryMsg(void)
/** /**
*/ */
FieldData_pa FieldDataAlloc(void) FieldData_pa FieldDataAlloc(Boolean_t doTrackVarSharing)
{ {
FieldData_pa Result; FieldData_pa Result;
Result = (FieldData_pa)ALLOC_ITEM(struct _FieldData_a, "FieldDataPtr"); Result = static_cast<FieldData_pa>(ALLOC_ITEM(struct _FieldData_a, "FieldDataPtr"));
if (Result != NULL) if (Result != NULL)
{ {
Result->Data = NULL; Result->Data = NULL;
@ -94,8 +74,9 @@ FieldData_pa FieldDataAlloc(void)
Result->Type = FieldDataType_Invalid; Result->Type = FieldDataType_Invalid;
Result->ValueLocation = ValueLocation_Invalid; Result->ValueLocation = ValueLocation_Invalid;
Result->RefCount = 1; /* self */ #if defined TECPLOTKERNEL /* TecIO doesn't require these features yet */
Result->VarShareRefCount = 1; /* self */ /* CORE SOURCE CODE REMOVED */
#endif
Result->NumValues = 0; 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 */ /* CORE SOURCE CODE REMOVED */
@ -121,7 +102,7 @@ void FieldDataDeallocData(FieldData_pa FieldData)
if (FieldData->Data != NULL) if (FieldData->Data != NULL)
{ {
/* Hack to remove 'deleting void* is undefined' warning... */ /* Hack to remove 'deleting void* is undefined' warning... */
char *Tmp = (char *)FieldData->Data; char *Tmp = static_cast<char *>(FieldData->Data);
FREE_ARRAY(Tmp, "FieldData _Data"); FREE_ARRAY(Tmp, "FieldData _Data");
FieldData->Data = NULL; FieldData->Data = NULL;
} }
@ -185,18 +166,6 @@ void FieldDataDeallocData(FieldData_pa FieldData)
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif #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) void FieldDataCleanup(FieldData_pa FieldData)
@ -217,20 +186,15 @@ void FieldDataDealloc(FieldData_pa *FieldData,
{ {
REQUIRE(VALID_REF(FieldData)); REQUIRE(VALID_REF(FieldData));
REQUIRE(VALID_REF(*FieldData) || *FieldData == NULL); REQUIRE(VALID_REF(*FieldData) || *FieldData == NULL);
REQUIRE(IMPLICATION(*FieldData != NULL, #if defined TECPLOTKERNEL
IsStructureReferenced(*FieldData))); /* CORE SOURCE CODE REMOVED */
REQUIRE(IMPLICATION(*FieldData != NULL && DoTrackVarSharing, #endif
IsVarStructureReferenced(*FieldData)));
REQUIRE(VALID_BOOLEAN(DoTrackVarSharing));
REQUIRE(IMPLICATION(*FieldData != NULL,
(*FieldData)->RefCount >= (*FieldData)->VarShareRefCount));
if (*FieldData != NULL) if (*FieldData != NULL)
{ {
if (DoTrackVarSharing) #if defined TECPLOTKERNEL
DecVarStructureReference(*FieldData); /* CORE SOURCE CODE REMOVED */
DecStructureReference(*FieldData); #endif
if (!IsStructureReferenced(*FieldData))
{ {
FieldDataCleanup(*FieldData); FieldDataCleanup(*FieldData);
@ -248,14 +212,6 @@ void FieldDataDealloc(FieldData_pa *FieldData,
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* 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 #endif
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
@ -269,11 +225,21 @@ static void copyTypedValueArray(void* DstArray,
LgIndex_t SrcStart, LgIndex_t SrcStart,
LgIndex_t SrcEnd) LgIndex_t SrcEnd)
{ {
T* SrcPtr = ((T*)SrcArray) + SrcStart; REQUIRE(VALID_REF(DstArray));
T* DstPtr = ((T*)DstArray) + DstStart; REQUIRE(DstStart >= 0);
size_t numBytes = sizeof(T) * (SrcEnd - SrcStart + 1); 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<T const*>(SrcArray)) + SrcStart;
T* DstPtr = (static_cast<T*>(DstArray)) + DstStart;
memcpy(DstPtr, SrcPtr, numBytes); memcpy(DstPtr, SrcPtr, numBytes);
} }
}
/** /**
* DstArray and SrcArray are aligned on proper word boundaries. * DstArray and SrcArray are aligned on proper word boundaries.
*/ */
@ -289,7 +255,7 @@ void CopyTypedValueArray(FieldDataType_e ValueType,
REQUIRE(VALID_REF(DstArray)); REQUIRE(VALID_REF(DstArray));
REQUIRE(DstStart >= 0); REQUIRE(DstStart >= 0);
REQUIRE(VALID_REF(SrcArray)); REQUIRE(VALID_REF(SrcArray));
REQUIRE(0 <= SrcStart && SrcStart <= SrcEnd); REQUIRE(0 <= SrcStart && SrcStart <= SrcEnd+1);
REQUIRE(DstArray != SrcArray); REQUIRE(DstArray != SrcArray);
switch (ValueType) switch (ValueType)
@ -356,8 +322,8 @@ void SwapBytesInTypedValueArray(FieldDataType_e ValueType,
case FieldDataType_Double: case FieldDataType_Double:
{ {
/* swap 8 bytes blocks */ /* swap 8 bytes blocks */
UInt64_t *SrcPtr = ((UInt64_t *)SrcArray) + SrcStart; UInt64_t *SrcPtr = (static_cast<UInt64_t *>(SrcArray)) + SrcStart;
UInt64_t *SrcPtrEnd = ((UInt64_t *)SrcArray) + SrcEnd; UInt64_t *SrcPtrEnd = (static_cast<UInt64_t *>(SrcArray)) + SrcEnd;
CHECK(sizeof(UInt64_t) == 8 && sizeof(double) == 8); CHECK(sizeof(UInt64_t) == 8 && sizeof(double) == 8);
while (SrcPtr <= SrcPtrEnd) while (SrcPtr <= SrcPtrEnd)
{ {
@ -369,8 +335,8 @@ void SwapBytesInTypedValueArray(FieldDataType_e ValueType,
case FieldDataType_Int32: case FieldDataType_Int32:
{ {
/* swap 4 bytes blocks */ /* swap 4 bytes blocks */
UInt32_t *SrcPtr = ((UInt32_t *)SrcArray) + SrcStart; UInt32_t *SrcPtr = (static_cast<UInt32_t *>(SrcArray)) + SrcStart;
UInt32_t *SrcPtrEnd = ((UInt32_t *)SrcArray) + SrcEnd; UInt32_t *SrcPtrEnd = (static_cast<UInt32_t *>(SrcArray)) + SrcEnd;
CHECK(sizeof(UInt32_t) == 4 && sizeof(float) == 4); CHECK(sizeof(UInt32_t) == 4 && sizeof(float) == 4);
while (SrcPtr <= SrcPtrEnd) while (SrcPtr <= SrcPtrEnd)
{ {
@ -381,8 +347,8 @@ void SwapBytesInTypedValueArray(FieldDataType_e ValueType,
case FieldDataType_Int16: case FieldDataType_Int16:
{ {
/* swap 4 bytes blocks */ /* swap 4 bytes blocks */
UInt16_t *SrcPtr = ((UInt16_t *)SrcArray) + SrcStart; UInt16_t *SrcPtr = (static_cast<UInt16_t *>(SrcArray)) + SrcStart;
UInt16_t *SrcPtrEnd = ((UInt16_t *)SrcArray) + SrcEnd; UInt16_t *SrcPtrEnd = (static_cast<UInt16_t *>(SrcArray)) + SrcEnd;
CHECK(sizeof(UInt16_t) == 2); CHECK(sizeof(UInt16_t) == 2);
while (SrcPtr <= SrcPtrEnd) while (SrcPtr <= SrcPtrEnd)
{ {
@ -421,8 +387,8 @@ void SwapBytesInUnalignedTypedValueArray(FieldDataType_e ValueType,
case FieldDataType_Double: case FieldDataType_Double:
{ {
/* swap 8-byte blocks */ /* swap 8-byte blocks */
Byte_t *SrcPtr = ((Byte_t *)SrcArray) + SrcStart * sizeof(UInt64_t); Byte_t *SrcPtr = (static_cast<Byte_t *>(SrcArray)) + SrcStart * sizeof(UInt64_t);
Byte_t *SrcPtrEnd = ((Byte_t *)SrcArray) + SrcEnd * sizeof(UInt64_t); Byte_t *SrcPtrEnd = (static_cast<Byte_t *>(SrcArray)) + SrcEnd * sizeof(UInt64_t);
size_t byte_skip = SrcSkip * sizeof(UInt64_t); size_t byte_skip = SrcSkip * sizeof(UInt64_t);
CHECK(sizeof(UInt64_t) == 8 && sizeof(double) == 8); CHECK(sizeof(UInt64_t) == 8 && sizeof(double) == 8);
while (SrcPtr <= SrcPtrEnd) while (SrcPtr <= SrcPtrEnd)
@ -435,8 +401,8 @@ void SwapBytesInUnalignedTypedValueArray(FieldDataType_e ValueType,
case FieldDataType_Int32: case FieldDataType_Int32:
{ {
/* swap 4-byte blocks */ /* swap 4-byte blocks */
Byte_t *SrcPtr = ((Byte_t *)SrcArray) + SrcStart * sizeof(UInt32_t); Byte_t *SrcPtr = (static_cast<Byte_t *>(SrcArray)) + SrcStart * sizeof(UInt32_t);
Byte_t *SrcPtrEnd = ((Byte_t *)SrcArray) + SrcEnd * sizeof(UInt32_t); Byte_t *SrcPtrEnd = (static_cast<Byte_t *>(SrcArray)) + SrcEnd * sizeof(UInt32_t);
size_t byte_skip = SrcSkip * sizeof(UInt32_t); size_t byte_skip = SrcSkip * sizeof(UInt32_t);
CHECK(sizeof(UInt32_t) == 4 && sizeof(float) == 4); CHECK(sizeof(UInt32_t) == 4 && sizeof(float) == 4);
while (SrcPtr <= SrcPtrEnd) while (SrcPtr <= SrcPtrEnd)
@ -448,8 +414,8 @@ void SwapBytesInUnalignedTypedValueArray(FieldDataType_e ValueType,
case FieldDataType_Int16: case FieldDataType_Int16:
{ {
/* swap 2-byte blocks */ /* swap 2-byte blocks */
Byte_t *SrcPtr = ((Byte_t *)SrcArray) + SrcStart * sizeof(UInt16_t); Byte_t *SrcPtr = (static_cast<Byte_t *>(SrcArray)) + SrcStart * sizeof(UInt16_t);
Byte_t *SrcPtrEnd = ((Byte_t *)SrcArray) + SrcEnd * sizeof(UInt16_t); Byte_t *SrcPtrEnd = (static_cast<Byte_t *>(SrcArray)) + SrcEnd * sizeof(UInt16_t);
size_t byte_skip = SrcSkip * sizeof(UInt16_t); size_t byte_skip = SrcSkip * sizeof(UInt16_t);
CHECK(sizeof(UInt16_t) == 2); CHECK(sizeof(UInt16_t) == 2);
while (SrcPtr <= SrcPtrEnd) while (SrcPtr <= SrcPtrEnd)
@ -509,6 +475,14 @@ void SwapBytesInUnalignedTypedValueArray(FieldDataType_e ValueType,
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif #endif
#if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */
#endif
#if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */
#endif
#if defined DEBUG_FIELDVALUES #if defined DEBUG_FIELDVALUES
# define DEBUG_FIELDVALUES_BAD_VALUE 0x11 # define DEBUG_FIELDVALUES_BAD_VALUE 0x11
static unsigned char BadValueStr[] = static unsigned char BadValueStr[] =
@ -531,7 +505,7 @@ static unsigned char BadValueStr[] =
# else # else
# define FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, type) \ # define FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, type) \
((sizeof(type) < 4) /* cannot make reliably test with less than four bytes */ || \ ((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<char *>((fd)->Data))+sizeof(type)*(pt), sizeof(type)) != 0)
# endif # endif
#else #else
# define FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, type) TRUE # 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(0 <= pt && pt < GetFieldDataNumValues(fd));
REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, float)); REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, float));
double Result = (double)GetFieldDataFloatPtr(fd)[pt]; double Result = static_cast<double>(GetFieldDataFloatPtr(fd)[pt]);
return Result; return Result;
} }
@ -599,7 +573,7 @@ double STDCALL GetFieldValueForInt32(const FieldData_pa fd,
REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd));
REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Int32_t)); REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Int32_t));
double Result = (double)GetFieldDataInt32Ptr(fd)[pt]; double Result = static_cast<double>(GetFieldDataInt32Ptr(fd)[pt]);
return Result; return Result;
} }
@ -622,7 +596,7 @@ double STDCALL GetFieldValueForInt16(const FieldData_pa fd,
REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd));
REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Int16_t)); REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Int16_t));
double Result = (double)GetFieldDataInt16Ptr(fd)[pt]; double Result = static_cast<double>(GetFieldDataInt16Ptr(fd)[pt]);
return Result; return Result;
} }
@ -646,7 +620,7 @@ double STDCALL GetFieldValueForByte(const FieldData_pa fd,
REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd)); REQUIRE(0 <= pt && pt < GetFieldDataNumValues(fd));
REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Byte_t)); REQUIRE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Byte_t));
double Result = (double)GetFieldDataBytePtr(fd)[pt]; double Result = static_cast<double>(GetFieldDataBytePtr(fd)[pt]);
return Result; return Result;
} }
@ -850,7 +824,7 @@ static void STDCALL SetFieldValueForByte(FieldData_pa fd,
else if (val > 255.0) else if (val > 255.0)
GetFieldDataBytePtr(fd)[pt] = 255; GetFieldDataBytePtr(fd)[pt] = 255;
else else
GetFieldDataBytePtr(fd)[pt] = (Byte_t)val; GetFieldDataBytePtr(fd)[pt] = static_cast<Byte_t>(val);
ENSURE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Byte_t)); ENSURE(FIELD_DATA_VALUE_IS_INITIALIZED(fd, pt, Byte_t));
} }
@ -955,12 +929,12 @@ Int64_t FieldDataGetBytesNeeded(LgIndex_t NumValues,
switch (DataType) switch (DataType)
{ {
case FieldDataType_Float: Result = ((Int64_t)NumValues)*sizeof(float); break; case FieldDataType_Float: Result = (static_cast<Int64_t>(NumValues))*sizeof(float); break;
case FieldDataType_Double: Result = ((Int64_t)NumValues)*sizeof(double); break; case FieldDataType_Double: Result = (static_cast<Int64_t>(NumValues))*sizeof(double); break;
case FieldDataType_Int32: Result = ((Int64_t)NumValues)*sizeof(LgIndex_t); break; case FieldDataType_Int32: Result = (static_cast<Int64_t>(NumValues))*sizeof(LgIndex_t); break;
case FieldDataType_Int16: Result = ((Int64_t)NumValues)*sizeof(SmInteger_t); break; case FieldDataType_Int16: Result = (static_cast<Int64_t>(NumValues))*sizeof(SmInteger_t); break;
case FieldDataType_Byte: Result = ((Int64_t)NumValues)*sizeof(Byte_t); break; case FieldDataType_Byte: Result = (static_cast<Int64_t>(NumValues))*sizeof(Byte_t); break;
case FieldDataType_Bit: Result = ((Int64_t)(NumValues+7)/8)*sizeof(Byte_t); break; case FieldDataType_Bit: Result = (static_cast<Int64_t>(NumValues+7)/8)*sizeof(Byte_t); break;
default: CHECK(FALSE); 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 * On the SGI, HP, Sun and Itanium Linux machines 64 bit objects such as
* byte aligned while on all other machines 32 bit alignment suffices. Some * doubles must be 8 byte aligned while on all other machines 32 bit alignment
* allow 1 byte alignment but we won't bother with that. * suffices. Some allow 1 byte alignment but we won't bother with that.
*/ */
#if defined IRISX || defined HPUX || defined SUNX #if defined IRISX || defined HPUX || defined SUNX
# define SIZEOF_LARGEST_OBJECT_TO_ALIGN sizeof(Int64_t) # define SIZEOF_LARGEST_OBJECT_TO_ALIGN sizeof(Int64_t)
@ -988,7 +962,7 @@ Boolean_t IsOffsetAlignedForFieldDataType(FieldDataType_e FieldDataType,
REQUIRE(Offset >= 0); REQUIRE(Offset >= 0);
Int64_t SizeOfType = FieldDataGetBytesNeeded(1, FieldDataType); Int64_t SizeOfType = FieldDataGetBytesNeeded(1, FieldDataType);
if (SizeOfType > (Int64_t)SIZEOF_LARGEST_OBJECT_TO_ALIGN) if (SizeOfType > static_cast<Int64_t>(SIZEOF_LARGEST_OBJECT_TO_ALIGN))
SizeOfType = SIZEOF_LARGEST_OBJECT_TO_ALIGN; SizeOfType = SIZEOF_LARGEST_OBJECT_TO_ALIGN;
Boolean_t HasValidAlignment = (Offset % SizeOfType == 0); Boolean_t HasValidAlignment = (Offset % SizeOfType == 0);
@ -1006,7 +980,7 @@ Int64_t GetAlignedOffsetForFieldDataType(FieldDataType_e FieldDataType,
REQUIRE(Offset >= 0); REQUIRE(Offset >= 0);
Int64_t SizeOfType = FieldDataGetBytesNeeded(1, FieldDataType); Int64_t SizeOfType = FieldDataGetBytesNeeded(1, FieldDataType);
if (SizeOfType > (Int64_t)SIZEOF_LARGEST_OBJECT_TO_ALIGN) if (SizeOfType > static_cast<Int64_t>(SIZEOF_LARGEST_OBJECT_TO_ALIGN))
SizeOfType = SIZEOF_LARGEST_OBJECT_TO_ALIGN; SizeOfType = SIZEOF_LARGEST_OBJECT_TO_ALIGN;
Int64_t NumBytesPastAlignment = (Offset % SizeOfType); Int64_t NumBytesPastAlignment = (Offset % SizeOfType);
@ -1049,13 +1023,17 @@ void FieldDataDefineData(FieldData_pa FieldData,
# if defined TECPLOTKERNEL # if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
# else /* ...for TecIO only */ # else /* ...for TecIO only */
FieldData->GetValueCallback[0] = (void *)DetermineFieldDataGetFunction(DataType, FALSE); FieldData->GetValueCallback[0] = reinterpret_cast<void *>(DetermineFieldDataGetFunction(DataType, FALSE));
FieldData->SetValueCallback[0] = (void *)DetermineFieldDataSetFunction(DataType, FALSE); FieldData->SetValueCallback[0] = reinterpret_cast<void *>(DetermineFieldDataSetFunction(DataType, FALSE));
#endif #endif
ENSURE(FieldData->Data == NULL); ENSURE(FieldData->Data == NULL);
} }
#if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */
#endif
/** /**
*/ */
Boolean_t FieldDataAllocData(FieldData_pa FieldData, 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. * so we might have to squeeze it down possibly loosing precision.
*/ */
Int64_t ActualBytesNeeded = FieldDataGetBytesNeeded(FieldData->NumValues, FieldData->Type); Int64_t ActualBytesNeeded = FieldDataGetBytesNeeded(FieldData->NumValues, FieldData->Type);
size_t BytesToAllocate = (size_t)ActualBytesNeeded; size_t BytesToAllocate = static_cast<size_t>(ActualBytesNeeded);
/* /*
* 64 bit architectures are effectively unlimited in their allocation size * 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); CHECK(sizeof(size_t) == 4 || sizeof(size_t) == 8);
Boolean_t IsOk = (FieldData->NumValues <= MAXINDEX && Boolean_t IsOk = (FieldData->NumValues <= MAXINDEX &&
IMPLICATION(sizeof(size_t) == 4, IMPLICATION(sizeof(size_t) == 4,
ActualBytesNeeded <= (Int64_t)0xffffffff)); ActualBytesNeeded <= static_cast<Int64_t>(0xffffffff)));
if (IsOk) if (IsOk)
{ {
if (FieldData->NumValues > 0) if (FieldData->NumValues > 0)
{ {
FieldData->Data = (void *)ALLOC_ARRAY(BytesToAllocate, char, "FieldData's Data"); FieldData->Data = reinterpret_cast<void *>(ALLOC_ARRAY(BytesToAllocate, char, "FieldData's Data"));
#if defined DEBUG_FIELDVALUES #if defined DEBUG_FIELDVALUES
{ {
if (FieldData->Data != NULL) 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 * byte. By zeroing the unused bits at the end of the array we
* produce consistent data files when written to disk. * produce consistent data files when written to disk.
*/ */
if (FieldData->Type == FieldDataType_Bit) if (FieldData->Type == FieldDataType_Bit && FieldData->Data != NULL)
((char*)FieldData->Data)[BytesToAllocate-1] = '\0'; (static_cast<char*>(FieldData->Data))[BytesToAllocate-1] = '\0';
} }
IsOk = (FieldData->NumValues == 0 || IsOk = (FieldData->NumValues == 0 ||
FieldData->Data != NULL); FieldData->Data != NULL);
@ -1109,7 +1087,7 @@ Boolean_t FieldDataAllocData(FieldData_pa FieldData,
OutOfMemoryMsg(); OutOfMemoryMsg();
} }
else if (ShowErrMsg) 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<long>(MAXINDEX));
# if defined TECPLOTKERNEL # if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
@ -1179,7 +1157,7 @@ FieldData_pa AllocScratchNodalFieldDataPtr(LgIndex_t NumValues,
REQUIRE(VALID_FIELD_DATA_TYPE(Type)); REQUIRE(VALID_FIELD_DATA_TYPE(Type));
REQUIRE(VALID_BOOLEAN(ShowErrMsg)); REQUIRE(VALID_BOOLEAN(ShowErrMsg));
FieldData_pa Result = FieldDataAlloc(); FieldData_pa Result = FieldDataAlloc(FALSE);
if (Result != NULL) if (Result != NULL)
{ {
FieldDataDefineData(Result, NumValues, Type, ValueLocation_Nodal); FieldDataDefineData(Result, NumValues, Type, ValueLocation_Nodal);
@ -1476,6 +1454,26 @@ void *GetFieldDataVoidPtr_FUNC(FieldData_pa fd)
} }
#endif #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 #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif /* TECPLOTKERNEL */ #endif /* TECPLOTKERNEL */
@ -1500,6 +1498,22 @@ void *GetFieldDataVoidPtr_FUNC(FieldData_pa fd)
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif #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 #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif /* TECPLOTKERNEL */ #endif /* TECPLOTKERNEL */
@ -1575,6 +1589,12 @@ void CopyFieldValue(FieldData_pa dst,
} /* CopyFieldValue() */ } /* CopyFieldValue() */
#if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */
#if defined TECPLOTKERNEL
#endif /* TECPLOTKERNEL */
#endif
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif #endif
@ -1651,8 +1671,12 @@ void SetFieldDataPtrToAllZeros(FieldData_pa fd)
if (NumBytesToMemSet > 0) if (NumBytesToMemSet > 0)
{ {
void *fd_data = GetFieldDataVoidPtr(fd); char* fd_data = static_cast<char*>(GetFieldDataVoidPtr(fd));
#if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */
#else
memset(fd_data, 0, NumBytesToMemSet); memset(fd_data, 0, NumBytesToMemSet);
#endif
} }
else else
{ {

View file

@ -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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
#define TECPLOTENGINEMODULE #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, ReadPureBlock(FileStream,
DoRead, DoRead,
(void *)CurVPtr, static_cast<void *>(CurVPtr),
FieldDataTypeInFile, FieldDataTypeInFile,
0, 0,
NumValues, NumValues,
@ -205,6 +182,7 @@ Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly,
LgIndex_t **NumPtsK, LgIndex_t **NumPtsK,
ZoneType_e **ZoneType, ZoneType_e **ZoneType,
StringList_pa *UserRec, StringList_pa *UserRec,
AuxData_pa *DatasetAuxData,
Boolean_t RawDataSpaceAllocated, Boolean_t RawDataSpaceAllocated,
NodeMap_t ***NodeMap, NodeMap_t ***NodeMap,
double ***VDataBase) double ***VDataBase)
@ -247,22 +225,23 @@ Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly,
FALSE, FALSE,
NumZones, NumZones,
NumVars, NumVars,
(SmInteger_t *)NULL, static_cast<SmInteger_t *>(NULL),
DataSetTitle, DataSetTitle,
(Text_s **)NULL, static_cast<Text_s **>(NULL),
(Geom_s **)NULL, static_cast<Geom_s **>(NULL),
(StringList_pa **)NULL, static_cast<StringList_pa **>(NULL),
UserRec, UserRec,
(AuxData_pa *)NULL, DatasetAuxData,
0,
&IsVarCellCentered, &IsVarCellCentered,
(Boolean_t *)NULL, static_cast<Boolean_t *>(NULL),
(Boolean_t *)NULL, static_cast<Boolean_t *>(NULL),
&ZoneSpecList, &ZoneSpecList,
VarNames, VarNames,
(ArrayList_pa *)NULL, static_cast<ArrayList_pa *>(NULL),
(Set_pa *)NULL, static_cast<Set_pa *>(NULL),
&FNNumBndryConns, &FNNumBndryConns,
(DataFileType_e *)NULL); static_cast<DataFileType_e *>(NULL));
@ -437,10 +416,10 @@ Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly,
{ {
EntIndex_t NumDupVars, ZZ; EntIndex_t NumDupVars, ZZ;
NumDupVars = (EntIndex_t)GetIoFileInt(ReadTecFileStream, *IVersion, 0, (LgIndex_t) * NumVars, &InputIsOk); NumDupVars = static_cast<EntIndex_t>(GetIoFileInt(ReadTecFileStream, *IVersion, 0, static_cast<LgIndex_t>( * NumVars), &InputIsOk));
for (J = 0; J < NumDupVars; J++) for (J = 0; J < NumDupVars; J++)
{ {
ZZ = (EntIndex_t)GetIoFileInt(ReadTecFileStream, *IVersion, 0, *NumVars, &InputIsOk) - 1; ZZ = static_cast<EntIndex_t>(GetIoFileInt(ReadTecFileStream, *IVersion, 0, *NumVars, &InputIsOk)) - 1;
VarSharesFromZone[ZZ] = CurZone - 1; /* emulate DupVar: share from previous zone */ VarSharesFromZone[ZZ] = CurZone - 1; /* emulate DupVar: share from previous zone */
} }
/* Can't duplicate from the first 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++) for (J = 0; J < *NumVars; J++)
{ {
VarType[J] = (FieldDataType_e)GetIoFileInt(ReadTecFileStream, *IVersion, VarType[J] = static_cast<FieldDataType_e>(GetIoFileInt(ReadTecFileStream, *IVersion,
0, 0,
(LgIndex_t)FieldDataType_Bit, static_cast<LgIndex_t>(FieldDataType_Bit),
&InputIsOk); &InputIsOk));
if (!InputIsOk) if (!InputIsOk)
{ {
ErrMsg(translate("Invalid data type - binary input file corrupted")); ErrMsg(translate("Invalid data type - binary input file corrupted"));
@ -497,13 +476,13 @@ Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly,
if (*IVersion >= 105 && InputIsOk) if (*IVersion >= 105 && InputIsOk)
{ {
/* passive variables */ /* passive variables */
if ((Boolean_t)GetIoFileInt(ReadTecFileStream, *IVersion, 0, 1, &InputIsOk) && InputIsOk) if (static_cast<Boolean_t>(GetIoFileInt(ReadTecFileStream, *IVersion, 0, 1, &InputIsOk)) && InputIsOk)
{ {
for (CurVar = 0; CurVar < *NumVars && InputIsOk; CurVar++) for (CurVar = 0; CurVar < *NumVars && InputIsOk; CurVar++)
{ {
IsVarPassive[CurVar] = (Boolean_t)GetIoFileInt(ReadTecFileStream, IsVarPassive[CurVar] = static_cast<Boolean_t>(GetIoFileInt(ReadTecFileStream,
*IVersion, *IVersion,
0, 1, &InputIsOk); 0, 1, &InputIsOk));
} }
} }
} }
@ -511,7 +490,7 @@ Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly,
if (*IVersion >= 101 && InputIsOk) if (*IVersion >= 101 && InputIsOk)
{ {
/* variable sharing: equivalent to DupVar for ReadTec */ /* variable sharing: equivalent to DupVar for ReadTec */
if ((Boolean_t)GetIoFileInt(ReadTecFileStream, *IVersion, 0, 1, &InputIsOk) && InputIsOk) if (static_cast<Boolean_t>(GetIoFileInt(ReadTecFileStream, *IVersion, 0, 1, &InputIsOk)) && InputIsOk)
{ {
for (CurVar = 0; CurVar < *NumVars && InputIsOk; CurVar++) for (CurVar = 0; CurVar < *NumVars && InputIsOk; CurVar++)
{ {
@ -928,13 +907,13 @@ Boolean_t STDCALL ReadTec(Boolean_t GetHeaderInfoOnly,
void * STDCALL TecAlloc(size_t size) void * STDCALL TecAlloc(size_t size)
{ {
return (void *)ALLOC_ARRAY(size, char, "TecAlloc"); return static_cast<void *>(ALLOC_ARRAY(size, char, "TecAlloc"));
} }
void STDCALL TecFree(void *ptr) void STDCALL TecFree(void *ptr)
{ {
/* Hack to remove delete warning... */ /* Hack to remove delete warning... */
char *Tmp = (char *)ptr; char *Tmp = static_cast<char *>(ptr);
FREE_ARRAY(Tmp, "TecAlloc"); FREE_ARRAY(Tmp, "TecAlloc");
} }

View file

@ -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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
#define TECPLOTENGINEMODULE #define TECPLOTENGINEMODULE
@ -29,7 +6,7 @@
***************************************************************** *****************************************************************
***************************************************************** *****************************************************************
******* ******** ******* ********
****** Copyright (C) 1988-2008 Tecplot, Inc. ******* ****** Copyright (C) 1988-2010 Tecplot, Inc. *******
******* ******** ******* ********
***************************************************************** *****************************************************************
***************************************************************** *****************************************************************

View file

@ -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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
#define TECPLOTENGINEMODULE #define TECPLOTENGINEMODULE
@ -29,7 +6,7 @@
***************************************************************** *****************************************************************
***************************************************************** *****************************************************************
******* ******** ******* ********
****** Copyright (C) 1988-2008 Tecplot, Inc. ******* ****** Copyright (C) 1988-2010 Tecplot, Inc. *******
******* ******** ******* ********
***************************************************************** *****************************************************************
***************************************************************** *****************************************************************

View file

@ -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 "stdafx.h"
#include "MASTER.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. * argument, in which case it is essentially the warning message itself.
* *
* param Format * param format
* C Format string or a simple message. * C format string or a simple message.
* param ... * param ...
* Zero or more variable arguments. The number of arguments must correspond * Zero or more variable arguments. The number of arguments must correspond
* to the placeholders in the format string. * to the placeholders in the format string.
*/ */
void Warning(TranslatedString Format, void Warning(TranslatedString format,
...) /* zero or more arguments */ ...) /* zero or more arguments */
{ {
REQUIRE(!Format.isNull()); REQUIRE(!format.isNull());
static Boolean_t InWarning = FALSE; /* ...used to prevent recursive deadlock */ static Boolean_t InWarning = FALSE; /* ...used to prevent recursive deadlock */
if (!InWarning) if (!InWarning)
@ -222,14 +199,14 @@ void Warning(TranslatedString Format,
Boolean_t cleanUp = TRUE; Boolean_t cleanUp = TRUE;
va_list Arguments; va_list Arguments;
va_start(Arguments, Format); va_start(Arguments, format);
char* message = vFormatString(Format.c_str(), Arguments); char* message = vFormatString(format.c_str(), Arguments);
va_end(Arguments); va_end(Arguments);
if (message == NULL) if (message == NULL)
{ {
cleanUp = FALSE; // ...this boolean allows us to "carefully" cast away the const'ness cleanUp = FALSE; // ...this boolean allows us to "carefully" cast away the const'ness
message = (char*)Format.c_str(); message = const_cast<char*>(format.c_str());
} }
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
@ -261,13 +238,13 @@ void Warning(TranslatedString Format,
static void SendErrToFile(FILE *File, static void SendErrToFile(FILE *File,
const char *Msg) const char *Msg)
{ {
char *FormattedMsg; char *formattedMsg;
REQUIRE(VALID_REF(File)); REQUIRE(VALID_REF(File));
REQUIRE(VALID_REF(Msg)); REQUIRE(VALID_REF(Msg));
if (WrapString(Msg, &FormattedMsg)) if (WrapString(Msg, &formattedMsg))
{ {
fprintf(File, "Err: %s\n", FormattedMsg); fprintf(File, "Err: %s\n", formattedMsg);
FREE_ARRAY(FormattedMsg, "temp error string"); FREE_ARRAY(formattedMsg, "temp error string");
} }
else else
fprintf(File, "Err: %s\n", Msg); fprintf(File, "Err: %s\n", Msg);
@ -290,10 +267,12 @@ static void DefaultErrMsg(const char *Msg)
#endif #endif
} }
static void PostErrorMessage(TranslatedString Format, /**
*/
static void PostErrorMessage(TranslatedString format,
va_list Arguments) va_list Arguments)
{ {
REQUIRE(!Format.isNull()); REQUIRE(!format.isNull());
/* /*
* Attempt to format the string. Failing that simply use the original format * Attempt to format the string. Failing that simply use the original format
@ -302,16 +281,16 @@ static void PostErrorMessage(TranslatedString Format,
* previous operation anyway. * previous operation anyway.
*/ */
Boolean_t cleanUp = TRUE; Boolean_t cleanUp = TRUE;
char* messageString = vFormatString(Format.c_str(), Arguments); char* messageString = vFormatString(format.c_str(), Arguments);
if (messageString == NULL) if (messageString == NULL)
{ {
cleanUp = FALSE; // ...this boolean allows us to "carefully" cast away the const'ness cleanUp = FALSE; // ...this boolean allows us to "carefully" cast away the const'ness
messageString = (char*)Format.c_str(); messageString = const_cast<char*>(format.c_str());
} }
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#ifdef MSWIN #if defined MSWIN
#endif #endif
#if defined UNIXX #if defined UNIXX
#if !defined ENGINE #if !defined ENGINE
@ -335,10 +314,10 @@ static void PostErrorMessage(TranslatedString Format,
* queued for display on idle. In batch mode all messages are sent to the * queued for display on idle. In batch mode all messages are sent to the
* batch log file. * batch log file.
*/ */
void vErrMsg(TranslatedString Format, void vErrMsg(TranslatedString format,
va_list Arguments) va_list Arguments)
{ {
REQUIRE(!Format.isNull()); REQUIRE(!format.isNull());
static Boolean_t InErrMsg = FALSE; /* ...used to prevent recursive deadlock */ static Boolean_t InErrMsg = FALSE; /* ...used to prevent recursive deadlock */
if (!InErrMsg) if (!InErrMsg)
@ -349,7 +328,7 @@ void vErrMsg(TranslatedString Format,
InErrMsg = TRUE; InErrMsg = TRUE;
{ {
PostErrorMessage(Format, Arguments); PostErrorMessage(format, Arguments);
} }
InErrMsg = FALSE; 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. * argument, in which case it is essentially the error message itself.
* *
* @param Format * @param format
* C Format string or a simple message. * C format string or a simple message.
* @param ... * @param ...
* Zero or more variable arguments. The number of arguments must correspond * Zero or more variable arguments. The number of arguments must correspond
* to the placeholders in the format string. * to the placeholders in the format string.
*/ */
void ErrMsg(TranslatedString Format, void ErrMsg(TranslatedString format,
...) /* zero or more arguments */ ...) /* zero or more arguments */
{ {
REQUIRE(!Format.isNull()); REQUIRE(!format.isNull());
va_list Arguments; va_list Arguments;
va_start(Arguments, Format); va_start(Arguments, format);
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#else #else
PostErrorMessage(Format, Arguments); PostErrorMessage(format, Arguments);
#endif #endif
va_end(Arguments); va_end(Arguments);
} }

View file

@ -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 "stdafx.h"
#include "MASTER.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; return Result;
} }
/**
*/
Boolean_t IsPrintable8BitAsciiChar(wchar_t wChar)
{
return ((wChar >= static_cast<wchar_t>(33) && wChar <= static_cast<wchar_t>(126)) ||
(wChar >= static_cast<wchar_t>(160) && wChar <= static_cast<wchar_t>(255)));
}
Boolean_t ShouldConvertWideStringToUtf8String(const wchar_t *str) Boolean_t ShouldConvertWideStringToUtf8String(const wchar_t *str)
{ {
@ -306,7 +291,9 @@ Boolean_t ShouldConvertWideStringToUtf8String(const wchar_t *str)
#if defined MSWIN && defined TECPLOTKERNEL #if defined MSWIN && defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif /* MSWIN and TECPLOTKERNEL */ #else
UNUSED(str);
#endif
ENSURE(VALID_BOOLEAN(Result)); ENSURE(VALID_BOOLEAN(Result));
return Result; return Result;
@ -412,6 +399,38 @@ Boolean_t IsNullOrZeroLengthString(TranslatedString TS)
return TS.isNullOrZeroLength(); 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<char>((asciiChar & 0x3F) | 0x80);
result += static_cast<char>((asciiChar >> 6) | 0xC0);
}
return result;
}
} }
} }
@ -442,6 +461,4 @@ void MSWinTrace(const char *Format, ...)
delete [] buffer; delete [] buffer;
} }
#endif #endif

View file

@ -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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
#define TECPLOTENGINEMODULE #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 "ALLOC.h"
#include "SET.h" #include "SET.h"
/* * SET FUNCTIONS * */ /* * SET FUNCTIONS * */
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
@ -61,7 +37,7 @@
#define SetExpansionFactor 2 #define SetExpansionFactor 2
#endif #endif
using namespace tecplot::strutil; using tecplot::strutil::translate;
/* /*
*/ */
@ -110,10 +86,11 @@ void DeallocSet(Set_pa *Set)
Boolean_t SetItemDestructor(void *ItemRef, Boolean_t SetItemDestructor(void *ItemRef,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
Set_pa *SetRef = (Set_pa *)ItemRef; Set_pa *SetRef = static_cast<Set_pa *>(ItemRef);
REQUIRE(VALID_REF(SetRef)); REQUIRE(VALID_REF(SetRef));
REQUIRE(VALID_REF(*SetRef) || *SetRef == NULL); REQUIRE(VALID_REF(*SetRef) || *SetRef == NULL);
UNUSED(ClientData);
if (*SetRef != NULL) if (*SetRef != NULL)
DeallocSet(SetRef); DeallocSet(SetRef);
@ -130,7 +107,7 @@ Boolean_t ExpandSet(Set_pa Set,
Boolean_t show_error_msg) Boolean_t show_error_msg)
{ {
SetData_t *data; SetData_t *data;
long new_size; SetIndex_t new_size;
REQUIRE(max_val >= 0); 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 new_set_size_in_bytes = sizeof(data[0]) * (new_size / SetBitSize);
size_t numBytesToReset = new_set_size_in_bytes - old_set_size_in_bytes; 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<char*>(data) + old_set_size_in_bytes, 0, numBytesToReset);
FREE_ARRAY(Set->data, "old Set data"); FREE_ARRAY(Set->data, "old Set data");
Set->data = data; Set->data = data;
@ -201,7 +178,7 @@ Boolean_t CopySet(Set_pa dst,
SetIndex_t dst_size_in_words = dst->size / SetBitSize; SetIndex_t dst_size_in_words = dst->size / SetBitSize;
CHECK(dst_size_in_words>=src_size_in_words); // ...guaranteed by above ExpandSet() call 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); 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<char*>(dst->data + src_size_in_words), 0, numBytesToReset);
return TRUE; return TRUE;
} }
@ -222,7 +199,7 @@ Boolean_t AppendSet(Set_pa dst,
SetIndex_t member; SetIndex_t member;
ForAllMembersInSet(member, src) ForAllMembersInSet(member, src)
{ {
if (!AddToSet(dst, member, TRUE)) if (!AddToSet(dst, member, show_error_msg))
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
@ -254,7 +231,7 @@ Boolean_t AddToSet(Set_pa Set,
((member + 1 <= Set->size) || ExpandSet(Set, member + 1, show_error_msg))) ((member + 1 <= Set->size) || ExpandSet(Set, member + 1, show_error_msg)))
{ {
SetIndex_t word = member / SetBitSize; SetIndex_t word = member / SetBitSize;
SetData_t bit = (SetData_t)1 << (member % SetBitSize); SetData_t bit = static_cast<SetData_t>(1) << (member % SetBitSize);
Set->data[word] |= bit; Set->data[word] |= bit;
return TRUE; return TRUE;
} }
@ -273,8 +250,8 @@ void RemoveFromSet(Set_pa Set,
if (Set && (member < Set->size) && Set->data) if (Set && (member < Set->size) && Set->data)
{ {
SetIndex_t word = member / SetBitSize; SetIndex_t word = member / SetBitSize;
SetData_t bit = (SetData_t)1 << (member % SetBitSize); SetData_t bit = static_cast<SetData_t> (1) << (member % SetBitSize);
Set->data[word] &= (((SetData_t) - 1) ^ bit); Set->data[word] &= ((static_cast<SetData_t>( - 1)) ^ bit);
} }
} /* RemoveFromSet() */ } /* RemoveFromSet() */
@ -441,7 +418,7 @@ SetIndex_t GetNextMember(Set_pa Set,
else if (start_at + 1 < Set->size) else if (start_at + 1 < Set->size)
{ {
word = (start_at + 1) / SetBitSize; word = (start_at + 1) / SetBitSize;
bit = (start_at + 1) % SetBitSize; bit = static_cast<int>((start_at + 1) % SetBitSize);
if (word < set_size_in_words) if (word < set_size_in_words)
word_val = Set->data[word] >> bit; word_val = Set->data[word] >> bit;
} }
@ -492,7 +469,7 @@ SetIndex_t GetPrevMember(Set_pa Set,
else if (start_at > 0) else if (start_at > 0)
{ {
word = (start_at - 1) / SetBitSize; word = (start_at - 1) / SetBitSize;
bit = (start_at - 1) % SetBitSize; bit = static_cast<int>((start_at - 1) % SetBitSize);
if (word >= 0) if (word >= 0)
word_val = Set->data[word] << (SetBitSize - bit - 1); word_val = Set->data[word] << (SetBitSize - bit - 1);
} }
@ -503,7 +480,7 @@ SetIndex_t GetPrevMember(Set_pa Set,
while ((word >= 0) && (word_val == 0)) while ((word >= 0) && (word_val == 0))
{ {
word--; word--;
bit = SetBitSize - 1; bit = static_cast<int>(SetBitSize - 1);
if (word >= 0) if (word >= 0)
word_val = Set->data[word] << (SetBitSize - bit - 1); word_val = Set->data[word] << (SetBitSize - bit - 1);
} }
@ -691,6 +668,3 @@ void ShiftSet(Set_pa Set,
CopySet(Set, NewSet, TRUE); CopySet(Set, NewSet, TRUE);
DeallocSet(&NewSet); DeallocSet(&NewSet);
} }

View file

@ -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_ #if !defined STDAFX_H_
# define 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, * stdafx.h : include file for standard system include files,
* or project specific include files that are used frequently, but * or project specific include files that are used frequently, but
* are changed infrequently * are changed infrequently
* Used for Windows only
*/ */
/*
* Must include locale before MFC includes to avoid a conflict
* between xlocale and MFC debug new.
*/
#include <locale>
#if defined _WIN32 #if defined _WIN32
/* /*

View file

@ -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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
#define TECPLOTENGINEMODULE #define TECPLOTENGINEMODULE
@ -29,7 +6,7 @@
****************************************************************** ******************************************************************
****************************************************************** ******************************************************************
******* ******** ******* ********
****** (C) 1988-2008 Tecplot, Inc. ******* ****** (C) 1988-2010 Tecplot, Inc. *******
******* ******** ******* ********
****************************************************************** ******************************************************************
****************************************************************** ******************************************************************
@ -49,7 +26,10 @@
/* END HEADER */ /* 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 * This set of functions provide a wrapper around the array list utilities
@ -74,11 +54,11 @@ using namespace tecplot::strutil;
static Boolean_t StringListItemDestructor(void* ItemRef, static Boolean_t StringListItemDestructor(void* ItemRef,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
char **StringRef = (char **)ItemRef; REQUIRE(VALID_REF(ItemRef));
REQUIRE(VALID_REF(*static_cast<char**>(ItemRef)) || *static_cast<char**>(ItemRef) == NULL);
REQUIRE(VALID_REF(StringRef)); UNUSED(ClientData);
REQUIRE(VALID_REF(*StringRef) || *StringRef == NULL);
char** StringRef = static_cast<char**>(ItemRef);
if (*StringRef != NULL) if (*StringRef != NULL)
{ {
FREE_ARRAY(*StringRef, "string"); FREE_ARRAY(*StringRef, "string");
@ -109,13 +89,14 @@ static Boolean_t StringListItemDuplicator(void *TargetItemRef,
void* SourceItemRef, void* SourceItemRef,
ArbParam_t ClientData) ArbParam_t ClientData)
{ {
Boolean_t IsOk = TRUE; REQUIRE(VALID_REF(TargetItemRef));
char **TargetStringRef = (char **)TargetItemRef; REQUIRE(VALID_REF(SourceItemRef));
char **SourceStringRef = (char **)SourceItemRef; REQUIRE(VALID_REF(*static_cast<char**>(SourceItemRef)) || *static_cast<char**>(SourceItemRef) == NULL);
UNUSED(ClientData);
REQUIRE(VALID_REF(TargetStringRef)); Boolean_t IsOk = TRUE;
REQUIRE(VALID_REF(SourceStringRef)); char** TargetStringRef = static_cast<char**>(TargetItemRef);
REQUIRE(VALID_REF(*SourceStringRef) || *SourceStringRef == NULL); char** SourceStringRef = static_cast<char**>(SourceItemRef);
if (*SourceStringRef != NULL) if (*SourceStringRef != NULL)
IsOk = ((*TargetStringRef = DupString(dontTranslate(*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 StringListValid(StringList_pa stringList)
{ {
Boolean_t isValid = ArrayListIsValid((ArrayList_pa)stringList); Boolean_t isValid = ArrayListIsValid(reinterpret_cast<ArrayList_pa>(stringList));
if (isValid) if (isValid)
{ {
LgIndex_t stringCount = ArrayListGetCount((ArrayList_pa)stringList); LgIndex_t stringCount = ArrayListGetCount(reinterpret_cast<ArrayList_pa>(stringList));
#if defined PERFORM_EXPENSIVE_STRLIST_TESTS #if defined PERFORM_EXPENSIVE_STRLIST_TESTS
{ {
for (LgIndex_t index = 0; index < stringCount; index++) for (LgIndex_t index = 0; index < stringCount; index++)
{ {
char *string = ArrayListGetCharPtr((ArrayList_pa)stringList, index); char* string = ArrayListGetCharPtr(reinterpret_cast<ArrayList_pa>(stringList), index);
if (string != NULL && !VALID_REF(string)) if (string != NULL && !VALID_REF(string))
{ {
isValid = FALSE; isValid = FALSE;
break; break;
} }
} }
}
#else #else
{ {
/* Check first and last only */ /* Check first and last only */
if (stringCount > 0) if (stringCount > 0)
{ {
char *string = ArrayListGetCharPtr((ArrayList_pa)stringList, 0); char* string = ArrayListGetCharPtr(reinterpret_cast<ArrayList_pa>(stringList), 0);
if (string != NULL && !VALID_REF(string)) if (string != NULL && !VALID_REF(string))
{ {
isValid = FALSE; isValid = FALSE;
@ -163,7 +144,7 @@ Boolean_t StringListValid(StringList_pa stringList)
} }
if (isValid && stringCount > 1) if (isValid && stringCount > 1)
{ {
char *string = ArrayListGetCharPtr((ArrayList_pa)stringList, stringCount - 1); char* string = ArrayListGetCharPtr(reinterpret_cast<ArrayList_pa>(stringList), stringCount - 1);
if (string != NULL && !VALID_REF(string)) if (string != NULL && !VALID_REF(string))
{ {
isValid = FALSE; isValid = FALSE;
@ -185,7 +166,7 @@ Boolean_t StringListValid(StringList_pa stringList)
{ {
REQUIRE(StringListValid(StringList)); REQUIRE(StringListValid(StringList));
ArrayListDeleteAllItems((ArrayList_pa)StringList, StringListItemDestructor, 0); ArrayListDeleteAllItems(reinterpret_cast<ArrayList_pa>(StringList), StringListItemDestructor, 0);
ENSURE(StringListValid(StringList) && StringListCount(StringList) == 0); ENSURE(StringListValid(StringList) && StringListCount(StringList) == 0);
} }
@ -204,7 +185,7 @@ Boolean_t StringListValid(StringList_pa stringList)
REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1); REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1);
REQUIRE(1 <= Count && StringOffset + Count <= StringListCount(StringList)); REQUIRE(1 <= Count && StringOffset + Count <= StringListCount(StringList));
ArrayListDeleteItems((ArrayList_pa)StringList, StringOffset, Count, ArrayListDeleteItems(reinterpret_cast<ArrayList_pa>(StringList), StringOffset, Count,
StringListItemDestructor, 0); StringListItemDestructor, 0);
ENSURE(StringListValid(StringList)); ENSURE(StringListValid(StringList));
@ -222,7 +203,7 @@ Boolean_t StringListValid(StringList_pa stringList)
REQUIRE(StringListValid(StringList)); REQUIRE(StringListValid(StringList));
REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1); REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1);
ArrayListDeleteItems((ArrayList_pa)StringList, StringOffset, 1, ArrayListDeleteItems(reinterpret_cast<ArrayList_pa>(StringList), StringOffset, 1,
StringListItemDestructor, 0); StringListItemDestructor, 0);
ENSURE(StringListValid(StringList)); ENSURE(StringListValid(StringList));
@ -238,7 +219,7 @@ Boolean_t StringListValid(StringList_pa stringList)
REQUIRE(*StringList == NULL || StringListValid(*StringList)); REQUIRE(*StringList == NULL || StringListValid(*StringList));
if (*StringList != NULL) if (*StringList != NULL)
ArrayListDealloc((ArrayList_pa *)StringList, StringListItemDestructor, 0); ArrayListDealloc(reinterpret_cast<ArrayList_pa*>(StringList), StringListItemDestructor, 0);
ENSURE(*StringList == NULL); ENSURE(*StringList == NULL);
} }
@ -250,9 +231,7 @@ Boolean_t StringListValid(StringList_pa stringList)
*/ */
StringList_pa StringListAlloc(void) StringList_pa StringListAlloc(void)
{ {
StringList_pa Result; StringList_pa Result = reinterpret_cast<StringList_pa>(ArrayListAlloc(0, ArrayListType_CharPtr, NULL, 0));
Result = (StringList_pa)ArrayListAlloc(0, ArrayListType_CharPtr, NULL, 0);
ENSURE(Result == NULL || StringListValid(Result)); ENSURE(Result == NULL || StringListValid(Result));
return Result; return Result;
@ -267,14 +246,12 @@ Boolean_t StringListValid(StringList_pa stringList)
* item. * item.
*/ */
Boolean_t StringListAppendString(StringList_pa StringList, Boolean_t StringListAppendString(StringList_pa StringList,
const char *String) char const* String)
{ {
Boolean_t IsOk;
REQUIRE(StringListValid(StringList)); REQUIRE(StringListValid(StringList));
REQUIRE(String == NULL || VALID_REF(String)); REQUIRE(String == NULL || VALID_REF(String));
IsOk = StringListSetString(StringList, StringListCount(StringList), String); Boolean_t IsOk = StringListSetString(StringList, StringListCount(StringList), String);
ENSURE(StringListValid(StringList)); ENSURE(StringListValid(StringList));
ENSURE(VALID_BOOLEAN(IsOk)); ENSURE(VALID_BOOLEAN(IsOk));
@ -287,11 +264,9 @@ Boolean_t StringListValid(StringList_pa stringList)
*/ */
LgIndex_t LIBCALL StringListCount(StringList_pa StringList) LgIndex_t LIBCALL StringListCount(StringList_pa StringList)
{ {
LgIndex_t Result;
REQUIRE(StringListValid(StringList)); REQUIRE(StringListValid(StringList));
Result = ArrayListGetCount((ArrayList_pa)StringList); LgIndex_t Result = ArrayListGetCount(reinterpret_cast<ArrayList_pa>(StringList));
ENSURE(Result >= 0); ENSURE(Result >= 0);
return Result; return Result;
@ -304,13 +279,11 @@ Boolean_t StringListValid(StringList_pa stringList)
char* LIBCALL StringListGetString(StringList_pa StringList, char* LIBCALL StringListGetString(StringList_pa StringList,
LgIndex_t StringOffset) LgIndex_t StringOffset)
{ {
char *Result;
const char *StringRef;
REQUIRE(StringListValid(StringList)); REQUIRE(StringListValid(StringList));
REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1); REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1);
StringRef = StringListGetStringRef(StringList, StringOffset); char* Result;
char const* StringRef = StringListGetStringRef(StringList, StringOffset);
if (StringRef == NULL) if (StringRef == NULL)
Result = NULL; Result = NULL;
else else
@ -327,15 +300,13 @@ Boolean_t StringListValid(StringList_pa stringList)
* attempt to free this string. Changing this string should be done with * attempt to free this string. Changing this string should be done with
* utmost caution. * utmost caution.
*/ */
const char *StringListGetStringRef_FUNC(StringList_pa StringList, char const* StringListGetStringRef_FUNC(StringList_pa StringList,
LgIndex_t StringOffset) LgIndex_t StringOffset)
{ {
const char *Result;
REQUIRE(StringListValid(StringList)); REQUIRE(StringListValid(StringList));
REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1); REQUIRE(0 <= StringOffset && StringOffset <= StringListCount(StringList) - 1);
Result = StringListGetStringRef_MACRO(StringList, StringOffset); char const* Result = StringListGetStringRef_MACRO(StringList, StringOffset);
ENSURE(Result == NULL || VALID_REF(Result)); ENSURE(Result == NULL || VALID_REF(Result));
return Result; return Result;
@ -355,15 +326,15 @@ Boolean_t StringListValid(StringList_pa stringList)
*/ */
Boolean_t StringListSetString(StringList_pa StringList, Boolean_t StringListSetString(StringList_pa StringList,
LgIndex_t StringOffset, LgIndex_t StringOffset,
const char *String) char const* String)
{ {
Boolean_t IsOk;
ArrayListItem_u ItemCopy;
REQUIRE(StringListValid(StringList)); REQUIRE(StringListValid(StringList));
REQUIRE(StringOffset >= 0); REQUIRE(StringOffset >= 0);
REQUIRE(String == NULL || VALID_REF(String)); REQUIRE(String == NULL || VALID_REF(String));
Boolean_t IsOk;
ArrayListItem_u ItemCopy;
if (String != NULL) if (String != NULL)
{ {
ItemCopy.CharPtr = DupString(dontTranslate(String)); ItemCopy.CharPtr = DupString(dontTranslate(String));
@ -376,7 +347,7 @@ Boolean_t StringListValid(StringList_pa stringList)
} }
if (IsOk) if (IsOk)
IsOk = ArrayListSetItem((ArrayList_pa)StringList, StringOffset, ItemCopy, IsOk = ArrayListSetItem(reinterpret_cast<ArrayList_pa>(StringList), StringOffset, ItemCopy,
StringListItemDestructor, 0); StringListItemDestructor, 0);
ENSURE(StringListValid(StringList)); ENSURE(StringListValid(StringList));
@ -394,15 +365,15 @@ Boolean_t StringListValid(StringList_pa stringList)
*/ */
Boolean_t StringListInsertString(StringList_pa StringList, Boolean_t StringListInsertString(StringList_pa StringList,
LgIndex_t StringOffset, LgIndex_t StringOffset,
const char *String) char const* String)
{ {
Boolean_t IsOk;
ArrayListItem_u ItemCopy;
REQUIRE(StringListValid(StringList)); REQUIRE(StringListValid(StringList));
REQUIRE(StringOffset >= 0); REQUIRE(StringOffset >= 0);
REQUIRE(String == NULL || VALID_REF(String)); REQUIRE(String == NULL || VALID_REF(String));
Boolean_t IsOk;
ArrayListItem_u ItemCopy;
if (String != NULL) if (String != NULL)
{ {
ItemCopy.CharPtr = DupString(dontTranslate(String)); ItemCopy.CharPtr = DupString(dontTranslate(String));
@ -415,8 +386,8 @@ Boolean_t StringListValid(StringList_pa stringList)
} }
if (IsOk) if (IsOk)
IsOk = ArrayListInsertItem( IsOk = ArrayListInsertItem(reinterpret_cast<ArrayList_pa>(StringList),
(ArrayList_pa)StringList, StringOffset, ItemCopy); StringOffset, ItemCopy);
ENSURE(StringListValid(StringList)); ENSURE(StringListValid(StringList));
ENSURE(VALID_BOOLEAN(IsOk)); ENSURE(VALID_BOOLEAN(IsOk));
@ -430,12 +401,11 @@ Boolean_t StringListValid(StringList_pa stringList)
*/ */
StringList_pa StringListCopy(StringList_pa StringList) StringList_pa StringListCopy(StringList_pa StringList)
{ {
StringList_pa Result;
REQUIRE(StringListValid(StringList)); REQUIRE(StringListValid(StringList));
Result = (StringList_pa)ArrayListCopy((ArrayList_pa)StringList, StringList_pa Result =
StringListItemDuplicator, 0); reinterpret_cast<StringList_pa>(ArrayListCopy(reinterpret_cast<ArrayList_pa>(StringList),
StringListItemDuplicator, 0));
ENSURE(Result == NULL || ENSURE(Result == NULL ||
(StringListValid(Result) && (StringListValid(Result) &&
@ -454,19 +424,16 @@ Boolean_t StringListValid(StringList_pa stringList)
Boolean_t StringListAppend(StringList_pa Target, Boolean_t StringListAppend(StringList_pa Target,
StringList_pa Source) StringList_pa Source)
{ {
Boolean_t IsOk;
StringList_pa SourceCopy;
REQUIRE(StringListValid(Target)); REQUIRE(StringListValid(Target));
REQUIRE(StringListValid(Source)); REQUIRE(StringListValid(Source));
SourceCopy = StringListCopy(Source); StringList_pa SourceCopy = StringListCopy(Source);
IsOk = (SourceCopy != NULL); Boolean_t IsOk = (SourceCopy != NULL);
if (IsOk) if (IsOk)
{ {
ArrayListAppend((ArrayList_pa)Target, (ArrayList_pa)SourceCopy); ArrayListAppend(reinterpret_cast<ArrayList_pa>(Target), reinterpret_cast<ArrayList_pa>(SourceCopy));
/* deallocate the list but not the string items since Target now owns them */ /* deallocate the list but not the string items since Target now owns them */
ArrayListDealloc((ArrayList_pa *)(void *)&SourceCopy, NULL, 0); ArrayListDealloc(static_cast<ArrayList_pa*>(static_cast<void*>(&SourceCopy)), NULL, 0);
} }
ENSURE(StringListValid(Target)); ENSURE(StringListValid(Target));
@ -482,38 +449,35 @@ Boolean_t StringListValid(StringList_pa stringList)
*/ */
char* StringListToNLString(StringList_pa StringList) char* StringListToNLString(StringList_pa StringList)
{ {
char *Result;
int Count;
size_t Length = 0;
REQUIRE(StringListValid(StringList)); REQUIRE(StringListValid(StringList));
size_t Length = 0;
/* determine the resulting new line, '\n', separated string length */ /* determine the resulting new line, '\n', separated string length */
Count = StringListCount(StringList); LgIndex_t Count = StringListCount(StringList);
if (Count >= 1) if (Count >= 1)
{ {
int Index; LgIndex_t Index;
for (Index = 0, Length = strlen("\n") * (Count - 1); for (Index = 0, Length = strlen("\n") * (Count - 1);
Index < Count; Index < Count;
Index++) Index++)
{ {
char *String = ArrayListGetCharPtr((ArrayList_pa)StringList, Index); char* String = ArrayListGetCharPtr(reinterpret_cast<ArrayList_pa>(StringList), Index);
if (String != NULL) if (String != NULL)
Length += strlen(String); Length += strlen(String);
} }
} }
/* create a new line, '\n', separated string */ /* create a new line, '\n', separated string */
Result = ALLOC_ARRAY(Length + 1, char, "new line separated string"); char* Result = ALLOC_ARRAY(Length + 1, char, "new line separated string");
if (Result != NULL) if (Result != NULL)
{ {
int Index; LgIndex_t Index;
for (Index = 0, strcpy(Result, ""); for (Index = 0, strcpy(Result, "");
Index < Count; Index < Count;
Index++) Index++)
{ {
char *String = ArrayListGetCharPtr( char* String = ArrayListGetCharPtr(reinterpret_cast<ArrayList_pa>(StringList), Index);
(ArrayList_pa)StringList, Index);
if (Index != 0) if (Index != 0)
strcat(Result, "\n"); strcat(Result, "\n");
@ -532,16 +496,14 @@ Boolean_t StringListValid(StringList_pa stringList)
* Create a string list from the new line, '\n', separated string. The string * Create a string list from the new line, '\n', separated string. The string
* is copied and therefore owned and managed by the caller. * is copied and therefore owned and managed by the caller.
*/ */
StringList_pa StringListFromNLString(const char *String) StringList_pa StringListFromNLString(char const* String)
{ {
StringList_pa Result;
LgIndex_t StartIndex;
LgIndex_t EndIndex;
REQUIRE(VALID_REF(String)); REQUIRE(VALID_REF(String));
/* create the string list and scan the entire string */ /* create the string list and scan the entire string */
Result = StringListAlloc(); StringList_pa Result = StringListAlloc();
LgIndex_t StartIndex;
LgIndex_t EndIndex;
for (StartIndex = EndIndex = 0; Result != NULL; EndIndex++) for (StartIndex = EndIndex = 0; Result != NULL; EndIndex++)
{ {
/* end of sub-string ? */ /* end of sub-string ? */
@ -583,12 +545,10 @@ Boolean_t StringListValid(StringList_pa stringList)
*/ */
char** StringListToArray(StringList_pa StringList) char** StringListToArray(StringList_pa StringList)
{ {
char **Result;
REQUIRE(StringListValid(StringList)); REQUIRE(StringListValid(StringList));
Result = (char **)ArrayListToArray((ArrayList_pa)StringList, char** Result = static_cast<char**>(ArrayListToArray(reinterpret_cast<ArrayList_pa>(StringList),
StringListItemDuplicator, 0); StringListItemDuplicator, 0));
ENSURE(Result == NULL || VALID_REF(Result)); ENSURE(Result == NULL || VALID_REF(Result));
return Result; return Result;
@ -600,17 +560,15 @@ Boolean_t StringListValid(StringList_pa stringList)
* Create a string list from the 'C' string array. The string array * Create a string list from the 'C' string array. The string array
* is copied and therefore owned and managed by the caller. * is copied and therefore owned and managed by the caller.
*/ */
StringList_pa StringListFromArray(const char **StringArray, StringList_pa StringListFromArray(char const** StringArray,
LgIndex_t Count) LgIndex_t Count)
{ {
StringList_pa Result;
REQUIRE((Count == 0 && StringArray == NULL) || REQUIRE((Count == 0 && StringArray == NULL) ||
(Count >= 1 && VALID_REF(StringArray))); (Count >= 1 && VALID_REF(StringArray)));
Result = (StringList_pa)ArrayListFromArray((void *)StringArray, StringList_pa Result = reinterpret_cast<StringList_pa>(ArrayListFromArray(static_cast<void*>(StringArray),
Count, ArrayListType_CharPtr, Count, ArrayListType_CharPtr,
StringListItemDuplicator, 0); StringListItemDuplicator, 0));
ENSURE(Result == NULL || StringListValid(Result)); ENSURE(Result == NULL || StringListValid(Result));
return Result; return Result;
@ -620,7 +578,7 @@ Boolean_t StringListValid(StringList_pa stringList)
#define ISJOINCHAR(c) ((c == ';') || (c == '+')) #define ISJOINCHAR(c) ((c == ';') || (c == '+'))
static void SkipWhiteSpaceOrComma(const char **CPtr) static void SkipWhiteSpaceOrComma(char const** CPtr)
{ {
REQUIRE(VALID_REF(CPtr) && VALID_REF(*CPtr)); REQUIRE(VALID_REF(CPtr) && VALID_REF(*CPtr));
while (ISWHITESPACE(**CPtr) || (**CPtr == ',')) while (ISWHITESPACE(**CPtr) || (**CPtr == ','))
@ -640,29 +598,27 @@ Boolean_t StringListValid(StringList_pa stringList)
* any of the following characters: +;,<space> * any of the following characters: +;,<space>
* *
*/ */
static Boolean_t GetNextSubString(const char **OriginalCPtr, static Boolean_t GetNextSubString(char const** OriginalCPtr,
char** NextSubString) char** NextSubString)
{ {
Boolean_t IsOk = TRUE;
const char *CStart;
const char *CPtr;
char InsideDelimiter = '\0';
REQUIRE(VALID_REF(OriginalCPtr) && (VALID_REF(*OriginalCPtr))); REQUIRE(VALID_REF(OriginalCPtr) && (VALID_REF(*OriginalCPtr)));
REQUIRE(VALID_REF(NextSubString)); REQUIRE(VALID_REF(NextSubString));
Boolean_t IsOk = TRUE;
*NextSubString = NULL; *NextSubString = NULL;
CPtr = *OriginalCPtr; char const* CPtr = *OriginalCPtr;
SkipWhiteSpaceOrComma(&CPtr); SkipWhiteSpaceOrComma(&CPtr);
char InsideDelimiter = '\0';
if (*CPtr == '"' || *CPtr == '\'') if (*CPtr == '"' || *CPtr == '\'')
{ {
InsideDelimiter = *CPtr; InsideDelimiter = *CPtr;
CPtr++; CPtr++;
} }
CStart = CPtr; char const* CStart = CPtr;
while (*CPtr && while (*CPtr &&
((InsideDelimiter && (*CPtr != InsideDelimiter)) || ((InsideDelimiter && (*CPtr != InsideDelimiter)) ||
@ -684,7 +640,7 @@ Boolean_t StringListValid(StringList_pa stringList)
if (IsOk && CStart < CPtr) if (IsOk && CStart < CPtr)
{ {
size_t StrLen = (size_t)(CPtr - CStart); size_t StrLen = static_cast<size_t>(CPtr - CStart);
*NextSubString = ALLOC_ARRAY(StrLen + 1, char, "GetNextSubString: NextSubString"); *NextSubString = ALLOC_ARRAY(StrLen + 1, char, "GetNextSubString: NextSubString");
if (*NextSubString) if (*NextSubString)
{ {
@ -742,21 +698,19 @@ Boolean_t StringListValid(StringList_pa stringList)
* Internally, the original string is converted to a list of strings where * Internally, the original string is converted to a list of strings where
* each string uses newlines to separate one sub-string from the next. * each string uses newlines to separate one sub-string from the next.
*/ */
StringList_pa StringListFromCompound(const char *String) StringList_pa StringListFromCompound(char const* String)
{ {
const char *CPtr;
StringList_pa Result;
Boolean_t IsOk = TRUE;
char *CurString = NULL;
REQUIRE(VALID_REF(String)); REQUIRE(VALID_REF(String));
SkipWhiteSpaceOrComma(&String); SkipWhiteSpaceOrComma(&String);
REQUIRE(!ISJOINCHAR(*String)); REQUIRE(!ISJOINCHAR(*String));
/* extract character sequences */ Boolean_t IsOk = TRUE;
Result = StringListAlloc();
CPtr = String;
/* extract character sequences */
StringList_pa Result = StringListAlloc();
char const* CPtr = String;
char* CurString = NULL;
while (IsOk && *CPtr != '\0') while (IsOk && *CPtr != '\0')
{ {
char* NextSubString = NULL; char* NextSubString = NULL;
@ -823,18 +777,18 @@ Boolean_t StringListValid(StringList_pa stringList)
*/ */
char *StringListToCompound(StringList_pa StringList, char *StringListToCompound(StringList_pa StringList,
char GroupJoinCharacter, char GroupJoinCharacter,
const char *CharsToEscape) char const* CharsToEscape)
{ {
Boolean_t IsOk = TRUE;
LgIndex_t Index;
LgIndex_t Count;
char *Result = NULL;
REQUIRE(StringListValid(StringList)); REQUIRE(StringListValid(StringList));
REQUIRE(StringListCount(StringList) >= 1); REQUIRE(StringListCount(StringList) >= 1);
REQUIRE(ISJOINCHAR(GroupJoinCharacter)); REQUIRE(ISJOINCHAR(GroupJoinCharacter));
REQUIRE(VALID_REF(CharsToEscape)); 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; for (Index = 0, Count = StringListCount(StringList), IsOk = TRUE;
Index < Count && IsOk; Index < Count && IsOk;
Index++) Index++)
@ -846,7 +800,7 @@ Boolean_t StringListValid(StringList_pa stringList)
char* CStart = NULL; char* CStart = NULL;
char* CEnd = NULL; char* CEnd = NULL;
char* EscapedString = NULL; char* EscapedString = NULL;
const char *EscChar = NULL; char const* EscChar = NULL;
char* StrChar = NULL; char* StrChar = NULL;
/* First scan the string and escape any specified characters. */ /* First scan the string and escape any specified characters. */
@ -868,8 +822,6 @@ Boolean_t StringListValid(StringList_pa stringList)
while (IsOk && *CEnd != '\0') while (IsOk && *CEnd != '\0')
{ {
int Len = 0; int Len = 0;
char *TString;
CStart = CEnd; CStart = CEnd;
while (*CEnd != '\0' && *CEnd != '\n') while (*CEnd != '\0' && *CEnd != '\n')
{ {
@ -879,11 +831,9 @@ Boolean_t StringListValid(StringList_pa stringList)
CEnd++; CEnd++;
} }
TString = ALLOC_ARRAY(Len + 4, char, "temp compound sub-string"); char* TString = ALLOC_ARRAY(Len + 4, char, "temp compound sub-string");
if (TString != NULL) if (TString != NULL)
{ {
char *TStr;
/* prepend the new string with either */ /* prepend the new string with either */
/* a space character or the plus symbol */ /* a space character or the plus symbol */
if (CStart == EscapedString) if (CStart == EscapedString)
@ -897,7 +847,7 @@ Boolean_t StringListValid(StringList_pa stringList)
} }
/* stuff TString and append the new string */ /* stuff TString and append the new string */
TStr = TString; char* TStr = TString;
*TStr++ = '"'; *TStr++ = '"';
while (CStart != CEnd) while (CStart != CEnd)
{ {
@ -949,117 +899,6 @@ Boolean_t StringListValid(StringList_pa stringList)
return Result; return Result;
} }
/**
* Holds the comparator function pointer.
*/
static StringListStringComparator_pf ComparatorFunction = NULL;
/**
* Forwards the comparison test to the 'Comparator' supplied to the
* 'StringListSort' function.
*
* param Item1
* Item to compare against Item2.
* param Item2
* Item to compare against Item1.
* param ClientData
* Contextual information that was passed to the 'ArrayListQSort' function.
*
* return
* -1: if Item1 is less than Item2
* 0: if Item1 is equal to Item2
* 1: if Item1 is greater than Item2
*/
static int STDCALL ComparatorProxy(ArrayListItem_u Item1,
ArrayListItem_u Item2,
ArbParam_t ClientData)
{
/* forward the request */
return ComparatorFunction(Item1.CharPtr, Item2.CharPtr, ClientData);
}
/**
* Compares two strings from a list string. Note that either string may be
* NULL as StringLists allow for NULL elements.
*
* param String1
* String to compare against String2.
* param String2
* String to compare against String1.
* param ClientData
* Contextual information that was passed to the 'StringListSort' function.
*
* return
* - A value less than zero if String1 is less than String2.
* - A value of zero if String1 is equal to String2.
* - A value greater than zero if String1 is greater than String2.
*/
static int STDCALL DefaultStrcmpComparator(const char *String1,
const char *String2,
ArbParam_t ClientData)
{
int Result = 0; /* ...quite compiler */
REQUIRE(VALID_REF(String1) || String1 == NULL);
REQUIRE(VALID_REF(String2) || String2 == NULL);
if (String1 != NULL && String2 != NULL)
{
Result = strcmp(String1, String2);
if (Result < 0)
Result = -1;
else if (Result > 0)
Result = 1;
}
else if (String1 == NULL && String2 == NULL)
Result = 0;
else if (String1 == NULL)
Result = -1;
else if (String2 == NULL)
Result = 1;
else
CHECK(FALSE);
ENSURE((Result == -1) || (Result == 0) || (Result == 1));
return Result;
}
/**
* Sorts the string list by repeatedly calling the 'Comparator' function until
* the list is in order.
*
* param StringList
* String list to sort.
* param Comparator
* Function called to compare two string list strings or NULL for the
* default sort. The default sorting handles NULL elements and uses the
* system's strcmp utility for comparing valid strings elements.
* param ClientData
* Contextual information that is passed along to the comparator function.
*/
void StringListSort(StringList_pa StringList,
StringListStringComparator_pf Comparator,
ArbParam_t ClientData)
{
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif #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;
}

View file

@ -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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
#define TECPLOTENGINEMODULE #define TECPLOTENGINEMODULE
@ -29,7 +6,7 @@
****************************************************************** ******************************************************************
****************************************************************** ******************************************************************
******* ******** ******* ********
****** (C) 1988-2008 Tecplot, Inc. ******* ****** (C) 1988-2010 Tecplot, Inc. *******
******* ******** ******* ********
****************************************************************** ******************************************************************
****************************************************************** ******************************************************************
@ -44,6 +21,7 @@
#endif #endif
#include "ARRLIST.h" #include "ARRLIST.h"
#include "STRLIST.h" #include "STRLIST.h"
#include "CHARTYPE.h"
#include "STRUTIL.h" #include "STRUTIL.h"
#include "ALLOC.h" #include "ALLOC.h"
@ -55,10 +33,18 @@
#include "TranslatedString.h" #include "TranslatedString.h"
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#else
#define DECLARE_NUMERIC_LOCALE_SETTER
#define VALID_NUMERIC_LOCALE() (true)
#endif #endif
using namespace std; using std::string;
using namespace tecplot::strutil; using tecplot::strutil::translate;
using tecplot::strutil::dontTranslate;
using tecplot::strutil::TranslatedString;
#if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */
#endif
#ifdef MSWIN #ifdef MSWIN
# pragma warning (disable : 4786) /* STL warning about trucated identifiers */ # pragma warning (disable : 4786) /* STL warning about trucated identifiers */
@ -120,10 +106,13 @@ char *vFormatString(const char *Format,
* causing infinite recursion. * causing infinite recursion.
*/ */
if (FormatStringBuffer == NULL) if (FormatStringBuffer == NULL)
FormatStringBuffer = (char *)malloc(FormatStringBufferSize); FormatStringBuffer = static_cast<char *>(malloc(FormatStringBufferSize));
if (FormatStringBuffer != NULL) if (FormatStringBuffer != NULL)
{ {
DECLARE_NUMERIC_LOCALE_SETTER
REQUIRE(VALID_NUMERIC_LOCALE());
Boolean_t TryAgain = FALSE; Boolean_t TryAgain = FALSE;
do do
{ {
@ -132,7 +121,7 @@ char *vFormatString(const char *Format,
* can determine if the buffer needs to be expanded. If after we call * 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. * vsnprintf the end of the buffer has a '\0' we need to expand it.
*/ */
FormatStringBuffer[FormatStringBufferSize - 1] = (char)!'\0'; FormatStringBuffer[FormatStringBufferSize - 1] = static_cast<char>(!'\0');
# if defined MSWIN # if defined MSWIN
memset(FormatStringBuffer, 0, FormatStringBufferSize - 1); memset(FormatStringBuffer, 0, FormatStringBufferSize - 1);
@ -169,7 +158,7 @@ char *vFormatString(const char *Format,
*/ */
free(FormatStringBuffer); free(FormatStringBuffer);
FormatStringBufferSize += MAX(1, FormatStringBufferSize / 2); FormatStringBufferSize += MAX(1, FormatStringBufferSize / 2);
FormatStringBuffer = (char *)malloc(FormatStringBufferSize); FormatStringBuffer = static_cast<char *>(malloc(FormatStringBufferSize));
TryAgain = (FormatStringBuffer != NULL); TryAgain = (FormatStringBuffer != NULL);
if (!TryAgain) if (!TryAgain)
FormatStringBufferSize = INITIAL_FORMAT_BUFFER_SIZE; FormatStringBufferSize = INITIAL_FORMAT_BUFFER_SIZE;
@ -222,7 +211,7 @@ int FormatString(string& Buffer,
if (FormattedString != NULL) if (FormattedString != NULL)
{ {
Buffer.assign(FormattedString); Buffer.assign(FormattedString);
Result = (int)Buffer.size(); Result = static_cast<int>(Buffer.size());
FREE_ARRAY(FormattedString, "FormattedString"); FREE_ARRAY(FormattedString, "FormattedString");
} }
else else
@ -272,14 +261,14 @@ void CopySubString(char *Target,
REQUIRE("Target string is sized to accommodate a string who's length " REQUIRE("Target string is sized to accommodate a string who's length "
"is at least MIN(strlen(&Source[Index]), Count) characters."); "is at least MIN(strlen(&Source[Index]), Count) characters.");
REQUIRE(VALID_REF(Source)); REQUIRE(VALID_REF(Source));
REQUIRE(0 <= Index && Index <= (LgIndex_t)strlen(Source)); REQUIRE(0 <= Index && Index <= static_cast<LgIndex_t>(strlen(Source)));
REQUIRE(Count >= 0); REQUIRE(Count >= 0);
Length = MIN((LgIndex_t)strlen(&Source[Index]), Count); Length = MIN(static_cast<LgIndex_t>(strlen(&Source[Index])), Count);
memmove(Target, &Source[Index], Length); memmove(Target, &Source[Index], Length);
Target[Length] = '\0'; Target[Length] = '\0';
ENSURE(VALID_REF(Target) && (LgIndex_t)strlen(Target) == Length); ENSURE(VALID_REF(Target) && static_cast<LgIndex_t>(strlen(Target)) == Length);
} }
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
@ -299,7 +288,7 @@ char *StringFlushLeft(char *String)
/* move the substring beginning at the first non-whitespace */ /* move the substring beginning at the first non-whitespace */
/* character to the head of the string */ /* character to the head of the string */
while (isspace(*Start)) while (tecplot::isspace(*Start))
Start++; Start++;
if (Start != String) if (Start != String)
memmove(String, Start, strlen(Start) + 1); memmove(String, Start, strlen(Start) + 1);
@ -320,7 +309,7 @@ static char *StringFlushRight(char *String)
REQUIRE(VALID_REF(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'; End[-1] = '\0';
ENSURE(VALID_REF(Result) && Result == String); ENSURE(VALID_REF(Result) && Result == String);
@ -366,11 +355,11 @@ char *StringTruncate(char *String,
REQUIRE(VALID_REF(String)); REQUIRE(VALID_REF(String));
REQUIRE(MaxLength >= 0); REQUIRE(MaxLength >= 0);
if ((LgIndex_t)strlen(String) > MaxLength) if (static_cast<LgIndex_t>(strlen(String)) > MaxLength)
String[MaxLength] = '\0';/* UTF8_SetAt(String,'\0',MaxLength); */ String[MaxLength] = '\0';/* UTF8_SetAt(String,'\0',MaxLength); */
ENSURE(VALID_REF(String)); ENSURE(VALID_REF(String));
ENSURE((LgIndex_t)strlen(String) <= MaxLength); ENSURE(static_cast<LgIndex_t>(strlen(String)) <= MaxLength);
return String; return String;
} }
@ -393,11 +382,21 @@ char *StringTrimAndTruncate(char *String,
REQUIRE(VALID_REF(String)); REQUIRE(VALID_REF(String));
REQUIRE(MaxLength >= 0); REQUIRE(MaxLength >= 0);
TrimLeadAndTrailSpaces(String); /*
* 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); StringTruncate(String,MaxLength);
StringFlushRight(String);
ENSURE(VALID_REF(String)); ENSURE(VALID_REF(String));
ENSURE((LgIndex_t)strlen(String) <= MaxLength); ENSURE(static_cast<LgIndex_t>(strlen(String)) <= MaxLength);
ENSURE(IMPLICATION(strlen(String) != 0,
(!tecplot::isspace(String[0]) &&
!tecplot::isspace(String[strlen(String)-1]))));
return String; return String;
} }
@ -491,7 +490,6 @@ StringList_pa LineBreakString(const char *String,
} }
#endif #endif
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
#endif /* TECPLOTKERNEL */ #endif /* TECPLOTKERNEL */
@ -520,7 +518,6 @@ int ustrncmp(const char *s1,
{ {
REQUIRE((s1 == NULL) || VALID_REF(s1)); REQUIRE((s1 == NULL) || VALID_REF(s1));
REQUIRE((s2 == NULL) || VALID_REF(s2)); REQUIRE((s2 == NULL) || VALID_REF(s2));
REQUIRE(Len >= 0);
char *t1; char *t1;
char *t2; char *t2;
@ -534,8 +531,8 @@ int ustrncmp(const char *s1,
else if (s2 == NULL) else if (s2 == NULL)
return 1; return 1;
t1 = (char*)s1; t1 = const_cast<char*>(s1);
t2 = (char*)s2; t2 = const_cast<char*>(s2);
while (*t1 && *t2 && (I < Len)) while (*t1 && *t2 && (I < Len))
{ {
@ -578,7 +575,9 @@ int ustrcmp(const char *s1,
return (ustrncmp(s1, s2, INT_MAX)); return (ustrncmp(s1, s2, INT_MAX));
} }
#if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */
#endif
#if defined TECPLOTKERNEL #if defined TECPLOTKERNEL
/* CORE SOURCE CODE REMOVED */ /* CORE SOURCE CODE REMOVED */
@ -700,7 +699,7 @@ Boolean_t TackOnString(char **SBase,
(*StringToAdd == '\0') && (*StringToAdd == '\0') &&
DeleteStringToAdd) DeleteStringToAdd)
{ {
char *TMP = (char *)StringToAdd; char *TMP = const_cast<char *>(StringToAdd);
FREE_ARRAY(TMP, "empty string to add"); FREE_ARRAY(TMP, "empty string to add");
} }
} }
@ -724,7 +723,7 @@ Boolean_t TackOnString(char **SBase,
{ {
if (DeleteStringToAdd) if (DeleteStringToAdd)
{ {
char *TMP = (char *)StringToAdd; char *TMP = const_cast<char *>(StringToAdd);
FREE_ARRAY(TMP, StringToAdd); FREE_ARRAY(TMP, StringToAdd);
} }
IsOk = FALSE; IsOk = FALSE;
@ -758,7 +757,7 @@ Boolean_t TackOnString(char **SBase,
if (DeleteStringToAdd) if (DeleteStringToAdd)
{ {
char *TMP = (char *)StringToAdd; char *TMP = const_cast<char *>(StringToAdd);
FREE_ARRAY(TMP, StringToAdd); FREE_ARRAY(TMP, StringToAdd);
} }

View file

@ -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 "stdafx.h"
#include "MASTER.h" #include "MASTER.h"
#define TECPLOTENGINEMODULE #define TECPLOTENGINEMODULE
@ -29,7 +6,7 @@
***************************************************************** *****************************************************************
***************************************************************** *****************************************************************
******* ******** ******* ********
****** Copyright (C) 1988-2008 Tecplot, Inc. ******* ****** Copyright (C) 1988-2010 Tecplot, Inc. *******
******* ******** ******* ********
***************************************************************** *****************************************************************
***************************************************************** *****************************************************************